C# Class PocketCampus.Main.Services.HttpClient

An HTTP client able to make GET and POST requests.
Inheritance: IHttpClient
Datei anzeigen Open project: accandme/pocketcampus

Public Methods

Method Description
DownloadAsync ( string url ) : Task

Asynchronously downloads a file as a byte array from the specified URL.

GetAsync ( string url, string>.IDictionary parameters = null, Encoding encoding = null ) : Task

Asynchronously gets a web page (using a GET query).

PostAsync ( string url, string>.IDictionary parameters, Encoding encoding = null ) : Task

Asynchronously posts the specified query to the specified URL (using a POST query).

Private Methods

Method Description
GetParametersString ( string>.IDictionary parameters ) : string

Transforms GET parameters into a string.

HttpClient ( ) : System

Initializes static members of HttpClient.

ProcessResponseAsync ( HttpResponseMessage response, Encoding encoding ) : Task

Asynchronously processes an HTTP response message, ensuring it was successful and extracting its content.

Method Details

DownloadAsync() public method

Asynchronously downloads a file as a byte array from the specified URL.
public DownloadAsync ( string url ) : Task
url string
return Task

GetAsync() public method

Asynchronously gets a web page (using a GET query).
public GetAsync ( string url, string>.IDictionary parameters = null, Encoding encoding = null ) : Task
url string The web page URL.
parameters string>.IDictionary Optional. The query parameters.
encoding System.Text.Encoding
return Task

PostAsync() public method

Asynchronously posts the specified query to the specified URL (using a POST query).
public PostAsync ( string url, string>.IDictionary parameters, Encoding encoding = null ) : Task
url string The query URL.
parameters string>.IDictionary The query parameters.
encoding System.Text.Encoding
return Task