docs.unity3d.com
    Show / Hide Table of Contents

    Class ServiceHttpClient

    An implementation of an HTTP client which abstracts the Task of sending HttpRequestMessage.

    Inheritance
    Object
    ServiceHttpClient
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Unity.Cloud.Common
    Syntax
    public class ServiceHttpClient : IServiceHttpClient, IHttpClient

    Constructors

    ServiceHttpClient(IHttpClient, IAccessTokenProvider, IAppIdProvider)

    Initializes and returns an instance of ServiceHttpClient

    Declaration
    public ServiceHttpClient(IHttpClient baseHttpClient, IAccessTokenProvider accessTokenProvider, IAppIdProvider appIdProvider)
    Parameters
    Type Name Description
    IHttpClient baseHttpClient

    The base HTTP client.

    IAccessTokenProvider accessTokenProvider

    The access token provider to authenticate requests.

    IAppIdProvider appIdProvider

    The App ID provider.

    Properties

    Timeout

    The timespan to wait before the request times out.

    Declaration
    public TimeSpan Timeout { get; set; }
    Property Value
    Type Description
    TimeSpan
    Implements
    IHttpClient.Timeout

    Methods

    SendAsync(HttpRequestMessage, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)

    Sends an asynchronous HTTP request.

    Declaration
    public Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, IProgress<HttpProgress> progress, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    HttpRequestMessage request

    The request to be sent.

    HttpCompletionOption completionOption

    When the operation should complete.

    IProgress<HttpProgress> progress

    The progress provider.

    CancellationToken cancellationToken

    Cancellation token that will try to cancel the operation.

    Returns
    Type Description
    Task<HttpResponseMessage>

    A task that will hold the HttpResponseMessage once the request is completed

    Implements
    IHttpClient.SendAsync(HttpRequestMessage, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when the request is null.

    HttpRequestException

    Thrown when an HTTP response can't be obtained from the server.

    OperationCanceledException

    Thrown when the request is cancelled by a cancellation token.

    TimeoutException

    Thrown when the request failed due to timeout.

    SendAsync(HttpRequestMessage, ServiceHttpClientOptions, IProgress<HttpProgress>, CancellationToken)

    Declaration
    public async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, ServiceHttpClientOptions options, IProgress<HttpProgress> progress, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    HttpRequestMessage request
    ServiceHttpClientOptions options
    IProgress<HttpProgress> progress
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<HttpResponseMessage>

    SendAsync(HttpRequestMessage, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)

    Send an asynchronous HTTP request.

    Declaration
    public async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, ServiceHttpClientOptions options, HttpCompletionOption completionOption, IProgress<HttpProgress> progress, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    HttpRequestMessage request

    The request to be sent.

    ServiceHttpClientOptions options

    The options for the client.

    HttpCompletionOption completionOption

    When the operation should complete.

    IProgress<HttpProgress> progress

    The progress provider.

    CancellationToken cancellationToken

    Optional cancellation token that will try to cancel the operation.

    Returns
    Type Description
    Task<HttpResponseMessage>

    A task that will hold the HttpResponseMessage once the request is completed

    Implements
    IServiceHttpClient.SendAsync(HttpRequestMessage, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when the request is null.

    HttpRequestException

    Thrown when an HTTP response can't be obtained from the server.

    OperationCanceledException

    Thrown when the request is cancelled by a cancellation token.

    TimeoutException

    Thrown when the request failed due to timeout.

    Extension Methods

    HttpClientExtensions.SendAsync(IHttpClient, HttpRequestMessage)
    HttpClientExtensions.SendAsync(IHttpClient, HttpRequestMessage, CancellationToken)
    HttpClientExtensions.SendAsync(IHttpClient, HttpRequestMessage, HttpCompletionOption)
    HttpClientExtensions.SendAsync(IHttpClient, HttpRequestMessage, HttpCompletionOption, CancellationToken)
    HttpClientExtensions.GetAsync(IHttpClient, String, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    HttpClientExtensions.GetAsync(IHttpClient, Uri, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    HttpClientExtensions.PostAsync(IHttpClient, String, HttpContent, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    HttpClientExtensions.PostAsync(IHttpClient, Uri, HttpContent, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    HttpClientExtensions.PutAsync(IHttpClient, String, HttpContent, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    HttpClientExtensions.PutAsync(IHttpClient, Uri, HttpContent, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    HttpClientExtensions.PatchAsync(IHttpClient, String, HttpContent, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    HttpClientExtensions.PatchAsync(IHttpClient, Uri, HttpContent, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    HttpClientExtensions.DeleteAsync(IHttpClient, String, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    HttpClientExtensions.DeleteAsync(IHttpClient, Uri, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    HttpClientExtensions.DeleteAsync(IHttpClient, String, HttpContent, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    HttpClientExtensions.DeleteAsync(IHttpClient, Uri, HttpContent, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    HttpClientExtensions.WithApiSourceHeaders(IHttpClient, String, String)
    HttpClientExtensions.WithApiSourceHeadersFromAssembly(IHttpClient, Assembly)
    HttpClientJsonExtensions.GetJsonAsync<TModel>(IHttpClient, String, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    HttpClientJsonExtensions.PostJsonAsync<TModel>(IHttpClient, String, Object, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    HttpClientJsonExtensions.PutJsonAsync<TModel>(IHttpClient, String, Object, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    HttpClientJsonExtensions.PatchJsonAsync<TModel>(IHttpClient, String, Object, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    HttpClientJsonExtensions.DeleteJsonAsync<TModel>(IHttpClient, String, Object, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    HttpClientJsonExtensions.DeleteJsonAsync(IHttpClient, String, Object, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    ServiceHttpClientExtensions.SendAsync(IServiceHttpClient, HttpRequestMessage, ServiceHttpClientOptions)
    ServiceHttpClientExtensions.SendAsync(IServiceHttpClient, HttpRequestMessage, ServiceHttpClientOptions, CancellationToken)
    ServiceHttpClientExtensions.SendAsync(IServiceHttpClient, HttpRequestMessage, ServiceHttpClientOptions, HttpCompletionOption)
    ServiceHttpClientExtensions.SendAsync(IServiceHttpClient, HttpRequestMessage, ServiceHttpClientOptions, HttpCompletionOption, CancellationToken)
    ServiceHttpClientExtensions.GetAsync(IServiceHttpClient, String, ServiceHttpClientOptions)
    ServiceHttpClientExtensions.GetAsync(IServiceHttpClient, String, ServiceHttpClientOptions, CancellationToken)
    ServiceHttpClientExtensions.GetAsync(IServiceHttpClient, String, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    ServiceHttpClientExtensions.GetAsync(IServiceHttpClient, Uri, ServiceHttpClientOptions)
    ServiceHttpClientExtensions.GetAsync(IServiceHttpClient, Uri, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    ServiceHttpClientExtensions.GetAsync(IServiceHttpClient, Uri, ServiceHttpClientOptions, CancellationToken)
    ServiceHttpClientExtensions.PostAsync(IServiceHttpClient, String, HttpContent, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    ServiceHttpClientExtensions.PostAsync(IServiceHttpClient, String, HttpContent, ServiceHttpClientOptions, CancellationToken)
    ServiceHttpClientExtensions.PostAsync(IServiceHttpClient, String, HttpContent, ServiceHttpClientOptions)
    ServiceHttpClientExtensions.PostAsync(IServiceHttpClient, Uri, HttpContent, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    ServiceHttpClientExtensions.PostAsync(IServiceHttpClient, Uri, HttpContent, ServiceHttpClientOptions, CancellationToken)
    ServiceHttpClientExtensions.PostAsync(IServiceHttpClient, Uri, HttpContent, ServiceHttpClientOptions)
    ServiceHttpClientExtensions.PatchAsync(IServiceHttpClient, String, HttpContent, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    ServiceHttpClientExtensions.PatchAsync(IServiceHttpClient, String, HttpContent, ServiceHttpClientOptions, CancellationToken)
    ServiceHttpClientExtensions.PatchAsync(IServiceHttpClient, String, HttpContent, ServiceHttpClientOptions)
    ServiceHttpClientExtensions.PatchAsync(IServiceHttpClient, Uri, HttpContent, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    ServiceHttpClientExtensions.PatchAsync(IServiceHttpClient, Uri, HttpContent, ServiceHttpClientOptions, CancellationToken)
    ServiceHttpClientExtensions.PatchAsync(IServiceHttpClient, Uri, HttpContent, ServiceHttpClientOptions)
    ServiceHttpClientExtensions.PutAsync(IServiceHttpClient, String, HttpContent, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    ServiceHttpClientExtensions.PutAsync(IServiceHttpClient, String, HttpContent, ServiceHttpClientOptions, CancellationToken)
    ServiceHttpClientExtensions.PutAsync(IServiceHttpClient, String, HttpContent, ServiceHttpClientOptions)
    ServiceHttpClientExtensions.PutAsync(IServiceHttpClient, Uri, HttpContent, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    ServiceHttpClientExtensions.PutAsync(IServiceHttpClient, Uri, HttpContent, ServiceHttpClientOptions, CancellationToken)
    ServiceHttpClientExtensions.PutAsync(IServiceHttpClient, Uri, HttpContent, ServiceHttpClientOptions)
    ServiceHttpClientExtensions.DeleteAsync(IServiceHttpClient, String, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    ServiceHttpClientExtensions.DeleteAsync(IServiceHttpClient, String, ServiceHttpClientOptions, CancellationToken)
    ServiceHttpClientExtensions.DeleteAsync(IServiceHttpClient, String, ServiceHttpClientOptions)
    ServiceHttpClientExtensions.DeleteAsync(IServiceHttpClient, Uri, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    ServiceHttpClientExtensions.DeleteAsync(IServiceHttpClient, Uri, ServiceHttpClientOptions, CancellationToken)
    ServiceHttpClientExtensions.DeleteAsync(IServiceHttpClient, Uri, ServiceHttpClientOptions)
    ServiceHttpClientExtensions.DeleteAsync(IServiceHttpClient, String, HttpContent, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    ServiceHttpClientExtensions.DeleteAsync(IServiceHttpClient, String, HttpContent, ServiceHttpClientOptions, CancellationToken)
    ServiceHttpClientExtensions.DeleteAsync(IServiceHttpClient, String, HttpContent, ServiceHttpClientOptions)
    ServiceHttpClientExtensions.DeleteAsync(IServiceHttpClient, Uri, HttpContent, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
    ServiceHttpClientExtensions.DeleteAsync(IServiceHttpClient, Uri, HttpContent, ServiceHttpClientOptions, CancellationToken)
    ServiceHttpClientExtensions.DeleteAsync(IServiceHttpClient, Uri, HttpContent, ServiceHttpClientOptions)
    ServiceHttpClientExtensions.WithApiSourceHeaders(IServiceHttpClient, String, String)
    ServiceHttpClientExtensions.WithApiSourceHeadersFromAssembly(IServiceHttpClient, Assembly)
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023