Google API Client Library for .NET  1.10.0
Classes | Public Member Functions | Properties | List of all members
Google.Apis.Requests.BatchRequest Class Reference

A batch request which represents individual requests to Google servers. You should add a single service request using the Queue 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. More...

Public Member Functions

delegate void OnResponse< in TResponse > (TResponse content, RequestError error, int index, HttpResponseMessage message)
 A concrete type callback for an individual response. More...
 
 BatchRequest (IClientService service)
 Constructs a new batch request using the given service. See BatchRequest(IClientService, string) for more information. More...
 
 BatchRequest (IClientService service, string batchUrl)
 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. More...
 
void Queue< TResponse > (IClientServiceRequest request, OnResponse< TResponse > callback)
 Queues an individual request. More...
 
Task ExecuteAsync ()
 Asynchronously executes the batch request. More...
 
async Task ExecuteAsync (CancellationToken cancellationToken)
 Asynchronously executes the batch request. More...
 

Properties

int Count [get]
 Gets the count of all queued requests. More...
 

Detailed Description

A batch request which represents individual requests to Google servers. You should add a single service request using the Queue 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.

Current implementation doesn't retry on unsuccessful individual response and doesn't support requests with different access tokens (different users or scopes).

Constructor & Destructor Documentation

Google.Apis.Requests.BatchRequest.BatchRequest ( IClientService  service)
inline

Constructs a new batch request using the given service. See BatchRequest(IClientService, string) for more information.

Google.Apis.Requests.BatchRequest.BatchRequest ( IClientService  service,
string  batchUrl 
)
inline

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.

Member Function Documentation

Task Google.Apis.Requests.BatchRequest.ExecuteAsync ( )
inline

Asynchronously executes the batch request.

async Task Google.Apis.Requests.BatchRequest.ExecuteAsync ( CancellationToken  cancellationToken)
inline

Asynchronously executes the batch request.

Parameters
cancellationTokenCancellation token to cancel operation.
delegate void Google.Apis.Requests.BatchRequest.OnResponse< in TResponse > ( TResponse  content,
RequestError  error,
int  index,
HttpResponseMessage  message 
)

A concrete type callback for an individual response.

Template Parameters
TResponseThe response type.
Parameters
contentThe content response or null if the request failed.
errorError or null if the request succeeded.
indexThe request index.
messageThe HTTP individual response.
Type Constraints
TResponse :class 
void Google.Apis.Requests.BatchRequest.Queue< TResponse > ( IClientServiceRequest  request,
OnResponse< TResponse >  callback 
)
inline

Queues an individual request.

Template Parameters
TResponseThe response's type.
Parameters
requestThe individual request.
callbackA callback which will be called after a response was parsed.
Type Constraints
TResponse :class 

Property Documentation

int Google.Apis.Requests.BatchRequest.Count
get

Gets the count of all queued requests.


The documentation for this class was generated from the following file: