[e3d4e0a] | 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\DiscoveryEngine\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\DiscoveryEngine\GoogleCloudDiscoveryengineV1Document;
|
---|
| 21 | use Google\Service\DiscoveryEngine\GoogleCloudDiscoveryengineV1ImportDocumentsRequest;
|
---|
| 22 | use Google\Service\DiscoveryEngine\GoogleCloudDiscoveryengineV1ListDocumentsResponse;
|
---|
| 23 | use Google\Service\DiscoveryEngine\GoogleCloudDiscoveryengineV1PurgeDocumentsRequest;
|
---|
| 24 | use Google\Service\DiscoveryEngine\GoogleLongrunningOperation;
|
---|
| 25 | use Google\Service\DiscoveryEngine\GoogleProtobufEmpty;
|
---|
| 26 |
|
---|
| 27 | /**
|
---|
| 28 | * The "documents" collection of methods.
|
---|
| 29 | * Typical usage is:
|
---|
| 30 | * <code>
|
---|
| 31 | * $discoveryengineService = new Google\Service\DiscoveryEngine(...);
|
---|
| 32 | * $documents = $discoveryengineService->projects_locations_collections_dataStores_branches_documents;
|
---|
| 33 | * </code>
|
---|
| 34 | */
|
---|
| 35 | class ProjectsLocationsCollectionsDataStoresBranchesDocuments extends \Google\Service\Resource
|
---|
| 36 | {
|
---|
| 37 | /**
|
---|
| 38 | * Creates a Document. (documents.create)
|
---|
| 39 | *
|
---|
| 40 | * @param string $parent Required. The parent resource name, such as `projects/{
|
---|
| 41 | * project}/locations/{location}/collections/{collection}/dataStores/{data_store
|
---|
| 42 | * }/branches/{branch}`.
|
---|
| 43 | * @param GoogleCloudDiscoveryengineV1Document $postBody
|
---|
| 44 | * @param array $optParams Optional parameters.
|
---|
| 45 | *
|
---|
| 46 | * @opt_param string documentId Required. The ID to use for the Document, which
|
---|
| 47 | * becomes the final component of the Document.name. If the caller does not have
|
---|
| 48 | * permission to create the Document, regardless of whether or not it exists, a
|
---|
| 49 | * `PERMISSION_DENIED` error is returned. This field must be unique among all
|
---|
| 50 | * Documents with the same parent. Otherwise, an `ALREADY_EXISTS` error is
|
---|
| 51 | * returned. This field must conform to
|
---|
| 52 | * [RFC-1034](https://tools.ietf.org/html/rfc1034) standard with a length limit
|
---|
| 53 | * of 63 characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
|
---|
| 54 | * @return GoogleCloudDiscoveryengineV1Document
|
---|
| 55 | * @throws \Google\Service\Exception
|
---|
| 56 | */
|
---|
| 57 | public function create($parent, GoogleCloudDiscoveryengineV1Document $postBody, $optParams = [])
|
---|
| 58 | {
|
---|
| 59 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 60 | $params = array_merge($params, $optParams);
|
---|
| 61 | return $this->call('create', [$params], GoogleCloudDiscoveryengineV1Document::class);
|
---|
| 62 | }
|
---|
| 63 | /**
|
---|
| 64 | * Deletes a Document. (documents.delete)
|
---|
| 65 | *
|
---|
| 66 | * @param string $name Required. Full resource name of Document, such as `projec
|
---|
| 67 | * ts/{project}/locations/{location}/collections/{collection}/dataStores/{data_s
|
---|
| 68 | * tore}/branches/{branch}/documents/{document}`. If the caller does not have
|
---|
| 69 | * permission to delete the Document, regardless of whether or not it exists, a
|
---|
| 70 | * `PERMISSION_DENIED` error is returned. If the Document to delete does not
|
---|
| 71 | * exist, a `NOT_FOUND` error is returned.
|
---|
| 72 | * @param array $optParams Optional parameters.
|
---|
| 73 | * @return GoogleProtobufEmpty
|
---|
| 74 | * @throws \Google\Service\Exception
|
---|
| 75 | */
|
---|
| 76 | public function delete($name, $optParams = [])
|
---|
| 77 | {
|
---|
| 78 | $params = ['name' => $name];
|
---|
| 79 | $params = array_merge($params, $optParams);
|
---|
| 80 | return $this->call('delete', [$params], GoogleProtobufEmpty::class);
|
---|
| 81 | }
|
---|
| 82 | /**
|
---|
| 83 | * Gets a Document. (documents.get)
|
---|
| 84 | *
|
---|
| 85 | * @param string $name Required. Full resource name of Document, such as `projec
|
---|
| 86 | * ts/{project}/locations/{location}/collections/{collection}/dataStores/{data_s
|
---|
| 87 | * tore}/branches/{branch}/documents/{document}`. If the caller does not have
|
---|
| 88 | * permission to access the Document, regardless of whether or not it exists, a
|
---|
| 89 | * `PERMISSION_DENIED` error is returned. If the requested Document does not
|
---|
| 90 | * exist, a `NOT_FOUND` error is returned.
|
---|
| 91 | * @param array $optParams Optional parameters.
|
---|
| 92 | * @return GoogleCloudDiscoveryengineV1Document
|
---|
| 93 | * @throws \Google\Service\Exception
|
---|
| 94 | */
|
---|
| 95 | public function get($name, $optParams = [])
|
---|
| 96 | {
|
---|
| 97 | $params = ['name' => $name];
|
---|
| 98 | $params = array_merge($params, $optParams);
|
---|
| 99 | return $this->call('get', [$params], GoogleCloudDiscoveryengineV1Document::class);
|
---|
| 100 | }
|
---|
| 101 | /**
|
---|
| 102 | * Bulk import of multiple Documents. Request processing may be synchronous.
|
---|
| 103 | * Non-existing items are created. Note: It is possible for a subset of the
|
---|
| 104 | * Documents to be successfully updated. (documents.import)
|
---|
| 105 | *
|
---|
| 106 | * @param string $parent Required. The parent branch resource name, such as `pro
|
---|
| 107 | * jects/{project}/locations/{location}/collections/{collection}/dataStores/{dat
|
---|
| 108 | * a_store}/branches/{branch}`. Requires create/update permission.
|
---|
| 109 | * @param GoogleCloudDiscoveryengineV1ImportDocumentsRequest $postBody
|
---|
| 110 | * @param array $optParams Optional parameters.
|
---|
| 111 | * @return GoogleLongrunningOperation
|
---|
| 112 | * @throws \Google\Service\Exception
|
---|
| 113 | */
|
---|
| 114 | public function import($parent, GoogleCloudDiscoveryengineV1ImportDocumentsRequest $postBody, $optParams = [])
|
---|
| 115 | {
|
---|
| 116 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 117 | $params = array_merge($params, $optParams);
|
---|
| 118 | return $this->call('import', [$params], GoogleLongrunningOperation::class);
|
---|
| 119 | }
|
---|
| 120 | /**
|
---|
| 121 | * Gets a list of Documents.
|
---|
| 122 | * (documents.listProjectsLocationsCollectionsDataStoresBranchesDocuments)
|
---|
| 123 | *
|
---|
| 124 | * @param string $parent Required. The parent branch resource name, such as `pro
|
---|
| 125 | * jects/{project}/locations/{location}/collections/{collection}/dataStores/{dat
|
---|
| 126 | * a_store}/branches/{branch}`. Use `default_branch` as the branch ID, to list
|
---|
| 127 | * documents under the default branch. If the caller does not have permission to
|
---|
| 128 | * list Documents under this branch, regardless of whether or not this branch
|
---|
| 129 | * exists, a `PERMISSION_DENIED` error is returned.
|
---|
| 130 | * @param array $optParams Optional parameters.
|
---|
| 131 | *
|
---|
| 132 | * @opt_param int pageSize Maximum number of Documents to return. If
|
---|
| 133 | * unspecified, defaults to 100. The maximum allowed value is 1000. Values above
|
---|
| 134 | * 1000 are set to 1000. If this field is negative, an `INVALID_ARGUMENT` error
|
---|
| 135 | * is returned.
|
---|
| 136 | * @opt_param string pageToken A page token
|
---|
| 137 | * ListDocumentsResponse.next_page_token, received from a previous
|
---|
| 138 | * DocumentService.ListDocuments call. Provide this to retrieve the subsequent
|
---|
| 139 | * page. When paginating, all other parameters provided to
|
---|
| 140 | * DocumentService.ListDocuments must match the call that provided the page
|
---|
| 141 | * token. Otherwise, an `INVALID_ARGUMENT` error is returned.
|
---|
| 142 | * @return GoogleCloudDiscoveryengineV1ListDocumentsResponse
|
---|
| 143 | * @throws \Google\Service\Exception
|
---|
| 144 | */
|
---|
| 145 | public function listProjectsLocationsCollectionsDataStoresBranchesDocuments($parent, $optParams = [])
|
---|
| 146 | {
|
---|
| 147 | $params = ['parent' => $parent];
|
---|
| 148 | $params = array_merge($params, $optParams);
|
---|
| 149 | return $this->call('list', [$params], GoogleCloudDiscoveryengineV1ListDocumentsResponse::class);
|
---|
| 150 | }
|
---|
| 151 | /**
|
---|
| 152 | * Updates a Document. (documents.patch)
|
---|
| 153 | *
|
---|
| 154 | * @param string $name Immutable. The full resource name of the document.
|
---|
| 155 | * Format: `projects/{project}/locations/{location}/collections/{collection}/dat
|
---|
| 156 | * aStores/{data_store}/branches/{branch}/documents/{document_id}`. This field
|
---|
| 157 | * must be a UTF-8 encoded string with a length limit of 1024 characters.
|
---|
| 158 | * @param GoogleCloudDiscoveryengineV1Document $postBody
|
---|
| 159 | * @param array $optParams Optional parameters.
|
---|
| 160 | *
|
---|
| 161 | * @opt_param bool allowMissing If set to `true` and the Document is not found,
|
---|
| 162 | * a new Document is be created.
|
---|
| 163 | * @opt_param string updateMask Indicates which fields in the provided imported
|
---|
| 164 | * 'document' to update. If not set, by default updates all fields.
|
---|
| 165 | * @return GoogleCloudDiscoveryengineV1Document
|
---|
| 166 | * @throws \Google\Service\Exception
|
---|
| 167 | */
|
---|
| 168 | public function patch($name, GoogleCloudDiscoveryengineV1Document $postBody, $optParams = [])
|
---|
| 169 | {
|
---|
| 170 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 171 | $params = array_merge($params, $optParams);
|
---|
| 172 | return $this->call('patch', [$params], GoogleCloudDiscoveryengineV1Document::class);
|
---|
| 173 | }
|
---|
| 174 | /**
|
---|
| 175 | * Permanently deletes all selected Documents in a branch. This process is
|
---|
| 176 | * asynchronous. Depending on the number of Documents to be deleted, this
|
---|
| 177 | * operation can take hours to complete. Before the delete operation completes,
|
---|
| 178 | * some Documents might still be returned by DocumentService.GetDocument or
|
---|
| 179 | * DocumentService.ListDocuments. To get a list of the Documents to be deleted,
|
---|
| 180 | * set PurgeDocumentsRequest.force to false. (documents.purge)
|
---|
| 181 | *
|
---|
| 182 | * @param string $parent Required. The parent resource name, such as `projects/{
|
---|
| 183 | * project}/locations/{location}/collections/{collection}/dataStores/{data_store
|
---|
| 184 | * }/branches/{branch}`.
|
---|
| 185 | * @param GoogleCloudDiscoveryengineV1PurgeDocumentsRequest $postBody
|
---|
| 186 | * @param array $optParams Optional parameters.
|
---|
| 187 | * @return GoogleLongrunningOperation
|
---|
| 188 | * @throws \Google\Service\Exception
|
---|
| 189 | */
|
---|
| 190 | public function purge($parent, GoogleCloudDiscoveryengineV1PurgeDocumentsRequest $postBody, $optParams = [])
|
---|
| 191 | {
|
---|
| 192 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 193 | $params = array_merge($params, $optParams);
|
---|
| 194 | return $this->call('purge', [$params], GoogleLongrunningOperation::class);
|
---|
| 195 | }
|
---|
| 196 | }
|
---|
| 197 |
|
---|
| 198 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 199 | class_alias(ProjectsLocationsCollectionsDataStoresBranchesDocuments::class, 'Google_Service_DiscoveryEngine_Resource_ProjectsLocationsCollectionsDataStoresBranchesDocuments');
|
---|