1 | <?php
|
---|
2 | /*
|
---|
3 | * Copyright 2014 Google Inc.
|
---|
4 | *
|
---|
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
---|
6 | * use this file except in compliance with the License. You may obtain a copy of
|
---|
7 | * the License at
|
---|
8 | *
|
---|
9 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
10 | *
|
---|
11 | * Unless required by applicable law or agreed to in writing, software
|
---|
12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
---|
13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
---|
14 | * License for the specific language governing permissions and limitations under
|
---|
15 | * the License.
|
---|
16 | */
|
---|
17 |
|
---|
18 | namespace Google\Service\CloudSearch\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\CloudSearch\Media as MediaModel;
|
---|
21 |
|
---|
22 | /**
|
---|
23 | * The "media" collection of methods.
|
---|
24 | * Typical usage is:
|
---|
25 | * <code>
|
---|
26 | * $cloudsearchService = new Google\Service\CloudSearch(...);
|
---|
27 | * $media = $cloudsearchService->media;
|
---|
28 | * </code>
|
---|
29 | */
|
---|
30 | class Media extends \Google\Service\Resource
|
---|
31 | {
|
---|
32 | /**
|
---|
33 | * Uploads media for indexing. The upload endpoint supports direct and resumable
|
---|
34 | * upload protocols and is intended for large items that can not be [inlined
|
---|
35 | * during index requests](https://developers.google.com/cloud-
|
---|
36 | * search/docs/reference/rest/v1/indexing.datasources.items#itemcontent). To
|
---|
37 | * index large content: 1. Call indexing.datasources.items.upload with the item
|
---|
38 | * name to begin an upload session and retrieve the UploadItemRef. 1. Call
|
---|
39 | * media.upload to upload the content, as a streaming request, using the same
|
---|
40 | * resource name from the UploadItemRef from step 1. 1. Call
|
---|
41 | * indexing.datasources.items.index to index the item. Populate the
|
---|
42 | * [ItemContent](/cloud-
|
---|
43 | * search/docs/reference/rest/v1/indexing.datasources.items#ItemContent) with
|
---|
44 | * the UploadItemRef from step 1. For additional information, see [Create a
|
---|
45 | * content connector using the REST API](https://developers.google.com/cloud-
|
---|
46 | * search/docs/guides/content-connector#rest). **Note:** This API requires a
|
---|
47 | * service account to execute. (media.upload)
|
---|
48 | *
|
---|
49 | * @param string $resourceName Name of the media that is being downloaded. See
|
---|
50 | * ReadRequest.resource_name.
|
---|
51 | * @param MediaModel $postBody
|
---|
52 | * @param array $optParams Optional parameters.
|
---|
53 | * @return MediaModel
|
---|
54 | * @throws \Google\Service\Exception
|
---|
55 | */
|
---|
56 | public function upload($resourceName, MediaModel $postBody, $optParams = [])
|
---|
57 | {
|
---|
58 | $params = ['resourceName' => $resourceName, 'postBody' => $postBody];
|
---|
59 | $params = array_merge($params, $optParams);
|
---|
60 | return $this->call('upload', [$params], MediaModel::class);
|
---|
61 | }
|
---|
62 | }
|
---|
63 |
|
---|
64 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
65 | class_alias(Media::class, 'Google_Service_CloudSearch_Resource_Media');
|
---|