Interface IClientService (1.60.0)

public interface IClientService : IDisposable

Client service contains all the necessary information a Google service requires. Each concrete IClientServiceRequest has a reference to a service for important properties like API key, application name, base Uri, etc. This service interface also contains serialization methods to serialize an object to stream and deserialize a stream into an object.

Namespace

GoogleApisServices

Assembly

Google.Apis.dll

Properties

ApiKey

string ApiKey { get; }

Gets the API-Key (DeveloperKey) which this service uses for all requests.

Property Value
TypeDescription
string

ApplicationName

string ApplicationName { get; }

Gets the application name to be used in the User-Agent header.

Property Value
TypeDescription
string

BasePath

string BasePath { get; }

Gets the BasePath of the service.

Property Value
TypeDescription
string

BaseUri

string BaseUri { get; }

Gets the BaseUri of the service. All request paths should be relative to this URI.

Property Value
TypeDescription
string

Features

IList<string> Features { get; }

Gets the supported features by this service.

Property Value
TypeDescription
IListstring

GZipEnabled

bool GZipEnabled { get; }

Gets or sets whether this service supports GZip.

Property Value
TypeDescription
bool

HttpClient

ConfigurableHttpClient HttpClient { get; }

Gets the HTTP client which is used to create requests.

Property Value
TypeDescription
ConfigurableHttpClient

HttpClientInitializer

IConfigurableHttpClientInitializer HttpClientInitializer { get; }

Gets a HTTP client initializer which is able to custom properties on ConfigurableHttpClient and ConfigurableMessageHandler.

Property Value
TypeDescription
IConfigurableHttpClientInitializer

Name

string Name { get; }

Gets the service name.

Property Value
TypeDescription
string

Serializer

ISerializer Serializer { get; }

Gets the Serializer used by this service.

Property Value
TypeDescription
ISerializer

Methods

DeserializeError(HttpResponseMessage)

Task<RequestError> DeserializeError(HttpResponseMessage response)

Deserializes an error response into a RequestError object.

Parameter
NameDescription
responseHttpResponseMessage
Returns
TypeDescription
TaskRequestError
Exceptions
TypeDescription
GoogleApiException

If no error is found in the response.

DeserializeResponse<T>(HttpResponseMessage)

Task<T> DeserializeResponse<T>(HttpResponseMessage response)

Deserializes a response into the specified object.

Parameter
NameDescription
responseHttpResponseMessage
Returns
TypeDescription
Task
Type Parameter
NameDescription
T

SerializeObject(object)

string SerializeObject(object data)

Serializes an object into a string representation.

Parameter
NameDescription
dataobject
Returns
TypeDescription
string

SetRequestSerailizedContent(HttpRequestMessage, object)

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
NameDescription
requestHttpRequestMessage
bodyobject

Extension Method