Skip to content

client API methods session

hannsolo edited this page May 6, 2020 · 2 revisions

login(user:string, password:string):Promise <ILoginReply>

Create a session with the given credentials.

logout( ):Promise <boolean>

Close an existing session.

getCurrentUser():string

Returns the user name of the current session.

getSessionCookie():string|null

Returns the current session cookie value if any.

changePassword(currentPassword: string, newPassWord: string, options: IHTTPOptions = {}): Promise<boolean>

Change the password of the current user.

changeUser(user: string, options: IHTTPOptions = {}): Promise<boolean>

Log in as a different user.

getUserList(options: IHTTPOptions = {}): Promise<string[]>

Load a list of user names.

client.login("user", "password")
.then( () => {
    client.getUserList()
    .then ( (users) => {
      console.log(users);
    })
    .catch(console.error)
    .finally( () => {
      client.logout();
    })
})
.catch(console.error);
Clone this wiki locally