Class HttpService
- Namespace
- Akavache
- Assembly
- Akavache.dll
Provides a default implementation of HTTP service functionality for Akavache.
- Inheritance
-
Http
Service
- Implements
- Derived
- Extension Methods
Constructors
HttpService()
Initializes a new instance of the Http
Properties
HttpClient
Gets or sets the HTTP client used for making web requests.
Property Value
Methods
DownloadUrl(IBlobCache, string, HttpMethod?, IEnumerable<KeyValuePair<string, string>>?, bool, DateTimeOffset?)
Downloads data from a URL and caches it, using the URL as the cache key.
public IObservable<byte[]> DownloadUrl(IBlobCache blobCache, string url, HttpMethod? method = null, IEnumerable<KeyValuePair<string, string>>? headers = null, bool fetchAlways = false, DateTimeOffset? absoluteExpiration = null)
Parameters
blobCacheIBlobCache The blob cache to store the downloaded data.
urlstringThe URL to download from.
methodHttpMethod The HTTP method to use for the request.
headersIEnumerable<KeyValue <string, string>>Pair Optional HTTP headers to include in the request.
fetchAlwaysboolA value indicating whether to always fetch from the web, bypassing the cache.
absoluteExpirationDateTime ?Offset An optional expiration date for the cached data.
Returns
- IObservable<byte[]>
An observable that emits the downloaded byte data.
DownloadUrl(IBlobCache, string, string, HttpMethod?, IEnumerable<KeyValuePair<string, string>>?, bool, DateTimeOffset?)
Downloads data from a URL and caches it using a custom cache key.
public IObservable<byte[]> DownloadUrl(IBlobCache blobCache, string key, string url, HttpMethod? method = null, IEnumerable<KeyValuePair<string, string>>? headers = null, bool fetchAlways = false, DateTimeOffset? absoluteExpiration = null)
Parameters
blobCacheIBlobCache The blob cache to store the downloaded data.
keystringThe custom key to use for the cache entry.
urlstringThe URL to download from.
methodHttpMethod The HTTP method to use for the request.
headersIEnumerable<KeyValue <string, string>>Pair Optional HTTP headers to include in the request.
fetchAlwaysboolA value indicating whether to always fetch from the web, bypassing the cache.
absoluteExpirationDateTime ?Offset An optional expiration date for the cached data.
Returns
- IObservable<byte[]>
An observable that emits the downloaded byte data.
DownloadUrl(IBlobCache, string, Uri, HttpMethod?, IEnumerable<KeyValuePair<string, string>>?, bool, DateTimeOffset?)
Downloads data from a URL and caches it using a custom cache key.
public IObservable<byte[]> DownloadUrl(IBlobCache blobCache, string key, Uri url, HttpMethod? method = null, IEnumerable<KeyValuePair<string, string>>? headers = null, bool fetchAlways = false, DateTimeOffset? absoluteExpiration = null)
Parameters
blobCacheIBlobCache The blob cache to store the downloaded data.
keystringThe custom key to use for the cache entry.
urlUriThe URL to download from.
methodHttpMethod The HTTP method to use for the request.
headersIEnumerable<KeyValue <string, string>>Pair Optional HTTP headers to include in the request.
fetchAlwaysboolA value indicating whether to always fetch from the web, bypassing the cache.
absoluteExpirationDateTime ?Offset An optional expiration date for the cached data.
Returns
- IObservable<byte[]>
An observable that emits the downloaded byte data.
DownloadUrl(IBlobCache, Uri, HttpMethod?, IEnumerable<KeyValuePair<string, string>>?, bool, DateTimeOffset?)
Downloads data from a URL and caches it, using the URL as the cache key.
public IObservable<byte[]> DownloadUrl(IBlobCache blobCache, Uri url, HttpMethod? method = null, IEnumerable<KeyValuePair<string, string>>? headers = null, bool fetchAlways = false, DateTimeOffset? absoluteExpiration = null)
Parameters
blobCacheIBlobCache The blob cache to store the downloaded data.
urlUriThe URL to download from.
methodHttpMethod The HTTP method to use for the request.
headersIEnumerable<KeyValue <string, string>>Pair Optional HTTP headers to include in the request.
fetchAlwaysboolA value indicating whether to always fetch from the web, bypassing the cache.
absoluteExpirationDateTime ?Offset An optional expiration date for the cached data.
Returns
- IObservable<byte[]>
An observable that emits the downloaded byte data.
MakeWebRequest(Uri, HttpMethod, IEnumerable<KeyValuePair<string, string>>?, string?, int, TimeSpan?)
Makes a web request to the specified URI.
protected virtual IObservable<HttpResponseMessage> MakeWebRequest(Uri uri, HttpMethod method, IEnumerable<KeyValuePair<string, string>>? headers = null, string? content = null, int retries = 3, TimeSpan? timeout = null)
Parameters
uriUriThe URI to make the request to.
methodHttpMethod The HTTP method to use for the request.
headersIEnumerable<KeyValue <string, string>>Pair Optional HTTP headers to include in the request.
contentstringOptional content to send with the request.
retriesintThe number of retry attempts for failed requests.
timeoutTimeSpan ?The timeout duration for the request.
Returns
- IObservable<Http
Response >Message An observable that emits the HTTP response message.