# Interface IClientService (1.73.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [1.73.0 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Services.IClientService)
- [1.69.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.69.0/Google.Apis.Services.IClientService)
- [1.68.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.68.0/Google.Apis.Services.IClientService)
- [1.60.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.60.0/Google.Apis.Services.IClientService)
- [1.59.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.59.0/Google.Apis.Services.IClientService)
- [1.55.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.55.0/Google.Apis.Services.IClientService)
- [1.50.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/1.50.0/Google.Apis.Services.IClientService)

    public interface IClientService : IDisposable

Client service contains all the necessary information a Google service requires.
Each concrete [IClientServiceRequest](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Requests.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.

## Inherited Members

[IDisposable.Dispose()](https://learn.microsoft.com/dotnet/api/system.idisposable.dispose)

## Namespace

[Google.Apis.Services](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Services)

## Assembly

Google.Apis.dll

## Properties

### ApiKey

    string ApiKey { get; }

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

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### ApplicationName

    string ApplicationName { get; }

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

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### BasePath

    string BasePath { get; }

Gets the BasePath of the service.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### BaseUri

    string BaseUri { get; }

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

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### Features

    IList<string> Features { get; }

Gets the supported features by this service.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1https://learn.microsoft.com/dotnet/api/system.string` |   |

### GZipEnabled

    bool GZipEnabled { get; }

Gets or sets whether this service supports GZip.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.boolean` |   |

### HttpClient

    ConfigurableHttpClient HttpClient { get; }

Gets the HTTP client which is used to create requests.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.ConfigurableHttpClient` |   |

### HttpClientInitializer

    IConfigurableHttpClientInitializer HttpClientInitializer { get; }

Gets a HTTP client initializer which is able to custom properties on
[ConfigurableHttpClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.ConfigurableHttpClient) and
[ConfigurableMessageHandler](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.ConfigurableMessageHandler).

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.IConfigurableHttpClientInitializer` |   |

### Name

    string Name { get; }

Gets the service name.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### Serializer

    ISerializer Serializer { get; }

Gets the Serializer used by this service.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.ISerializer` |   |

## Methods

### DeserializeError(HttpResponseMessage)

    Task<RequestError> DeserializeError(HttpResponseMessage response)

Deserializes an error response into a [RequestError](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Requests.RequestError) object.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `response` | `https://learn.microsoft.com/dotnet/api/system.net.http.httpresponsemessage` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Requests.RequestError` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.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** ||
|---|---|
| **Name** | **Description** |
| `response` | `https://learn.microsoft.com/dotnet/api/system.net.http.httpresponsemessage` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1` |   |

| **Type Parameter** ||
|---|---|
| **Name** | **Description** |
| `T` |   |

### SerializeObject(object)

    string SerializeObject(object data)

Serializes an object into a string representation.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `data` | `https://learn.microsoft.com/dotnet/api/system.object` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.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** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://learn.microsoft.com/dotnet/api/system.net.http.httprequestmessage` |
| `body` | `https://learn.microsoft.com/dotnet/api/system.object` |

## Extension Method

[Utilities.ThrowIfNull\<T\>(T, string)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Util.Utilities#Google_Apis_Util_Utilities_ThrowIfNull__1___0_System_String_)