[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\Document\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\Document\GoogleCloudDocumentaiV1BatchProcessRequest;
|
---|
| 21 | use Google\Service\Document\GoogleCloudDocumentaiV1DisableProcessorRequest;
|
---|
| 22 | use Google\Service\Document\GoogleCloudDocumentaiV1EnableProcessorRequest;
|
---|
| 23 | use Google\Service\Document\GoogleCloudDocumentaiV1ListProcessorsResponse;
|
---|
| 24 | use Google\Service\Document\GoogleCloudDocumentaiV1ProcessRequest;
|
---|
| 25 | use Google\Service\Document\GoogleCloudDocumentaiV1ProcessResponse;
|
---|
| 26 | use Google\Service\Document\GoogleCloudDocumentaiV1Processor;
|
---|
| 27 | use Google\Service\Document\GoogleCloudDocumentaiV1SetDefaultProcessorVersionRequest;
|
---|
| 28 | use Google\Service\Document\GoogleLongrunningOperation;
|
---|
| 29 |
|
---|
| 30 | /**
|
---|
| 31 | * The "processors" collection of methods.
|
---|
| 32 | * Typical usage is:
|
---|
| 33 | * <code>
|
---|
| 34 | * $documentaiService = new Google\Service\Document(...);
|
---|
| 35 | * $processors = $documentaiService->projects_locations_processors;
|
---|
| 36 | * </code>
|
---|
| 37 | */
|
---|
| 38 | class ProjectsLocationsProcessors extends \Google\Service\Resource
|
---|
| 39 | {
|
---|
| 40 | /**
|
---|
| 41 | * LRO endpoint to batch process many documents. The output is written to Cloud
|
---|
| 42 | * Storage as JSON in the [Document] format. (processors.batchProcess)
|
---|
| 43 | *
|
---|
| 44 | * @param string $name Required. The resource name of Processor or
|
---|
| 45 | * ProcessorVersion. Format:
|
---|
| 46 | * `projects/{project}/locations/{location}/processors/{processor}`, or `project
|
---|
| 47 | * s/{project}/locations/{location}/processors/{processor}/processorVersions/{pr
|
---|
| 48 | * ocessorVersion}`
|
---|
| 49 | * @param GoogleCloudDocumentaiV1BatchProcessRequest $postBody
|
---|
| 50 | * @param array $optParams Optional parameters.
|
---|
| 51 | * @return GoogleLongrunningOperation
|
---|
| 52 | * @throws \Google\Service\Exception
|
---|
| 53 | */
|
---|
| 54 | public function batchProcess($name, GoogleCloudDocumentaiV1BatchProcessRequest $postBody, $optParams = [])
|
---|
| 55 | {
|
---|
| 56 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 57 | $params = array_merge($params, $optParams);
|
---|
| 58 | return $this->call('batchProcess', [$params], GoogleLongrunningOperation::class);
|
---|
| 59 | }
|
---|
| 60 | /**
|
---|
| 61 | * Creates a processor from the ProcessorType provided. The processor will be at
|
---|
| 62 | * `ENABLED` state by default after its creation. Note that this method requires
|
---|
| 63 | * the `documentai.processors.create` permission on the project, which is highly
|
---|
| 64 | * privileged. A user or service account with this permission can create new
|
---|
| 65 | * processors that can interact with any gcs bucket in your project.
|
---|
| 66 | * (processors.create)
|
---|
| 67 | *
|
---|
| 68 | * @param string $parent Required. The parent (project and location) under which
|
---|
| 69 | * to create the processor. Format: `projects/{project}/locations/{location}`
|
---|
| 70 | * @param GoogleCloudDocumentaiV1Processor $postBody
|
---|
| 71 | * @param array $optParams Optional parameters.
|
---|
| 72 | * @return GoogleCloudDocumentaiV1Processor
|
---|
| 73 | * @throws \Google\Service\Exception
|
---|
| 74 | */
|
---|
| 75 | public function create($parent, GoogleCloudDocumentaiV1Processor $postBody, $optParams = [])
|
---|
| 76 | {
|
---|
| 77 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 78 | $params = array_merge($params, $optParams);
|
---|
| 79 | return $this->call('create', [$params], GoogleCloudDocumentaiV1Processor::class);
|
---|
| 80 | }
|
---|
| 81 | /**
|
---|
| 82 | * Deletes the processor, unloads all deployed model artifacts if it was enabled
|
---|
| 83 | * and then deletes all artifacts associated with this processor.
|
---|
| 84 | * (processors.delete)
|
---|
| 85 | *
|
---|
| 86 | * @param string $name Required. The processor resource name to be deleted.
|
---|
| 87 | * @param array $optParams Optional parameters.
|
---|
| 88 | * @return GoogleLongrunningOperation
|
---|
| 89 | * @throws \Google\Service\Exception
|
---|
| 90 | */
|
---|
| 91 | public function delete($name, $optParams = [])
|
---|
| 92 | {
|
---|
| 93 | $params = ['name' => $name];
|
---|
| 94 | $params = array_merge($params, $optParams);
|
---|
| 95 | return $this->call('delete', [$params], GoogleLongrunningOperation::class);
|
---|
| 96 | }
|
---|
| 97 | /**
|
---|
| 98 | * Disables a processor (processors.disable)
|
---|
| 99 | *
|
---|
| 100 | * @param string $name Required. The processor resource name to be disabled.
|
---|
| 101 | * @param GoogleCloudDocumentaiV1DisableProcessorRequest $postBody
|
---|
| 102 | * @param array $optParams Optional parameters.
|
---|
| 103 | * @return GoogleLongrunningOperation
|
---|
| 104 | * @throws \Google\Service\Exception
|
---|
| 105 | */
|
---|
| 106 | public function disable($name, GoogleCloudDocumentaiV1DisableProcessorRequest $postBody, $optParams = [])
|
---|
| 107 | {
|
---|
| 108 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 109 | $params = array_merge($params, $optParams);
|
---|
| 110 | return $this->call('disable', [$params], GoogleLongrunningOperation::class);
|
---|
| 111 | }
|
---|
| 112 | /**
|
---|
| 113 | * Enables a processor (processors.enable)
|
---|
| 114 | *
|
---|
| 115 | * @param string $name Required. The processor resource name to be enabled.
|
---|
| 116 | * @param GoogleCloudDocumentaiV1EnableProcessorRequest $postBody
|
---|
| 117 | * @param array $optParams Optional parameters.
|
---|
| 118 | * @return GoogleLongrunningOperation
|
---|
| 119 | * @throws \Google\Service\Exception
|
---|
| 120 | */
|
---|
| 121 | public function enable($name, GoogleCloudDocumentaiV1EnableProcessorRequest $postBody, $optParams = [])
|
---|
| 122 | {
|
---|
| 123 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 124 | $params = array_merge($params, $optParams);
|
---|
| 125 | return $this->call('enable', [$params], GoogleLongrunningOperation::class);
|
---|
| 126 | }
|
---|
| 127 | /**
|
---|
| 128 | * Gets a processor detail. (processors.get)
|
---|
| 129 | *
|
---|
| 130 | * @param string $name Required. The processor resource name.
|
---|
| 131 | * @param array $optParams Optional parameters.
|
---|
| 132 | * @return GoogleCloudDocumentaiV1Processor
|
---|
| 133 | * @throws \Google\Service\Exception
|
---|
| 134 | */
|
---|
| 135 | public function get($name, $optParams = [])
|
---|
| 136 | {
|
---|
| 137 | $params = ['name' => $name];
|
---|
| 138 | $params = array_merge($params, $optParams);
|
---|
| 139 | return $this->call('get', [$params], GoogleCloudDocumentaiV1Processor::class);
|
---|
| 140 | }
|
---|
| 141 | /**
|
---|
| 142 | * Lists all processors which belong to this project.
|
---|
| 143 | * (processors.listProjectsLocationsProcessors)
|
---|
| 144 | *
|
---|
| 145 | * @param string $parent Required. The parent (project and location) which owns
|
---|
| 146 | * this collection of Processors. Format:
|
---|
| 147 | * `projects/{project}/locations/{location}`
|
---|
| 148 | * @param array $optParams Optional parameters.
|
---|
| 149 | *
|
---|
| 150 | * @opt_param int pageSize The maximum number of processors to return. If
|
---|
| 151 | * unspecified, at most `50` processors will be returned. The maximum value is
|
---|
| 152 | * `100`. Values above `100` will be coerced to `100`.
|
---|
| 153 | * @opt_param string pageToken We will return the processors sorted by creation
|
---|
| 154 | * time. The page token will point to the next processor.
|
---|
| 155 | * @return GoogleCloudDocumentaiV1ListProcessorsResponse
|
---|
| 156 | * @throws \Google\Service\Exception
|
---|
| 157 | */
|
---|
| 158 | public function listProjectsLocationsProcessors($parent, $optParams = [])
|
---|
| 159 | {
|
---|
| 160 | $params = ['parent' => $parent];
|
---|
| 161 | $params = array_merge($params, $optParams);
|
---|
| 162 | return $this->call('list', [$params], GoogleCloudDocumentaiV1ListProcessorsResponse::class);
|
---|
| 163 | }
|
---|
| 164 | /**
|
---|
| 165 | * Processes a single document. (processors.process)
|
---|
| 166 | *
|
---|
| 167 | * @param string $name Required. The resource name of the Processor or
|
---|
| 168 | * ProcessorVersion to use for processing. If a Processor is specified, the
|
---|
| 169 | * server will use its default version. Format:
|
---|
| 170 | * `projects/{project}/locations/{location}/processors/{processor}`, or `project
|
---|
| 171 | * s/{project}/locations/{location}/processors/{processor}/processorVersions/{pr
|
---|
| 172 | * ocessorVersion}`
|
---|
| 173 | * @param GoogleCloudDocumentaiV1ProcessRequest $postBody
|
---|
| 174 | * @param array $optParams Optional parameters.
|
---|
| 175 | * @return GoogleCloudDocumentaiV1ProcessResponse
|
---|
| 176 | * @throws \Google\Service\Exception
|
---|
| 177 | */
|
---|
| 178 | public function process($name, GoogleCloudDocumentaiV1ProcessRequest $postBody, $optParams = [])
|
---|
| 179 | {
|
---|
| 180 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 181 | $params = array_merge($params, $optParams);
|
---|
| 182 | return $this->call('process', [$params], GoogleCloudDocumentaiV1ProcessResponse::class);
|
---|
| 183 | }
|
---|
| 184 | /**
|
---|
| 185 | * Set the default (active) version of a Processor that will be used in
|
---|
| 186 | * ProcessDocument and BatchProcessDocuments.
|
---|
| 187 | * (processors.setDefaultProcessorVersion)
|
---|
| 188 | *
|
---|
| 189 | * @param string $processor Required. The resource name of the Processor to
|
---|
| 190 | * change default version.
|
---|
| 191 | * @param GoogleCloudDocumentaiV1SetDefaultProcessorVersionRequest $postBody
|
---|
| 192 | * @param array $optParams Optional parameters.
|
---|
| 193 | * @return GoogleLongrunningOperation
|
---|
| 194 | * @throws \Google\Service\Exception
|
---|
| 195 | */
|
---|
| 196 | public function setDefaultProcessorVersion($processor, GoogleCloudDocumentaiV1SetDefaultProcessorVersionRequest $postBody, $optParams = [])
|
---|
| 197 | {
|
---|
| 198 | $params = ['processor' => $processor, 'postBody' => $postBody];
|
---|
| 199 | $params = array_merge($params, $optParams);
|
---|
| 200 | return $this->call('setDefaultProcessorVersion', [$params], GoogleLongrunningOperation::class);
|
---|
| 201 | }
|
---|
| 202 | }
|
---|
| 203 |
|
---|
| 204 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 205 | class_alias(ProjectsLocationsProcessors::class, 'Google_Service_Document_Resource_ProjectsLocationsProcessors');
|
---|