Twitch SDK (Internal)
chatapitaskhost.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 
14 
15 namespace ttv
16 {
17  class UserRepository;
18 
19  namespace chat
20  {
21  class ChatAPITaskHost;
22  }
23 }
24 
30 {
31 public:
32  using BanUserCallback = std::function<void(TTV_ErrorCode ec, BanUserError&& error)>;
33  using UnbanUserCallback = std::function<void(TTV_ErrorCode ec, UnbanUserError&& error)>;
34  using ModUserCallback = std::function<void(TTV_ErrorCode ec, ModUserError&& error)>;
35  using UnmodUserCallback = std::function<void(TTV_ErrorCode ec, UnmodUserError&& error)>;
36  using UpdateUserColorCallback = std::function<void(TTV_ErrorCode ec)>;
37  using FetchChannelModeratorsCallback = std::function<void(TTV_ErrorCode ec, std::vector<std::string>&& modNames, std::string&& nextCursor)>;
38  using FetchBadgesCallback = std::function<void(TTV_ErrorCode ec, BadgeSet&& result)>;
39 
40 public:
42 
43  TTV_ErrorCode BanUser(UserId userId, ChannelId channelId, const std::string& bannedUserName, uint32_t duration, BanUserCallback&& callback);
44  TTV_ErrorCode UnbanUser(UserId userId, ChannelId channelId, const std::string& unbannedUserName, UnbanUserCallback&& callback);
45  TTV_ErrorCode ModUser(UserId userId, ChannelId channelId, const std::string& modUserName, ModUserCallback&& callback);
46  TTV_ErrorCode UnmodUser(UserId userId, ChannelId channelId, const std::string& unmodUserName, UnmodUserCallback&& callback);
47  TTV_ErrorCode UpdateUserColor(UserId userId, const std::string& color, UpdateUserColorCallback&& callback);
48  TTV_ErrorCode FetchChannelModerators(ChannelId channelId, const std::string& cursor, FetchChannelModeratorsCallback&& callback);
49 
50  TTV_ErrorCode FetchGlobalBadges(const std::string& language, FetchBadgesCallback&& callback);
51  TTV_ErrorCode FetchChannelBadges(ChannelId channelId, const std::string& language, FetchBadgesCallback&& callback);
52 
53  void SetUserRepository(const std::shared_ptr<UserRepository>& repository) { mUserRepository = repository; }
54 
55  // Component overrides
56  virtual std::string GetLoggerName() const override { return "ChatAPITaskHost"; }
57 
58 private:
59  std::shared_ptr<UserRepository> mUserRepository;
60 };
uint32_t UserId
Definition: coretypes.h:22
TTV_ErrorCode ModUser(UserId userId, ChannelId channelId, const std::string &modUserName, ModUserCallback &&callback)
std::function< void(TTV_ErrorCode ec, std::vector< std::string > &&modNames, std::string &&nextCursor)> FetchChannelModeratorsCallback
Definition: chatapitaskhost.h:37
TTV_ErrorCode FetchGlobalBadges(const std::string &language, FetchBadgesCallback &&callback)
Definition: chatapitaskhost.h:29
virtual std::string GetLoggerName() const override
Definition: chatapitaskhost.h:56
JSON (JavaScript Object Notation).
Definition: adsapi.h:16
std::function< void(TTV_ErrorCode ec, ModUserError &&error)> ModUserCallback
Definition: chatapitaskhost.h:34
TTV_ErrorCode FetchChannelModerators(ChannelId channelId, const std::string &cursor, FetchChannelModeratorsCallback &&callback)
TTV_ErrorCode UpdateUserColor(UserId userId, const std::string &color, UpdateUserColorCallback &&callback)
Definition: component.h:50
std::shared_ptr< UserRepository > mUserRepository
Definition: chatapitaskhost.h:59
uint32_t TTV_ErrorCode
Definition: errortypes.h:30
TTV_ErrorCode FetchChannelBadges(ChannelId channelId, const std::string &language, FetchBadgesCallback &&callback)
TTV_ErrorCode BanUser(UserId userId, ChannelId channelId, const std::string &bannedUserName, uint32_t duration, BanUserCallback &&callback)
void SetUserRepository(const std::shared_ptr< UserRepository > &repository)
Definition: chatapitaskhost.h:53
std::function< void(TTV_ErrorCode ec)> UpdateUserColorCallback
Definition: chatapitaskhost.h:36
std::function< void(TTV_ErrorCode ec, BanUserError &&error)> BanUserCallback
Definition: chatapitaskhost.h:32
TTV_ErrorCode UnbanUser(UserId userId, ChannelId channelId, const std::string &unbannedUserName, UnbanUserCallback &&callback)
std::function< void(TTV_ErrorCode ec, UnbanUserError &&error)> UnbanUserCallback
Definition: chatapitaskhost.h:33
TTV_ErrorCode UnmodUser(UserId userId, ChannelId channelId, const std::string &unmodUserName, UnmodUserCallback &&callback)
uint32_t ChannelId
Definition: coretypes.h:23
std::function< void(TTV_ErrorCode ec, UnmodUserError &&error)> UnmodUserCallback
Definition: chatapitaskhost.h:35
std::function< void(TTV_ErrorCode ec, BadgeSet &&result)> FetchBadgesCallback
Definition: chatapitaskhost.h:38