Twitch SDK (Internal)
Public Types | Public Member Functions | List of all members
ttv::chat::IChatRoom Class Referenceabstract

#include <ichatroom.h>

Inheritance diagram for ttv::chat::IChatRoom:
ttv::chat::ChatRoom

Public Types

using DeleteRoomCallback = std::function< void(TTV_ErrorCode ec)>
 
using SendMessageCallback = std::function< void(TTV_ErrorCode ec, SendRoomMessageError &&error, ChatRoomMessage &&message)>
 
using EditMessageCallback = std::function< void(TTV_ErrorCode ec, ChatRoomMessage &&message)>
 
using DeleteMessageCallback = std::function< void(TTV_ErrorCode ec)>
 
using FetchMessagesCallback = std::function< void(TTV_ErrorCode ec, std::vector< ChatRoomMessage > &&messages, std::string &&nextCursor, bool moreMessages)>
 
using UpdateRoomInfoCallback = std::function< void(TTV_ErrorCode ec, UpdateRoomError &&error, ChatRoomInfo &&info)>
 
using UpdateRoomModesCallback = std::function< void(TTV_ErrorCode ec, UpdateRoomModesError &&error, ChatRoomInfo &&info)>
 
using UpdateRoomViewCallback = std::function< void(TTV_ErrorCode ec, ChatRoomInfo &&info)>
 
using FetchRoomInfoCallback = std::function< void(TTV_ErrorCode ec, ChatRoomInfo &&info)>
 

Public Member Functions

virtual ~IChatRoom ()=default
 
virtual TTV_ErrorCode Dispose ()=0
 
virtual TTV_ErrorCode DeleteRoom (const DeleteRoomCallback &callback)=0
 
virtual TTV_ErrorCode SendMessage (const std::string &message, ChatRoomMessage &placeholderMessage, const SendMessageCallback &callback)=0
 
virtual TTV_ErrorCode EditMessage (const std::string &messageId, const std::string &message, ChatRoomMessage &placeholderMessage, const EditMessageCallback &callback)=0
 
virtual TTV_ErrorCode DeleteMessage (const std::string &messageId, const DeleteMessageCallback &callback)=0
 
virtual TTV_ErrorCode FetchMessagesBeforeCursor (const std::string &cursor, uint32_t limit, const FetchMessagesCallback &callback)=0
 
virtual TTV_ErrorCode FetchMessagesAfterCursor (const std::string &cursor, uint32_t limit, const FetchMessagesCallback &callback)=0
 
virtual TTV_ErrorCode FetchMessagesBeforeTimestamp (Timestamp timestamp, uint32_t limit, const FetchMessagesCallback &callback)=0
 
virtual TTV_ErrorCode FetchMessagesAfterTimestamp (Timestamp timestamp, uint32_t limit, const FetchMessagesCallback &callback)=0
 
virtual TTV_ErrorCode FetchRoomInfo (const FetchRoomInfoCallback &callback)=0
 
virtual TTV_ErrorCode SetRoomName (const std::string &name, const UpdateRoomInfoCallback &callback)=0
 
virtual TTV_ErrorCode SetTopic (const std::string &topic, const UpdateRoomInfoCallback &callback)=0
 
virtual TTV_ErrorCode SetPreviewable (bool isPreviewable, const UpdateRoomInfoCallback &callback)=0
 
virtual TTV_ErrorCode SetMinimumAllowedRole (RoomRole minimumAllowedRole, const UpdateRoomInfoCallback &callback)=0
 
virtual TTV_ErrorCode EnableSlowMode (uint32_t durationSeconds, const UpdateRoomModesCallback &callback)=0
 
virtual TTV_ErrorCode DisableSlowMode (const UpdateRoomModesCallback &callback)=0
 
virtual TTV_ErrorCode EnableR9kMode (const UpdateRoomModesCallback &callback)=0
 
virtual TTV_ErrorCode DisableR9kMode (const UpdateRoomModesCallback &callback)=0
 
virtual TTV_ErrorCode EnableEmotesOnlyMode (const UpdateRoomModesCallback &callback)=0
 
virtual TTV_ErrorCode DisableEmotesOnlyMode (const UpdateRoomModesCallback &callback)=0
 
virtual TTV_ErrorCode SetLastReadAt (Timestamp lastReadAt, const UpdateRoomViewCallback &callback)=0
 
virtual TTV_ErrorCode SetMuted (bool isMuted, const UpdateRoomViewCallback &callback)=0
 
virtual TTV_ErrorCode SetArchived (bool isArchived, const UpdateRoomViewCallback &callback)=0
 

Detailed Description

The interface for a chat room.

Member Typedef Documentation

◆ DeleteMessageCallback

Used with DeleteMessage().

Parameters
[in]ec
  • TTV_EC_SUCCESS: The message was successfully deleted.
  • TTV_EC_WEBAPI_RESULT_INVALID_JSON: Something went wrong when trying to delete the message.
[in]messageThe message received back from the server.

◆ DeleteRoomCallback

Used with DeleteRoom().

Parameters
[in]ec
  • TTV_EC_SUCCESS: The room was successfully deleted.
  • TTV_EC_WEBAPI_RESULT_INVALID_JSON: Something went wrong when trying to delete the room.

◆ EditMessageCallback

using ttv::chat::IChatRoom::EditMessageCallback = std::function<void(TTV_ErrorCode ec, ChatRoomMessage&& message)>

Used with EditMessage().

Parameters
[in]ec
  • TTV_EC_SUCCESS: The message was successfully edited.
  • TTV_EC_WEBAPI_RESULT_INVALID_JSON: Something went wrong when trying to edit the message.
[in]messageThe message received back from the server.

◆ FetchMessagesCallback

using ttv::chat::IChatRoom::FetchMessagesCallback = std::function<void(TTV_ErrorCode ec, std::vector<ChatRoomMessage>&& messages, std::string&& nextCursor, bool moreMessages)>

Used with FetchMessages functions.

Parameters
[in]ec
  • TTV_EC_SUCCESS: The messages were retrieved.
  • TTV_EC_WEBAPI_RESULT_INVALID_JSON: Something went wrong when trying to fetch the messages.
[in]messagesThe list of messages received back from the server. If fetching before a time/cursor, listed from newest to oldest. Else if fetching after a time/cursor, listed from oldest to newest.
[in]nextCursorThe cursor to use next time to fetch messages from where we left off, in the same pagination direction.
[in]moreMessagesTrue if there are more messages to be fetched at the cursor, else false.

◆ FetchRoomInfoCallback

Used with FetchRoomInfo().

Parameters
[in]ec
  • TTV_EC_SUCCESS: The room info was retrieved.
  • TTV_EC_WEBAPI_RESULT_INVALID_JSON: Something went wrong when trying to retrieve the room info.
[in]infoThe updated information of the room.

◆ SendMessageCallback

Used with SendMessage().

Parameters
[in]ec
  • TTV_EC_SUCCESS: The message was successfully sent.
  • TTV_EC_WEBAPI_RESULT_INVALID_JSON: Received an invalid response from the back-end.
  • TTV_EC_GRAPHQL_ERROR: Received an error code from the back-end.
[in]errorError object received from GraphQL describing reason why sending message failed.
[in]messageThe message received back from the server.

◆ UpdateRoomInfoCallback

Used when updating the information of a room.

Parameters
[in]ec
  • TTV_EC_SUCCESS: The room info was changed.
  • TTV_EC_WEBAPI_RESULT_INVALID_JSON: Something went wrong when trying to change the room info.
  • TTV_EC_GRAPHQL_ERROR: Received an error code from the back-end.
[in]errorError object received from GraphQL describing the reason why updating room info failed.
[in]infoThe updated information of the room.

◆ UpdateRoomModesCallback

Used when updating a room's chat mode.

Parameters
[in]ec
  • TTV_EC_SUCCESS: The room's chat mode was changed.
  • TTV_EC_WEBAPI_RESULT_INVALID_JSON: Something went wrong when trying to change the room's chat mode.
  • TTV_EC_GRAPHQL_ERROR: Received an error code from the back-end.
[in]errorError object received from GraphQL describing the reason why updating room mode failed.
[in]infoThe updated information of the room.

◆ UpdateRoomViewCallback

Used when updating a room's view.

Parameters
[in]ec
  • TTV_EC_SUCCESS: The room's view was changed.
  • TTV_EC_WEBAPI_RESULT_INVALID_JSON: Something went wrong when trying to change the room's view.
[in]infoThe updated information of the room.

Constructor & Destructor Documentation

◆ ~IChatRoom()

virtual ttv::chat::IChatRoom::~IChatRoom ( )
virtualdefault

Member Function Documentation

◆ DeleteMessage()

virtual TTV_ErrorCode ttv::chat::IChatRoom::DeleteMessage ( const std::string &  messageId,
const DeleteMessageCallback callback 
)
pure virtual

Deletes a message in the chat room.

Parameters
[in]messageIdThe id of the message we want to delete.
[in]callbackCallback when API call returns, receives an error code.
Returns
  • TTV_EC_SUCCESS: We've sent the request to delete the message.
  • TTV_EC_SHUT_DOWN: The chat room object is not initialized.
  • TTV_EC_NEED_TO_LOGIN: The user is not properly logged in.

Implemented in ttv::chat::ChatRoom.

◆ DeleteRoom()

virtual TTV_ErrorCode ttv::chat::IChatRoom::DeleteRoom ( const DeleteRoomCallback callback)
pure virtual

Deletes the chat room from the channel. User must be the owner of the chat room.

Parameters
[in]callbackCallback when API call returns, receives an error code.
Returns
  • TTV_EC_SUCCESS: We've sent the request to delete the room.
  • TTV_EC_SHUT_DOWN: The chat room object is not initialized.
  • TTV_EC_NEED_TO_LOGIN: The user is not properly logged in.

Implemented in ttv::chat::ChatRoom.

◆ DisableEmotesOnlyMode()

virtual TTV_ErrorCode ttv::chat::IChatRoom::DisableEmotesOnlyMode ( const UpdateRoomModesCallback callback)
pure virtual

Turns off emotes-only mode for the chat room.

Parameters
[in]callbackCallback when the API call returns, receives an error code and the new room info.
Returns
  • TTV_EC_SUCCESS: We've send the request to turn off emotes-only mode for the chat room.
  • TTV_EC_SHUT_DOWN: The chat room object is not initialized.
  • TTV_EC_NEED_TO_LOGIN: The user is not properly logged in.

Implemented in ttv::chat::ChatRoom.

◆ DisableR9kMode()

virtual TTV_ErrorCode ttv::chat::IChatRoom::DisableR9kMode ( const UpdateRoomModesCallback callback)
pure virtual

Turns off r9k mode for the chat room.

Parameters
[in]callbackCallback when the API call returns, receives an error code and the new room info.
Returns
  • TTV_EC_SUCCESS: We've send the request to turn off r9k mode for the chat room.
  • TTV_EC_SHUT_DOWN: The chat room object is not initialized.
  • TTV_EC_NEED_TO_LOGIN: The user is not properly logged in.

Implemented in ttv::chat::ChatRoom.

◆ DisableSlowMode()

virtual TTV_ErrorCode ttv::chat::IChatRoom::DisableSlowMode ( const UpdateRoomModesCallback callback)
pure virtual

Turns off slow mode for the chat room.

Parameters
[in]callbackCallback when the API call returns, receives an error code and the new room info.
Returns
  • TTV_EC_SUCCESS: We've send the request to turn off slow mode for the chat room.
  • TTV_EC_SHUT_DOWN: The chat room object is not initialized.
  • TTV_EC_NEED_TO_LOGIN: The user is not properly logged in.

Implemented in ttv::chat::ChatRoom.

◆ Dispose()

virtual TTV_ErrorCode ttv::chat::IChatRoom::Dispose ( )
pure virtual

This should be called when the application is done with the instance.

Returns
  • TTV_EC_SUCCESS: Instance has been disposed.

Implemented in ttv::chat::ChatRoom.

◆ EditMessage()

virtual TTV_ErrorCode ttv::chat::IChatRoom::EditMessage ( const std::string &  messageId,
const std::string &  message,
ChatRoomMessage placeholderMessage,
const EditMessageCallback callback 
)
pure virtual

Edits a message's content in the chat room. User must have written the message.

Parameters
[in]messageIdThe id of the message we want to edit.
[in]messageThe content that we want to set the message to.
[out]placeholderMessageA ChatRoomMessage created client-side to be displayed until we receive the actual message result from the backend.
[in]callbackCallback when API call returns, receives an error code and the edited message.
Returns
  • TTV_EC_SUCCESS: We've sent the request to edit the message.
  • TTV_EC_SHUT_DOWN: The chat room object is not initialized.
  • TTV_EC_NEED_TO_LOGIN: The user is not properly logged in.

Implemented in ttv::chat::ChatRoom.

◆ EnableEmotesOnlyMode()

virtual TTV_ErrorCode ttv::chat::IChatRoom::EnableEmotesOnlyMode ( const UpdateRoomModesCallback callback)
pure virtual

Turns on emotes-only mode for the chat room.

Parameters
[in]callbackCallback when the API call returns, receives an error code and the new room info.
Returns
  • TTV_EC_SUCCESS: We've send the request to turn on emotes-only mode for the chat room.
  • TTV_EC_SHUT_DOWN: The chat room object is not initialized.
  • TTV_EC_NEED_TO_LOGIN: The user is not properly logged in.

Implemented in ttv::chat::ChatRoom.

◆ EnableR9kMode()

virtual TTV_ErrorCode ttv::chat::IChatRoom::EnableR9kMode ( const UpdateRoomModesCallback callback)
pure virtual

Turns on r9k mode for the chat room.

Parameters
[in]callbackCallback when the API call returns, receives an error code and the new room info.
Returns
  • TTV_EC_SUCCESS: We've send the request to turn on r9k mode for the chat room.
  • TTV_EC_SHUT_DOWN: The chat room object is not initialized.
  • TTV_EC_NEED_TO_LOGIN: The user is not properly logged in.

Implemented in ttv::chat::ChatRoom.

◆ EnableSlowMode()

virtual TTV_ErrorCode ttv::chat::IChatRoom::EnableSlowMode ( uint32_t  durationSeconds,
const UpdateRoomModesCallback callback 
)
pure virtual

Turns on slow mode for the chat room.

Parameters
[in]durationSecondsThe number of seconds a user must wait between sending messages. Cannot be 0.
[in]callbackCallback when the API call returns, receives an error code and the new room info.
Returns
  • TTV_EC_SUCCESS: We've send the request to turn on slow mode for the chat room.
  • TTV_EC_INVALID_ARG: durationSeconds cannot be 0.
  • TTV_EC_SHUT_DOWN: The chat room object is not initialized.
  • TTV_EC_NEED_TO_LOGIN: The user is not properly logged in.

Implemented in ttv::chat::ChatRoom.

◆ FetchMessagesAfterCursor()

virtual TTV_ErrorCode ttv::chat::IChatRoom::FetchMessagesAfterCursor ( const std::string &  cursor,
uint32_t  limit,
const FetchMessagesCallback callback 
)
pure virtual

Fetches newer messages from the chat room starting at the cursor, from oldest to newest.

Parameters
[in]cursorThe cursor that we want to start fetching messages from. If the empty string is passed in, we fetch the oldest messages in the room.
[in]limitThe max number of messages to fetch. Can be a number from 1-100.
[in]callbackCallback when API call returns, receives an error code and the list of messages.
Returns
  • TTV_EC_SUCCESS: We've sent the request to fetch the messages.
  • TTV_EC_INVALID_ARG: One of the parameters passed in is not a valid value.
  • TTV_EC_SHUT_DOWN: The chat room object is not initialized.
  • TTV_EC_NEED_TO_LOGIN: The user is not properly logged in.

Implemented in ttv::chat::ChatRoom.

◆ FetchMessagesAfterTimestamp()

virtual TTV_ErrorCode ttv::chat::IChatRoom::FetchMessagesAfterTimestamp ( Timestamp  timestamp,
uint32_t  limit,
const FetchMessagesCallback callback 
)
pure virtual

Fetches messages from the chat room and after the timestamp (inclusive), from oldest to newest.

Parameters
[in]timestampThe timestamp that we want to start fetching messages from.
[in]limitThe max number of messages to fetch. Can be a number from 1-100.
[in]callbackCallback when API call returns, receives an error code and the list of messages.
Returns
  • TTV_EC_SUCCESS: We've sent the request to fetch the messages.
  • TTV_EC_INVALID_ARG: One of the parameters passed in is not a valid value.
  • TTV_EC_SHUT_DOWN: The chat room object is not initialized.
  • TTV_EC_NEED_TO_LOGIN: The user is not properly logged in.

Implemented in ttv::chat::ChatRoom.

◆ FetchMessagesBeforeCursor()

virtual TTV_ErrorCode ttv::chat::IChatRoom::FetchMessagesBeforeCursor ( const std::string &  cursor,
uint32_t  limit,
const FetchMessagesCallback callback 
)
pure virtual

Fetches older messages from the chat room starting at the cursor, from newest to oldest.

Parameters
[in]cursorThe cursor that we want to start fetching messages from. If the empty string is passed in, we fetch the most recent messages in the room.
[in]limitThe max number of messages to fetch. Can be a number from 1-100.
[in]callbackCallback when API call returns, receives an error code and the list of messages.
Returns
  • TTV_EC_SUCCESS: We've sent the request to fetch the messages.
  • TTV_EC_INVALID_ARG: One of the parameters passed in is not a valid value.
  • TTV_EC_SHUT_DOWN: The chat room object is not initialized.
  • TTV_EC_NEED_TO_LOGIN: The user is not properly logged in.

Implemented in ttv::chat::ChatRoom.

◆ FetchMessagesBeforeTimestamp()

virtual TTV_ErrorCode ttv::chat::IChatRoom::FetchMessagesBeforeTimestamp ( Timestamp  timestamp,
uint32_t  limit,
const FetchMessagesCallback callback 
)
pure virtual

Fetches messages from the chat room before the timestamp, from newest to oldest.

Parameters
[in]timestampThe timestamp that we want to start fetching messages from.
[in]limitThe max number of messages to fetch. Can be a number from 1-100.
[in]callbackCallback when API call returns, receives an error code and the list of messages.
Returns
  • TTV_EC_SUCCESS: We've sent the request to fetch the messages.
  • TTV_EC_INVALID_ARG: One of the parameters passed in is not a valid value.
  • TTV_EC_SHUT_DOWN: The chat room object is not initialized.
  • TTV_EC_NEED_TO_LOGIN: The user is not properly logged in.

Implemented in ttv::chat::ChatRoom.

◆ FetchRoomInfo()

virtual TTV_ErrorCode ttv::chat::IChatRoom::FetchRoomInfo ( const FetchRoomInfoCallback callback)
pure virtual

Fetches the information of the chat room and returns it in the callback.

Parameters
[in]callbackCallback when API call returns, receives an error code and the room info.
Returns
  • TTV_EC_SUCCESS: We've sent the request to fetch the room info.
  • TTV_EC_SHUT_DOWN: The chat room object is not initialized.
  • TTV_EC_NEED_TO_LOGIN: The user is not properly logged in.

Implemented in ttv::chat::ChatRoom.

◆ SendMessage()

virtual TTV_ErrorCode ttv::chat::IChatRoom::SendMessage ( const std::string &  message,
ChatRoomMessage placeholderMessage,
const SendMessageCallback callback 
)
pure virtual

Send a message to the chat room. User must be joined to the chat room.

Parameters
[in]messageContent of the message we want to send to the chat room.
[out]placeholderMessageA ChatRoomMessage created client-side to be displayed until we receive the actual message result from the backend.
[in]callbackCallback when API call returns, receives an error code and the sent message.
Returns
  • TTV_EC_SUCCESS: We've sent the request to send the message.
  • TTV_EC_SHUT_DOWN: The chat room object is not initialized.
  • TTV_EC_NEED_TO_LOGIN: The user is not properly logged in.

Implemented in ttv::chat::ChatRoom.

◆ SetArchived()

virtual TTV_ErrorCode ttv::chat::IChatRoom::SetArchived ( bool  isArchived,
const UpdateRoomViewCallback callback 
)
pure virtual

Update if the user has archived the chat room.

Parameters
[in]isArchivedWhether the user has archived the room.
[in]callbackCallback when API call returns, receives an error code and the new room info.
Returns
  • TTV_EC_SUCCESS: We've sent the request to archive the room.
  • TTV_EC_SHUT_DOWN: The chat room object is not initialized.
  • TTV_EC_NEED_TO_LOGIN: The user is not properly logged in.

Implemented in ttv::chat::ChatRoom.

◆ SetLastReadAt()

virtual TTV_ErrorCode ttv::chat::IChatRoom::SetLastReadAt ( Timestamp  lastReadAt,
const UpdateRoomViewCallback callback 
)
pure virtual

Update when the user last read a message in the chat room.

Parameters
[in]lastReadAtThe time the user last read a message.
[in]callbackCallback when API call returns, receives an error code and the new room info.
Returns
  • TTV_EC_SUCCESS: We've sent the request set the last read at time.
  • TTV_EC_SHUT_DOWN: The chat room object is not initialized.
  • TTV_EC_NEED_TO_LOGIN: The user is not properly logged in.

Implemented in ttv::chat::ChatRoom.

◆ SetMinimumAllowedRole()

virtual TTV_ErrorCode ttv::chat::IChatRoom::SetMinimumAllowedRole ( RoomRole  minimumAllowedRole,
const UpdateRoomInfoCallback callback 
)
pure virtual

Update the minimum role required to join the chat room.

Parameters
[in]minimumAllowedRoleThe new minimum required role for the room.
[in]callbackCallback when API call returns, receives an error code and the new room info.
Returns
  • TTV_EC_SUCCESS: We've sent the request to set the room's minimum allowed role.
  • TTV_EC_INVALID_ARG: The room role passed in cannot be Unknown.
  • TTV_EC_SHUT_DOWN: The chat room object is not initialized.
  • TTV_EC_NEED_TO_LOGIN: The user is not properly logged in.

Implemented in ttv::chat::ChatRoom.

◆ SetMuted()

virtual TTV_ErrorCode ttv::chat::IChatRoom::SetMuted ( bool  isMuted,
const UpdateRoomViewCallback callback 
)
pure virtual

Update if the user has muted the chat room.

Parameters
[in]isMutedWhether the user has muted the room.
[in]callbackCallback when API call returns, receives an error code and the new room info.
Returns
  • TTV_EC_SUCCESS: We've sent the request to mute the room.
  • TTV_EC_SHUT_DOWN: The chat room object is not initialized.
  • TTV_EC_NEED_TO_LOGIN: The user is not properly logged in.

Implemented in ttv::chat::ChatRoom.

◆ SetPreviewable()

virtual TTV_ErrorCode ttv::chat::IChatRoom::SetPreviewable ( bool  isPreviewable,
const UpdateRoomInfoCallback callback 
)
pure virtual

Update whether the chat room is previewable to non-joined users.

Parameters
[in]isPreviewableWhether the chat room will be previewable.
[in]callbackCallback when API call returns, receives an error code and the new room info.
Returns
  • TTV_EC_SUCCESS: We've sent the request to set the room's previewability.
  • TTV_EC_SHUT_DOWN: The chat room object is not initialized.
  • TTV_EC_NEED_TO_LOGIN: The user is not properly logged in.

Implemented in ttv::chat::ChatRoom.

◆ SetRoomName()

virtual TTV_ErrorCode ttv::chat::IChatRoom::SetRoomName ( const std::string &  name,
const UpdateRoomInfoCallback callback 
)
pure virtual

Update the name of the chat room.

Parameters
[in]nameThe new name of the room.
[in]callbackCallback when API call returns, receives an error code and the new room info.
Returns
  • TTV_EC_SUCCESS: We've sent the request to set the room name.
  • TTV_EC_SHUT_DOWN: The chat room object is not initialized.
  • TTV_EC_NEED_TO_LOGIN: The user is not properly logged in.

Implemented in ttv::chat::ChatRoom.

◆ SetTopic()

virtual TTV_ErrorCode ttv::chat::IChatRoom::SetTopic ( const std::string &  topic,
const UpdateRoomInfoCallback callback 
)
pure virtual

Update the topic of the chat room.

Parameters
[in]nameThe new topic of the room.
[in]callbackCallback when API call returns, receives an error code and the new room info.
Returns
  • TTV_EC_SUCCESS: We've sent the request to set the room topic.
  • TTV_EC_SHUT_DOWN: The chat room object is not initialized.
  • TTV_EC_NEED_TO_LOGIN: The user is not properly logged in.

Implemented in ttv::chat::ChatRoom.


The documentation for this class was generated from the following file: