|
Twitch SDK (Internal)
|
#include <chatapi.h>
Classes | |
| class | CoreApiClient |
Public Types | |
| using | FetchUserListCallback = std::function< void(TTV_ErrorCode ec, UserList &&userList)> |
| using | BlockChangeCallback = std::function< void(TTV_ErrorCode ec)> |
| using | FetchEmoticonSetsCallback = std::function< void(TTV_ErrorCode ec, const std::vector< EmoticonSet > &sets)> |
| using | FetchBadgesCallback = std::function< void(TTV_ErrorCode ec, BadgeSet &&badges)> |
| using | FetchBitsConfigurationCallback = std::function< void(TTV_ErrorCode ec, const std::shared_ptr< BitsConfiguration > &bitsConfig)> |
| using | SetBroadcasterLanguageChatEnabledCallback = std::function< void(TTV_ErrorCode ec)> |
| using | SendMessageCallback = std::function< void(TTV_ErrorCode ec, MessageId messageID)> |
| using | FetchThreadDataPageCallback = std::function< void(TTV_ErrorCode ec, const std::vector< ThreadData > &threadPage, uint32_t total)> |
| using | FetchThreadDataCallback = std::function< void(TTV_ErrorCode ec, const ThreadData &threadData)> |
| using | FetchThreadMessagesCallback = std::function< void(TTV_ErrorCode ec, const std::vector< WhisperMessage > &message)> |
| using | SetLastMessageReadIdCallback = std::function< void(TTV_ErrorCode ec)> |
| using | SetThreadMutedCallback = std::function< void(TTV_ErrorCode ec)> |
| using | SetThreadArchivedCallback = std::function< void(TTV_ErrorCode ec)> |
| using | FetchThreadUnreadCountsCallback = std::function< void(TTV_ErrorCode ec, const UnreadThreadCounts &counts)> |
| using | FetchBlockedUsersCallback = std::function< void(TTV_ErrorCode ec, const std::vector< UserInfo > &blockedUsers)> |
| using | BanUserCallback = std::function< void(TTV_ErrorCode ec, BanUserError &&error)> |
| using | UnbanUserCallback = std::function< void(TTV_ErrorCode ec, UnbanUserError &&error)> |
| using | ModUserCallback = std::function< void(TTV_ErrorCode ec, ModUserError &&error)> |
| using | UnmodUserCallback = std::function< void(TTV_ErrorCode ec, UnmodUserError &&error)> |
| using | UpdateUserColorCallback = std::function< void(TTV_ErrorCode ec)> |
| using | FetchChannelModeratorsCallback = std::function< void(TTV_ErrorCode ec, const std::vector< std::string > &modNames, const std::string &nextCursor)> |
| enum | State { State::Uninitialized, State::Initializing, State::Initialized, State::ShuttingDown } |
| using | InitializeCallback = std::function< void(TTV_ErrorCode ec)> |
| using | ShutdownCallback = std::function< void(TTV_ErrorCode ec)> |
Public Member Functions | |
| ChatAPI () | |
| virtual | ~ChatAPI () |
| virtual std::string | GetModuleName () const override |
| virtual TTV_ErrorCode | Initialize (const InitializeCallback &callback) override |
| virtual TTV_ErrorCode | Shutdown (const ShutdownCallback &callback) override |
| virtual TTV_ErrorCode | Update () override |
| TTV_ErrorCode | SetCoreApi (const std::shared_ptr< CoreAPI > &coreApi) |
| TTV_ErrorCode | SetListener (const std::shared_ptr< IChatAPIListener > &listener) |
| TTV_ErrorCode | SetEnabledFeatures (const FeatureFlags &features) |
| TTV_ErrorCode | SetTokenizationOptions (const TokenizationOptions &options) |
| TTV_ErrorCode | SetUserThreadsListener (UserId userId, const std::shared_ptr< IChatUserThreadsListener > &listener) |
| TTV_ErrorCode | Connect (UserId userId, ChannelId channelId, const std::shared_ptr< IChatChannelListener > &listener) |
| TTV_ErrorCode | Disconnect (UserId userId, ChannelId channelId) |
| TTV_ErrorCode | SendChatMessage (UserId userId, ChannelId channelId, const std::string &message) |
| TTV_ErrorCode | FetchUserListForChannel (UserId userId, ChannelId channelId, const FetchUserListCallback &callback) |
| TTV_ErrorCode | BlockUser (UserId userId, UserId blockUserId, const std::string &reason, bool whisper, const BlockChangeCallback &callback) |
| TTV_ErrorCode | UnblockUser (UserId userId, UserId blockUserId, const BlockChangeCallback &callback) |
| TTV_ErrorCode | GetUserBlocked (UserId userId, UserId blockUserId, bool &blocked) |
| TTV_ErrorCode | FetchBlockedUsers (UserId userId, const FetchBlockedUsersCallback &callback) |
| TTV_ErrorCode | FetchUserEmoticonSets (UserId userId, bool forceRefetch, const FetchEmoticonSetsCallback &callback) |
| TTV_ErrorCode | FetchGlobalBadges (const FetchBadgesCallback &callback) |
| TTV_ErrorCode | FetchChannelBadges (ChannelId channelId, const FetchBadgesCallback &callback) |
| TTV_ErrorCode | FetchGlobalBitsConfiguration (const FetchBitsConfigurationCallback &callback) |
| TTV_ErrorCode | FetchChannelBitsConfiguration (ChannelId channelId, const FetchBitsConfigurationCallback &callback) |
| TTV_ErrorCode | SetBroadcasterLanguageChatEnabled (UserId userId, ChannelId channelId, bool enabled, const SetBroadcasterLanguageChatEnabledCallback &callback) |
| TTV_ErrorCode | OptInToBroadcasterLanguageChat (UserId userId, ChannelId channelId, const std::string &language) |
| TTV_ErrorCode | GenerateThreadId (UserId userId, UserId otherUserId, std::string &threadId) |
| TTV_ErrorCode | SendMessageToUser (UserId userId, UserId otherUserId, const std::string &message, WhisperMessage &placeholderMessage, const SendMessageCallback &callback) |
| TTV_ErrorCode | FetchThreadDataPage (UserId userId, uint32_t offset, uint32_t pageSize, const FetchThreadDataPageCallback &callback) |
| TTV_ErrorCode | FetchUserThreadData (UserId userId, const std::string &threadId, const FetchThreadDataCallback &callback) |
| TTV_ErrorCode | FetchThreadMessages (UserId userId, const std::string &threadId, MessageId start, uint32_t beforeCount, const FetchThreadMessagesCallback &callback) |
| TTV_ErrorCode | SetLastMessageReadId (UserId userId, const std::string &threadId, MessageId lastReadMessageId, const SetLastMessageReadIdCallback &callback) |
| TTV_ErrorCode | SetThreadMuted (UserId userId, const std::string &threadId, bool muted, const SetThreadMutedCallback &callback) |
| TTV_ErrorCode | SetThreadArchived (UserId userId, const std::string &threadId, bool archived, const SetThreadArchivedCallback &callback) |
| TTV_ErrorCode | FetchThreadUnreadCounts (UserId userId, const FetchThreadUnreadCountsCallback &callback) |
| TTV_ErrorCode | SetMessageFlushInterval (uint64_t milliseconds) |
| uint64_t | GetMessageFlushInterval () const |
| TTV_ErrorCode | GetEmoticonUrl (uint32_t emoticonId, float scale, std::string &result) |
| TTV_ErrorCode | CreateChatChannel (UserId userId, ChannelId channelId, const std::shared_ptr< IChatChannelListener > &listener, std::shared_ptr< IChatChannel > &result) |
| TTV_ErrorCode | CreateChatChannelProperties (UserId userId, ChannelId channelId, const std::shared_ptr< IChatChannelPropertyListener > &listener, std::shared_ptr< IChatChannelProperties > &result) |
| TTV_ErrorCode | CreateChatReplay (UserId userId, const std::string &vodId, const std::shared_ptr< IChatReplayListener > &listener, std::shared_ptr< IChatReplay > &result) |
| TTV_ErrorCode | CreateChannelChatRoomManager (UserId userId, ChannelId channelId, const std::shared_ptr< IChannelChatRoomManagerListener > &listener, std::shared_ptr< IChannelChatRoomManager > &result) |
| TTV_ErrorCode | CreateChatRoom (UserId userId, const std::string &roomId, ChannelId channelId, const std::shared_ptr< IChatRoomListener > &listener, std::shared_ptr< IChatRoom > &result) |
| TTV_ErrorCode | CreateChatRoomNotifications (UserId userId, const std::shared_ptr< IChatRoomNotificationsListener > &listener, std::shared_ptr< IChatRoomNotifications > &result) |
| TTV_ErrorCode | CreateChatRaid (UserId userId, ChannelId channelId, const std::shared_ptr< IChatRaidListener > &listener, std::shared_ptr< IChatRaid > &result) |
| TTV_ErrorCode | CreateBitsStatus (UserId userId, ChannelId channelId, const std::shared_ptr< IBitsListener > &listener, std::shared_ptr< IBitsStatus > &result) |
| TTV_ErrorCode | CreateFollowersStatus (UserId userId, ChannelId channelId, const std::shared_ptr< IFollowersListener > &listener, std::shared_ptr< IFollowersStatus > &result) |
| TTV_ErrorCode | CreateSubscribersStatus (UserId userId, ChannelId channelId, const std::shared_ptr< ISubscribersListener > &listener, std::shared_ptr< ISubscribersStatus > &result) |
| TTV_ErrorCode | BanUser (UserId userId, ChannelId channelId, const std::string &bannedUserName, uint32_t durationSeconds, const BanUserCallback &callback) |
| TTV_ErrorCode | UnbanUser (UserId userId, ChannelId channelId, const std::string &bannedUserName, const UnbanUserCallback &callback) |
| TTV_ErrorCode | ModUser (UserId userId, ChannelId channelId, const std::string &modUserName, const ModUserCallback &callback) |
| TTV_ErrorCode | UnmodUser (UserId userId, ChannelId channelId, const std::string &unmodUserName, const UnmodUserCallback &callback) |
| TTV_ErrorCode | UpdateUserColor (UserId userId, const std::string &color, const UpdateUserColorCallback &callback) |
| TTV_ErrorCode | FetchChannelModerators (ChannelId channelId, const std::string &cursor, const FetchChannelModeratorsCallback &callback) |
| void | SetChatObjectFactory (const std::shared_ptr< IChatObjectFactory > &factory) |
| virtual State | GetState () const override |
Static Public Member Functions | |
| static void | GetRequiredAuthScopes (std::vector< std::string > &scopes) |
Protected Member Functions | |
| void | NotifyStateChange () |
| void | RegisterInitializeCallback (const InitializeCallback &callback) |
| void | RegisterShutdownCallback (const ShutdownCallback &callback) |
| template<typename T > | |
| void | Invoke (std::function< void(std::shared_ptr< T >)> callback) |
| std::shared_ptr< ComponentContainer > | GetComponentContainer () |
Protected Attributes | |
| EventSource< IModuleListener > | mListeners |
| State | mState |
| State | mLastReportedState |
Private Member Functions | |
| TTV_ErrorCode | GetChannelSet (UserId userId, std::shared_ptr< ChatChannelSet > &channelSet) |
| std::shared_ptr< ChatUserBlockList > | CreateUserBlockList (const std::shared_ptr< User > &user) |
| void | CoreUserLoggedIn (std::shared_ptr< User > user) |
| void | CoreUserLoggedOut (std::shared_ptr< User > user) |
| void | CoreLocalLanguageChanged (const std::string &language) |
| virtual bool | CheckShutdown () override |
| virtual void | CompleteShutdown () override |
| TTV_ErrorCode | GetBlockListForUser (UserId userId, std::shared_ptr< ChatUserBlockList > &blockList) |
| TTV_ErrorCode | GetUserThreadsForUser (UserId userId, std::shared_ptr< ChatUserThreads > &userThreads) |
| TTV_ErrorCode | GetThreadForUser (UserId userId, const std::string &threadId, std::shared_ptr< ChatUserThread > &thread) |
| TTV_ErrorCode | DisposeChatChannel (const std::shared_ptr< IChatChannel > &chatChannel) |
| TTV_ErrorCode | DisposeChatChannelProperties (const std::shared_ptr< IChatChannelProperties > &chatChannelProperties) |
| TTV_ErrorCode | DisposeChatReplay (const std::shared_ptr< IChatReplay > &chatReplay) |
| TTV_ErrorCode | DisposeChatRaid (const std::shared_ptr< IChatRaid > &chatRaid) |
| TTV_ErrorCode | DisposeChannelChatRoomManager (const std::shared_ptr< IChannelChatRoomManager > &channelChatRoomManager) |
| TTV_ErrorCode | DisposeChatRoom (const std::shared_ptr< IChatRoom > &chatRoom) |
| TTV_ErrorCode | DisposeChatRoomNotifications (const std::shared_ptr< IChatRoomNotifications > &chatRoomNotifications) |
| TTV_ErrorCode | DisposeBitsStatus (const std::shared_ptr< IBitsStatus > &bitsStatus) |
| TTV_ErrorCode | DisposeFollowersStatus (const std::shared_ptr< IFollowersStatus > &followersStatus) |
| TTV_ErrorCode | DisposeSubscribersStatus (const std::shared_ptr< ISubscribersStatus > &subscribersStatus) |
Private Attributes | |
| std::shared_ptr< CoreAPI > | mCoreApi |
| std::shared_ptr< CoreApiClient > | mCoreApiClient |
| std::shared_ptr< ChatAPIInternalData > | mInternalData |
| std::shared_ptr< IChatObjectFactory > | mChatObjectFactory |
| std::shared_ptr< ChannelRepository > | mChannelRepository |
More... | |
| std::shared_ptr< UserRepository > | mUserRepository |
More... | |
| std::shared_ptr< SettingRepository > | mSettingRepository |
More... | |
| std::shared_ptr< BitsConfigRepository > | mBitsConfigRepository |
| std::shared_ptr< ChatAPITaskHost > | mTaskHost |
| std::shared_ptr< TaskRunner > | mTaskRunner |
| std::shared_ptr< TaskRunner > | mUserBlocksTaskRunner |
More... | |
| FeatureFlags | mEnabledFeatures |
More... | |
| TokenizationOptions | mTokenizationOptions |
Provides the main chat service functionality.
The following properties must be set before calling Initialize().
| using ttv::chat::ChatAPI::BanUserCallback = std::function<void(TTV_ErrorCode ec, BanUserError&& error)> |
Used with BanUser().
| [in] | ec |
|
| [in] | error | Error object received from GraphQL describing why banning the user failed. |
| using ttv::chat::ChatAPI::BlockChangeCallback = std::function<void(TTV_ErrorCode ec)> |
Used with BlockUser(), UnblockUser()
| [in] | ec |
|
| using ttv::chat::ChatAPI::FetchBadgesCallback = std::function<void(TTV_ErrorCode ec, BadgeSet&& badges)> |
Used with FetchGlobalBadges() and FetchChannelBadges()
| [in] | ec |
|
| [in] | badges | The badges that were fetched. |
| using ttv::chat::ChatAPI::FetchBitsConfigurationCallback = std::function<void(TTV_ErrorCode ec, const std::shared_ptr<BitsConfiguration>& bitsConfig)> |
Used with FetchGlobalBitsConfiguration() and FetchChannelBitsConfiguration()
| [in] | ec |
|
| [in] | bitsConfig | A shared pointer to the fetched bits configuration object. |
| using ttv::chat::ChatAPI::FetchBlockedUsersCallback = std::function<void(TTV_ErrorCode ec, const std::vector<UserInfo>& blockedUsers)> |
Used with FetchBlockedUsers()
| [in] | ec |
|
| [in] | blockedUsers | The list of blocked users. |
| using ttv::chat::ChatAPI::FetchChannelModeratorsCallback = std::function<void(TTV_ErrorCode ec, const std::vector<std::string>& modNames, const std::string& nextCursor)> |
Used with FetchChannelModerators().
| [in] | ec |
|
| [in] | modNames | List of moderator names, up the GraphQL pagination limit (currently 100). |
| [in] | nextCursor | The cursor to fetch the next batch of moderator names. Is empty string if no more mods to fetch. |
| using ttv::chat::ChatAPI::FetchEmoticonSetsCallback = std::function<void(TTV_ErrorCode ec, const std::vector<EmoticonSet>& sets)> |
Used with FetchUserEmoticonSets()
| [in] | ec |
|
| [in] | sets | A list of the emoticon sets available to the user. |
| using ttv::chat::ChatAPI::FetchThreadDataCallback = std::function<void(TTV_ErrorCode ec, const ThreadData& threadData)> |
Used with FetchThreadData()
| [in] | ec |
|
| [in] | threadData | The data for the fetched thread. |
| using ttv::chat::ChatAPI::FetchThreadDataPageCallback = std::function<void(TTV_ErrorCode ec, const std::vector<ThreadData>& threadPage, uint32_t total)> |
Used with FetchThreadDataPage()
| [in] | ec |
|
| [in] | threadPage | A page of thread data for the user. |
| [in] | total | The total number of threads for the user. |
| using ttv::chat::ChatAPI::FetchThreadMessagesCallback = std::function<void(TTV_ErrorCode ec, const std::vector<WhisperMessage>& message)> |
Used with FetchThreadMessages()
| [in] | ec |
|
| [in] | message | The list of messages in the thread. |
| using ttv::chat::ChatAPI::FetchThreadUnreadCountsCallback = std::function<void(TTV_ErrorCode ec, const UnreadThreadCounts& counts)> |
Used with FetchThreadUnreadCounts()
| [in] | ec |
|
| [in] | counts | Contains the number of unread threads and messages. |
| using ttv::chat::ChatAPI::FetchUserListCallback = std::function<void(TTV_ErrorCode ec, UserList&& userList)> |
Used with FetchUserListForChannel()
| [in] | ec |
|
| [in] | userList | The list of users in the channel. |
|
inherited |
| using ttv::chat::ChatAPI::ModUserCallback = std::function<void(TTV_ErrorCode ec, ModUserError&& error)> |
Used with ModUser().
| [in] | ec |
|
| [in] | error | Error object received from GraphQL describing why the modding failed. |
| using ttv::chat::ChatAPI::SendMessageCallback = std::function<void(TTV_ErrorCode ec, MessageId messageID)> |
Used with SendMessageToUser()
| [in] | ec |
|
| [in] | messageID | The ID of the sent message. |
| using ttv::chat::ChatAPI::SetBroadcasterLanguageChatEnabledCallback = std::function<void(TTV_ErrorCode ec)> |
Used with SetBroadcasterLanguageChatEnabled()
| [in] | ec |
|
| using ttv::chat::ChatAPI::SetLastMessageReadIdCallback = std::function<void(TTV_ErrorCode ec)> |
Used with SetLastMessageReadId()
| [in] | ec |
|
| using ttv::chat::ChatAPI::SetThreadArchivedCallback = std::function<void(TTV_ErrorCode ec)> |
Used with SetThreadArchived()
| [in] | ec |
|
| using ttv::chat::ChatAPI::SetThreadMutedCallback = std::function<void(TTV_ErrorCode ec)> |
Used with SetThreadMuted()
| [in] | ec |
|
|
inherited |
| using ttv::chat::ChatAPI::UnbanUserCallback = std::function<void(TTV_ErrorCode ec, UnbanUserError&& error)> |
Used with UnbanUser().
| [in] | ec |
|
| [in] | error | Error object received from GraphQL describing why the unbanning failed. |
| using ttv::chat::ChatAPI::UnmodUserCallback = std::function<void(TTV_ErrorCode ec, UnmodUserError&& error)> |
Used with UnmodUser().
| [in] | ec |
|
| [in] | error | Error object received from GraphQL describing why the unmodding failed. |
| using ttv::chat::ChatAPI::UpdateUserColorCallback = std::function<void(TTV_ErrorCode ec)> |
Used with UpdateUserColor().
| [in] | ec |
|
|
stronginherited |
| ttv::chat::ChatAPI::ChatAPI | ( | ) |
|
virtual |
| TTV_ErrorCode ttv::chat::ChatAPI::BanUser | ( | UserId | userId, |
| ChannelId | channelId, | ||
| const std::string & | bannedUserName, | ||
| uint32_t | durationSeconds, | ||
| const BanUserCallback & | callback | ||
| ) |
Bans or timeouts the given user name from the given channel.
| [in] | userId | The id of the user who is issuing the ban. Must be owner or moderator of the channel. |
| [in] | channelId | The id of the channel the user is being banned from. |
| [in] | bannedUserName | The name of the user who is being banned. |
| [in] | durationSeconds | The duration of the ban/timeout in seconds. Value is 0 for a permanent ban. |
| [in] | callback | Receives an error code indicating the ban's success. |
| TTV_ErrorCode ttv::chat::ChatAPI::BlockUser | ( | UserId | userId, |
| UserId | blockUserId, | ||
| const std::string & | reason, | ||
| bool | whisper, | ||
| const BlockChangeCallback & | callback | ||
| ) |
Block another user.
| [in] | userId | The currently logged in user. |
| [in] | blockUserId | The user being blocked. |
| [in] | reason | The reason for blocking the user. |
| [in] | whisper | True if blocking due to a whisper. |
| [in] | callback | Function that receives whether the blocking was successful. |
|
overrideprivatevirtual |
Reimplemented from ttv::ModuleBase.
|
overrideprivatevirtual |
Reimplemented from ttv::ModuleBase.
| TTV_ErrorCode ttv::chat::ChatAPI::Connect | ( | UserId | userId, |
| ChannelId | channelId, | ||
| const std::shared_ptr< IChatChannelListener > & | listener | ||
| ) |
Connect to the channel's chat.
| [in] | userId | The currently logged in user that is connecting to chat. Can be the anonymous user with ID of 0. |
| [in] | channelId | The channel of the chat the user is connecting to. |
| [in] | listener | Receives unsolicited events regarding the channel's chat. |
|
private |
|
private |
|
private |
| TTV_ErrorCode ttv::chat::ChatAPI::CreateBitsStatus | ( | UserId | userId, |
| ChannelId | channelId, | ||
| const std::shared_ptr< IBitsListener > & | listener, | ||
| std::shared_ptr< IBitsStatus > & | result | ||
| ) |
Returns an implementation of IBitsStatus for the user/channel. This object is used to recieve bits updates for a user/channel. Bits updates that can be listened for:
| [in] | userId | The currently logged in user creating the bits status. |
| [in] | channelId | Should be the same as userId. |
| [in] | listener | The listener to receive bits updates for a user/channel. |
| [out] | result | BitsStatus object for the given user/channel to receive bits updates on. This object maintains the lifetime of the listener associated it. |
| TTV_ErrorCode ttv::chat::ChatAPI::CreateChannelChatRoomManager | ( | UserId | userId, |
| ChannelId | channelId, | ||
| const std::shared_ptr< IChannelChatRoomManagerListener > & | listener, | ||
| std::shared_ptr< IChannelChatRoomManager > & | result | ||
| ) |
Returns an implementation of IChannelChatRoomManager for the given user. This object handles any functions that aren't associated with a specific chat room, such as what rooms a user is connected to.
| [in] | userId | The id of the user we're creating the ChannelChatRoomManager object for. |
| [in] | channelId | The id of the channel that owns the chat rooms that the user is entering. |
| [in] | listener | Listener for user chat rooms. Called when a user is kicked/banned/timed out of a room, is mentioned, or has their view changed. |
| [out] | result | Stores the resulting ChannelChatRoomManager object. |
| TTV_ErrorCode ttv::chat::ChatAPI::CreateChatChannel | ( | UserId | userId, |
| ChannelId | channelId, | ||
| const std::shared_ptr< IChatChannelListener > & | listener, | ||
| std::shared_ptr< IChatChannel > & | result | ||
| ) |
Returns an implementation of IChatChannel for connecting to a channel on behalf of a user.
| [in] | userId | The currently logged in user. Can be the anonymous user with ID of 0. |
| [in] | channelId | The channel the user wants the object for. |
| [in] | listener | Listener for unsolicited events on the chat channel (raids, hosting, subscriptions, info changes, etc.) |
| [out] | result | The chat channel object for the channel. |
result.| TTV_ErrorCode ttv::chat::ChatAPI::CreateChatChannelProperties | ( | UserId | userId, |
| ChannelId | channelId, | ||
| const std::shared_ptr< IChatChannelPropertyListener > & | listener, | ||
| std::shared_ptr< IChatChannelProperties > & | result | ||
| ) |
Returns an implementation of IChatChannelProperties for a given channelId. This object is used to receive unsolicited chat channel property updates for a channel. Property updates that can be listened for:
| [in] | userId | The id of the user creating the ChatChannelProperties object. Can be the anonymous user with ID of 0. |
| [in] | channelId | The id of the channel we are receiving property updates for. |
| [in] | listener | Listener for the user. Called when certain properties (listed above) are updated on a channel. |
| [out] | result | Stores the resulting ChatChannelProperties object. |
| TTV_ErrorCode ttv::chat::ChatAPI::CreateChatRaid | ( | UserId | userId, |
| ChannelId | channelId, | ||
| const std::shared_ptr< IChatRaidListener > & | listener, | ||
| std::shared_ptr< IChatRaid > & | result | ||
| ) |
Returns an implementation of IChatRaid for the given owning user and channel, which is used later to start, join, leave, or cancel a raid.
| [in] | userId | The id of the user creating the raid object. If the anonymous user is passed in, you can listen for raid updates but not start or join a raid. To start a raid after creation, the user must be the broadcaster or moderator of the channel. |
| [in] | channelId | The source channel id that the raid is starting from. |
| [in] | listener | Listener for the raid with callback functions when the raid is started, updated, completed, and cancelled. |
| [out] | result | Stores the resulting ChatRaid object. |
| TTV_ErrorCode ttv::chat::ChatAPI::CreateChatReplay | ( | UserId | userId, |
| const std::string & | vodId, | ||
| const std::shared_ptr< IChatReplayListener > & | listener, | ||
| std::shared_ptr< IChatReplay > & | result | ||
| ) |
Returns an implementation of IChatReplay for the given owning user and vod.
| [in] | userId | The currently logged in user creating the ChatReplay object. Can be the anonymous user with ID of 0. |
| [in] | vodId | The VOD to create the chat replay for. |
| [in] | listener | Listener for the chat replay. Called for unsolicited changes to the chat replay. |
| [out] | result | Stores the resulting ChatReplay object. |
result.| TTV_ErrorCode ttv::chat::ChatAPI::CreateChatRoom | ( | UserId | userId, |
| const std::string & | roomId, | ||
| ChannelId | channelId, | ||
| const std::shared_ptr< IChatRoomListener > & | listener, | ||
| std::shared_ptr< IChatRoom > & | result | ||
| ) |
Returns an implementation of IChatRoom for the given room id. This object is used to manage a specific chat room.
| [in] | userId | The id of the user creating the chat room object. |
| [in] | roomId | The id of the room that the ChatRoom object is representing. |
| [in] | channelId | The channel that owns the created chat room. |
| [in] | listener | Listener for the chat room. Called when a message is sent/edited/deleted, or when the room information has been updated. |
| [out] | result | Stores the resulting ChatRoom object. |
| TTV_ErrorCode ttv::chat::ChatAPI::CreateChatRoomNotifications | ( | UserId | userId, |
| const std::shared_ptr< IChatRoomNotificationsListener > & | listener, | ||
| std::shared_ptr< IChatRoomNotifications > & | result | ||
| ) |
Returns an implementation of IChatRoomNotifications for the given user id. This object is used to receive unsolicited chat room events for the user.
| [in] | userId | The id of the user creating the chat room notifications object. Cannot be the anonymous user. |
| [in] | listener | Listener for the user. Called when the user is banned/timed out, or when the user's room view has been updated. |
| [out] | result | Stores the resulting ChatRoomNotifications object. |
| TTV_ErrorCode ttv::chat::ChatAPI::CreateFollowersStatus | ( | UserId | userId, |
| ChannelId | channelId, | ||
| const std::shared_ptr< IFollowersListener > & | listener, | ||
| std::shared_ptr< IFollowersStatus > & | result | ||
| ) |
Returns an implementation of IFollowersStatus for the user.
| [in] | userId | The currently logged in user creating the followers status object. Can be the anonymous user with ID of 0. |
| [in] | channelId | The channel we care about listening to for follows. |
| [in] | listener | The listener to receive info about follows in the channel. |
| [out] | result | FollowersStatus object for the given user/channel to receive follower updates on. This object maintains the lifetime of the listener associated it. |
| TTV_ErrorCode ttv::chat::ChatAPI::CreateSubscribersStatus | ( | UserId | userId, |
| ChannelId | channelId, | ||
| const std::shared_ptr< ISubscribersListener > & | listener, | ||
| std::shared_ptr< ISubscribersStatus > & | result | ||
| ) |
Returns an implementation of ISubscribersStatus for the user. This is only relevant for partners/affiliates who are able to have subscribers.
| [in] | userId | The currently logged in user creating the subscribers status object. |
| [in] | channelId | Should be the same as userId, since you can only check your own subscribers. |
| [in] | listener | The listener to receive info about subscribers in the channel. |
| [out] | result | SubscribersStatus object for the given user/channel to receive subscriber updates on. This object maintains the lifetime of the listener associated it. |
|
private |
| TTV_ErrorCode ttv::chat::ChatAPI::Disconnect | ( | UserId | userId, |
| ChannelId | channelId | ||
| ) |
Disconnect from the channel's chat.
| [in] | userId | The currently logged in user that is disconneting from chat. Can be the anonymous user with ID of 0. |
| [in] | channelId | The channel of the chat the user is disconnecting from. |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
| TTV_ErrorCode ttv::chat::ChatAPI::FetchBlockedUsers | ( | UserId | userId, |
| const FetchBlockedUsersCallback & | callback | ||
| ) |
Fetches the list of blocked users (UserInfo) for the given user. This will not use a cached value and will fetch whenever this is called.
| [in] | userId | The currently logged in user whose blocked users is being fetched. |
| [in] | callback | Function that receives a list of the blocked users. |
| TTV_ErrorCode ttv::chat::ChatAPI::FetchChannelBadges | ( | ChannelId | channelId, |
| const FetchBadgesCallback & | callback | ||
| ) |
Fetches the badge sets for the given channel. May use a cached value.
| [in] | channelId | The channel we're fetching badges for. |
| [in] | callback | Function that takes in the channel badge set information. |
| TTV_ErrorCode ttv::chat::ChatAPI::FetchChannelBitsConfiguration | ( | ChannelId | channelId, |
| const FetchBitsConfigurationCallback & | callback | ||
| ) |
Fetches the bits configuration object specifically for this channel. The BitsConfiguration object we get back may contain additional actions/cheers specifically for the channel. This value is cached for each channel.
| [in] | channelId | The channel we want to fetch the bits configuration for. |
| [in] | callback | Function that takes in the bits configuration information. |
| TTV_ErrorCode ttv::chat::ChatAPI::FetchChannelModerators | ( | ChannelId | channelId, |
| const std::string & | cursor, | ||
| const FetchChannelModeratorsCallback & | callback | ||
| ) |
Fetches the names of moderators in a channel.
| [in] | channelId | The id of the channel we're fetching mdoerators for. |
| [in] | cursor | The cursor to start fetching moderators names from. To start from the beginning, use empty string. |
| [in] | callback | Receives an error code indicating the change's success and a list of the names of the moderators. |
| TTV_ErrorCode ttv::chat::ChatAPI::FetchGlobalBadges | ( | const FetchBadgesCallback & | callback | ) |
Fetches the global badge sets. May use a cached value.
| [in] | callback | Function that receives the global badge set information. |
| TTV_ErrorCode ttv::chat::ChatAPI::FetchGlobalBitsConfiguration | ( | const FetchBitsConfigurationCallback & | callback | ) |
Fetches the global bits configuration object. This object contains info about the various bits actions (cheers). This value is cached over time, but the initial fetch can take some time.
| [in] | callback | Function that takes in the bits configuration information. |
| TTV_ErrorCode ttv::chat::ChatAPI::FetchThreadDataPage | ( | UserId | userId, |
| uint32_t | offset, | ||
| uint32_t | pageSize, | ||
| const FetchThreadDataPageCallback & | callback | ||
| ) |
Fetch a page of thread data.
| [in] | userId | The currently logged in user who is fetching the page. |
| [in] | offset | The point to start fetching threads from. |
| [in] | pageSize | How many threads to fetch. |
| [in] | callback | Function that receives a list of thread data. |
| TTV_ErrorCode ttv::chat::ChatAPI::FetchThreadMessages | ( | UserId | userId, |
| const std::string & | threadId, | ||
| MessageId | start, | ||
| uint32_t | beforeCount, | ||
| const FetchThreadMessagesCallback & | callback | ||
| ) |
Fetch the messages for a thread.
| [in] | userId | The currently logged in user who is fetching their thread's messages. |
| [in] | threadId | The ID of the thread to fetch messages for. |
| [in] | start | The ID of the message to start fetching messages from. |
| [in] | beforeCount | The max number of messages to fetch. |
| [in] | callback | Function that receives the list of whispers. |
| TTV_ErrorCode ttv::chat::ChatAPI::FetchThreadUnreadCounts | ( | UserId | userId, |
| const FetchThreadUnreadCountsCallback & | callback | ||
| ) |
Fetch the number of unread threads a user has.
| [in] | userId | The currently logged in user who is fetching their unread counts. |
| [in] | callback | Function that receives the UnreadThreadCounts object |
| TTV_ErrorCode ttv::chat::ChatAPI::FetchUserEmoticonSets | ( | UserId | userId, |
| bool | forceRefetch, | ||
| const FetchEmoticonSetsCallback & | callback | ||
| ) |
Fetches the emoticon sets available to the user. Calling this function may potentially fire IChatAPIListener::ChatUserEmoticonSetsChanged()
| [in] | userId | The currently logged in user whose emoticons are being fetched. |
| [in] | forceRefetch | If false, will potentially call the callback immediately with cached values. Otherwise will force a fetch for latest values. |
| [in] | callback | Function that receives a list of emoticon sets for the user. |
| TTV_ErrorCode ttv::chat::ChatAPI::FetchUserListForChannel | ( | UserId | userId, |
| ChannelId | channelId, | ||
| const FetchUserListCallback & | callback | ||
| ) |
Fetches the user list for the channel.
| [in] | userId | The currently logged in user who is fetching the user list. |
| [in] | channelId | The channel we're fetching the user list for. |
| [in] | callback | Function that receives the returned user list. |
| TTV_ErrorCode ttv::chat::ChatAPI::FetchUserThreadData | ( | UserId | userId, |
| const std::string & | threadId, | ||
| const FetchThreadDataCallback & | callback | ||
| ) |
Fetch the data for a specific thread.
| [in] | userId | The currently logged in user who is fetching their thread's data. |
| [in] | threadId | The thread to retrieve the information for. |
| [in] | callback | Function that receives the data for the thread. |
| TTV_ErrorCode ttv::chat::ChatAPI::GenerateThreadId | ( | UserId | userId, |
| UserId | otherUserId, | ||
| std::string & | threadId | ||
| ) |
Returns the thread ID between two users.
| [in] | userId | The currently logged in user. |
| [in] | otherUserId | The other user participating in the thread. |
| [out] | threadId | The thread id of the two users. |
userId nor otherUserId can be 0.
|
private |
|
private |
|
inlineprotectedinherited |
Returns the common ComponentContainer which hosts all components which live at the module level.
| TTV_ErrorCode ttv::chat::ChatAPI::GetEmoticonUrl | ( | uint32_t | emoticonId, |
| float | scale, | ||
| std::string & | result | ||
| ) |
Generate the url for an emoticon with given ID and scale factor.
| [in] | emoticonId | The emoticon we're generating the url for. |
| [in] | scale | The scale factor for the emoticon. |
| [out] | result | The url for the emoticon. |
result. | uint64_t ttv::chat::ChatAPI::GetMessageFlushInterval | ( | ) | const |
Get the current interval duration for flushing messages.
|
overridevirtual |
Returns the name of the module.
Implements ttv::IModule.
|
static |
Adds to the scopes list the required scopes that Chat API requires.
| [in,out] | scopes | The old values in scopes, with the new scopes required by Chat API appended to the end. |
|
overridevirtualinherited |
Returns the current state of the module.
Implements ttv::IModule.
|
private |
| TTV_ErrorCode ttv::chat::ChatAPI::GetUserBlocked | ( | UserId | userId, |
| UserId | blockUserId, | ||
| bool & | blocked | ||
| ) |
Check whether a user is blocked or not.
| [in] | userId | The currently logged in user. |
| [in] | blockedUserId | The other user that we're checking if blocked. |
| [out] | blocked | True if blockUserId is blocked by userId. |
blocked.
|
private |
|
overridevirtual |
Initializes the module asynchronously. The module state will be reported in IModuleListener::ModuleStateChanged(). No other calls should be made into the module until the module state is either State::Initialized or State::Uninitialized. You should only expect changes to the module state if this method succeeds.
Reimplemented from ttv::ModuleBase.
|
inlineprotectedinherited |
Invokes the callback for the module listeners.
| TTV_ErrorCode ttv::chat::ChatAPI::ModUser | ( | UserId | userId, |
| ChannelId | channelId, | ||
| const std::string & | modUserName, | ||
| const ModUserCallback & | callback | ||
| ) |
Mods the given user name in the given channel.
| [in] | userId | The id of the user who is granting the mod privilege. |
| [in] | channelId | The id of the channel that the target user is becoming a mod of. |
| [in] | modUserName | The name of the user who is becoming a mod. |
| [in] | callback | Receives an error code indicating the success of the modding. |
|
protectedinherited |
| TTV_ErrorCode ttv::chat::ChatAPI::OptInToBroadcasterLanguageChat | ( | UserId | userId, |
| ChannelId | channelId, | ||
| const std::string & | language | ||
| ) |
Opt into the channel's broadcaster chat language.
| [in] | userId | The currently logged in user that is opting into. |
| [in] | channelId | The channel that the user is opting into for the chat language. |
| [in] | language | The language of the channel. |
language cannot be the empty string.
|
inlineprotectedinherited |
|
inlineprotectedinherited |
| TTV_ErrorCode ttv::chat::ChatAPI::SendChatMessage | ( | UserId | userId, |
| ChannelId | channelId, | ||
| const std::string & | message | ||
| ) |
Send a message to the channel's chat.
| [in] | userId | The currently logged in user that is sending the message. |
| [in] | channelId | The channel of the chat the user is sending a message to. |
| [in] | message | The content of the message being sent. |
| TTV_ErrorCode ttv::chat::ChatAPI::SendMessageToUser | ( | UserId | userId, |
| UserId | otherUserId, | ||
| const std::string & | message, | ||
| WhisperMessage & | placeholderMessage, | ||
| const SendMessageCallback & | callback | ||
| ) |
Sends a private message from one user to another. Synchronously generates a placeholder message to use until the send is complete.
| [in] | userId | The currently logged in user that is sending the whisper. |
| [in] | otherUserId | The user the message is being sent to. |
| [in] | message | The message contents to send. |
| [out] | placeholderMessage | The message object to be used as a placeholder until the callback returns the real message. |
| [in] | callback | Function that receives the ID of the new message. |
| TTV_ErrorCode ttv::chat::ChatAPI::SetBroadcasterLanguageChatEnabled | ( | UserId | userId, |
| ChannelId | channelId, | ||
| bool | enabled, | ||
| const SetBroadcasterLanguageChatEnabledCallback & | callback | ||
| ) |
Enables/disables the broadcaster language setting.
| [in] | userId | The currently logged in user that is changing the channel's broadcaster language chat settings. |
| [in] | channelId | The channel whose settings are being changed. |
| [in] | enabled | Whether to enable or disable the broadcaster language chat settings. |
| [in] | callback | Function that receives whether changing the broadcaster language chat settings was successful. |
| void ttv::chat::ChatAPI::SetChatObjectFactory | ( | const std::shared_ptr< IChatObjectFactory > & | factory | ) |
Set the chat object factory.
| [in] | factory | Set the chat object factory. If factory is null, Chat API will use a default implementation. |
| TTV_ErrorCode ttv::chat::ChatAPI::SetCoreApi | ( | const std::shared_ptr< CoreAPI > & | coreApi | ) |
Sets the pointer to the core API.
| [in] | coreApi | A non-null pointer to the core API. |
| TTV_ErrorCode ttv::chat::ChatAPI::SetEnabledFeatures | ( | const FeatureFlags & | features | ) |
Set the enabled features for chat.
| [in] | features | Represents the features that should be enabled. |
| TTV_ErrorCode ttv::chat::ChatAPI::SetLastMessageReadId | ( | UserId | userId, |
| const std::string & | threadId, | ||
| MessageId | lastReadMessageId, | ||
| const SetLastMessageReadIdCallback & | callback | ||
| ) |
Set the last read message in a thread.
| [in] | userId | The currently logged in user who is setting the message as read. |
| [in] | threadId | The thread that is being set as read. |
| [in] | lastReadMessageId | The message in the thread that is being set as the last message read. |
| [in] | callback | Function that receives whether setting the last read was successful. |
| TTV_ErrorCode ttv::chat::ChatAPI::SetListener | ( | const std::shared_ptr< IChatAPIListener > & | listener | ) |
Set the Chat API listener.
| [in] | listener | A pointer to the chat API listener. |
| TTV_ErrorCode ttv::chat::ChatAPI::SetMessageFlushInterval | ( | uint64_t | milliseconds | ) |
Set how interval duration for flushing messages.
| [in] | milliseconds | The interval duration to be set to. |
| TTV_ErrorCode ttv::chat::ChatAPI::SetThreadArchived | ( | UserId | userId, |
| const std::string & | threadId, | ||
| bool | archived, | ||
| const SetThreadArchivedCallback & | callback | ||
| ) |
Archive/unarchive a thread.
| [in] | userId | The currently logged in user who is archiving/unarchiving their thread. |
| [in] | threadId | The thread that is being archived/unarchived. |
| [in] | archived | Whether we're archiving or unarchiving the thread. |
| [in] | callback | Function that receives whether archiving/unarchiving the thread was successful. |
| TTV_ErrorCode ttv::chat::ChatAPI::SetThreadMuted | ( | UserId | userId, |
| const std::string & | threadId, | ||
| bool | muted, | ||
| const SetThreadMutedCallback & | callback | ||
| ) |
Mute/unmute a thread.
| [in] | userId | The currently logged in user who is muting/unmuting their thread. |
| [in] | threadId | The thread that is being muted/unmuted. |
| [in] | muted | Whether we're muting or unmuting the thread. |
| [in] | callback | Function that receives whether muting/unmuting the thread was successful. |
| TTV_ErrorCode ttv::chat::ChatAPI::SetTokenizationOptions | ( | const TokenizationOptions & | options | ) |
Set the tokenization options for messages in chat.
| [in] | features | Lists which tokenization options are set. |
| TTV_ErrorCode ttv::chat::ChatAPI::SetUserThreadsListener | ( | UserId | userId, |
| const std::shared_ptr< IChatUserThreadsListener > & | listener | ||
| ) |
Set the tokenization options for messages in chat.
| [in] | features | Lists which tokenization options are set. |
|
overridevirtual |
Initiates an asynchronous shutdown of the module. The module state will be reported in IModuleListener::ModuleStateChanged(). No other calls should be made into the module until the module state is either State::Initialized or State::Uninitialized. All modules that depend on this module need to be shutdown first. You should only expect changes to the module state if this method succeeds.
Reimplemented from ttv::ModuleBase.
| TTV_ErrorCode ttv::chat::ChatAPI::UnbanUser | ( | UserId | userId, |
| ChannelId | channelId, | ||
| const std::string & | bannedUserName, | ||
| const UnbanUserCallback & | callback | ||
| ) |
Unbans or untimeouts the given user name from the given channel.
| [in] | userId | The id of the user who is reverting the ban. Must be owner or moderator of the channel. |
| [in] | channelId | The id of the channel the user is being unbanned from. |
| [in] | bannedUserName | The name of the user who is being unbanned. |
| [in] | callback | Receives an error code indicating the unban's success. |
| TTV_ErrorCode ttv::chat::ChatAPI::UnblockUser | ( | UserId | userId, |
| UserId | blockUserId, | ||
| const BlockChangeCallback & | callback | ||
| ) |
Unblock another user.
| [in] | userId | The currently logged in user. |
| [in] | blockUserId | The user being unblocked. |
| [in] | callback | Function that receives whether the unblocking was successful. |
| TTV_ErrorCode ttv::chat::ChatAPI::UnmodUser | ( | UserId | userId, |
| ChannelId | channelId, | ||
| const std::string & | unmodUserName, | ||
| const UnmodUserCallback & | callback | ||
| ) |
Unmods the given user name in the given channel.
| [in] | userId | The id of the user who is issuing the unmod request. |
| [in] | channelId | The id of the channel that the target user is being unmodded from. |
| [in] | unmodUserName | The name of the user who is being unmodded. |
| [in] | callback | Receives an error code indicating the unmod's success. |
|
overridevirtual |
Updates the internal state of the module and fires any pending callbacks.
Reimplemented from ttv::ModuleBase.
| TTV_ErrorCode ttv::chat::ChatAPI::UpdateUserColor | ( | UserId | userId, |
| const std::string & | color, | ||
| const UpdateUserColorCallback & | callback | ||
| ) |
Changes the user's chat color.
| [in] | userId | The id of the user who is changing their color. |
| [in] | color | The new chat color of the user. |
| [in] | callback | Receives an error code indicating the change's success. |
|
private |
|
private |
The internal chat object factory.
|
private |
|
private |
|
private |
|
private |
The task runner to use for block lists. Once we rework the way httprequest queueing and retried works we can use the general one.
|
private |
|
protectedinherited |
|
protectedinherited |
The registered listeners. These listeners extend IModuleListener and will be of the type required for the module.
|
private |
The set of all local users.
|
protectedinherited |
|
private |
|
private |
|
private |
|
private |
The general task runner to use for api calls.
|
private |
The cache of channel info.
1.8.13