diff --git a/src/client.js b/src/client.js index dc6601d..cb284d7 100644 --- a/src/client.js +++ b/src/client.js @@ -151,6 +151,16 @@ export default class Client { ).then(source => new Method(source)); } + /** + * @param {String} restapiId + * @return {Promise} + */ + getRestapi({ restapiId }) { + return this.getFetcher().get( + `${this._getBaseUrl()}/restapis/${restapiId}` + ).then(source => new Restapi(source)); + } + /** * @param {String} restapiId * @return {Promise} diff --git a/test/client-test.js b/test/client-test.js index 58018a6..b22bd91 100644 --- a/test/client-test.js +++ b/test/client-test.js @@ -122,6 +122,24 @@ describe('Client', () => { }); }); + describe('#getRestapi', () => { + it('does not raise any error', (done) => { + client.use( + Mock, + { + body: JSON.stringify({}), + headers: { + 'Content-Type': 'application/json' + } + } + ).getRestapi({ + restapiId: 'restapiId' + }).then(() => { + done(); + }); + }); + }); + describe('#getRootResource', () => { it('does not raise any error', (done) => { client.use(