C# Class HaloEzAPI.Limits.RequestRateHttpClient

Responsible for handling all Http Request to the API, via a Semaphore and Stopwatch system to prevent excessive requests.
Show file Open project: glitch100/Halo-API

Public Properties

Property Type Description
SecondsLimit int

Public Methods

Method Description
GetRequest ( Uri endpoint ) : Task

Goes to make a Get requst to the specifed Uri, only if it hasn't exceeded the call limit

SetAPIToken ( string token ) : void

Set the API Token Header in the HttpClient

SetRequestLimit ( int limit ) : void

Recreates the Semaphore, and reassigns a Limit

SetSecondsLimit ( int limit ) : void

Assigns a new seconds limit

Private Methods

Method Description
RequestRateHttpClient ( ) : System

Method Details

GetRequest() public static method

Goes to make a Get requst to the specifed Uri, only if it hasn't exceeded the call limit
public static GetRequest ( Uri endpoint ) : Task
endpoint System.Uri Endpoint to request
return Task

SetAPIToken() public static method

Set the API Token Header in the HttpClient
public static SetAPIToken ( string token ) : void
token string Your Halo Developer API Token
return void

SetRequestLimit() public static method

Recreates the Semaphore, and reassigns a Limit
public static SetRequestLimit ( int limit ) : void
limit int Request limit
return void

SetSecondsLimit() public static method

Assigns a new seconds limit
public static SetSecondsLimit ( int limit ) : void
limit int Seconds limit
return void

Property Details

SecondsLimit public static property

Number of seconds the for the Limit of requests (10 seconds for 10 requests etc)
public static int SecondsLimit
return int