public class ResumableUpload<TRequest, TResponse> : ResumableUpload<TRequest>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.
Namespace
Google.Apis.UploadAssembly
Google.Apis.dll
Type Parameters |
|
|---|---|
| Name | Description |
TRequest |
The 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. |
TResponse |
The type of the response body. |
Remarks
See: https://developers.google.com/gdata/docs/resumable_upload for information on the protocol.
Constructors
ResumableUpload(IClientService, string, string, Stream, string)
protected ResumableUpload(IClientService service, string path, string httpMethod, Stream contentStream, string contentType)Create a resumable upload instance with the required parameters.
| Parameters | |
|---|---|
| Name | Description |
service |
IClientServiceThe client service. |
path |
stringThe path for this media upload method. |
httpMethod |
stringThe HTTP method to start this upload. |
contentStream |
StreamThe stream containing the content to upload. |
contentType |
stringContent type of the content to be uploaded. |
Considerations regarding contentStream:
-
If
contentStreamis seekable, then the stream position will be reset to0before reading commences. IfcontentStreamis not seekable, then it will be read from its current position. -
Caller is responsible for maintaining the
contentStreamopen until the upload is completed. -
Caller is responsible for closing the
contentStream.
Properties
ResponseBody
public TResponse ResponseBody { get; }The response body.
| Property Value | |
|---|---|
| Type | Description |
TResponse |
|
This property will be set during upload. The ResponseReceived event is triggered when this has been set.
Methods
ProcessResponse(HttpResponseMessage)
protected override void ProcessResponse(HttpResponseMessage response)Process the response body
| Parameter | |
|---|---|
| Name | Description |
response |
HttpResponseMessage |
Events
ResponseReceived
public event Action<TResponse> ResponseReceivedEvent which is called when the response metadata is processed.
| Event Type | |
|---|---|
| Type | Description |
Action |
|