## Modules
Promise
* [.loadMore()](#module_Collection--module.exports+loadMore) ⇒ Promise
* * *
### module.exports ⏏
Handles a paginated API response.
**Kind**: Exported class
* * *
#### new module.exports(resourceURL, handler)
Create a Collection instance
| Param | Type | Description |
| --- | --- | --- |
| resourceURL | string
| the API endpoint to call |
| handler | callback
| anonymous function used to handle the response |
* * *
#### module.exports.load() ⇒ Promise
Loads first batch of results
**Kind**: instance method of [module.exports
](#exp_module_Collection--module.exports)
* * *
#### module.exports.loadMore() ⇒ Promise
Attempts to load more results
**Kind**: instance method of [module.exports
](#exp_module_Collection--module.exports)
* * *
## ChatApi
* [ChatApi](#module_ChatApi)
* [module.exports](#exp_module_ChatApi--module.exports) ⏏
* [.channel(channelId)](#module_ChatApi--module.exports+channel) ⇒ Promise
* [.channels()](#module_ChatApi--module.exports+channels) ⇒ [module.exports
](#exp_module_Collection--module.exports)
* [.moveChannelMessages(channelId, data)](#module_ChatApi--module.exports+moveChannelMessages) ⇒ Promise
* [.destroyChannel(channelId, channelName)](#module_ChatApi--module.exports+destroyChannel) ⇒ Promise
* [.createChannel(data)](#module_ChatApi--module.exports+createChannel) ⇒ Promise
* [.categoryPermissions(categoryId)](#module_ChatApi--module.exports+categoryPermissions) ⇒ Promise
* [.sendMessage(channelId, data)](#module_ChatApi--module.exports+sendMessage) ⇒ Promise
* [.createChannelArchive(channelId, data)](#module_ChatApi--module.exports+createChannelArchive) ⇒ Promise
* [.updateChannel(channelId, data)](#module_ChatApi--module.exports+updateChannel) ⇒ Promise
* [.updateChannelStatus(channelId, status)](#module_ChatApi--module.exports+updateChannelStatus) ⇒ Promise
* [.listChannelMemberships(channelId)](#module_ChatApi--module.exports+listChannelMemberships) ⇒ [module.exports
](#exp_module_Collection--module.exports)
* [.listCurrentUserChannels()](#module_ChatApi--module.exports+listCurrentUserChannels) ⇒ Promise
* [.followChannel(channelId)](#module_ChatApi--module.exports+followChannel) ⇒ Promise
* [.unfollowChannel(channelId)](#module_ChatApi--module.exports+unfollowChannel) ⇒ Promise
* [.updateCurrentUserChannelNotificationsSettings(channelId, data)](#module_ChatApi--module.exports+updateCurrentUserChannelNotificationsSettings) ⇒ Promise
* * *
### module.exports ⏏
Chat API service. Provides methods to interact with the chat API.
**Kind**: Exported class
**Implements**: {@ember/service}
* * *
#### module.exports.channel(channelId) ⇒ Promise
Get a channel by its ID.
**Kind**: instance method of [module.exports
](#exp_module_ChatApi--module.exports)
| Param | Type | Description |
| --- | --- | --- |
| channelId | number
| The ID of the channel. |
**Example**
```js
this.chatApi.channel(1).then(channel => { ... })
```
* * *
#### module.exports.channels() ⇒ [module.exports
](#exp_module_Collection--module.exports)
List all accessible category channels of the current user.
**Kind**: instance method of [module.exports
](#exp_module_ChatApi--module.exports)
**Example**
```js
this.chatApi.channels.then(channels => { ... })
```
* * *
#### module.exports.moveChannelMessages(channelId, data) ⇒ Promise
Moves messages from one channel to another.
**Kind**: instance method of [module.exports
](#exp_module_ChatApi--module.exports)
| Param | Type | Description |
| --- | --- | --- |
| channelId | number
| The ID of the original channel. |
| data | object
| Params of the move. |
| data.message_ids | Array.<number>
| IDs of the moved messages. |
| data.destination_channel_id | number
| ID of the channel where the messages are moved to. |
**Example**
```js
this.chatApi
.moveChannelMessages(1, {
message_ids: [2, 3],
destination_channel_id: 4,
}).then(() => { ... })
```
* * *
#### module.exports.destroyChannel(channelId, channelName) ⇒ Promise
Destroys a channel.
**Kind**: instance method of [module.exports
](#exp_module_ChatApi--module.exports)
| Param | Type | Description |
| --- | --- | --- |
| channelId | number
| The ID of the channel. |
| channelName | string
| The name of the channel to be destroyed, used as confirmation. |
**Example**
```js
this.chatApi.destroyChannel(1, "foo").then(() => { ... })
```
* * *
#### module.exports.createChannel(data) ⇒ Promise
Creates a channel.
**Kind**: instance method of [module.exports
](#exp_module_ChatApi--module.exports)
| Param | Type | Description |
| --- | --- | --- |
| data | object
| Params of the channel. |
| data.name | string
| The name of the channel. |
| data.chatable_id | string
| The category of the channel. |
| data.description | string
| The description of the channel. |
| [data.auto_join_users] | boolean
| Should users join this channel automatically. |
**Example**
```js
this.chatApi
.createChannel({ name: "foo", chatable_id: 1, description "bar" })
.then((channel) => { ... })
```
* * *
#### module.exports.categoryPermissions(categoryId) ⇒ Promise
Lists chat permissions for a category.
**Kind**: instance method of [module.exports
](#exp_module_ChatApi--module.exports)
| Param | Type | Description |
| --- | --- | --- |
| categoryId | number
| ID of the category. |
* * *
#### module.exports.sendMessage(channelId, data) ⇒ Promise
Sends a message.
**Kind**: instance method of [module.exports
](#exp_module_ChatApi--module.exports)
| Param | Type | Description |
| --- | --- | --- |
| channelId | number
| ID of the channel. |
| data | object
| Params of the message. |
| data.message | string
| The raw content of the message in markdown. |
| data.cooked | string
| The cooked content of the message. |
| [data.in_reply_to_id] | number
| The ID of the replied-to message. |
| [data.staged_id] | number
| The staged ID of the message before it was persisted. |
| [data.upload_ids] | Array.<number>
| Array of upload ids linked to the message. |
* * *
#### module.exports.createChannelArchive(channelId, data) ⇒ Promise
Creates a channel archive.
**Kind**: instance method of [module.exports
](#exp_module_ChatApi--module.exports)
| Param | Type | Description |
| --- | --- | --- |
| channelId | number
| The ID of the channel. |
| data | object
| Params of the archive. |
| data.selection | string
| "new_topic" or "existing_topic". |
| [data.title] | string
| Title of the topic when creating a new topic. |
| [data.category_id] | string
| ID of the category used when creating a new topic. |
| [data.tags] | Array.<string>
| tags used when creating a new topic. |
| [data.topic_id] | string
| ID of the topic when using an existing topic. |
* * *
#### module.exports.updateChannel(channelId, data) ⇒ Promise
Updates a channel.
**Kind**: instance method of [module.exports
](#exp_module_ChatApi--module.exports)
| Param | Type | Description |
| --- | --- | --- |
| channelId | number
| The ID of the channel. |
| data | object
| Params of the archive. |
| [data.description] | string
| Description of the channel. |
| [data.name] | string
| Name of the channel. |
* * *
#### module.exports.updateChannelStatus(channelId, status) ⇒ Promise
Updates the status of a channel.
**Kind**: instance method of [module.exports
](#exp_module_ChatApi--module.exports)
| Param | Type | Description |
| --- | --- | --- |
| channelId | number
| The ID of the channel. |
| status | string
| The new status, can be "open" or "closed". |
* * *
#### module.exports.listChannelMemberships(channelId) ⇒ [module.exports
](#exp_module_Collection--module.exports)
Lists members of a channel.
**Kind**: instance method of [module.exports
](#exp_module_ChatApi--module.exports)
| Param | Type | Description |
| --- | --- | --- |
| channelId | number
| The ID of the channel. |
* * *
#### module.exports.listCurrentUserChannels() ⇒ Promise
Lists public and direct message channels of the current user.
**Kind**: instance method of [module.exports
](#exp_module_ChatApi--module.exports)
* * *
#### module.exports.followChannel(channelId) ⇒ Promise
Makes current user follow a channel.
**Kind**: instance method of [module.exports
](#exp_module_ChatApi--module.exports)
| Param | Type | Description |
| --- | --- | --- |
| channelId | number
| The ID of the channel. |
* * *
#### module.exports.unfollowChannel(channelId) ⇒ Promise
Makes current user unfollow a channel.
**Kind**: instance method of [module.exports
](#exp_module_ChatApi--module.exports)
| Param | Type | Description |
| --- | --- | --- |
| channelId | number
| The ID of the channel. |
* * *
#### module.exports.updateCurrentUserChannelNotificationsSettings(channelId, data) ⇒ Promise
Update notifications settings of current user for a channel.
**Kind**: instance method of [module.exports
](#exp_module_ChatApi--module.exports)
| Param | Type | Description |
| --- | --- | --- |
| channelId | number
| The ID of the channel. |
| data | object
| The settings to modify. |
| [data.muted] | boolean
| Mutes the channel. |
| [data.desktop_notification_level] | string
| Notifications level on desktop: never, mention or always. |
| [data.mobile_notification_level] | string
| Notifications level on mobile: never, mention or always. |
* * *