Class MediaResource
The "media" collection of methods.
Inherited Members
Namespace: Google.Apis.CloudSupport.v2beta
Assembly: Google.Apis.CloudSupport.v2beta.dll
Syntax
public class MediaResource
Constructors
MediaResource(IClientService)
Constructs a new resource.
Declaration
public MediaResource(IClientService service)
Parameters
Type | Name | Description |
---|---|---|
IClientService | service |
Methods
Download(string)
Download a file attachment on a case. Note: HTTP requests must append "?alt=media" to the URL. Here is an example of calling this endpoint using cURL:
shell
name="projects/some-project/cases/43594844/attachments/0674M00000WijAnZAJ" curl \ --header "Authorization:
Bearer $(gcloud auth print-access-token)" \
"https://cloudsupport.googleapis.com/v2/$name:download?alt=media"
Declaration
public virtual MediaResource.DownloadRequest Download(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The resource name of the attachment to be downloaded. |
Returns
Type | Description |
---|---|
MediaResource.DownloadRequest |
Upload(CreateAttachmentRequest, string)
Create a file attachment on a case or Cloud resource. The attachment object must have the following fields set: filename. Here is an example of calling this endpoint using cURL:
shell echo "This text is in a file
I'm uploading using CSAPI." \ > "./example_file.txt" case="projects/some-project/cases/43594844" curl
\ --header "Authorization: Bearer $(gcloud auth print-access-token)" \ --data-binary @"./example_file.txt" \
"https://cloudsupport.googleapis.com/upload/v2beta/$case/attachments?attachment.filename=uploaded_via_curl.txt"
Declaration
public virtual MediaResource.UploadRequest Upload(CreateAttachmentRequest body, string parent)
Parameters
Type | Name | Description |
---|---|---|
CreateAttachmentRequest | body | The body of the request. |
string | parent | Required. The resource name of the case (or case parent) to which the attachment should be attached. |
Returns
Type | Description |
---|---|
MediaResource.UploadRequest |
Upload(CreateAttachmentRequest, string, Stream, string)
Create a file attachment on a case or Cloud resource. The attachment object must have the following fields set: filename. Here is an example of calling this endpoint using cURL:
shell echo "This text is in a file
I'm uploading using CSAPI." \ > "./example_file.txt" case="projects/some-project/cases/43594844" curl
\ --header "Authorization: Bearer $(gcloud auth print-access-token)" \ --data-binary @"./example_file.txt" \
"https://cloudsupport.googleapis.com/upload/v2beta/$case/attachments?attachment.filename=uploaded_via_curl.txt"
Declaration
public virtual MediaResource.UploadMediaUpload Upload(CreateAttachmentRequest body, string parent, Stream stream, string contentType)
Parameters
Type | Name | Description |
---|---|---|
CreateAttachmentRequest | body | The body of the request. |
string | parent | Required. The resource name of the case (or case parent) to which the attachment should be attached. |
Stream | stream | The stream to upload. See remarks for further information. |
string | contentType | The content type of the stream to upload. |
Returns
Type | Description |
---|---|
MediaResource.UploadMediaUpload |
Remarks
Considerations regarding stream
:
-
If
stream
is seekable, then the stream position will be reset to0
before reading commences. Ifstream
is not seekable, then it will be read from its current position -
Caller is responsible for maintaining the
stream
open until the upload is completed - Caller is responsible for closing the
stream