Skip to content

Commit

Permalink
feat(api-client): get list search options
Browse files Browse the repository at this point in the history
Signed-off-by: Gianfranco Manganiello <gmanganiello@teclib.com>
  • Loading branch information
Gianfranco97 authored and ajsb85 committed Feb 2, 2018
1 parent c3c91f7 commit 264cf7a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/glpiApiClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,29 @@ class GlpiApiClient {
})
}

listSearchOptions (itemtype, queryString) {
return new Promise((resolve, reject) => {
try {
const data = {
function: 'listSearchOptions',
itemtype,
queryString
}

this._makeRequest( prepareRequest(data), 'listSearchOptions', (response, isOk) => {
if (isOk) {
resolve ( response )
} else {
reject (response)
}
})
}
catch (err) {
reject(err)
}
})
}

registerUser (userToken, userData) {
return new Promise(async (resolve, reject) => {
try {
Expand Down
8 changes: 8 additions & 0 deletions src/prepareRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,14 @@ function prepareRequest (data) {
myInit = { method: 'GET' }
break

case 'listSearchOptions':
queryString = `?${createQueryString({items: data.queryString})}`

url = `${url}/listSearchOptions/${data.itemtype}/${queryString}`

myInit = { method: 'GET' }
break

default:
break
}
Expand Down

0 comments on commit 264cf7a

Please sign in to comment.