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\DeleteQueueItemsRequest;
|
---|
21 | use Google\Service\CloudSearch\IndexItemRequest;
|
---|
22 | use Google\Service\CloudSearch\Item;
|
---|
23 | use Google\Service\CloudSearch\ListItemsResponse;
|
---|
24 | use Google\Service\CloudSearch\Operation;
|
---|
25 | use Google\Service\CloudSearch\PollItemsRequest;
|
---|
26 | use Google\Service\CloudSearch\PollItemsResponse;
|
---|
27 | use Google\Service\CloudSearch\PushItemRequest;
|
---|
28 | use Google\Service\CloudSearch\StartUploadItemRequest;
|
---|
29 | use Google\Service\CloudSearch\UnreserveItemsRequest;
|
---|
30 | use Google\Service\CloudSearch\UploadItemRef;
|
---|
31 |
|
---|
32 | /**
|
---|
33 | * The "items" collection of methods.
|
---|
34 | * Typical usage is:
|
---|
35 | * <code>
|
---|
36 | * $cloudsearchService = new Google\Service\CloudSearch(...);
|
---|
37 | * $items = $cloudsearchService->indexing_datasources_items;
|
---|
38 | * </code>
|
---|
39 | */
|
---|
40 | class IndexingDatasourcesItems extends \Google\Service\Resource
|
---|
41 | {
|
---|
42 | /**
|
---|
43 | * Deletes Item resource for the specified resource name. This API requires an
|
---|
44 | * admin or service account to execute. The service account used is the one
|
---|
45 | * whitelisted in the corresponding data source. (items.delete)
|
---|
46 | *
|
---|
47 | * @param string $name Required. The name of the item to delete. Format:
|
---|
48 | * datasources/{source_id}/items/{item_id}
|
---|
49 | * @param array $optParams Optional parameters.
|
---|
50 | *
|
---|
51 | * @opt_param string connectorName The name of connector making this call.
|
---|
52 | * Format: datasources/{source_id}/connectors/{ID}
|
---|
53 | * @opt_param bool debugOptions.enableDebugging If you are asked by Google to
|
---|
54 | * help with debugging, set this field. Otherwise, ignore this field.
|
---|
55 | * @opt_param string mode Required. The RequestMode for this request.
|
---|
56 | * @opt_param string version Required. The incremented version of the item to
|
---|
57 | * delete from the index. The indexing system stores the version from the
|
---|
58 | * datasource as a byte string and compares the Item version in the index to the
|
---|
59 | * version of the queued Item using lexical ordering. Cloud Search Indexing
|
---|
60 | * won't delete any queued item with a version value that is less than or equal
|
---|
61 | * to the version of the currently indexed item. The maximum length for this
|
---|
62 | * field is 1024 bytes. For information on how item version affects the deletion
|
---|
63 | * process, refer to [Handle revisions after manual
|
---|
64 | * deletes](https://developers.google.com/cloud-search/docs/guides/operations).
|
---|
65 | * @return Operation
|
---|
66 | * @throws \Google\Service\Exception
|
---|
67 | */
|
---|
68 | public function delete($name, $optParams = [])
|
---|
69 | {
|
---|
70 | $params = ['name' => $name];
|
---|
71 | $params = array_merge($params, $optParams);
|
---|
72 | return $this->call('delete', [$params], Operation::class);
|
---|
73 | }
|
---|
74 | /**
|
---|
75 | * Deletes all items in a queue. This method is useful for deleting stale items.
|
---|
76 | * This API requires an admin or service account to execute. The service account
|
---|
77 | * used is the one whitelisted in the corresponding data source.
|
---|
78 | * (items.deleteQueueItems)
|
---|
79 | *
|
---|
80 | * @param string $name The name of the Data Source to delete items in a queue.
|
---|
81 | * Format: datasources/{source_id}
|
---|
82 | * @param DeleteQueueItemsRequest $postBody
|
---|
83 | * @param array $optParams Optional parameters.
|
---|
84 | * @return Operation
|
---|
85 | * @throws \Google\Service\Exception
|
---|
86 | */
|
---|
87 | public function deleteQueueItems($name, DeleteQueueItemsRequest $postBody, $optParams = [])
|
---|
88 | {
|
---|
89 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
90 | $params = array_merge($params, $optParams);
|
---|
91 | return $this->call('deleteQueueItems', [$params], Operation::class);
|
---|
92 | }
|
---|
93 | /**
|
---|
94 | * Gets Item resource by item name. This API requires an admin or service
|
---|
95 | * account to execute. The service account used is the one whitelisted in the
|
---|
96 | * corresponding data source. (items.get)
|
---|
97 | *
|
---|
98 | * @param string $name The name of the item to get info. Format:
|
---|
99 | * datasources/{source_id}/items/{item_id}
|
---|
100 | * @param array $optParams Optional parameters.
|
---|
101 | *
|
---|
102 | * @opt_param string connectorName The name of connector making this call.
|
---|
103 | * Format: datasources/{source_id}/connectors/{ID}
|
---|
104 | * @opt_param bool debugOptions.enableDebugging If you are asked by Google to
|
---|
105 | * help with debugging, set this field. Otherwise, ignore this field.
|
---|
106 | * @return Item
|
---|
107 | * @throws \Google\Service\Exception
|
---|
108 | */
|
---|
109 | public function get($name, $optParams = [])
|
---|
110 | {
|
---|
111 | $params = ['name' => $name];
|
---|
112 | $params = array_merge($params, $optParams);
|
---|
113 | return $this->call('get', [$params], Item::class);
|
---|
114 | }
|
---|
115 | /**
|
---|
116 | * Updates Item ACL, metadata, and content. It will insert the Item if it does
|
---|
117 | * not exist. This method does not support partial updates. Fields with no
|
---|
118 | * provided values are cleared out in the Cloud Search index. This API requires
|
---|
119 | * an admin or service account to execute. The service account used is the one
|
---|
120 | * whitelisted in the corresponding data source. (items.index)
|
---|
121 | *
|
---|
122 | * @param string $name The name of the Item. Format:
|
---|
123 | * datasources/{source_id}/items/{item_id} This is a required field. The maximum
|
---|
124 | * length is 1536 characters.
|
---|
125 | * @param IndexItemRequest $postBody
|
---|
126 | * @param array $optParams Optional parameters.
|
---|
127 | * @return Operation
|
---|
128 | * @throws \Google\Service\Exception
|
---|
129 | */
|
---|
130 | public function index($name, IndexItemRequest $postBody, $optParams = [])
|
---|
131 | {
|
---|
132 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
133 | $params = array_merge($params, $optParams);
|
---|
134 | return $this->call('index', [$params], Operation::class);
|
---|
135 | }
|
---|
136 | /**
|
---|
137 | * Lists all or a subset of Item resources. This API requires an admin or
|
---|
138 | * service account to execute. The service account used is the one whitelisted
|
---|
139 | * in the corresponding data source. (items.listIndexingDatasourcesItems)
|
---|
140 | *
|
---|
141 | * @param string $name The name of the Data Source to list Items. Format:
|
---|
142 | * datasources/{source_id}
|
---|
143 | * @param array $optParams Optional parameters.
|
---|
144 | *
|
---|
145 | * @opt_param bool brief When set to true, the indexing system only populates
|
---|
146 | * the following fields: name, version, queue. metadata.hash, metadata.title,
|
---|
147 | * metadata.sourceRepositoryURL, metadata.objectType, metadata.createTime,
|
---|
148 | * metadata.updateTime, metadata.contentLanguage, metadata.mimeType,
|
---|
149 | * structured_data.hash, content.hash, itemType, itemStatus.code,
|
---|
150 | * itemStatus.processingError.code, itemStatus.repositoryError.type, If this
|
---|
151 | * value is false, then all the fields are populated in Item.
|
---|
152 | * @opt_param string connectorName The name of connector making this call.
|
---|
153 | * Format: datasources/{source_id}/connectors/{ID}
|
---|
154 | * @opt_param bool debugOptions.enableDebugging If you are asked by Google to
|
---|
155 | * help with debugging, set this field. Otherwise, ignore this field.
|
---|
156 | * @opt_param int pageSize Maximum number of items to fetch in a request. The
|
---|
157 | * max value is 1000 when brief is true. The max value is 10 if brief is false.
|
---|
158 | * The default value is 10
|
---|
159 | * @opt_param string pageToken The next_page_token value returned from a
|
---|
160 | * previous List request, if any.
|
---|
161 | * @return ListItemsResponse
|
---|
162 | * @throws \Google\Service\Exception
|
---|
163 | */
|
---|
164 | public function listIndexingDatasourcesItems($name, $optParams = [])
|
---|
165 | {
|
---|
166 | $params = ['name' => $name];
|
---|
167 | $params = array_merge($params, $optParams);
|
---|
168 | return $this->call('list', [$params], ListItemsResponse::class);
|
---|
169 | }
|
---|
170 | /**
|
---|
171 | * Polls for unreserved items from the indexing queue and marks a set as
|
---|
172 | * reserved, starting with items that have the oldest timestamp from the highest
|
---|
173 | * priority ItemStatus. The priority order is as follows: ERROR MODIFIED
|
---|
174 | * NEW_ITEM ACCEPTED Reserving items ensures that polling from other threads
|
---|
175 | * cannot create overlapping sets. After handling the reserved items, the client
|
---|
176 | * should put items back into the unreserved state, either by calling index, or
|
---|
177 | * by calling push with the type REQUEUE. Items automatically become available
|
---|
178 | * (unreserved) after 4 hours even if no update or push method is called. This
|
---|
179 | * API requires an admin or service account to execute. The service account used
|
---|
180 | * is the one whitelisted in the corresponding data source. (items.poll)
|
---|
181 | *
|
---|
182 | * @param string $name The name of the Data Source to poll items. Format:
|
---|
183 | * datasources/{source_id}
|
---|
184 | * @param PollItemsRequest $postBody
|
---|
185 | * @param array $optParams Optional parameters.
|
---|
186 | * @return PollItemsResponse
|
---|
187 | * @throws \Google\Service\Exception
|
---|
188 | */
|
---|
189 | public function poll($name, PollItemsRequest $postBody, $optParams = [])
|
---|
190 | {
|
---|
191 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
192 | $params = array_merge($params, $optParams);
|
---|
193 | return $this->call('poll', [$params], PollItemsResponse::class);
|
---|
194 | }
|
---|
195 | /**
|
---|
196 | * Pushes an item onto a queue for later polling and updating. This API requires
|
---|
197 | * an admin or service account to execute. The service account used is the one
|
---|
198 | * whitelisted in the corresponding data source. (items.push)
|
---|
199 | *
|
---|
200 | * @param string $name The name of the item to push into the indexing queue.
|
---|
201 | * Format: datasources/{source_id}/items/{ID} This is a required field. The
|
---|
202 | * maximum length is 1536 characters.
|
---|
203 | * @param PushItemRequest $postBody
|
---|
204 | * @param array $optParams Optional parameters.
|
---|
205 | * @return Item
|
---|
206 | * @throws \Google\Service\Exception
|
---|
207 | */
|
---|
208 | public function push($name, PushItemRequest $postBody, $optParams = [])
|
---|
209 | {
|
---|
210 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
211 | $params = array_merge($params, $optParams);
|
---|
212 | return $this->call('push', [$params], Item::class);
|
---|
213 | }
|
---|
214 | /**
|
---|
215 | * Unreserves all items from a queue, making them all eligible to be polled.
|
---|
216 | * This method is useful for resetting the indexing queue after a connector has
|
---|
217 | * been restarted. This API requires an admin or service account to execute. The
|
---|
218 | * service account used is the one whitelisted in the corresponding data source.
|
---|
219 | * (items.unreserve)
|
---|
220 | *
|
---|
221 | * @param string $name The name of the Data Source to unreserve all items.
|
---|
222 | * Format: datasources/{source_id}
|
---|
223 | * @param UnreserveItemsRequest $postBody
|
---|
224 | * @param array $optParams Optional parameters.
|
---|
225 | * @return Operation
|
---|
226 | * @throws \Google\Service\Exception
|
---|
227 | */
|
---|
228 | public function unreserve($name, UnreserveItemsRequest $postBody, $optParams = [])
|
---|
229 | {
|
---|
230 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
231 | $params = array_merge($params, $optParams);
|
---|
232 | return $this->call('unreserve', [$params], Operation::class);
|
---|
233 | }
|
---|
234 | /**
|
---|
235 | * Creates an upload session for uploading item content. For items smaller than
|
---|
236 | * 100 KB, it's easier to embed the content inline within an index request. This
|
---|
237 | * API requires an admin or service account to execute. The service account used
|
---|
238 | * is the one whitelisted in the corresponding data source. (items.upload)
|
---|
239 | *
|
---|
240 | * @param string $name The name of the Item to start a resumable upload. Format:
|
---|
241 | * datasources/{source_id}/items/{item_id}. The maximum length is 1536 bytes.
|
---|
242 | * @param StartUploadItemRequest $postBody
|
---|
243 | * @param array $optParams Optional parameters.
|
---|
244 | * @return UploadItemRef
|
---|
245 | * @throws \Google\Service\Exception
|
---|
246 | */
|
---|
247 | public function upload($name, StartUploadItemRequest $postBody, $optParams = [])
|
---|
248 | {
|
---|
249 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
250 | $params = array_merge($params, $optParams);
|
---|
251 | return $this->call('upload', [$params], UploadItemRef::class);
|
---|
252 | }
|
---|
253 | }
|
---|
254 |
|
---|
255 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
256 | class_alias(IndexingDatasourcesItems::class, 'Google_Service_CloudSearch_Resource_IndexingDatasourcesItems');
|
---|