Table of Contents

Class HttpService

Namespace
Akavache
Assembly
Akavache.dll

Provides a default implementation of HTTP service functionality for Akavache.

public class HttpService : IHttpService
Inheritance
HttpService
Implements
Derived
Extension Methods
WhenAnyMixin.WhenAny<TSender, TRet, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(TSender?, Expression<Func<TSender, T1>>, Expression<Func<TSender, T2>>, Expression<Func<TSender, T3>>, Expression<Func<TSender, T4>>, Expression<Func<TSender, T5>>, Expression<Func<TSender, T6>>, Expression<Func<TSender, T7>>, Expression<Func<TSender, T8>>, Expression<Func<TSender, T9>>, Expression<Func<TSender, T10>>, Expression<Func<TSender, T11>>, Expression<Func<TSender, T12>>, Func<IObservedChange<TSender, T1>, IObservedChange<TSender, T2>, IObservedChange<TSender, T3>, IObservedChange<TSender, T4>, IObservedChange<TSender, T5>, IObservedChange<TSender, T6>, IObservedChange<TSender, T7>, IObservedChange<TSender, T8>, IObservedChange<TSender, T9>, IObservedChange<TSender, T10>, IObservedChange<TSender, T11>, IObservedChange<TSender, T12>, TRet>)
WhenAnyMixin.WhenAny<TSender, TRet, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(TSender?, Expression<Func<TSender, T1>>, Expression<Func<TSender, T2>>, Expression<Func<TSender, T3>>, Expression<Func<TSender, T4>>, Expression<Func<TSender, T5>>, Expression<Func<TSender, T6>>, Expression<Func<TSender, T7>>, Expression<Func<TSender, T8>>, Expression<Func<TSender, T9>>, Expression<Func<TSender, T10>>, Expression<Func<TSender, T11>>, Expression<Func<TSender, T12>>, Func<IObservedChange<TSender, T1>, IObservedChange<TSender, T2>, IObservedChange<TSender, T3>, IObservedChange<TSender, T4>, IObservedChange<TSender, T5>, IObservedChange<TSender, T6>, IObservedChange<TSender, T7>, IObservedChange<TSender, T8>, IObservedChange<TSender, T9>, IObservedChange<TSender, T10>, IObservedChange<TSender, T11>, IObservedChange<TSender, T12>, TRet>, bool)

Constructors

HttpService()

Initializes a new instance of the HttpService class.

public HttpService()

Properties

HttpClient

Gets or sets the HTTP client used for making web requests.

public HttpClient HttpClient { get; set; }

Property Value

HttpClient

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

blobCache IBlobCache

The blob cache to store the downloaded data.

url string

The URL to download from.

method HttpMethod

The HTTP method to use for the request.

headers IEnumerable<KeyValuePair<string, string>>

Optional HTTP headers to include in the request.

fetchAlways bool

A value indicating whether to always fetch from the web, bypassing the cache.

absoluteExpiration DateTimeOffset?

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

blobCache IBlobCache

The blob cache to store the downloaded data.

key string

The custom key to use for the cache entry.

url string

The URL to download from.

method HttpMethod

The HTTP method to use for the request.

headers IEnumerable<KeyValuePair<string, string>>

Optional HTTP headers to include in the request.

fetchAlways bool

A value indicating whether to always fetch from the web, bypassing the cache.

absoluteExpiration DateTimeOffset?

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

blobCache IBlobCache

The blob cache to store the downloaded data.

key string

The custom key to use for the cache entry.

url Uri

The URL to download from.

method HttpMethod

The HTTP method to use for the request.

headers IEnumerable<KeyValuePair<string, string>>

Optional HTTP headers to include in the request.

fetchAlways bool

A value indicating whether to always fetch from the web, bypassing the cache.

absoluteExpiration DateTimeOffset?

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

blobCache IBlobCache

The blob cache to store the downloaded data.

url Uri

The URL to download from.

method HttpMethod

The HTTP method to use for the request.

headers IEnumerable<KeyValuePair<string, string>>

Optional HTTP headers to include in the request.

fetchAlways bool

A value indicating whether to always fetch from the web, bypassing the cache.

absoluteExpiration DateTimeOffset?

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

uri Uri

The URI to make the request to.

method HttpMethod

The HTTP method to use for the request.

headers IEnumerable<KeyValuePair<string, string>>

Optional HTTP headers to include in the request.

content string

Optional content to send with the request.

retries int

The number of retry attempts for failed requests.

timeout TimeSpan?

The timeout duration for the request.

Returns

IObservable<HttpResponseMessage>

An observable that emits the HTTP response message.