Twitch SDK (Internal)
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
ttv::broadcast::TwitchAPI Class Reference

#include <twitchapi.h>

Inheritance diagram for ttv::broadcast::TwitchAPI:
ttv::Component ttv::IComponent

Classes

struct  ChannelInfo
 

Public Types

enum  { kDefaultRequestTimeoutInSec = 10 }
 
enum  MetaDataEventClass { METADATA_ACTION, METADATA_START, METADATA_END }
 
typedef std::function< void(TwitchAPI *source, TTV_ErrorCode ec, ChannelInfo &&result)> GetChannelInfoCallback
 
typedef std::function< void(TwitchAPI *source, TTV_ErrorCode ec)> SetStreamInfoCallback
 
typedef std::function< void(TwitchAPI *source, TTV_ErrorCode ec, const std::shared_ptr< StreamInfo > &result)> GetStreamInfoCallback
 
typedef std::function< void(TwitchAPI *source, TTV_ErrorCode ec, const std::shared_ptr< ArchivingState > &result)> GetChannelRecordingStatusCallback
 
typedef std::function< void(TwitchAPI *source, TTV_ErrorCode ec)> RunCommercialCallback
 
typedef std::function< void(TwitchAPI *source, const std::string &str, TTV_ErrorCode ec, const std::shared_ptr< GameInfoList > &result)> GetGameNameListCallback
 
typedef std::function< void(TwitchAPI *source, TTV_ErrorCode ec, std::vector< IngestServer > &&result)> GetIngestServerListCallback
 
enum  State { State::Uninitialized, State::Initialized, State::ShuttingDown, State::Inert }
 

Public Member Functions

 TwitchAPI ()
 
 TwitchAPI (const std::shared_ptr< User > &user)
 
virtual std::string GetLoggerName () const override
 
TTV_ErrorCode GetChannelInfo (GetChannelInfoCallback &&callback)
 
TTV_ErrorCode SetStreamInfo (ChannelId channelId, const std::string &streamTitle, const std::string &gameName, SetStreamInfoCallback &&callback)
 
TTV_ErrorCode GetStreamInfo (ChannelId channelId, GetStreamInfoCallback &&callback)
 
TTV_ErrorCode GetChannelRecordingStatus (GetChannelRecordingStatusCallback &&callback)
 
TTV_ErrorCode RunCommercial (ChannelId channelId, uint32_t timeBreakSeconds, RunCommercialCallback &&callback)
 
TTV_ErrorCode GetGameNameList (const std::string &str, GetGameNameListCallback &&callback)
 
TTV_ErrorCode GetIngestServerList (GetIngestServerListCallback &&callback)
 
virtual void SetTaskRunner (std::shared_ptr< TaskRunner > taskRunner)
 
std::shared_ptr< TaskRunnerGetTaskRunner ()
 
virtual State GetState () const override
 
virtual TTV_ErrorCode Initialize () override
 
virtual void Update () override
 
virtual TTV_ErrorCode Shutdown () override
 

Static Public Member Functions

static std::string GetComponentName ()
 
static const char * CurrentApiVersionString ()
 

Protected Member Functions

TTV_ErrorCode StartTask (std::shared_ptr< Task > task)
 
void CompleteTask (Task *task)
 
bool IsTaskRunning (Task *task) const
 
virtual void SetState (State state)
 
virtual void SetClientState (State state)
 
virtual void SetServerState (State state)
 
virtual bool CheckShutdown ()
 
virtual void CompleteShutdown ()
 

Protected Attributes

ClientServerValue< StatemState
 
std::shared_ptr< TaskRunnermTaskRunner
 
std::vector< std::shared_ptr< Task > > mRunningTasks
 
std::mutex mTaskMutex
 
uint64_t mShutdownTimeMilliseconds
 

Private Attributes

std::weak_ptr< UsermUser
 
std::shared_ptr< MatchGameNamesTaskmOutstandingMatchGameNamesTask
 
std::string mNextGameNamesQuery
 
GetGameNameListCallback mNextGameNamesCallback
 

Detailed Description

A convenience component for managing requests. Some requests are not associated with a User so this is not a proper UserComponent since it needs to be hosted independently from a User.


Class Documentation

◆ ttv::broadcast::TwitchAPI::ChannelInfo

struct ttv::broadcast::TwitchAPI::ChannelInfo
Class Members
string displayName
string loginName
string streamKey
string url

Member Typedef Documentation

◆ GetChannelInfoCallback

typedef std::function<void(TwitchAPI* source, TTV_ErrorCode ec, ChannelInfo&& result)> ttv::broadcast::TwitchAPI::GetChannelInfoCallback

◆ GetChannelRecordingStatusCallback

typedef std::function<void(TwitchAPI* source, TTV_ErrorCode ec, const std::shared_ptr<ArchivingState>& result)> ttv::broadcast::TwitchAPI::GetChannelRecordingStatusCallback

◆ GetGameNameListCallback

typedef std::function<void(TwitchAPI* source, const std::string& str, TTV_ErrorCode ec, const std::shared_ptr<GameInfoList>& result)> ttv::broadcast::TwitchAPI::GetGameNameListCallback

◆ GetIngestServerListCallback

typedef std::function<void(TwitchAPI* source, TTV_ErrorCode ec, std::vector<IngestServer>&& result)> ttv::broadcast::TwitchAPI::GetIngestServerListCallback

◆ GetStreamInfoCallback

typedef std::function<void(TwitchAPI* source, TTV_ErrorCode ec, const std::shared_ptr<StreamInfo>& result)> ttv::broadcast::TwitchAPI::GetStreamInfoCallback

◆ RunCommercialCallback

◆ SetStreamInfoCallback

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
kDefaultRequestTimeoutInSec 

◆ MetaDataEventClass

Enumerator
METADATA_ACTION 
METADATA_START 
METADATA_END 

◆ State

enum ttv::IComponent::State
stronginherited
Enumerator
Uninitialized 
Initialized 
ShuttingDown 
Inert 

The component doesn't require shutting down.

Constructor & Destructor Documentation

◆ TwitchAPI() [1/2]

ttv::broadcast::TwitchAPI::TwitchAPI ( )

◆ TwitchAPI() [2/2]

ttv::broadcast::TwitchAPI::TwitchAPI ( const std::shared_ptr< User > &  user)

Member Function Documentation

◆ CheckShutdown()

virtual bool ttv::Component::CheckShutdown ( )
protectedvirtualinherited

◆ CompleteShutdown()

virtual void ttv::Component::CompleteShutdown ( )
protectedvirtualinherited

◆ CompleteTask()

void ttv::Component::CompleteTask ( Task task)
protectedinherited

◆ CurrentApiVersionString()

static const char* ttv::broadcast::TwitchAPI::CurrentApiVersionString ( )
static

◆ GetChannelInfo()

TTV_ErrorCode ttv::broadcast::TwitchAPI::GetChannelInfo ( GetChannelInfoCallback &&  callback)

◆ GetChannelRecordingStatus()

TTV_ErrorCode ttv::broadcast::TwitchAPI::GetChannelRecordingStatus ( GetChannelRecordingStatusCallback &&  callback)

◆ GetComponentName()

static std::string ttv::broadcast::TwitchAPI::GetComponentName ( )
inlinestatic

◆ GetGameNameList()

TTV_ErrorCode ttv::broadcast::TwitchAPI::GetGameNameList ( const std::string &  str,
GetGameNameListCallback &&  callback 
)

◆ GetIngestServerList()

TTV_ErrorCode ttv::broadcast::TwitchAPI::GetIngestServerList ( GetIngestServerListCallback &&  callback)

◆ GetLoggerName()

virtual std::string ttv::broadcast::TwitchAPI::GetLoggerName ( ) const
overridevirtual

Implements ttv::Component.

◆ GetState()

virtual State ttv::Component::GetState ( ) const
overridevirtualinherited

Implements ttv::IComponent.

◆ GetStreamInfo()

TTV_ErrorCode ttv::broadcast::TwitchAPI::GetStreamInfo ( ChannelId  channelId,
GetStreamInfoCallback &&  callback 
)

◆ GetTaskRunner()

std::shared_ptr<TaskRunner> ttv::Component::GetTaskRunner ( )
inlineinherited

◆ Initialize()

virtual TTV_ErrorCode ttv::Component::Initialize ( )
overridevirtualinherited

◆ IsTaskRunning()

bool ttv::Component::IsTaskRunning ( Task task) const
protectedinherited

◆ RunCommercial()

TTV_ErrorCode ttv::broadcast::TwitchAPI::RunCommercial ( ChannelId  channelId,
uint32_t  timeBreakSeconds,
RunCommercialCallback &&  callback 
)

◆ SetClientState()

virtual void ttv::Component::SetClientState ( State  state)
protectedvirtualinherited

◆ SetServerState()

virtual void ttv::Component::SetServerState ( State  state)
protectedvirtualinherited

◆ SetState()

virtual void ttv::Component::SetState ( State  state)
protectedvirtualinherited

◆ SetStreamInfo()

TTV_ErrorCode ttv::broadcast::TwitchAPI::SetStreamInfo ( ChannelId  channelId,
const std::string &  streamTitle,
const std::string &  gameName,
SetStreamInfoCallback &&  callback 
)

◆ SetTaskRunner()

virtual void ttv::Component::SetTaskRunner ( std::shared_ptr< TaskRunner taskRunner)
virtualinherited

◆ Shutdown()

virtual TTV_ErrorCode ttv::Component::Shutdown ( )
overridevirtualinherited

◆ StartTask()

TTV_ErrorCode ttv::Component::StartTask ( std::shared_ptr< Task task)
protectedinherited

◆ Update()

virtual void ttv::Component::Update ( )
overridevirtualinherited

Member Data Documentation

◆ mNextGameNamesCallback

GetGameNameListCallback ttv::broadcast::TwitchAPI::mNextGameNamesCallback
private

◆ mNextGameNamesQuery

std::string ttv::broadcast::TwitchAPI::mNextGameNamesQuery
private

◆ mOutstandingMatchGameNamesTask

std::shared_ptr<MatchGameNamesTask> ttv::broadcast::TwitchAPI::mOutstandingMatchGameNamesTask
private

◆ mRunningTasks

std::vector<std::shared_ptr<Task> > ttv::Component::mRunningTasks
protectedinherited

◆ mShutdownTimeMilliseconds

uint64_t ttv::Component::mShutdownTimeMilliseconds
protectedinherited

◆ mState

ClientServerValue<State> ttv::Component::mState
protectedinherited

◆ mTaskMutex

std::mutex ttv::Component::mTaskMutex
mutableprotectedinherited

◆ mTaskRunner

std::shared_ptr<TaskRunner> ttv::Component::mTaskRunner
protectedinherited

◆ mUser

std::weak_ptr<User> ttv::broadcast::TwitchAPI::mUser
private

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