TwitchLib 3.5.3
Loading...
Searching...
No Matches
TwitchLib.Api.Services.FollowerService Class Reference
Inheritance diagram for TwitchLib.Api.Services.FollowerService:
TwitchLib.Api.Services.ApiService

Public Member Functions

 FollowerService (ITwitchAPI api, int checkIntervalInSeconds=60, int queryCountPerRequest=100, int cacheSize=1000, bool invokeEventsOnStartup=false)
 FollowerService constructor. More...
 
void ClearCache ()
 Clears the existing cache. More...
 
void SetChannelsById (List< string > channelsToMonitor)
 Sets the channels to monitor by id. Event's channel properties will be Ids in this case. More...
 
void SetChannelsByName (List< string > channelsToMonitor)
 Sets the channels to monitor by name. Event's channel properties will be names in this case. More...
 
async Task UpdateLatestFollowersAsync (bool callEvents=true)
 Updates the followerservice with the latest followers. Automatically called internally when service is started. More...
 
- Public Member Functions inherited from TwitchLib.Api.Services.ApiService
virtual void Start ()
 Starts the service. More...
 
virtual void Stop ()
 Stops the service. More...
 

Protected Member Functions

override async Task OnServiceTimerTick ()
 Called when the service timer ticks. Invokes the OnServiceTick event. More...
 
- Protected Member Functions inherited from TwitchLib.Api.Services.ApiService
 ApiService (ITwitchAPI api, int checkIntervalInSeconds)
 Constructor from the ApiService. More...
 
virtual void SetChannels (List< string > channelsToMonitor)
 Sets channels by to monitor. More...
 
virtual Task OnServiceTimerTick ()
 Called when the service timer ticks. Invokes the OnServiceTick event. More...
 

Properties

Dictionary< string, List< Follow > > KnownFollowers = new Dictionary<string, List<Follow>>(StringComparer.OrdinalIgnoreCase) [get]
 The current known followers for each channel. More...
 
int QueryCountPerRequest [get]
 The amount of followers queried per request. More...
 
int CacheSize [get]
 The maximum amount of followers cached per channel. More...
 
- Properties inherited from TwitchLib.Api.Services.ApiService
List< string > ChannelsToMonitor [get]
 The list with channels to monitor. More...
 
int IntervalInSeconds [get]
 How often the service is being updated in seconds. More...
 
bool Enabled [get]
 Whether the service is currently enabled or not. More...
 

Events

EventHandler< OnNewFollowersDetectedArgsOnNewFollowersDetected
 Event which is called when new followers are detected. More...
 
- Events inherited from TwitchLib.Api.Services.ApiService
EventHandler< OnServiceStartedArgsOnServiceStarted
 Event invoked when the service has started. More...
 
EventHandler< OnServiceStoppedArgsOnServiceStopped
 Event invoked when the service has stopped. More...
 
EventHandler< OnServiceTickArgsOnServiceTick
 Event invoked when the service is updating. More...
 
EventHandler< OnChannelsSetArgsOnChannelsSet
 Event invoked when the channels have been set. More...
 

Additional Inherited Members

- Protected Attributes inherited from TwitchLib.Api.Services.ApiService
readonly ITwitchAPI _api
 

Constructor & Destructor Documentation

◆ FollowerService()

TwitchLib.Api.Services.FollowerService.FollowerService ( ITwitchAPI  api,
int  checkIntervalInSeconds = 60,
int  queryCountPerRequest = 100,
int  cacheSize = 1000,
bool  invokeEventsOnStartup = false 
)

FollowerService constructor.

Exceptions
ArgumentNullExceptionWhen the api is null.
ArgumentExceptionWhen the checkIntervalInSeconds is lower than one second.
ArgumentExceptionWhen the queryCountPerRequest is less than 1 or more than 100 followers per request.
ArgumentExceptionWhen the cacheSize is less than the queryCountPerRequest.
Parameters
apiThe api to use for querying followers.
checkIntervalInSecondsHow often new followers should be queried.
queryCountPerRequestThe amount of followers to query per request.
cacheSizeThe maximum amount of followers to cache per channel.
invokeEventsOnStartupWhether to invoke the update events on startup or not.

Member Function Documentation

◆ ClearCache()

void TwitchLib.Api.Services.FollowerService.ClearCache ( )

Clears the existing cache.

◆ OnServiceTimerTick()

override async Task TwitchLib.Api.Services.FollowerService.OnServiceTimerTick ( )
protectedvirtual

Called when the service timer ticks. Invokes the OnServiceTick event.

Reimplemented from TwitchLib.Api.Services.ApiService.

◆ SetChannelsById()

void TwitchLib.Api.Services.FollowerService.SetChannelsById ( List< string >  channelsToMonitor)

Sets the channels to monitor by id. Event's channel properties will be Ids in this case.

Exceptions
ArgumentNullExceptionWhen channelsToMonitor is null.
ArgumentExceptionWhen channelsToMonitor is empty.
Parameters
channelsToMonitorA list with channels to monitor.

◆ SetChannelsByName()

void TwitchLib.Api.Services.FollowerService.SetChannelsByName ( List< string >  channelsToMonitor)

Sets the channels to monitor by name. Event's channel properties will be names in this case.

Exceptions
ArgumentNullExceptionWhen channelsToMonitor is null.
ArgumentExceptionWhen channelsToMonitor is empty.
Parameters
channelsToMonitorA list with channels to monitor.

◆ UpdateLatestFollowersAsync()

async Task TwitchLib.Api.Services.FollowerService.UpdateLatestFollowersAsync ( bool  callEvents = true)

Updates the followerservice with the latest followers. Automatically called internally when service is started.

Parameters
callEventsWhether to invoke the update events or not.

Property Documentation

◆ CacheSize

int TwitchLib.Api.Services.FollowerService.CacheSize
get

The maximum amount of followers cached per channel.

◆ KnownFollowers

Dictionary<string, List<Follow> > TwitchLib.Api.Services.FollowerService.KnownFollowers = new Dictionary<string, List<Follow>>(StringComparer.OrdinalIgnoreCase)
get

The current known followers for each channel.

◆ QueryCountPerRequest

int TwitchLib.Api.Services.FollowerService.QueryCountPerRequest
get

The amount of followers queried per request.

Event Documentation

◆ OnNewFollowersDetected

EventHandler<OnNewFollowersDetectedArgs> TwitchLib.Api.Services.FollowerService.OnNewFollowersDetected

Event which is called when new followers are detected.


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