Class CloudClient
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
- clientIdstring
- The NativeConfidential client Id with which to authenticate. 
- clientSecretstring
- The NativeConfidential client secret with which to authenticate. 
Exceptions
- ArgumentNullException
- Thrown when the - clientIdor- clientSecretis 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
ClientSecret
A GIS Server NativeConfidential client secret.
public string ClientSecret { get; set; }Property Value
TimeoutInSeconds
The request timeout, default 100 seconds
public int TimeoutInSeconds { get; set; }Property Value
WebProxy
The proxy used for requesting a Web Response.
public IWebProxy WebProxy { get; set; }Property Value
Methods
AuthenticateWebRequest(WebRequest)
Apply token to header of the webRequest
protected void AuthenticateWebRequest(WebRequest webRequest)Parameters
- webRequestWebRequest
- The webRequest which need to apply token to header 
AuthenticateWebRequestAsync(WebRequest)
Apply token to header of the webRequest
protected Task AuthenticateWebRequestAsync(WebRequest webRequest)Parameters
- webRequestWebRequest
- The webRequest which need to apply token to header 
Returns
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
GetTokenCore()
protected virtual string GetTokenCore()Returns
GetTokenCoreAsync()
Get an AccessToken from server.
protected virtual Task<string> GetTokenCoreAsync()Returns
OnGettingAccessToken(GettingAccessTokenEventArgs)
Occurs before getting an AccessToken.
protected virtual void OnGettingAccessToken(GettingAccessTokenEventArgs e)Parameters
- eGettingAccessTokenEventArgs
- Event argument for GettingAccessToken event. 
OnSendingWebRequest(SendingWebRequestEventArgs)
Occurs before sending a web request.
protected virtual void OnSendingWebRequest(SendingWebRequestEventArgs e)Parameters
- eSendingWebRequestEventArgs
- Event argument for SendingWebRequest event. 
OnSentWebRequest(SentWebRequestEventArgs)
Occurs after the response of a web request is gotten.
protected virtual void OnSentWebRequest(SentWebRequestEventArgs e)Parameters
- eSentWebRequestEventArgs
- 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
- webRequestWebRequest
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
- webRequestWebRequest
Returns
- Task<WebResponse>
- The HTTP response. 
Events
GettingAccessToken
Occurs before getting an AccessToken.
public event EventHandler<GettingAccessTokenEventArgs> GettingAccessTokenEvent Type
SendingWebRequest
Occurs before sending a web request.
public event EventHandler<SendingWebRequestEventArgs> SendingWebRequestEvent Type
SentWebRequest
Occurs after the response of a web request is gotten.
public event EventHandler<SentWebRequestEventArgs> SentWebRequest