Twitch SDK (Internal)
chatapi.h
Go to the documentation of this file.
1 /********************************************************************************************
2 * Twitch Broadcasting SDK
3 *
4 * This software is supplied under the terms of a license agreement with Twitch Interactive, Inc. and
5 * may not be copied or used except in accordance with the terms of that agreement
6 * Copyright (c) 2012-2016 Twitch Interactive, Inc.
7 *********************************************************************************************/
8 
9 #pragma once
10 
11 #include "twitchsdk/core/coreapi.h"
12 #include "twitchsdk/core/module.h"
19 
20 #include <string>
21 #include <vector>
22 #include <unordered_set>
23 #include <map>
24 #include <memory>
25 #include <atomic>
26 
27 namespace ttv
28 {
29  class TaskRunner;
30  class UserRepository;
31  class SettingRepository;
32 
33  namespace chat
34  {
35  class ChatAPI;
36  class ChatAPITaskHost;
37  class ChatChannel;
39  class IChatObjectFactory;
40  class ChatChannelSet;
41  class ChatUserThreads;
42  class ChatUserThread;
43  class ChatUserBlockList;
46  class IChatRoom;
47  class IChatRoomListener;
50  class IChatChannel;
51  class IChatReplay;
52  class IChatRaid;
53  class IChatRaidListener;
54  class IBitsStatus;
55  class IBitsListener;
56  class IFollowersStatus;
57  class IFollowersListener;
58  class ISubscribersStatus;
62  struct ChatAPIInternalData;
63  }
64 }
65 
66 
75 {
76 public:
87  using FetchUserListCallback = std::function<void(TTV_ErrorCode ec, UserList&& userList)>;
88 
98  using BlockChangeCallback = std::function<void(TTV_ErrorCode ec)>;
99 
111  using FetchEmoticonSetsCallback = std::function<void(TTV_ErrorCode ec, const std::vector<EmoticonSet>& sets)>;
112 
123  using FetchBadgesCallback = std::function<void(TTV_ErrorCode ec, BadgeSet&& badges)>;
124 
135  using FetchBitsConfigurationCallback = std::function<void(TTV_ErrorCode ec, const std::shared_ptr<BitsConfiguration>& bitsConfig)>;
136 
146  using SetBroadcasterLanguageChatEnabledCallback = std::function<void(TTV_ErrorCode ec)>;
147 
158  using SendMessageCallback = std::function<void(TTV_ErrorCode ec, MessageId messageID)>;
159 
171  using FetchThreadDataPageCallback = std::function<void(TTV_ErrorCode ec, const std::vector<ThreadData>& threadPage, uint32_t total)>;
172 
183  using FetchThreadDataCallback = std::function<void(TTV_ErrorCode ec, const ThreadData& threadData)>;
184 
195  using FetchThreadMessagesCallback = std::function<void(TTV_ErrorCode ec, const std::vector<WhisperMessage>& message)>;
196 
206  using SetLastMessageReadIdCallback = std::function<void(TTV_ErrorCode ec)>;
207 
217  using SetThreadMutedCallback = std::function<void(TTV_ErrorCode ec)>;
218 
228  using SetThreadArchivedCallback = std::function<void(TTV_ErrorCode ec)>;
229 
240  using FetchThreadUnreadCountsCallback = std::function<void(TTV_ErrorCode ec, const UnreadThreadCounts& counts)>;
241 
252  using FetchBlockedUsersCallback = std::function<void(TTV_ErrorCode ec, const std::vector<UserInfo>& blockedUsers)>;
253 
264  using BanUserCallback = std::function<void(TTV_ErrorCode ec, BanUserError&& error)>;
265 
276  using UnbanUserCallback = std::function<void(TTV_ErrorCode ec, UnbanUserError&& error)>;
277 
288  using ModUserCallback = std::function<void(TTV_ErrorCode ec, ModUserError&& error)>;
289 
300  using UnmodUserCallback = std::function<void(TTV_ErrorCode ec, UnmodUserError&& error)>;
301 
310  using UpdateUserColorCallback = std::function<void(TTV_ErrorCode ec)>;
311 
322  using FetchChannelModeratorsCallback = std::function<void(TTV_ErrorCode ec, const std::vector<std::string>& modNames, const std::string& nextCursor)>;
323 
324  ChatAPI();
325  virtual ~ChatAPI();
326 
327  // IModule implementation
328  virtual std::string GetModuleName() const override;
329  virtual TTV_ErrorCode Initialize(const InitializeCallback& callback) override;
330  virtual TTV_ErrorCode Shutdown(const ShutdownCallback& callback) override;
331  virtual TTV_ErrorCode Update() override;
332 
342  TTV_ErrorCode SetCoreApi(const std::shared_ptr<CoreAPI>& coreApi);
343 
353  TTV_ErrorCode SetListener(const std::shared_ptr<IChatAPIListener>& listener);
354 
365 
376 
386  TTV_ErrorCode SetUserThreadsListener(UserId userId, const std::shared_ptr<IChatUserThreadsListener>& listener);
387 
406  TTV_ErrorCode Connect(UserId userId, ChannelId channelId, const std::shared_ptr<IChatChannelListener>& listener);
407 
421  TTV_ErrorCode Disconnect(UserId userId, ChannelId channelId);
422 
440  TTV_ErrorCode SendChatMessage(UserId userId, ChannelId channelId, const std::string& message);
441 
456  TTV_ErrorCode FetchUserListForChannel(UserId userId, ChannelId channelId, const FetchUserListCallback& callback);
457 
472  TTV_ErrorCode BlockUser(UserId userId, UserId blockUserId, const std::string& reason, bool whisper, const BlockChangeCallback& callback);
473 
486  TTV_ErrorCode UnblockUser(UserId userId, UserId blockUserId, const BlockChangeCallback& callback);
487 
500  TTV_ErrorCode GetUserBlocked(UserId userId, UserId blockUserId, bool& blocked);
501 
515 
529  TTV_ErrorCode FetchUserEmoticonSets(UserId userId, bool forceRefetch, const FetchEmoticonSetsCallback& callback);
530 
541 
553 
564 
577 
594 
610  TTV_ErrorCode OptInToBroadcasterLanguageChat(UserId userId, ChannelId channelId, const std::string& language);
611 
622  TTV_ErrorCode GenerateThreadId(UserId userId, UserId otherUserId, std::string& threadId);
623 
642  TTV_ErrorCode SendMessageToUser(UserId userId, UserId otherUserId, const std::string& message, WhisperMessage& placeholderMessage, const SendMessageCallback& callback);
643 
660  TTV_ErrorCode FetchThreadDataPage(UserId userId, uint32_t offset, uint32_t pageSize, const FetchThreadDataPageCallback& callback);
661 
677  TTV_ErrorCode FetchUserThreadData(UserId userId, const std::string& threadId, const FetchThreadDataCallback& callback);
678 
696  TTV_ErrorCode FetchThreadMessages(UserId userId, const std::string& threadId, MessageId start, uint32_t beforeCount, const FetchThreadMessagesCallback& callback);
697 
714  TTV_ErrorCode SetLastMessageReadId(UserId userId, const std::string& threadId, MessageId lastReadMessageId, const SetLastMessageReadIdCallback& callback);
715 
732  TTV_ErrorCode SetThreadMuted(UserId userId, const std::string& threadId, bool muted, const SetThreadMutedCallback& callback);
733 
750  TTV_ErrorCode SetThreadArchived(UserId userId, const std::string& threadId, bool archived, const SetThreadArchivedCallback& callback);
751 
767 
776  TTV_ErrorCode SetMessageFlushInterval(uint64_t milliseconds);
777 
783  uint64_t GetMessageFlushInterval() const;
784 
794  TTV_ErrorCode GetEmoticonUrl(uint32_t emoticonId, float scale, std::string& result);
795 
809  TTV_ErrorCode CreateChatChannel(UserId userId, ChannelId channelId, const std::shared_ptr<IChatChannelListener>& listener, std::shared_ptr<IChatChannel>& result);
810 
827  TTV_ErrorCode CreateChatChannelProperties(UserId userId, ChannelId channelId, const std::shared_ptr<IChatChannelPropertyListener>& listener, std::shared_ptr<IChatChannelProperties>& result);
828 
841  TTV_ErrorCode CreateChatReplay(UserId userId, const std::string& vodId, const std::shared_ptr<IChatReplayListener>& listener, std::shared_ptr<IChatReplay>& result);
842 
856  TTV_ErrorCode CreateChannelChatRoomManager(UserId userId, ChannelId channelId, const std::shared_ptr<IChannelChatRoomManagerListener>& listener, std::shared_ptr<IChannelChatRoomManager>& result);
857 
871  TTV_ErrorCode CreateChatRoom(UserId userId, const std::string& roomId, ChannelId channelId, const std::shared_ptr<IChatRoomListener>& listener, std::shared_ptr<IChatRoom>& result);
872 
884  TTV_ErrorCode CreateChatRoomNotifications(UserId userId, const std::shared_ptr<IChatRoomNotificationsListener>& listener, std::shared_ptr<IChatRoomNotifications>& result);
885 
900  TTV_ErrorCode CreateChatRaid(UserId userId, ChannelId channelId, const std::shared_ptr<IChatRaidListener>& listener, std::shared_ptr<IChatRaid>& result);
901 
918  TTV_ErrorCode CreateBitsStatus(UserId userId, ChannelId channelId, const std::shared_ptr<IBitsListener>& listener, std::shared_ptr<IBitsStatus>& result);
919 
933  TTV_ErrorCode CreateFollowersStatus(UserId userId, ChannelId channelId, const std::shared_ptr<IFollowersListener>& listener, std::shared_ptr<IFollowersStatus>& result);
934 
949  TTV_ErrorCode CreateSubscribersStatus(UserId userId, ChannelId channelId, const std::shared_ptr<ISubscribersListener>& listener, std::shared_ptr<ISubscribersStatus>& result);
950 
965  TTV_ErrorCode BanUser(UserId userId, ChannelId channelId, const std::string& bannedUserName, uint32_t durationSeconds, const BanUserCallback& callback);
966 
980  TTV_ErrorCode UnbanUser(UserId userId, ChannelId channelId, const std::string& bannedUserName, const UnbanUserCallback& callback);
981 
995  TTV_ErrorCode ModUser(UserId userId, ChannelId channelId, const std::string& modUserName, const ModUserCallback& callback);
996 
1010  TTV_ErrorCode UnmodUser(UserId userId, ChannelId channelId, const std::string& unmodUserName, const UnmodUserCallback& callback);
1011 
1024  TTV_ErrorCode UpdateUserColor(UserId userId, const std::string& color, const UpdateUserColorCallback& callback);
1025 
1037  TTV_ErrorCode FetchChannelModerators(ChannelId channelId, const std::string& cursor, const FetchChannelModeratorsCallback& callback);
1038 
1044  static void GetRequiredAuthScopes(std::vector<std::string>& scopes);
1045 
1051  void SetChatObjectFactory(const std::shared_ptr<IChatObjectFactory>& factory);
1052 
1053 private:
1055  {
1056  public:
1057  CoreApiClient(ChatAPI* api);
1058 
1059  // ICoreApiClient implementation
1060  virtual std::string GetClientName() override;
1061  virtual void GetRequiredOAuthScopes(std::vector<std::string>& scopes) override;
1062  virtual void CoreUserLoggedIn(std::shared_ptr<User> user) override;
1063  virtual void CoreUserLoggedOut(std::shared_ptr<User> user) override;
1064  virtual void CoreLocalLanguageChanged(const std::string& language) override;
1065 
1066  private:
1068  };
1069 
1070  TTV_ErrorCode GetChannelSet(UserId userId, std::shared_ptr<ChatChannelSet>& channelSet);
1071 
1072  std::shared_ptr<ChatUserBlockList> CreateUserBlockList(const std::shared_ptr<User>& user);
1073 
1074  // ICoreApiClient implementation
1075  void CoreUserLoggedIn(std::shared_ptr<User> user);
1076  void CoreUserLoggedOut(std::shared_ptr<User> user);
1077  void CoreLocalLanguageChanged(const std::string& language);
1078 
1079  // ModuleBase overrides
1080  virtual bool CheckShutdown() override;
1081  virtual void CompleteShutdown() override;
1082 
1083  TTV_ErrorCode GetBlockListForUser(UserId userId, std::shared_ptr<ChatUserBlockList>& blockList);
1084  TTV_ErrorCode GetUserThreadsForUser(UserId userId, std::shared_ptr<ChatUserThreads>& userThreads);
1085  TTV_ErrorCode GetThreadForUser(UserId userId, const std::string& threadId, std::shared_ptr<ChatUserThread>& thread);
1086 
1087  TTV_ErrorCode DisposeChatChannel(const std::shared_ptr<IChatChannel>& chatChannel);
1088  TTV_ErrorCode DisposeChatChannelProperties(const std::shared_ptr<IChatChannelProperties>& chatChannelProperties);
1089  TTV_ErrorCode DisposeChatReplay(const std::shared_ptr<IChatReplay>& chatReplay);
1090  TTV_ErrorCode DisposeChatRaid(const std::shared_ptr<IChatRaid>& chatRaid);
1091  TTV_ErrorCode DisposeChannelChatRoomManager(const std::shared_ptr<IChannelChatRoomManager>& channelChatRoomManager);
1092  TTV_ErrorCode DisposeChatRoom(const std::shared_ptr<IChatRoom>& chatRoom);
1093  TTV_ErrorCode DisposeChatRoomNotifications(const std::shared_ptr<IChatRoomNotifications>& chatRoomNotifications);
1094  TTV_ErrorCode DisposeBitsStatus(const std::shared_ptr<IBitsStatus>& bitsStatus);
1095  TTV_ErrorCode DisposeFollowersStatus(const std::shared_ptr<IFollowersStatus>& followersStatus);
1096  TTV_ErrorCode DisposeSubscribersStatus(const std::shared_ptr<ISubscribersStatus>& subscribersStatus);
1097 
1098  std::shared_ptr<CoreAPI> mCoreApi;
1099  std::shared_ptr<CoreApiClient> mCoreApiClient;
1100  std::shared_ptr<ChatAPIInternalData> mInternalData;
1101  std::shared_ptr<IChatObjectFactory> mChatObjectFactory;
1102  std::shared_ptr<ChannelRepository> mChannelRepository;
1103  std::shared_ptr<UserRepository> mUserRepository;
1104  std::shared_ptr<SettingRepository> mSettingRepository;
1105  std::shared_ptr<BitsConfigRepository> mBitsConfigRepository;
1106  std::shared_ptr<ChatAPITaskHost> mTaskHost;
1107 
1108  std::shared_ptr<TaskRunner> mTaskRunner;
1109  std::shared_ptr<TaskRunner> mUserBlocksTaskRunner;
1110 
1113 };
uint32_t UserId
Definition: coretypes.h:22
TTV_ErrorCode DisposeBitsStatus(const std::shared_ptr< IBitsStatus > &bitsStatus)
std::shared_ptr< ChatUserBlockList > CreateUserBlockList(const std::shared_ptr< User > &user)
TTV_ErrorCode OptInToBroadcasterLanguageChat(UserId userId, ChannelId channelId, const std::string &language)
TokenizationOptions mTokenizationOptions
Definition: chatapi.h:1112
virtual TTV_ErrorCode Update() override
std::function< void(TTV_ErrorCode ec, const std::vector< UserInfo > &blockedUsers)> FetchBlockedUsersCallback
Definition: chatapi.h:252
std::function< void(TTV_ErrorCode ec, UnbanUserError &&error)> UnbanUserCallback
Definition: chatapi.h:276
Definition: ichatchannel.h:27
TTV_ErrorCode SetBroadcasterLanguageChatEnabled(UserId userId, ChannelId channelId, bool enabled, const SetBroadcasterLanguageChatEnabledCallback &callback)
TTV_ErrorCode SetTokenizationOptions(const TokenizationOptions &options)
Definition: coreapi.h:51
Definition: isubscribersstatus.h:26
std::function< void(TTV_ErrorCode ec, const UnreadThreadCounts &counts)> FetchThreadUnreadCountsCallback
Definition: chatapi.h:240
Definition: ichatobjectfactory.h:22
std::shared_ptr< ChannelRepository > mChannelRepository
The internal chat object factory.
Definition: chatapi.h:1102
void SetChatObjectFactory(const std::shared_ptr< IChatObjectFactory > &factory)
Definition: ifollowersstatus.h:26
TTV_ErrorCode FetchChannelBadges(ChannelId channelId, const FetchBadgesCallback &callback)
TTV_ErrorCode FetchThreadDataPage(UserId userId, uint32_t offset, uint32_t pageSize, const FetchThreadDataPageCallback &callback)
Definition: ifollowerslistener.h:24
std::function< void(TTV_ErrorCode ec, const std::vector< WhisperMessage > &message)> FetchThreadMessagesCallback
Definition: chatapi.h:195
TTV_ErrorCode FetchUserThreadData(UserId userId, const std::string &threadId, const FetchThreadDataCallback &callback)
std::shared_ptr< UserRepository > mUserRepository
The cache of channel info.
Definition: chatapi.h:1103
TTV_ErrorCode GetEmoticonUrl(uint32_t emoticonId, float scale, std::string &result)
Definition: isubscriberslistener.h:24
virtual void CoreUserLoggedOut(std::shared_ptr< User > user) override
uint32_t MessageId
Definition: chattypes.h:26
TTV_ErrorCode FetchBlockedUsers(UserId userId, const FetchBlockedUsersCallback &callback)
std::function< void(TTV_ErrorCode ec, BadgeSet &&badges)> FetchBadgesCallback
Definition: chatapi.h:123
std::function< void(TTV_ErrorCode ec, const ThreadData &threadData)> FetchThreadDataCallback
Definition: chatapi.h:183
Definition: chatapitaskhost.h:29
Definition: ibitsstatus.h:26
TTV_ErrorCode GetBlockListForUser(UserId userId, std::shared_ptr< ChatUserBlockList > &blockList)
TTV_ErrorCode Connect(UserId userId, ChannelId channelId, const std::shared_ptr< IChatChannelListener > &listener)
FeatureFlags mEnabledFeatures
The task runner to use for block lists. Once we rework the way httprequest queueing and retried works...
Definition: chatapi.h:1111
TTV_ErrorCode ModUser(UserId userId, ChannelId channelId, const std::string &modUserName, const ModUserCallback &callback)
std::function< void(TTV_ErrorCode ec, const std::vector< ThreadData > &threadPage, uint32_t total)> FetchThreadDataPageCallback
Definition: chatapi.h:171
Definition: ichannelchatroommanager.h:25
Definition: ibitslistener.h:24
virtual TTV_ErrorCode Shutdown(const ShutdownCallback &callback) override
TTV_ErrorCode UnmodUser(UserId userId, ChannelId channelId, const std::string &unmodUserName, const UnmodUserCallback &callback)
Definition: chatuserblocklist.h:35
TTV_ErrorCode SetCoreApi(const std::shared_ptr< CoreAPI > &coreApi)
TTV_ErrorCode DisposeChatRoom(const std::shared_ptr< IChatRoom > &chatRoom)
std::shared_ptr< IChatObjectFactory > mChatObjectFactory
Definition: chatapi.h:1101
std::function< void(TTV_ErrorCode ec, const std::shared_ptr< BitsConfiguration > &bitsConfig)> FetchBitsConfigurationCallback
Definition: chatapi.h:135
std::shared_ptr< CoreAPI > mCoreApi
Definition: chatapi.h:1098
std::function< void(TTV_ErrorCode ec)> InitializeCallback
Definition: module.h:48
Definition: ichatroomnotifications.h:25
virtual void GetRequiredOAuthScopes(std::vector< std::string > &scopes) override
TTV_ErrorCode CreateChatRoom(UserId userId, const std::string &roomId, ChannelId channelId, const std::shared_ptr< IChatRoomListener > &listener, std::shared_ptr< IChatRoom > &result)
JSON (JavaScript Object Notation).
Definition: adsapi.h:16
TTV_ErrorCode DisposeSubscribersStatus(const std::shared_ptr< ISubscribersStatus > &subscribersStatus)
TTV_ErrorCode FetchUserListForChannel(UserId userId, ChannelId channelId, const FetchUserListCallback &callback)
uint64_t GetMessageFlushInterval() const
std::function< void(TTV_ErrorCode ec)> UpdateUserColorCallback
Definition: chatapi.h:310
Definition: ichannelchatroommanagerlistener.h:24
Definition: bitsconfigrepository.h:35
TTV_ErrorCode GenerateThreadId(UserId userId, UserId otherUserId, std::string &threadId)
TTV_ErrorCode SetListener(const std::shared_ptr< IChatAPIListener > &listener)
TTV_ErrorCode GetChannelSet(UserId userId, std::shared_ptr< ChatChannelSet > &channelSet)
TTV_ErrorCode DisposeChatReplay(const std::shared_ptr< IChatReplay > &chatReplay)
std::shared_ptr< SettingRepository > mSettingRepository
The set of all local users.
Definition: chatapi.h:1104
std::shared_ptr< ChatAPIInternalData > mInternalData
Definition: chatapi.h:1100
TTV_ErrorCode FetchChannelBitsConfiguration(ChannelId channelId, const FetchBitsConfigurationCallback &callback)
virtual std::string GetClientName() override
TTV_ErrorCode SetEnabledFeatures(const FeatureFlags &features)
TTV_ErrorCode CreateChannelChatRoomManager(UserId userId, ChannelId channelId, const std::shared_ptr< IChannelChatRoomManagerListener > &listener, std::shared_ptr< IChannelChatRoomManager > &result)
std::function< void(TTV_ErrorCode ec)> BlockChangeCallback
Definition: chatapi.h:98
std::shared_ptr< ChatAPITaskHost > mTaskHost
Definition: chatapi.h:1106
virtual std::string GetModuleName() const override
TTV_ErrorCode FetchUserEmoticonSets(UserId userId, bool forceRefetch, const FetchEmoticonSetsCallback &callback)
virtual void CoreLocalLanguageChanged(const std::string &language) override
std::shared_ptr< CoreApiClient > mCoreApiClient
Definition: chatapi.h:1099
TTV_ErrorCode CreateBitsStatus(UserId userId, ChannelId channelId, const std::shared_ptr< IBitsListener > &listener, std::shared_ptr< IBitsStatus > &result)
std::shared_ptr< BitsConfigRepository > mBitsConfigRepository
Definition: chatapi.h:1105
TTV_ErrorCode DisposeFollowersStatus(const std::shared_ptr< IFollowersStatus > &followersStatus)
Definition: ichatchannelproperties.h:25
uint32_t TTV_ErrorCode
Definition: errortypes.h:30
TTV_ErrorCode SetMessageFlushInterval(uint64_t milliseconds)
std::function< void(TTV_ErrorCode ec, const std::vector< EmoticonSet > &sets)> FetchEmoticonSetsCallback
Definition: chatapi.h:111
TTV_ErrorCode BanUser(UserId userId, ChannelId channelId, const std::string &bannedUserName, uint32_t durationSeconds, const BanUserCallback &callback)
TTV_ErrorCode DisposeChatRaid(const std::shared_ptr< IChatRaid > &chatRaid)
TTV_ErrorCode DisposeChannelChatRoomManager(const std::shared_ptr< IChannelChatRoomManager > &channelChatRoomManager)
Definition: chatuserthread.h:39
std::function< void(TTV_ErrorCode ec, MessageId messageID)> SendMessageCallback
Definition: chatapi.h:158
TTV_ErrorCode UpdateUserColor(UserId userId, const std::string &color, const UpdateUserColorCallback &callback)
std::function< void(TTV_ErrorCode ec)> SetBroadcasterLanguageChatEnabledCallback
Definition: chatapi.h:146
virtual void CoreUserLoggedIn(std::shared_ptr< User > user) override
std::function< void(TTV_ErrorCode ec)> ShutdownCallback
Definition: module.h:49
Definition: ichatchannelpropertylistener.h:25
std::function< void(TTV_ErrorCode ec, UserList &&userList)> FetchUserListCallback
Definition: chatapi.h:87
TTV_ErrorCode FetchThreadMessages(UserId userId, const std::string &threadId, MessageId start, uint32_t beforeCount, const FetchThreadMessagesCallback &callback)
Definition: ichatraid.h:28
Definition: ichatreplay.h:31
std::function< void(TTV_ErrorCode ec)> SetThreadArchivedCallback
Definition: chatapi.h:228
virtual TTV_ErrorCode Initialize(const InitializeCallback &callback) override
TTV_ErrorCode CreateChatRoomNotifications(UserId userId, const std::shared_ptr< IChatRoomNotificationsListener > &listener, std::shared_ptr< IChatRoomNotifications > &result)
Definition: ichatroomnotificationslistener.h:24
Definition: chatapi.h:1054
static void GetRequiredAuthScopes(std::vector< std::string > &scopes)
Definition: chatchannel.h:45
TTV_ErrorCode SetThreadArchived(UserId userId, const std::string &threadId, bool archived, const SetThreadArchivedCallback &callback)
TTV_ErrorCode UnblockUser(UserId userId, UserId blockUserId, const BlockChangeCallback &callback)
TTV_ErrorCode FetchGlobalBitsConfiguration(const FetchBitsConfigurationCallback &callback)
std::shared_ptr< TaskRunner > mTaskRunner
Definition: chatapi.h:1108
TTV_ErrorCode SendChatMessage(UserId userId, ChannelId channelId, const std::string &message)
Definition: module.h:85
TTV_ErrorCode CreateFollowersStatus(UserId userId, ChannelId channelId, const std::shared_ptr< IFollowersListener > &listener, std::shared_ptr< IFollowersStatus > &result)
Definition: chattypes.h:28
TTV_ErrorCode BlockUser(UserId userId, UserId blockUserId, const std::string &reason, bool whisper, const BlockChangeCallback &callback)
TTV_ErrorCode UnbanUser(UserId userId, ChannelId channelId, const std::string &bannedUserName, const UnbanUserCallback &callback)
Definition: ichatroomlistener.h:24
Definition: chatchannelset.h:40
std::function< void(TTV_ErrorCode ec)> SetLastMessageReadIdCallback
Definition: chatapi.h:206
uint32_t ChannelId
Definition: coretypes.h:23
TTV_ErrorCode FetchGlobalBadges(const FetchBadgesCallback &callback)
virtual void CompleteShutdown() override
TTV_ErrorCode SendMessageToUser(UserId userId, UserId otherUserId, const std::string &message, WhisperMessage &placeholderMessage, const SendMessageCallback &callback)
TTV_ErrorCode CreateSubscribersStatus(UserId userId, ChannelId channelId, const std::shared_ptr< ISubscribersListener > &listener, std::shared_ptr< ISubscribersStatus > &result)
Definition: ichatraidlistener.h:25
Definition: chattypes.h:343
TTV_ErrorCode SetThreadMuted(UserId userId, const std::string &threadId, bool muted, const SetThreadMutedCallback &callback)
std::function< void(TTV_ErrorCode ec, ModUserError &&error)> ModUserCallback
Definition: chatapi.h:288
std::function< void(TTV_ErrorCode ec, UnmodUserError &&error)> UnmodUserCallback
Definition: chatapi.h:300
TTV_ErrorCode CreateChatReplay(UserId userId, const std::string &vodId, const std::shared_ptr< IChatReplayListener > &listener, std::shared_ptr< IChatReplay > &result)
TTV_ErrorCode SetLastMessageReadId(UserId userId, const std::string &threadId, MessageId lastReadMessageId, const SetLastMessageReadIdCallback &callback)
TTV_ErrorCode FetchThreadUnreadCounts(UserId userId, const FetchThreadUnreadCountsCallback &callback)
Definition: chattypes.h:41
TTV_ErrorCode Disconnect(UserId userId, ChannelId channelId)
Definition: chatapi.h:74
std::function< void(TTV_ErrorCode ec)> SetThreadMutedCallback
Definition: chatapi.h:217
TTV_ErrorCode DisposeChatRoomNotifications(const std::shared_ptr< IChatRoomNotifications > &chatRoomNotifications)
TTV_ErrorCode FetchChannelModerators(ChannelId channelId, const std::string &cursor, const FetchChannelModeratorsCallback &callback)
std::function< void(TTV_ErrorCode ec, BanUserError &&error)> BanUserCallback
Definition: chatapi.h:264
TTV_ErrorCode SetUserThreadsListener(UserId userId, const std::shared_ptr< IChatUserThreadsListener > &listener)
Definition: ichatroom.h:25
ChatAPI * mApi
Definition: chatapi.h:1067
std::function< void(TTV_ErrorCode ec, const std::vector< std::string > &modNames, const std::string &nextCursor)> FetchChannelModeratorsCallback
Definition: chatapi.h:322
TTV_ErrorCode CreateChatRaid(UserId userId, ChannelId channelId, const std::shared_ptr< IChatRaidListener > &listener, std::shared_ptr< IChatRaid > &result)
std::shared_ptr< TaskRunner > mUserBlocksTaskRunner
The general task runner to use for api calls.
Definition: chatapi.h:1109
virtual bool CheckShutdown() override
TTV_ErrorCode GetUserThreadsForUser(UserId userId, std::shared_ptr< ChatUserThreads > &userThreads)
TTV_ErrorCode GetUserBlocked(UserId userId, UserId blockUserId, bool &blocked)
TTV_ErrorCode GetThreadForUser(UserId userId, const std::string &threadId, std::shared_ptr< ChatUserThread > &thread)
TTV_ErrorCode DisposeChatChannel(const std::shared_ptr< IChatChannel > &chatChannel)
Definition: chatuserthreads.h:50
TTV_ErrorCode DisposeChatChannelProperties(const std::shared_ptr< IChatChannelProperties > &chatChannelProperties)
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)