BarbezDotEu.Provider
9.0.0
Prefix Reserved
dotnet add package BarbezDotEu.Provider --version 9.0.0
NuGet\Install-Package BarbezDotEu.Provider -Version 9.0.0
<PackageReference Include="BarbezDotEu.Provider" Version="9.0.0" />
paket add BarbezDotEu.Provider --version 9.0.0
#r "nuget: BarbezDotEu.Provider, 9.0.0"
// Install BarbezDotEu.Provider as a Cake Addin #addin nuget:?package=BarbezDotEu.Provider&version=9.0.0 // Install BarbezDotEu.Provider as a Cake Tool #tool nuget:?package=BarbezDotEu.Provider&version=9.0.0
BarbezDotEu.Provider
A non-exhaustive, yet useful HTTP(S) JSON client that supports rate limiting, enabling you to implement a polite integration with a third-party data provider.
Contents
- IPoliteProvider
- IPoliteResponse`1
- PoliteProvider
- #ctor(logger,httpClientFactory)
- Logger
- RequiredSecondsInBetweenCalls
- GetPoliteResponse``1(response)
- IsPolite()
- Request``1(request,retryOnError,waitingMinutesBeforeRetry)
- SetMultiplier()
- SetRateLimitPerDay(callsPerDay)
- SetRateLimitPerHour(callsPerHour)
- SetRateLimitPerMinute(callsPerMinute)
- UpdateTimeOfLastCall(lastQueryTime)
- PoliteReponse`1
- PostClientAuthorizeResponse
<a name='T-BarbezDotEu-Provider-Interfaces-IPoliteProvider'></a>
IPoliteProvider type
Namespace
BarbezDotEu.Provider.Interfaces
Summary
Defines an HTTP(S) client that supports rate limiting so that a polite integration with a third-party data provider can be implemented.
<a name='M-BarbezDotEu-Provider-Interfaces-IPoliteProvider-IsPolite'></a>
IsPolite() method
Summary
Returns true if querying using this IPoliteProvider will respects the limit set forth by the third-party resource.
Parameters
This method has no parameters.
Remarks
Any other methods of this IPoliteProvider should be called only after this method was called and returned true first, ensuring this application will not be blacklisted or will start receiving errors.
<a name='M-BarbezDotEu-Provider-Interfaces-IPoliteProvider-SetMultiplier-System-Int64-'></a>
SetMultiplier() method
Summary
Sets a multiplier intended for cases where multiple calls to the third-party resource have to be performed in rapid succession (a batch). In such cases, the multiplier should be set to the number of calls that were performed in batch. The multiplier is reset to 1 after the next call to IsPolite returns true.
Parameters
This method has no parameters.
Remarks
E.g. if ordinary 1 call per minute can be made, but 2 are made in batch, set the multiplier to 2. This way, the next batch will only be allowed to run in 2 minutes' time, thus still respecting the average rate limit of 1 call per minute.
<a name='T-BarbezDotEu-Provider-Interfaces-IPoliteResponse`1'></a>
IPoliteResponse`1 type
Namespace
BarbezDotEu.Provider.Interfaces
Summary
Defines a IPoliteResponse`1 to a HttpRequestMessage requested by an IPoliteProvider.
<a name='P-BarbezDotEu-Provider-Interfaces-IPoliteResponse`1-Content'></a>
Content property
Summary
Gets the actual content of a successful response to a HttpRequestMessage.
<a name='P-BarbezDotEu-Provider-Interfaces-IPoliteResponse`1-HasFailed'></a>
HasFailed property
Summary
Gets a value indicating whether the HttpResponseMessage indicates a fault.
<a name='P-BarbezDotEu-Provider-Interfaces-IPoliteResponse`1-HttpResponseMessage'></a>
HttpResponseMessage property
Summary
Gets the HttpRequestMessage that indicates a fault that has occurred.
<a name='M-BarbezDotEu-Provider-Interfaces-IPoliteResponse1-SetContent-
0-'></a>
SetContent(content) method
Summary
Sets the the actual response content.
Parameters
Name | Type | Description |
---|---|---|
content | `0 | The response content to set. |
<a name='T-BarbezDotEu-Provider-PoliteProvider'></a>
PoliteProvider type
Namespace
BarbezDotEu.Provider
Summary
Implements an HTTP(S) client that supports rate limiting so that a polite integration with a third-party data provider can be implemented.
<a name='M-BarbezDotEu-Provider-PoliteProvider-#ctor-Microsoft-Extensions-Logging-ILogger,System-Net-Http-IHttpClientFactory-'></a>
#ctor(logger,httpClientFactory) constructor
Summary
Constructs a new PoliteProvider.
Parameters
Name | Type | Description |
---|---|---|
logger | Microsoft.Extensions.Logging.ILogger | A ILogger to use for logging. |
httpClientFactory | System.Net.Http.IHttpClientFactory | The IHttpClientFactory to use. |
<a name='P-BarbezDotEu-Provider-PoliteProvider-Logger'></a>
Logger property
Summary
Gets or sets the ILogger.
<a name='P-BarbezDotEu-Provider-PoliteProvider-RequiredSecondsInBetweenCalls'></a>
RequiredSecondsInBetweenCalls property
Summary
Gets the number of seconds required to lapse before a next call to the data provider is considered polite.
<a name='M-BarbezDotEu-Provider-PoliteProvider-GetPoliteResponse``1-System-Net-Http-HttpResponseMessage-'></a>
GetPoliteResponse``1(response) method
Summary
Converts a HttpResponseMessage into a PoliteReponse`1.
Returns
The HttpResponseMessage as PoliteReponse`1.
Parameters
Name | Type | Description |
---|---|---|
response | System.Net.Http.HttpResponseMessage | The response to convert. |
Generic Types
Name | Description |
---|---|
T | The view model to deserialize a successful response into. |
<a name='M-BarbezDotEu-Provider-PoliteProvider-IsPolite'></a>
IsPolite() method
Summary
Inherit from parent.
Parameters
This method has no parameters.
<a name='M-BarbezDotEu-Provider-PoliteProvider-Request``1-System-Net-Http-HttpRequestMessage,System-Boolean,System-Double-'></a>
Request``1(request,retryOnError,waitingMinutesBeforeRetry) method
Summary
Sends a HttpRequestMessage to the third-party provider, expecting a certain response.
Returns
The expected response content type, as well as other metadata, in case of an exception.
Parameters
Name | Type | Description |
---|---|---|
request | System.Net.Http.HttpRequestMessage | The HttpRequestMessage to send to the third-party provider. |
retryOnError | System.Boolean | |
waitingMinutesBeforeRetry | System.Double | The number of minutes to wait before automatically retrying re-sending the request, if the intention is to retry again upon error. |
Generic Types
Name | Description |
---|---|
T | The expected response content type. |
<a name='M-BarbezDotEu-Provider-PoliteProvider-SetMultiplier-System-Int64-'></a>
SetMultiplier() method
Summary
Inherit from parent.
Parameters
This method has no parameters.
<a name='M-BarbezDotEu-Provider-PoliteProvider-SetRateLimitPerDay-System-Int64-'></a>
SetRateLimitPerDay(callsPerDay) method
Summary
Sets the number of calls per day as allowed to the provider, i.e. third-party resource.
Parameters
Name | Type | Description |
---|---|---|
callsPerDay | System.Int64 | The max. number of allowed calls per day. |
Remarks
The parameter string is expected to hold numeric values only. SetRateLimitPerDay, SetRateLimitPerHour, and SetRateLimitPerMinute are mutually exclusive, hence the last called method determines the rate limiter.
<a name='M-BarbezDotEu-Provider-PoliteProvider-SetRateLimitPerHour-System-Int64-'></a>
SetRateLimitPerHour(callsPerHour) method
Summary
Sets the number of calls per hour as allowed to the provider, i.e. third-party resource.
Parameters
Name | Type | Description |
---|---|---|
callsPerHour | System.Int64 | The max. number of allowed calls per hour. |
Remarks
The parameter string is expected to hold numeric values only. SetRateLimitPerDay, SetRateLimitPerHour, and SetRateLimitPerMinute are mutually exclusive, hence the last called method determines the rate limiter.
<a name='M-BarbezDotEu-Provider-PoliteProvider-SetRateLimitPerMinute-System-Int64-'></a>
SetRateLimitPerMinute(callsPerMinute) method
Summary
Sets the number of calls per minute as allowed to the provider, i.e. third-party resource.
Parameters
Name | Type | Description |
---|---|---|
callsPerMinute | System.Int64 | The max. number of allowed calls per minute. |
Remarks
The parameter string is expected to hold numeric values only. SetRateLimitPerDay, SetRateLimitPerHour, and SetRateLimitPerMinute are mutually exclusive, hence the last called method determines the rate limiter.
<a name='M-BarbezDotEu-Provider-PoliteProvider-UpdateTimeOfLastCall-System-DateTime-'></a>
UpdateTimeOfLastCall(lastQueryTime) method
Summary
Updates the date and time of when the last call to the provider, i.e. third-party resource, was made.
Parameters
Name | Type | Description |
---|---|---|
lastQueryTime | System.DateTime |
Remarks
It is important to keep updating this number in order to continuously receive a correct answer from the IsPolite method.
<a name='T-BarbezDotEu-Provider-PoliteReponse`1'></a>
PoliteReponse`1 type
Namespace
BarbezDotEu.Provider
Summary
Inherit from parent.
<a name='M-BarbezDotEu-Provider-PoliteReponse`1-#ctor-System-Net-Http-HttpResponseMessage-'></a>
#ctor(httpResponseMessage) constructor
Summary
Constructs a new PoliteReponse`1 from a given HttpResponseMessage.
Parameters
Name | Type | Description |
---|---|---|
httpResponseMessage | System.Net.Http.HttpResponseMessage | The HttpResponseMessage to construct this IPoliteResponse`1 from. |
<a name='P-BarbezDotEu-Provider-PoliteReponse`1-Content'></a>
Content property
Summary
Inherit from parent.
<a name='P-BarbezDotEu-Provider-PoliteReponse`1-HasFailed'></a>
HasFailed property
Summary
Inherit from parent.
<a name='P-BarbezDotEu-Provider-PoliteReponse`1-HttpResponseMessage'></a>
HttpResponseMessage property
Summary
Inherit from parent.
<a name='M-BarbezDotEu-Provider-PoliteReponse1-SetContent-
0-'></a>
SetContent() method
Summary
Inherit from parent.
Parameters
This method has no parameters.
<a name='T-BarbezDotEu-Provider-DTO-PostClientAuthorizeResponse'></a>
PostClientAuthorizeResponse type
Namespace
BarbezDotEu.Provider.DTO
Summary
Implements a client authorization response DTO in accordance to the interface as defined and shared by Vimeo, Twitter, and others.
<a name='P-BarbezDotEu-Provider-DTO-PostClientAuthorizeResponse-AccessToken'></a>
AccessToken property
Summary
Gets or sets the access token.
<a name='P-BarbezDotEu-Provider-DTO-PostClientAuthorizeResponse-Scope'></a>
Scope property
Summary
Gets or sets the authorization scope.
<a name='P-BarbezDotEu-Provider-DTO-PostClientAuthorizeResponse-TokenType'></a>
TokenType property
Summary
Gets or sets the token type.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- BarbezDotEu.Http (>= 2.4.2)
- Microsoft.Extensions.Http (>= 8.0.0)
NuGet packages (5)
Showing the top 5 NuGet packages that depend on BarbezDotEu.Provider:
Package | Downloads |
---|---|
BarbezDotEu.StockTwits
An unofficial, modern, very much work-in-progress client for StockTwits APIs. |
|
BarbezDotEu.Vimeo
An unofficial, modern, very much work-in-progress client for Vimeo APIs. |
|
BarbezDotEu.AlphaVantage
An unofficial, modern, very much work-in-progress client for Alpha Vantage APIs. |
|
BarbezDotEu.Twitter
An unofficial, modern, very much work-in-progress client for Twitter APIs. |
|
BarbezDotEu.TheySaidSo.Quotes.QuoteOfTheDay
An unofficial, modern client for the free "Quote of the day" of the 'They Said So® Famous Quotes API' at quotes.rest. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
9.0.0 | 1,014 | 4/25/2024 |
8.0.2 | 374 | 11/25/2023 |
8.0.1 | 157 | 11/22/2023 |
8.0.0 | 242 | 11/18/2023 |
7.0.0 | 311 | 2/3/2023 |
6.1.0 | 437 | 9/16/2022 |
6.0.0 | 1,104 | 8/23/2022 |
5.1.0-alpha-1 | 151 | 8/23/2022 |
5.1.0-alpha-0 | 147 | 8/23/2022 |
5.0.2 | 1,114 | 5/17/2022 |
5.0.1 | 549 | 5/10/2022 |
5.0.0 | 1,251 | 3/23/2022 |
4.0.0 | 430 | 3/23/2022 |
3.0.4 | 1,268 | 1/30/2022 |
3.0.3 | 789 | 1/8/2022 |
3.0.0 | 474 | 12/2/2021 |
2.2.0 | 770 | 9/12/2021 |
2.1.0 | 367 | 9/12/2021 |
2.1.0-alpha | 266 | 9/12/2021 |
2.0.2 | 803 | 6/7/2021 |
2.0.0 | 746 | 5/22/2021 |