Send feedback
Class BaseClientService (1.50.0)
Stay organized with collections
Save and categorize content based on your preferences.
Version 1.50.0 keyboard_arrow_down
public abstract class BaseClientService : object, IClientService, IDisposable
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 IHttpExecuteInterceptor to the
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 IHttpUnsuccessfulResponseHandler , this
class adds the Authenticator to the ConfigurableMessageHandler 's unsuccessful
response handler list.
Inheritance
Object >
BaseClientService
Namespace
Google.Apis.Services
Assembly
Google.Apis.dll
Constructors
BaseClientService(BaseClientService.Initializer)
protected BaseClientService(BaseClientService.Initializer initializer)
Constructs a new base client with the specified initializer.
Fields
DefaultMaxUrlLength
public const uint DefaultMaxUrlLength = null
The default maximum allowed length of a URL string for GET requests.
Field Value Type Description UInt32
Properties
ApiKey
public string ApiKey { get; }
Gets the API-Key (DeveloperKey) which this service uses for all requests.
Property Value Type Description String
ApplicationName
public string ApplicationName { get; }
Gets the application name to be used in the User-Agent header.
Property Value Type Description String
BasePath
public abstract string BasePath { get; }
Gets the BasePath of the service.
Property Value Type Description String
BaseUri
public abstract string BaseUri { get; }
Gets the BaseUri of the service. All request paths should be relative to this URI.
Property Value Type Description String
BaseUriOverride
protected string BaseUriOverride { get; }
The BaseUri provided in the initializer, which may be null.
Property Value Type Description String
BatchPath
public virtual string BatchPath { get; }
The path used for batch operations.
Property Value Type Description String
BatchUri
public virtual string BatchUri { get; }
The URI used for batch operations.
Property Value Type Description String
Features
public abstract IList<string> Features { get; }
Gets the supported features by this service.
Property Value Type Description IList <String >
GZipEnabled
public bool GZipEnabled { get; }
Gets or sets whether this service supports GZip.
Property Value Type Description Boolean
HttpClient
public ConfigurableHttpClient HttpClient { get; }
Gets the HTTP client which is used to create requests.
HttpClientInitializer
public IConfigurableHttpClientInitializer HttpClientInitializer { get; }
Name
public abstract string Name { get; }
Property Value Type Description String
Serializer
public ISerializer Serializer { get; }
Gets the Serializer used by this service.
Methods
CreateBackOffHandler()
protected virtual BackOffHandler CreateBackOffHandler()
Creates the back-off handler with 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
IBackOff ).
DeserializeError(HttpResponseMessage)
public virtual Task<RequestError> DeserializeError(HttpResponseMessage response)
Parameter Name Description response
HttpResponseMessage
DeserializeResponse<T>(HttpResponseMessage)
public virtual Task<T> DeserializeResponse<T>(HttpResponseMessage response)
Deserializes a response into the specified object.
Parameter Name Description response
HttpResponseMessage
Returns Type Description Task <T>
Type Parameter Name Description T
Dispose()
public virtual void Dispose()
SerializeObject(Object)
public virtual string SerializeObject(object obj)
Serializes an object into a string representation.
Parameter Name Description obj
Object
SetRequestSerailizedContent(HttpRequestMessage, Object)
public 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.
Parameters Name Description request
HttpRequestMessage
body
Object
Extension Method
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-19 UTC.
[{
"type": "thumb-down",
"id": "hardToUnderstand",
"label":"Hard to understand"
},{
"type": "thumb-down",
"id": "incorrectInformationOrSampleCode",
"label":"Incorrect information or sample code"
},{
"type": "thumb-down",
"id": "missingTheInformationSamplesINeed",
"label":"Missing the information/samples I need"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
Need to tell us more?
{"lastModified": "Last updated 2024-09-19 UTC."}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-19 UTC."]]