Class BatchRequest
A batch request which represents individual requests to Google servers. You should add a single service
request using the Queue<TResponse>(IClientServiceRequest, BatchRequest.OnResponse<TResponse>) method and execute all individual requests using
Execute
Inheritance
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 | |
System. |
batchUrl |
Properties
Count
Gets the count of all queued requests.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System. |
Methods
ExecuteAsync()
Asynchronously executes the batch request.
Declaration
public Task ExecuteAsync()
Returns
Type | Description |
---|---|
System. |
ExecuteAsync(CancellationToken)
Asynchronously executes the batch request.
Declaration
public async Task ExecuteAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System. |
cancellationToken | Cancellation token to cancel operation. |
Returns
Type | Description |
---|---|
System. |
Queue<TResponse>(IClientServiceRequest, BatchRequest.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. |