public class ResumableUpload<TRequest> : ResumableUpload
Media upload which uses Google's resumable media upload protocol to upload data.
Derived Types
Namespace
Google.Apis.UploadAssembly
Google.Apis.dll
Type Parameter | |
---|---|
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. |
Remarks
See: https://developers.google.com/drive/manage-uploads#resumable for more 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 | IClientService The client service. |
path | String The path for this media upload method. |
httpMethod | String The HTTP method to start this upload. |
contentStream | Stream The stream containing the content to upload. |
contentType | String Content type of the content to be uploaded. Some services may allow this to be null; others require a content type to be specified and will fail when the upload is started if the value is null. |
Caller is responsible for maintaining the contentStream
open until the upload is
completed.
Caller is responsible for closing the contentStream
.
Properties
Body
public TRequest Body { get; set; }
Gets or sets the body of this request.
Property Value | |
---|---|
Type | Description |
TRequest |
ContentType
public string ContentType { get; }
Gets or sets the stream's Content-Type.
Property Value | |
---|---|
Type | Description |
String |
HttpMethod
public string HttpMethod { get; }
Gets or sets the HTTP method of this upload (used to initialize the upload).
Property Value | |
---|---|
Type | Description |
String |
Path
public string Path { get; }
Gets or sets the path of the method (combined with BaseUri) to produce absolute Uri.
Property Value | |
---|---|
Type | Description |
String |
Service
public IClientService Service { get; }
Gets or sets the service.
Property Value | |
---|---|
Type | Description |
IClientService |
Methods
InitiateSessionAsync(CancellationToken)
public override Task<Uri> InitiateSessionAsync(CancellationToken cancellationToken = default(CancellationToken))
Initiates the resumable upload session and returns the session URI, or upload URI. See https://developers.google.com/drive/manage-uploads#start-resumable and https://cloud.google.com/storage/docs/json_api/v1/how-tos/resumable-upload#start-resumable for more information.
Parameter | |
---|---|
Name | Description |
cancellationToken | CancellationToken The token to monitor for cancellation requests. |
Returns | |
---|---|
Type | Description |
Task<Uri> | The task containing the session URI to use for the resumable upload. |