diff --git a/src/prepareRequest.js b/src/prepareRequest.js index 6016f7b..758436e 100644 --- a/src/prepareRequest.js +++ b/src/prepareRequest.js @@ -53,7 +53,11 @@ function prepareRequest (data) { myInit = { method: 'GET'} break - + case 'getMyEntities': + url = `${url}/getMyEntities` + myInit = { method: 'GET'} + break + default: break } diff --git a/src/restclient.js b/src/restclient.js index 4106fba..66833f7 100644 --- a/src/restclient.js +++ b/src/restclient.js @@ -200,6 +200,24 @@ class GlpiRestClient { } }) } + + getMyEntities () { + return new Promise((resolve, reject) => { + try { + const data = { + function: 'getMyEntities' + } + this._makeRequest( prepareRequest(data), 'getMyEntities', (promise) => { + promise.then(response => { + resolve ( response ) + }) + }) + } + catch (err) { + reject(err) + } + }) + } } export default GlpiRestClient