Google API Client Library for .NET  1.10.0
Classes | Public Member Functions | Public Attributes | Protected Member Functions | Properties | List of all members
Google.Apis.Services.BaseClientService Class Reference

A base class for a client service which provides common mechanism for all services, like serialization and GZip support. It should be safe to use a single service instance to make server requests concurrently from multiple threads. This class adds a special Google.Apis.Http.IHttpExecuteInterceptor to the Google.Apis.Http.ConfigurableMessageHandler execute interceptor list, which uses the given Authenticator. It calls to its applying authentication method, and injects the "Authorization" header in the request. If the given Authenticator implements Google.Apis.Http.IHttpUnsuccessfulResponseHandler, this class adds the Authenticator to the Google.Apis.Http.ConfigurableMessageHandler's unsuccessful response handler list. More...

Inheritance diagram for Google.Apis.Services.BaseClientService:
Google.Apis.Services.IClientService

Classes

class  Initializer
 An initializer class for the client service. More...
 

Public Member Functions

void SetRequestSerailizedContent (HttpRequestMessage request, object body)
 Sets the content of the request by the given body and the this service's configuration. First the body object is serialized by the Serializer and then, if GZip is enabled, the content will be wrapped in a GZip stream, otherwise a regular string stream will be used. More...
 
virtual string SerializeObject (object obj)
 Serializes an object into a string representation. More...
 
virtual async Task< T > DeserializeResponse< T > (HttpResponseMessage response)
 Deserializes a response into the specified object. More...
 
virtual async Task< RequestErrorDeserializeError (HttpResponseMessage response)
 Deserializes an error response into a RequestError object. More...
 
virtual void Dispose ()
 

Public Attributes

const uint DefaultMaxUrlLength = 2048
 The default maximum allowed length of a URL string for GET requests. More...
 

Protected Member Functions

 BaseClientService (Initializer initializer)
 Constructs a new base client with the specified initializer. More...
 
virtual BackOffHandler CreateBackOffHandler ()
 Creates the back-off handler with Google.Apis.Util.ExponentialBackOff. Overrides this method to change the default behavior of back-off handler (e.g. you can change the maximum waited request's time span, or create a back-off handler with you own implementation of Google.Apis.Util.IBackOff). More...
 

Properties

ConfigurableHttpClient HttpClient [get, set]
 
IConfigurableHttpClientInitializer HttpClientInitializer [get, set]
 
bool GZipEnabled [get, set]
 
string ApiKey [get, set]
 
string ApplicationName [get, set]
 
ISerializer Serializer [get, set]
 
abstract string Name [get]
 
abstract string BaseUri [get]
 
abstract string BasePath [get]
 
abstract IList< string > Features [get]
 
- Properties inherited from Google.Apis.Services.IClientService
ConfigurableHttpClient HttpClient [get]
 Gets the HTTP client which is used to create requests. More...
 
IConfigurableHttpClientInitializer HttpClientInitializer [get]
 Gets a HTTP client initializer which is able to custom properties on Google.Apis.Http.ConfigurableHttpClient and Google.Apis.Http.ConfigurableMessageHandler. More...
 
string Name [get]
 Gets the service name. More...
 
string BaseUri [get]
 Gets the BaseUri of the service. All request paths should be relative to this URI. More...
 
string BasePath [get]
 Gets the BasePath of the service. More...
 
IList< string > Features [get]
 Gets the supported features by this service. More...
 
bool GZipEnabled [get]
 Gets or sets whether this service supports GZip. More...
 
string ApiKey [get]
 Gets the API-Key (DeveloperKey) which this service uses for all requests. More...
 
string ApplicationName [get]
 Gets the application name to be used in the User-Agent header. More...
 
ISerializer Serializer [get]
 Gets the Serializer used by this service. More...
 

Detailed Description

A base class for a client service which provides common mechanism for all services, like serialization and GZip support. It should be safe to use a single service instance to make server requests concurrently from multiple threads. This class adds a special Google.Apis.Http.IHttpExecuteInterceptor to the Google.Apis.Http.ConfigurableMessageHandler execute interceptor list, which uses the given Authenticator. It calls to its applying authentication method, and injects the "Authorization" header in the request. If the given Authenticator implements Google.Apis.Http.IHttpUnsuccessfulResponseHandler, this class adds the Authenticator to the Google.Apis.Http.ConfigurableMessageHandler's unsuccessful response handler list.

Constructor & Destructor Documentation

Google.Apis.Services.BaseClientService.BaseClientService ( Initializer  initializer)
inlineprotected

Constructs a new base client with the specified initializer.

Member Function Documentation

virtual BackOffHandler Google.Apis.Services.BaseClientService.CreateBackOffHandler ( )
inlineprotectedvirtual

Creates the back-off handler with Google.Apis.Util.ExponentialBackOff. Overrides this method to change the default behavior of back-off handler (e.g. you can change the maximum waited request's time span, or create a back-off handler with you own implementation of Google.Apis.Util.IBackOff).

virtual async Task<RequestError> Google.Apis.Services.BaseClientService.DeserializeError ( HttpResponseMessage  response)
inlinevirtual

Deserializes an error response into a RequestError object.

Exceptions
GoogleApiExceptionIf no error is found in the response.

Implements Google.Apis.Services.IClientService.

virtual async Task<T> Google.Apis.Services.BaseClientService.DeserializeResponse< T > ( HttpResponseMessage  response)
inlinevirtual

Deserializes a response into the specified object.

Implements Google.Apis.Services.IClientService.

virtual string Google.Apis.Services.BaseClientService.SerializeObject ( object  data)
inlinevirtual

Serializes an object into a string representation.

Implements Google.Apis.Services.IClientService.

void Google.Apis.Services.BaseClientService.SetRequestSerailizedContent ( HttpRequestMessage  request,
object  body 
)
inline

Sets the content of the request by the given body and the this service's configuration. First the body object is serialized by the Serializer and then, if GZip is enabled, the content will be wrapped in a GZip stream, otherwise a regular string stream will be used.

Implements Google.Apis.Services.IClientService.

Member Data Documentation

const uint Google.Apis.Services.BaseClientService.DefaultMaxUrlLength = 2048

The default maximum allowed length of a URL string for GET requests.


The documentation for this class was generated from the following file: