Skip to content

Commit b189f5b

Browse files
committed
feat(GlpiRestClient): create function of initSessionByCredentials
1 parent 75168e3 commit b189f5b

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/restclient.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,32 @@ class GlpiRestClient {
4545
})
4646
}
4747

48+
initSessionByCredentials (userName, userPassword) {
49+
return new Promise((resolve, reject) => {
50+
try {
51+
const data = {
52+
function: 'initSessionByCredentials',
53+
endpoint: 'initSession',
54+
method: 'GET',
55+
url: this._url,
56+
appToken: this._appToken,
57+
userName,
58+
userPassword
59+
}
60+
61+
const myRequest = prepareRequest(data)
62+
63+
this._makeRequest(myRequest, (response) => {
64+
resolve (
65+
response
66+
)
67+
})
68+
}
69+
catch (err) {
70+
reject(err)
71+
}
72+
})
73+
}
4874
}
4975

5076
export default GlpiRestClient

0 commit comments

Comments
 (0)