Class MediaResource
The "media" collection of methods.
Inherited Members
Namespace: Google.Apis.CloudSearch.v1
Assembly: Google.Apis.CloudSearch.v1.dll
Syntax
public class MediaResource
Constructors
MediaResource(IClientService)
Constructs a new resource.
Declaration
public MediaResource(IClientService service)
Parameters
| Type | Name | Description |
|---|---|---|
| IClientService | service |
Methods
Upload(Media, string)
Uploads media for indexing. The upload endpoint supports direct and resumable upload protocols and is intended for large items that can not be inlined during index requests. To index large content: 1. Call indexing.datasources.items.upload with the item name to begin an upload session and retrieve the UploadItemRef. 1. Call media.upload to upload the content, as a streaming request, using the same resource name from the UploadItemRef from step 1. 1. Call indexing.datasources.items.index to index the item. Populate the ItemContent with the UploadItemRef from step 1. For additional information, see Create a content connector using the REST API. Note: This API requires a service account to execute.
Declaration
public virtual MediaResource.UploadRequest Upload(Media body, string resourceName)
Parameters
| Type | Name | Description |
|---|---|---|
| Media | body | The body of the request. |
| string | resourceName | Name of the media that is being downloaded. See ReadRequest.resource_name. |
Returns
| Type | Description |
|---|---|
| MediaResource.UploadRequest |
Upload(Media, string, Stream, string)
Uploads media for indexing. The upload endpoint supports direct and resumable upload protocols and is intended for large items that can not be inlined during index requests. To index large content: 1. Call indexing.datasources.items.upload with the item name to begin an upload session and retrieve the UploadItemRef. 1. Call media.upload to upload the content, as a streaming request, using the same resource name from the UploadItemRef from step 1. 1. Call indexing.datasources.items.index to index the item. Populate the ItemContent with the UploadItemRef from step 1. For additional information, see Create a content connector using the REST API. Note: This API requires a service account to execute.
Declaration
public virtual MediaResource.UploadMediaUpload Upload(Media body, string resourceName, Stream stream, string contentType)
Parameters
| Type | Name | Description |
|---|---|---|
| Media | body | The body of the request. |
| string | resourceName | Name of the media that is being downloaded. See ReadRequest.resource_name. |
| 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
streamis seekable, then the stream position will be reset to0before reading commences. Ifstreamis not seekable, then it will be read from its current position -
Caller is responsible for maintaining the
streamopen until the upload is completed - Caller is responsible for closing the
stream