Account

Account

The account represents login credentials for a user and is returned by methods from the authentication process such as login.

The account is not used for sending or receiving messages. All messages are sent to and from Identities. Accounts store the email address used for login and the handle provided by the user during sign up. The handle is used as the default argument for Client methods that expect a handle argument for the currently logged in user.

Constructor

# new Account(options)

import Account from "https://designftw.github.io/chat-lib/src/models/Account.js";

Constructor for the Account. Should not be called directly, the Account is returned by the Client's login method.

Parameters:
Name Type Description
options Object

An object containing the following properties.

Properties
Name Type Description
id string

see BaseModel's id property

createdAt Date

see BaseModel's createdAt property

updatedAt Date

see BaseModel's updatedAt property

email string

see Account's email property

handle string

see Account's username property

Members

# email :string

The email address associated with the account.

Unique across all accounts.

Type:
  • string

# handle :string

The default handle associated with the account. Defaults to the handle provided during sign up.

Unique across all accounts.

Type:
  • string

Methods

# toJSON() → {Object}

Convert this account to a JSON object that could be fed to its constructor to create another object with the same data

Returns:
Type
Object