Table of Contents

Class CloudClient

Namespace
ThinkGeo.Core
Assembly
ThinkGeo.Core.dll

A base class that handles the underlying authentication and communication with the GIS Server.

public abstract class CloudClient : IDisposable
Inheritance
CloudClient
Implements
Derived
Inherited Members

Remarks

A base class that handles the underlying authentication and communication with the GIS Server.

Constructors

CloudClient()

This method is the default protected constructor. You need apply client Id and secret by properties.

protected CloudClient()

CloudClient(string, string)

This method is the default protected constructor with a NativeConfidential client ID and secret. It will send a request to the GIS Server to acquire an access token, which will then be added to the Header for all future requests.

protected CloudClient(string clientId, string clientSecret)

Parameters

clientId string

The NativeConfidential client Id with which to authenticate.

clientSecret string

The NativeConfidential client secret with which to authenticate.

Exceptions

ArgumentNullException

Thrown when the clientId or clientSecret is null.

Properties

BaseUris

Candidate Gis Server Uris. This collection must have one uri at least before sending any request.

public Collection<Uri> BaseUris { get; }

Property Value

Collection<Uri>

ClientId

A GIS Server NativeConfidential client ID.

public string ClientId { get; set; }

Property Value

string

ClientSecret

A GIS Server NativeConfidential client secret.

public string ClientSecret { get; set; }

Property Value

string

TimeoutInSeconds

The request timeout, default 100 seconds

public int TimeoutInSeconds { get; set; }

Property Value

int

WebProxy

The proxy used for requesting a Web Response.

public IWebProxy WebProxy { get; set; }

Property Value

IWebProxy

Methods

AuthenticateWebRequest(WebRequest)

Apply token to header of the webRequest

protected void AuthenticateWebRequest(WebRequest webRequest)

Parameters

webRequest WebRequest

The webRequest which need to apply token to header

AuthenticateWebRequestAsync(WebRequest)

Apply token to header of the webRequest

protected Task AuthenticateWebRequestAsync(WebRequest webRequest)

Parameters

webRequest WebRequest

The webRequest which need to apply token to header

Returns

Task

Dispose()

Disposes BaseClient class.

public virtual void Dispose()

GetNextCandidateBaseUri()

Get a Gis Server uri in BaseUris by polling way

protected string GetNextCandidateBaseUri()

Returns

string

A Gis Server uri

GetNextCandidateBaseUriCore()

Get a Gis Server uri in BaseUris by polling method

protected virtual string GetNextCandidateBaseUriCore()

Returns

string

A Gis Server uri

GetToken()

Get an AccessToken from server.

protected string GetToken()

Returns

string

The AccessToken from server. if the request is canceled by user, return null

GetTokenAsync()

Get an AccessToken from server.

protected Task<string> GetTokenAsync()

Returns

Task<string>

The AccessToken from server. if the request is canceled by user, return null

GetTokenCore()

protected virtual string GetTokenCore()

Returns

string

GetTokenCoreAsync()

Get an AccessToken from server.

protected virtual Task<string> GetTokenCoreAsync()

Returns

Task<string>

The AccessToken from server. if the request is canceled by user, return null

OnGettingAccessToken(GettingAccessTokenEventArgs)

Occurs before getting an AccessToken.

protected virtual void OnGettingAccessToken(GettingAccessTokenEventArgs e)

Parameters

e GettingAccessTokenEventArgs

Event argument for GettingAccessToken event.

OnSendingWebRequest(SendingWebRequestEventArgs)

Occurs before sending a web request.

protected virtual void OnSendingWebRequest(SendingWebRequestEventArgs e)

Parameters

e SendingWebRequestEventArgs

Event argument for SendingWebRequest event.

OnSentWebRequest(SentWebRequestEventArgs)

Occurs after the response of a web request is gotten.

protected virtual void OnSentWebRequest(SentWebRequestEventArgs e)

Parameters

e SentWebRequestEventArgs

Event argument for SentWebRequest event.

SendWebRequest(WebRequest)

Send the web request, the access token will be added to web request header.

protected WebResponse SendWebRequest(WebRequest webRequest)

Parameters

webRequest WebRequest

Returns

WebResponse

The HTTP response.

SendWebRequestAsync(WebRequest)

Send the web request asynchronously, the access token will be added to web request header.

protected Task<WebResponse> SendWebRequestAsync(WebRequest webRequest)

Parameters

webRequest WebRequest

Returns

Task<WebResponse>

The HTTP response.

Events

GettingAccessToken

Occurs before getting an AccessToken.

public event EventHandler<GettingAccessTokenEventArgs> GettingAccessToken

Event Type

EventHandler<GettingAccessTokenEventArgs>

SendingWebRequest

Occurs before sending a web request.

public event EventHandler<SendingWebRequestEventArgs> SendingWebRequest

Event Type

EventHandler<SendingWebRequestEventArgs>

SentWebRequest

Occurs after the response of a web request is gotten.

public event EventHandler<SentWebRequestEventArgs> SentWebRequest

Event Type

EventHandler<SentWebRequestEventArgs>