From a33984fb18fafebcca631f6187ebfa5542e1ec53 Mon Sep 17 00:00:00 2001 From: Gianfranco Manganiello Date: Tue, 16 Jan 2018 17:22:52 -0400 Subject: [PATCH] feat(GlpiRestClient): get my entities --- src/prepareRequest.js | 6 +++++- src/restclient.js | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) 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