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
ExecuteAsync(). More information about the batch protocol is available in
https://developers.google.com/storage/docs/json_api/v1/how-tos/batch.
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 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 | |
System.String | batchUrl |
Properties
Count
Gets the count of all queued requests.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
ExecuteAsync()
Asynchronously executes the batch request.
Declaration
public Task ExecuteAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
ExecuteAsync(CancellationToken)
Asynchronously executes the batch request.
Declaration
public async Task ExecuteAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Threading.CancellationToken | cancellationToken | Cancellation token to cancel operation. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
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 |
---|---|---|
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. |