MessageRepository

MessageRepository

new MessageRepository()

Methods

messagesForChannel(parameters) → {LiveCollection}

Get messages from a channel.
Parameters:
Name Type Description
parameters Object
Properties
Name Type Attributes Description
channelId String The channel ID.
tags Array.<string> <optional>
The tags to filter list of messages with.
parentId String <optional>
The id of the parent message.
filterByParentId Boolean <optional>
Enables filtering by parentId. If you omit to pass parentId, only the top level messages will be returned.
Throws:
Will throw an error if parameters are wrong.
Type
EkoSDKInvalidParameterError
Returns:
The LiveCollection instance of message models.
Type
LiveCollection

messageForId(messageId) → {LiveObject}

Fetch a message
Parameters:
Name Type Description
messageId string The message ID of the requested message.
Returns:
The LiveObject instance of message model
Type
LiveObject

createTextMessage(parameters) → {LiveObject}

Create a text message in channel.
Parameters:
Name Type Description
parameters Object
Properties
Name Type Attributes Description
channelId String The channel ID.
text String The text message.
tags Array.<string> <optional>
The message tags.
parentId String <optional>
The ID of the parent message (if any)
Throws:
Will throw an error if parameters are wrong.
Type
EkoSDKInvalidParameterError
Returns:
The LiveObject instance of MessageModel.
Type
LiveObject

flag(messageId) → {Promise.<undefined, EkoSDKError>}

Flag a message
Parameters:
Name Type Description
messageId String The message ID of the message to be flagged.
Throws:
Will throw an error if parameters are wrong.
Type
EkoSDKInvalidParameterError
Returns:
Returns a promise.
Type
Promise.<undefined, EkoSDKError>

unflag(messageId) → {Promise.<undefined, EkoSDKError>}

Unflag a flagged message
Parameters:
Name Type Description
messageId String The message ID of the flagged message.
Throws:
Will throw an error if parameters are wrong.
Type
EkoSDKInvalidParameterError
Returns:
Returns a promise.
Type
Promise.<undefined, EkoSDKError>