Skip to content

Commit

Permalink
feat(GlpiRestClient): create function of initSessionByCredentials
Browse files Browse the repository at this point in the history
  • Loading branch information
Gianfranco97 committed Jan 15, 2018
1 parent 75168e3 commit b189f5b
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/restclient.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,32 @@ class GlpiRestClient {
})
}

initSessionByCredentials (userName, userPassword) {
return new Promise((resolve, reject) => {
try {
const data = {
function: 'initSessionByCredentials',
endpoint: 'initSession',
method: 'GET',
url: this._url,
appToken: this._appToken,
userName,
userPassword
}

const myRequest = prepareRequest(data)

this._makeRequest(myRequest, (response) => {
resolve (
response
)
})
}
catch (err) {
reject(err)
}
})
}
}

export default GlpiRestClient

0 comments on commit b189f5b

Please sign in to comment.