/// <summary> /// Initializes a new instance of <see cref="Pastebin.Pastebin"/> with the specified API key. /// </summary> /// <param name="apiKey">The API key to make requests with. An API key can be obtained by logging into pastebin.com and going to http://pastebin.com/api </param> /// <param name="rateLimitMode">Specifies how rate limiting should be handled See <see cref="RateLimitMode" /> for more details.</param> public Pastebin( string apiKey, RateLimitMode rateLimitMode = RateLimitMode.None ) { if( apiKey == null ) throw new ArgumentNullException( "apiKey" ); this.agent = new WebAgent( apiKey, rateLimitMode ); }
/// <summary> /// Create new RateLimitManager. Defaults to Burst RateLimitMode /// </summary> /// <param name="mode">Defaults to Burst RateLimitMode</param> public RateLimitManager(RateLimitMode mode = RateLimitMode.Burst, int requestsPerMinuteWithOAuth = 60, int requestsPerMinuteWithoutOAuth = 30) { rateLimitLock = new SemaphoreSlim(1, 1); Reset = DateTimeOffset.UtcNow; Mode = mode; RequestsPerMinuteWithOAuth = requestsPerMinuteWithOAuth; RequestsPerMinuteWithoutOAuth = requestsPerMinuteWithoutOAuth; }
/// <summary> /// Create a new entry with given refresh token and settings. /// </summary> /// <param name="username"></param> /// <param name="refreshToken"></param> /// <param name="rateLimiterMode">Defaults to RateLimitMode.Burst</param> /// <param name="userAgentString">If none is provided, will use default UserAgentString set on RefreshTokenWebAgentPool</param> public RefreshTokenPoolEntry(string username, string refreshToken, RateLimitMode rateLimiterMode = RateLimitMode.Burst, string userAgentString = "") { Username = username; RefreshToken = refreshToken; RateLimiterMode = rateLimiterMode; UserAgentString = userAgentString; WebAgentID = Guid.NewGuid(); }
/// <summary> /// Initializes a new instance of <see cref="PastebinClient" /> with the specified API key. /// </summary> /// <param name="apiKey"> /// The API key to make requests with. An API key can be obtained by logging into https://pastebin.com /// and going to https://pastebin.com/api /// </param> /// <param name="rateLimitMode"> /// Specifies how rate limiting should be handled See <see cref="RateLimitMode" /> for more /// details. /// </param> public PastebinClient(string apiKey, RateLimitMode rateLimitMode = RateLimitMode.None) { if (apiKey == null) { throw new ArgumentNullException(nameof(apiKey)); } this._agent = new HttpWebAgent(apiKey, rateLimitMode); }
public WebAgent( string apiKey, RateLimitMode mode ) { this.apiKey = apiKey; this.rateLimitMode = mode; }
public HttpWebAgent(string apiKey, RateLimitMode mode) { this.ApiKey = apiKey; this._rateLimitMode = mode; }