RiotNet  8.0.0
A C#/.NET client for the Riot Games API.
Public Member Functions | Properties | List of all members
RiotNet.IRateLimiter Interface Reference

Handles proactive rate limiting. You should only ever create one instance of this interface. More...

Inheritance diagram for RiotNet.IRateLimiter:
RiotNet.RateLimiter

Public Member Functions

void TrySetRules (IEnumerable< RateLimitRule > rules, string platformId, IEnumerable< RateLimitRule > currentCounts=null)
 Adds application-level rate limiting rules if they have not been added already. More...
 
void TrySetRules (IEnumerable< RateLimitRule > rules, string methodName, string platformId, IEnumerable< RateLimitRule > currentCounts=null)
 Adds method-level rate limiting rules if they have not been added already. More...
 
DateTime AddRequestOrGetDelay (string methodName, string platformId)
 Increments the request count, or if the rate limit is reached, gets the time (in UTC) until which the client should wait before sending a request. More...
 

Properties

bool HasRules [get]
 Gets whether the rate limiter has any application-level rules set. More...
 

Detailed Description

Handles proactive rate limiting. You should only ever create one instance of this interface.

Member Function Documentation

DateTime RiotNet.IRateLimiter.AddRequestOrGetDelay ( string  methodName,
string  platformId 
)

Increments the request count, or if the rate limit is reached, gets the time (in UTC) until which the client should wait before sending a request.

Parameters
methodNameThe name of the method that is executing.
platformIdThe platform ID of the default server to connect to. This should equal one of the Models.PlatformId values.
Returns
The wait time, or DateTime.MinValue if no delay is required.

Implementations of this function must be thread-safe.

Implemented in RiotNet.RateLimiter.

void RiotNet.IRateLimiter.TrySetRules ( IEnumerable< RateLimitRule rules,
string  platformId,
IEnumerable< RateLimitRule currentCounts = null 
)

Adds application-level rate limiting rules if they have not been added already.

Parameters
rulesThe list of rules.
platformIdThe platform ID of the response that contained the rate limit definitions. The request count will automatically be incremented for this platform.
currentCountsThe current request counts for each rule. If unspecified, 1 request for each rule will be assumed.

Implemented in RiotNet.RateLimiter.

void RiotNet.IRateLimiter.TrySetRules ( IEnumerable< RateLimitRule rules,
string  methodName,
string  platformId,
IEnumerable< RateLimitRule currentCounts = null 
)

Adds method-level rate limiting rules if they have not been added already.

Parameters
rulesThe list of rules.
methodNameThe name of the method that is executing.
platformIdThe platform ID of the response that contained the rate limit definitions. The request count will automatically be incremented for this platform.
currentCountsThe current request counts for each rule. If unspecified, 1 request for each rule will be assumed.

Implemented in RiotNet.RateLimiter.

Property Documentation

bool RiotNet.IRateLimiter.HasRules
get

Gets whether the rate limiter has any application-level rules set.


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