Class: Client

Client(host)

Represents the main chatexchange Client class.

Constructor

new Client(host)

Creates an instance of Client.
Parameters:
Name Type Description
host string The host to connect to (stackexchange.com, meta.stackexchange.com, or stackoverflow.com)
Source:

Methods

(async) getMe() → {Promise.<User>}

Fetches the current logged-in user's profile
Source:
Throws:
If no user is currently logged in
Type
ChatExchangeError
Returns:
The user object
Type
Promise.<User>

(async) joinRoom(id) → {Promise.<Room>}

Joins a room, and returns the room object
Parameters:
Name Type Description
id number The ID of the room to join
Source:
Returns:
The room object
Type
Promise.<Room>

(async) login(email, password) → {Promise.<string>}

Attempts to login to the stackexchange network with the provided username and password
Parameters:
Name Type Description
email string Email
password string Password
Source:
Returns:
Request Cookie Jar (Optionally to save to `loginCookie`)
Type
Promise.<string>

(async) loginCookie(cookieString) → {Promise.<void>}

Attempts to login to stack exchange, using the provided cookie jar string, which was retrieved from the `login` method.
Parameters:
Name Type Description
cookieString string A cookie jar string
Source:
Returns:
A promise representing when login is complete
Type
Promise.<void>