Skip to content

Commit

Permalink
feat(GlpiRestClient): get my entities
Browse files Browse the repository at this point in the history
  • Loading branch information
Gianfranco97 authored and Hector Rondon committed Jan 17, 2018
1 parent fe6484b commit a33984f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/prepareRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ function prepareRequest (data) {
myInit = { method: 'GET'}
break


case 'getMyEntities':
url = `${url}/getMyEntities`
myInit = { method: 'GET'}
break

default:
break
}
Expand Down
18 changes: 18 additions & 0 deletions src/restclient.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit a33984f

Please sign in to comment.