Google API Client Library for .NET  1.10.0
Protected Member Functions | Properties | Events | List of all members
Google.Apis.Upload.ResumableUpload< TRequest, TResponse > Class Template Reference

Media upload which uses Google's resumable media upload protocol to upload data. The version with two types contains both a request object and a response object. More...

Inheritance diagram for Google.Apis.Upload.ResumableUpload< TRequest, TResponse >:
Google.Apis.Upload.ResumableUpload< TRequest >

Protected Member Functions

 ResumableUpload (IClientService service, string path, string httpMethod, Stream contentStream, string contentType)
 Create a resumable upload instance with the required parameters. More...
 
override void ProcessResponse (HttpResponseMessage response)
 Process the response body More...
 
- Protected Member Functions inherited from Google.Apis.Upload.ResumableUpload< TRequest >
 ResumableUpload (IClientService service, string path, string httpMethod, Stream contentStream, string contentType)
 Create a resumable upload instance with the required parameters. More...
 
async Task< bool > SendNextChunkAsync (Stream stream, CancellationToken cancellationToken)
 Uploads the next chunk of data to the server. More...
 

Properties

TResponse ResponseBody [get, set]
 The response body. More...
 
- Properties inherited from Google.Apis.Upload.ResumableUpload< TRequest >
IClientService Service [get, set]
 Gets or sets the service. More...
 
string Path [get, set]
 Gets or sets the path of the method (combined with Google.Apis.Services.IClientService.BaseUri) to produce absolute Uri. More...
 
string HttpMethod [get, set]
 Gets or sets the HTTP method of this upload (used to initialize the upload). More...
 
Stream ContentStream [get, set]
 Gets or sets the stream to upload. More...
 
string ContentType [get, set]
 Gets or sets the stream's Content-Type. More...
 
TRequest Body [get, set]
 Gets or sets the body of this request. More...
 
int ChunkSize [get, set]
 Gets or sets the size of each chunk sent to the server. Chunks (except the last chunk) must be a multiple of MinimumChunkSize to be compatible with Google upload servers. More...
 

Events

Action< TResponse > ResponseReceived
 Event which is called when the response metadata is processed. More...
 
- Events inherited from Google.Apis.Upload.ResumableUpload< TRequest >
Action< IUploadProgressProgressChanged
 Event called whenever the progress of the upload changes. More...
 

Additional Inherited Members

- Public Member Functions inherited from Google.Apis.Upload.ResumableUpload< TRequest >
IUploadProgress GetProgress ()
 Get the current progress state. More...
 
IUploadProgress Upload ()
 Uploads the content to the server. This method is synchronous and will block until the upload is completed. More...
 
Task< IUploadProgressUploadAsync ()
 Uploads the content asynchronously to the server. More...
 
async Task< IUploadProgressUploadAsync (CancellationToken cancellationToken)
 Uploads the content to the server using the given cancellation token. More...
 
IUploadProgress Resume ()
 Resumes the upload form the last point it was interrupted. More...
 
Task< IUploadProgressResumeAsync ()
 Asynchronously resumes the upload form the last point it was interrupted. More...
 
async Task< IUploadProgressResumeAsync (CancellationToken cancellationToken)
 Asynchronously resumes the upload form the last point it was interrupted. More...
 
- Public Attributes inherited from Google.Apis.Upload.ResumableUpload< TRequest >
const int MinimumChunkSize = 256 * KB
 Minimum chunk size (except the last one). Default value is 256*KB. More...
 
const int DefaultChunkSize = 10 * MB
 Default chunk size. Default value is 10*MB. More...
 
- Protected Attributes inherited from Google.Apis.Upload.ResumableUpload< TRequest >
int chunkSize = DefaultChunkSize
 Change this value ONLY for testing purposes! More...
 

Detailed Description

Media upload which uses Google's resumable media upload protocol to upload data. The version with two types contains both a request object and a response object.

See: https://developers.google.com/gdata/docs/resumable_upload for information on the protocol.

Template Parameters
TRequestThe type of the body of this request. Generally this should be the metadata related to the content to be uploaded. Must be serializable to/from JSON.
TResponseThe type of the response body.

Constructor & Destructor Documentation

Google.Apis.Upload.ResumableUpload< TRequest, TResponse >.ResumableUpload ( IClientService  service,
string  path,
string  httpMethod,
Stream  contentStream,
string  contentType 
)
inlineprotected

Create a resumable upload instance with the required parameters.

Parameters
serviceThe client service.
pathThe path for this media upload method.
httpMethodThe HTTP method to start this upload.
contentStreamThe stream containing the content to upload.
contentTypeContent type of the content to be uploaded.

The stream contentStream must support the "Length" property. Caller is responsible for maintaining the contentStream open until the upload is completed. Caller is responsible for closing the contentStream .

Member Function Documentation

override void Google.Apis.Upload.ResumableUpload< TRequest, TResponse >.ProcessResponse ( HttpResponseMessage  response)
inlineprotectedvirtual

Process the response body

Reimplemented from Google.Apis.Upload.ResumableUpload< TRequest >.

Property Documentation

TResponse Google.Apis.Upload.ResumableUpload< TRequest, TResponse >.ResponseBody
getset

The response body.

This property will be set during upload. The ResponseReceived event is triggered when this has been set.

Event Documentation

Action<TResponse> Google.Apis.Upload.ResumableUpload< TRequest, TResponse >.ResponseReceived

Event which is called when the response metadata is processed.


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