Twitch SDK (Internal)
twitchapi.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 
13 #include <string>
14 
15 namespace ttv
16 {
17  namespace broadcast
18  {
19  class TwitchAPI;
20  class MatchGameNamesTask;
21  }
22 }
23 
24 
30 {
31 public:
32  TwitchAPI();
33  TwitchAPI(const std::shared_ptr<User>& user);
34 
35  static std::string GetComponentName() { return "ttv::TwitchAPI"; }
36 
37  virtual std::string GetLoggerName() const override;
38 
39 public:
40  struct ChannelInfo
41  {
42  std::string streamKey;
43  std::string loginName;
44  std::string displayName;
45  std::string url;
46  };
47 
48  enum
49  {
51  };
52 
54  {
58  };
59 
60 
61 public:
62  static const char* CurrentApiVersionString();
63 
64 public:
65  typedef std::function<void(TwitchAPI* source, TTV_ErrorCode ec, ChannelInfo&& result)> GetChannelInfoCallback;
66  TTV_ErrorCode GetChannelInfo(GetChannelInfoCallback&& callback);
67 
68  typedef std::function<void(TwitchAPI* source, TTV_ErrorCode ec)> SetStreamInfoCallback;
69  TTV_ErrorCode SetStreamInfo(ChannelId channelId, const std::string& streamTitle, const std::string& gameName, SetStreamInfoCallback&& callback);
70 
71  typedef std::function<void(TwitchAPI* source, TTV_ErrorCode ec, const std::shared_ptr<StreamInfo>& result)> GetStreamInfoCallback;
73 
74  typedef std::function<void(TwitchAPI* source, TTV_ErrorCode ec, const std::shared_ptr<ArchivingState>& result)> GetChannelRecordingStatusCallback;
76 
77  typedef std::function<void(TwitchAPI* source, TTV_ErrorCode ec)> RunCommercialCallback;
78  TTV_ErrorCode RunCommercial(ChannelId channelId, uint32_t timeBreakSeconds, RunCommercialCallback&& callback);
79 
80  typedef std::function<void(TwitchAPI* source, const std::string& str, TTV_ErrorCode ec, const std::shared_ptr<GameInfoList>& result)> GetGameNameListCallback;
81  TTV_ErrorCode GetGameNameList(const std::string& str, GetGameNameListCallback&& callback);
82 
83  typedef std::function<void(TwitchAPI* source, TTV_ErrorCode ec, std::vector<IngestServer>&& result)> GetIngestServerListCallback;
85 
86 private:
87  std::weak_ptr<User> mUser;
88  std::shared_ptr<MatchGameNamesTask> mOutstandingMatchGameNamesTask;
89  std::string mNextGameNamesQuery;
91 };
std::function< void(TwitchAPI *source, TTV_ErrorCode ec, ChannelInfo &&result)> GetChannelInfoCallback
Definition: twitchapi.h:65
std::function< void(TwitchAPI *source, TTV_ErrorCode ec)> RunCommercialCallback
Definition: twitchapi.h:77
std::function< void(TwitchAPI *source, TTV_ErrorCode ec, const std::shared_ptr< StreamInfo > &result)> GetStreamInfoCallback
Definition: twitchapi.h:71
TTV_ErrorCode SetStreamInfo(ChannelId channelId, const std::string &streamTitle, const std::string &gameName, SetStreamInfoCallback &&callback)
Definition: twitchapi.h:29
TTV_ErrorCode GetStreamInfo(ChannelId channelId, GetStreamInfoCallback &&callback)
TTV_ErrorCode GetIngestServerList(GetIngestServerListCallback &&callback)
std::function< void(TwitchAPI *source, TTV_ErrorCode ec, const std::shared_ptr< ArchivingState > &result)> GetChannelRecordingStatusCallback
Definition: twitchapi.h:74
TTV_ErrorCode GetChannelInfo(GetChannelInfoCallback &&callback)
std::string url
Definition: twitchapi.h:45
std::string loginName
Definition: twitchapi.h:43
TTV_ErrorCode RunCommercial(ChannelId channelId, uint32_t timeBreakSeconds, RunCommercialCallback &&callback)
JSON (JavaScript Object Notation).
Definition: adsapi.h:16
std::string displayName
Definition: twitchapi.h:44
TTV_ErrorCode GetGameNameList(const std::string &str, GetGameNameListCallback &&callback)
virtual std::string GetLoggerName() const override
std::function< void(TwitchAPI *source, TTV_ErrorCode ec)> SetStreamInfoCallback
Definition: twitchapi.h:68
GetGameNameListCallback mNextGameNamesCallback
Definition: twitchapi.h:90
Definition: component.h:50
std::weak_ptr< User > mUser
Definition: twitchapi.h:87
uint32_t TTV_ErrorCode
Definition: errortypes.h:30
std::function< void(TwitchAPI *source, const std::string &str, TTV_ErrorCode ec, const std::shared_ptr< GameInfoList > &result)> GetGameNameListCallback
Definition: twitchapi.h:80
std::function< void(TwitchAPI *source, TTV_ErrorCode ec, std::vector< IngestServer > &&result)> GetIngestServerListCallback
Definition: twitchapi.h:83
uint32_t ChannelId
Definition: coretypes.h:23
static const char * CurrentApiVersionString()
static std::string GetComponentName()
Definition: twitchapi.h:35
MetaDataEventClass
Definition: twitchapi.h:53
std::string mNextGameNamesQuery
Definition: twitchapi.h:89
Definition: twitchapi.h:40
std::string streamKey
Definition: twitchapi.h:42
Definition: twitchapi.h:57
std::shared_ptr< MatchGameNamesTask > mOutstandingMatchGameNamesTask
Definition: twitchapi.h:88
TTV_ErrorCode GetChannelRecordingStatus(GetChannelRecordingStatusCallback &&callback)