C# Class Microsoft.WindowsAzure.MobileServices.MobileServiceHttpClient

Inheritance: IDisposable
Exibir arquivo Open project: Azure/azure-mobile-apps-net-client Class Usage Examples

Public Properties

Property Type Description
httpHandler System.Net.Http.HttpMessageHandler

Public Methods

Method Description
Dispose ( ) : void

Implemenation of IDisposable

MobileServiceHttpClient ( IEnumerable handlers, Uri applicationUri, string installationId ) : System

Instantiates a new MobileServiceHttpClient, which does all the request to a mobile service.

RequestAsync ( HttpMethod method, string uriPathAndQuery, MobileServiceUser user, HttpContent content, string>.IDictionary requestHeaders, MobileServiceFeatures features = MobileServiceFeatures.None, CancellationToken cancellationToken = default(CancellationToken) ) : Task

Makes an HTTP request that includes the standard Mobile Services headers. It will use an HttpClient with user-defined http handlers.

RequestAsync ( HttpMethod method, string uriPathAndQuery, MobileServiceUser user, string content = null, bool ensureResponseContent = true, string>.IDictionary requestHeaders = null, MobileServiceFeatures features = MobileServiceFeatures.None, CancellationToken cancellationToken = default(CancellationToken) ) : Task

Makes an HTTP request that includes the standard Mobile Services headers. It will use an HttpClient with user-defined http handlers.

RequestWithoutHandlersAsync ( HttpMethod method, string uriPathAndQuery, MobileServiceUser user, string content = null, MobileServiceFeatures features = MobileServiceFeatures.None ) : Task

Performs a web request and includes the standard Mobile Services headers. It will use an HttpClient without any http handlers.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Implemenation of IDisposable for derived classes to use.

Private Methods

Method Description
CreateHttpContent ( string content ) : HttpContent

Creates an HttpContent instance from a string.

CreateHttpRequestMessage ( HttpMethod method, string uriPathAndQuery, string>.IDictionary requestHeaders, HttpContent content, MobileServiceUser user ) : HttpRequestMessage

Creates an HttpRequestMessage with all of the required Mobile Service headers.

CreatePipeline ( IEnumerable handlers ) : HttpMessageHandler

Transform an IEnumerable of HttpMessageHandlers into a chain of HttpMessageHandlers.

GetDefaultHttpClientHandler ( ) : HttpMessageHandler

Returns a default HttpMessageHandler that supports automatic decompression.

GetResponseContent ( HttpResponseMessage response ) : Task

Returns the content from the response as a string.

GetUserAgentHeader ( ) : string

Gets the user-agent header to use with all requests.

RequestAsync ( bool UseHandlers, HttpMethod method, string uriPathAndQuery, MobileServiceUser user, string content = null, bool ensureResponseContent = true, string>.IDictionary requestHeaders = null, CancellationToken cancellationToken = default(CancellationToken) ) : Task

Makes an HTTP request that includes the standard Mobile Services headers. It will use an HttpClient that optionally has user-defined http handlers.

SendRequestAsync ( HttpClient client, HttpRequestMessage request, bool ensureResponseContent, CancellationToken cancellationToken ) : Task

Sends the request with the given client.

ThrowInvalidResponse ( HttpRequestMessage request, HttpResponseMessage response ) : Task

Throws an exception for an invalid response to a web request.

Method Details

Dispose() public method

Implemenation of IDisposable
public Dispose ( ) : void
return void

Dispose() protected method

Implemenation of IDisposable for derived classes to use.
protected Dispose ( bool disposing ) : void
disposing bool /// Indicates if being called from the Dispose() method /// or the finalizer. ///
return void

MobileServiceHttpClient() public method

Instantiates a new MobileServiceHttpClient, which does all the request to a mobile service.
public MobileServiceHttpClient ( IEnumerable handlers, Uri applicationUri, string installationId ) : System
handlers IEnumerable /// Chain of instances. /// All but the last should be s. ///
applicationUri System.Uri /// The URI for the Microsoft Azure Mobile Service. ///
installationId string /// The installation id of the application. ///
return System

RequestAsync() public method

Makes an HTTP request that includes the standard Mobile Services headers. It will use an HttpClient with user-defined http handlers.
public RequestAsync ( HttpMethod method, string uriPathAndQuery, MobileServiceUser user, HttpContent content, string>.IDictionary requestHeaders, MobileServiceFeatures features = MobileServiceFeatures.None, CancellationToken cancellationToken = default(CancellationToken) ) : Task
method HttpMethod /// The HTTP method used to request the resource. ///
uriPathAndQuery string /// The URI of the resource to request (relative to the Mobile Services /// runtime). ///
user MobileServiceUser /// The object representing the user on behalf of whom the request will be sent. ///
content System.Net.Http.HttpContent /// Content to send to the resource. ///
requestHeaders string>.IDictionary /// Additional request headers to include with the request. ///
features MobileServiceFeatures /// Value indicating which features of the SDK are being used in this call. Useful for telemetry. ///
cancellationToken System.Threading.CancellationToken The token to observe
return Task

RequestAsync() public method

Makes an HTTP request that includes the standard Mobile Services headers. It will use an HttpClient with user-defined http handlers.
public RequestAsync ( HttpMethod method, string uriPathAndQuery, MobileServiceUser user, string content = null, bool ensureResponseContent = true, string>.IDictionary requestHeaders = null, MobileServiceFeatures features = MobileServiceFeatures.None, CancellationToken cancellationToken = default(CancellationToken) ) : Task
method HttpMethod /// The HTTP method used to request the resource. ///
uriPathAndQuery string /// The URI of the resource to request (relative to the Mobile Services /// runtime). ///
user MobileServiceUser /// The object representing the user on behalf of whom the request will be sent. ///
content string /// Optional content to send to the resource. ///
ensureResponseContent bool /// Optional parameter to indicate if the response should include content. ///
requestHeaders string>.IDictionary /// Additional request headers to include with the request. ///
features MobileServiceFeatures /// Value indicating which features of the SDK are being used in this call. Useful for telemetry. ///
cancellationToken System.Threading.CancellationToken The token to observe
return Task

RequestWithoutHandlersAsync() public method

Performs a web request and includes the standard Mobile Services headers. It will use an HttpClient without any http handlers.
public RequestWithoutHandlersAsync ( HttpMethod method, string uriPathAndQuery, MobileServiceUser user, string content = null, MobileServiceFeatures features = MobileServiceFeatures.None ) : Task
method HttpMethod /// The HTTP method used to request the resource. ///
uriPathAndQuery string /// The URI of the resource to request (relative to the Mobile Services /// runtime). ///
user MobileServiceUser /// The object representing the user on behalf of whom the request will be sent. ///
content string /// Optional content to send to the resource. ///
features MobileServiceFeatures /// Optional MobileServiceFeatures used for telemetry purpose. ///
return Task

Property Details

httpHandler public_oe property

Represents a handler used to process HTTP requests and responses associated with the Mobile Service.
public HttpMessageHandler,System.Net.Http httpHandler
return System.Net.Http.HttpMessageHandler