API Docs for: 2.6
Show:

User Class

Module: user

Abstraction of a user.

It can throw exceptions.

Constructor

User

(
  • uname
  • na
  • sur
)
Object

Parameters:

  • uname String

    The username of the user

  • na String

    The name of the user

  • sur String

    The surname of the user

Returns:

Object:

The user object.

Methods

addEndpoint

(
  • type
  • id
  • data
)

Adds an endpoint. The function assumes that the specified endpoint type is valid. Otherwise it throws an exception.

It can throw an Exception.

Parameters:

  • type String

    The endpoint type

  • id String

    The endpoint identifier

  • data Object

    The object containing some informations on endpoint to add

getAllAuthorizations

() Object

Returns all the user authorizations.

Returns:

Object:

All the user authorizations.

getAllEndpoints

() Object

Returns all endpoints of the user.

Returns:

Object:

All the user endpoints.

getAllEndpointsJSON

() Object

Returns all endpoints of the user in JSON format.

It can throw an Exception.

Returns:

Object:

All the user endpoints in JSON format.

getAuthorization

(
  • type
)
Object

Gets an authorization.

Parameters:

  • type String

    The type of the authorization

Returns:

Object:

The authorization requested. The key is the passed type and the value is the authorization or an undefined if it doesn't exist.

getName

() String

Returns the name of the user.

Returns:

String:

The name

getSurname

() String

Returns the surname of the user.

Returns:

String:

The surname

getUsername

() String

Returns the username of the user.

Returns:

String:

The username

setAuthorization

(
  • type
  • value
)

Sets an authorization.

Parameters:

  • type String

    The type of the authorization

  • value String | Array

    The value of the autorization. It can be "true" or "false" or an array of value as in the case of customer card or streaming authorizations.

toJSON

() Object

Returns the JSON representation of the user.

{
    username: "alessandro.polidori" // the username
}

Returns:

Object:

The JSON representation of the object.

toString

() String

Returns the readable string of the user.

Returns:

String:

The readable description of the user

Properties

authorizations

Unknown private

The user authorizations.

Default: {}

endpoints

Unknown private

The endpoints of the user. The keys are the endpoint types and the values are objects that contains endpoint identifiers as keys and Endpoint objects as values.

name

String private

The name of the user.

surname

String private

The surname of the user.

username

String private

The username of the user.