Class BatchRequest
A batch request which represents individual requests to Google servers. You should add a single service
request using the Queue<TResponse>(IClient
Inherited Members
Namespace: Google.Apis.Requests
Assembly: Google.Apis.dll
Syntax
public sealed class BatchRequest
Constructors
BatchRequest(IClientService)
Constructs a new batch request using the given service. See
Batch
Declaration
public BatchRequest(IClientService service)
Parameters
Type | Name | Description |
---|---|---|
IClient |
service |
BatchRequest(IClientService, string)
Constructs a new batch request using the given service. The service's HTTP client is used to create a request to the given server URL and its serializer members are used to serialize the request and deserialize the response.
Declaration
public BatchRequest(IClientService service, string batchUrl)
Parameters
Type | Name | Description |
---|---|---|
IClient |
service | |
string | batchUrl |
Properties
Count
Gets the count of all queued requests.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
int |
Methods
ExecuteAsync()
Asynchronously executes the batch request.
Declaration
public Task ExecuteAsync()
Returns
Type | Description |
---|---|
Task |
ExecuteAsync(CancellationToken)
Asynchronously executes the batch request.
Declaration
public Task ExecuteAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
Cancellation |
cancellationToken | Cancellation token to cancel operation. |
Returns
Type | Description |
---|---|
Task |
Queue<TResponse>(IClientServiceRequest, OnResponse<TResponse>)
Queues an individual request.
Declaration
public void Queue<TResponse>(IClientServiceRequest request, BatchRequest.OnResponse<TResponse> callback) where TResponse : class
Parameters
Type | Name | Description |
---|---|---|
IClient |
request | The individual request. |
Batch |
callback | A callback which will be called after a response was parsed. |
Type Parameters
Name | Description |
---|---|
TResponse | The response's type. |