|
Twitch SDK (Internal)
|
#include <coreapi.h>
Classes | |
| class | PubSubListener |
| class | UserListener |
Public Types | |
| using | FetchUserInfoCallback = std::function< void(TTV_ErrorCode ec, const UserInfo &userInfo)> |
| using | FetchChannelInfoCallback = std::function< void(TTV_ErrorCode ec, const ChannelInfo &channelInfo)> |
| using | FetchStreamInfoCallback = std::function< void(TTV_ErrorCode ec, const StreamInfo &streamInfo)> |
| using | LogInCallback = std::function< void(TTV_ErrorCode ec, const UserInfo &userInfo)> |
| using | LogOutCallback = std::function< void(TTV_ErrorCode ec)> |
| using | UploadProfileImageCallback = std::function< void(TTV_ErrorCode ec, const std::vector< ProfileImage > &images)> |
| 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)> |
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 | |
| void | OnPubSubStateChanged (PubSubClient *source, PubSubState state, TTV_ErrorCode ec) |
| void | OnUserLogInComplete (User *source, TTV_ErrorCode ec) |
| void | OnUserLogOutComplete (User *source, TTV_ErrorCode ec) |
| void | OnUserInfoFetchComplete (User *source, TTV_ErrorCode ec) |
| void | OnUserAuthenticationIssue (User *source, std::shared_ptr< const OAuthToken > oauthToken, TTV_ErrorCode ec) |
| virtual bool | CheckShutdown () override |
| virtual void | CompleteShutdown () override |
| TTV_ErrorCode | DisposeChannelStatus (const std::shared_ptr< IChannelStatus > &channelStatus) |
| void | InitializeAnonymousUser () |
| TTV_ErrorCode | ValidateOAuthToken (const std::string &oauth, const std::function< void(TTV_ErrorCode ec)> &callback) |
Private Attributes | |
| std::shared_ptr< ChannelRepository > | mChannelRepository |
| std::shared_ptr< UserRepository > | mUserRepository |
| std::shared_ptr< TrackingContext > | mTrackingContext |
| std::shared_ptr< UserListener > | mUserListener |
| std::shared_ptr< PubSubListener > | mPubSubListener |
| std::shared_ptr< TaskRunner > | mTaskRunner |
| std::shared_ptr< SettingRepository > | mSettingRepository |
| std::shared_ptr< CoreAPIInternalData > | mInternalData |
| std::vector< std::shared_ptr< ICoreApiClient > > | mApiClients |
| std::string | mLocalLanguage |
Provides the core services need by other subsystems.
The following properties must be set before calling Initialize().
| using ttv::CoreAPI::FetchChannelInfoCallback = std::function<void(TTV_ErrorCode ec, const ChannelInfo& channelInfo)> |
| using ttv::CoreAPI::FetchStreamInfoCallback = std::function<void(TTV_ErrorCode ec, const StreamInfo& streamInfo)> |
| using ttv::CoreAPI::FetchUserInfoCallback = std::function<void(TTV_ErrorCode ec, const UserInfo& userInfo)> |
|
inherited |
| using ttv::CoreAPI::LogInCallback = std::function<void(TTV_ErrorCode ec, const UserInfo& userInfo)> |
| using ttv::CoreAPI::LogOutCallback = std::function<void(TTV_ErrorCode ec)> |
|
inherited |
| using ttv::CoreAPI::UploadProfileImageCallback = std::function<void(TTV_ErrorCode ec, const std::vector<ProfileImage>& images)> |
|
stronginherited |
| ttv::CoreAPI::CoreAPI | ( | ) |
|
virtual |
|
overrideprivatevirtual |
Reimplemented from ttv::ModuleBase.
|
overrideprivatevirtual |
Reimplemented from ttv::ModuleBase.
| TTV_ErrorCode ttv::CoreAPI::ConnectPubSub | ( | UserId | userId | ) |
| TTV_ErrorCode ttv::CoreAPI::CreateChannelStatus | ( | UserId | userId, |
| ChannelId | channelId, | ||
| const std::shared_ptr< IChannelListener > & | listener, | ||
| std::shared_ptr< IChannelStatus > & | result | ||
| ) |
An IChannelListener object can be passed in to receive updates for the channel.
| [in] | userId | The user id to create the channel listener for. Can be 0 if for not specific user. |
| [in] | channelId | The channel id to listen on. Cannot be 0. |
| [in] | listener | The listener to use for callbacks. Can be null if listener is not needed. |
| [out] | result | The resulting IChannelStatus implementation for the given user/channel to receive updates on. |
| TTV_ErrorCode ttv::CoreAPI::DisconnectPubSub | ( | UserId | userId | ) |
|
private |
| TTV_ErrorCode ttv::CoreAPI::FetchChannelInfoById | ( | ChannelId | channelId, |
| const FetchChannelInfoCallback & | callback | ||
| ) |
Asynchonously fetches the channel information for the given channel id.
| TTV_ErrorCode ttv::CoreAPI::FetchChannelInfoByName | ( | const std::string & | channelName, |
| const FetchChannelInfoCallback & | callback | ||
| ) |
Asynchonously fetches the channel information for the named channel.
| TTV_ErrorCode ttv::CoreAPI::FetchStreamInfoById | ( | ChannelId | channelId, |
| const FetchStreamInfoCallback & | callback | ||
| ) |
Asynchonously fetches the stream information for the given channel id.
| [in] | channelId | The id of the channel to fetch stream information for. |
| TTV_ErrorCode ttv::CoreAPI::FetchStreamInfoByName | ( | const std::string & | channelName, |
| const FetchStreamInfoCallback & | callback | ||
| ) |
Asynchonously fetches the stream information for the given channel name.
| [in] | channelName | The name of the channel to fetch stream information for. |
| TTV_ErrorCode ttv::CoreAPI::FetchUserInfoById | ( | UserId | userId, |
| FetchUserInfoCallback | callback | ||
| ) |
Asynchonously fetches the user information for the user with a given id. The result of the fetch will be returned in the callback.
| TTV_ErrorCode ttv::CoreAPI::FetchUserInfoByName | ( | const std::string & | userName, |
| FetchUserInfoCallback | callback | ||
| ) |
Asynchronously fetches the user information for the named user. The result of the fetch will be returned in the callback.
|
inline |
| TTV_ErrorCode ttv::CoreAPI::GetClientId | ( | std::string & | clientId | ) |
Retrieves the currently set client-id.
|
inlineprotectedinherited |
Returns the common ComponentContainer which hosts all components which live at the module level.
| TTV_ErrorCode ttv::CoreAPI::GetGlobalSetting | ( | const std::string & | key, |
| std::string & | value | ||
| ) |
| TTV_ErrorCode ttv::CoreAPI::GetLocalLanguage | ( | std::string & | language | ) |
Retrieves the currently set local language. This is a 2 language character code.
|
overridevirtual |
Returns the name of the module.
Implements ttv::IModule.
| TTV_ErrorCode ttv::CoreAPI::GetRequiredOAuthScopes | ( | std::vector< std::string > & | modules, |
| std::vector< std::string > & | scopes | ||
| ) |
Retrieves the required scopes from all registered modules.
|
inline |
|
overridevirtualinherited |
Returns the current state of the module.
Implements ttv::IModule.
|
inline |
|
inline |
|
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.
|
private |
|
inlineprotectedinherited |
Invokes the callback for the module listeners.
| TTV_ErrorCode ttv::CoreAPI::LogIn | ( | const std::string & | oauthToken, |
| LogInCallback | callback | ||
| ) |
| TTV_ErrorCode ttv::CoreAPI::LogOut | ( | UserId | userId, |
| LogOutCallback | callback | ||
| ) |
|
protectedinherited |
|
private |
|
private |
|
private |
|
private |
|
private |
| TTV_ErrorCode ttv::CoreAPI::RegisterClient | ( | std::shared_ptr< ICoreApiClient > | client | ) |
|
inlineprotectedinherited |
|
inlineprotectedinherited |
| TTV_ErrorCode ttv::CoreAPI::RemoveGlobalSetting | ( | const std::string & | key | ) |
| TTV_ErrorCode ttv::CoreAPI::SetGlobalSetting | ( | const std::string & | key, |
| const std::string & | value | ||
| ) |
| TTV_ErrorCode ttv::CoreAPI::SetListener | ( | std::shared_ptr< ICoreAPIListener > | listener | ) |
| TTV_ErrorCode ttv::CoreAPI::SetLocalLanguage | ( | const std::string & | language | ) |
Sets the language used by the local client. This is a 2 language character code.
|
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::CoreAPI::UnregisterClient | ( | std::shared_ptr< ICoreApiClient > | client | ) |
|
overridevirtual |
Updates the internal state of the module and fires any pending callbacks.
Reimplemented from ttv::ModuleBase.
|
private |
|
private |
|
private |
|
private |
|
protectedinherited |
|
protectedinherited |
The registered listeners. These listeners extend IModuleListener and will be of the type required for the module.
|
private |
|
private |
|
private |
|
protectedinherited |
|
private |
|
private |
|
private |
|
private |
1.8.13