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