Class BatchRequest
A batch request which represents individual requests to Google servers. You should add a single service
request using the Queue<TResponse>(IClientServiceRequest, OnResponse<TResponse>) method and execute all individual requests using
ExecuteAsync(). More information about the batch protocol is available in
https://developers.google.com/storage/docs/json_api/v1/how-tos/batch.
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 BatchRequest(IClientService, string) for more information.
Declaration
public BatchRequest(IClientService service)
Parameters
Type | Name | Description |
---|---|---|
IClientService | 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 |
---|---|---|
IClientService | 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 |
---|---|---|
CancellationToken | 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 |
---|---|---|
IClientServiceRequest | request | The individual request. |
BatchRequest.OnResponse<TResponse> | callback | A callback which will be called after a response was parsed. |
Type Parameters
Name | Description |
---|---|
TResponse | The response's type. |