Home Manual Reference Source
private class | source

UserController

Controller class for the User model.

Constructor Summary

Public Constructor
public

constructor(connection: Connection)

Member Summary

Private Members
private

Object to use for making a connection to the REST API and Websocket server.

Method Summary

Public Methods
public

Create a user.

public

Get the current authenticated user.

public

getUser(userId: string): Promise<User>

Get a user in the current active Organisation derived from the OAuth2 scope.

public

List all users in the current active Organisation derived from the OAuth2 scope.

Public Constructors

public constructor(connection: Connection) source

Params:

NameTypeAttributeDescription
connection Connection

Object to use for making a connection to the REST API and Websocket server.

Private Members

private _connection: Connection source

Object to use for making a connection to the REST API and Websocket server.

Public Methods

public createUser(user: User): Promise<User> source

Create a user. The user will be created in the current active Organisation derived from the OAuth2 scope.

Params:

NameTypeAttributeDescription
user User

User to create.

Return:

Promise<User>

Promise containing the newly created User.

Throw:

Promise.<Error>

user parameter of type "User" is required.

Promise.<Error>

If the server returned an error.

public getCurrentUser(): Promise<User> source

Get the current authenticated user.

Return:

Promise<User>

The current authenticated user.

Throw:

Promise.<Error>

If something went wrong in the server.

public getUser(userId: string): Promise<User> source

Get a user in the current active Organisation derived from the OAuth2 scope.

Params:

NameTypeAttributeDescription
userId string

Specify a user identifier.

Return:

Promise<User>

Promise containing a User.

Throw:

Promise.<Error>

userId parameter of type "string" is required.

Promise.<Error>

If no result could not be found.

public getUsers(): Promise<User[]> source

List all users in the current active Organisation derived from the OAuth2 scope.

Return:

Promise<User[]>

Promise containing an array of Users.

Throw:

Promise.<Error>

If no result could not be found.