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\Document\Resource;
19
20use Google\Service\Document\GoogleCloudDocumentaiV1BatchProcessRequest;
21use Google\Service\Document\GoogleCloudDocumentaiV1DeployProcessorVersionRequest;
22use Google\Service\Document\GoogleCloudDocumentaiV1ListProcessorVersionsResponse;
23use Google\Service\Document\GoogleCloudDocumentaiV1ProcessRequest;
24use Google\Service\Document\GoogleCloudDocumentaiV1ProcessResponse;
25use Google\Service\Document\GoogleCloudDocumentaiV1ProcessorVersion;
26use Google\Service\Document\GoogleCloudDocumentaiV1UndeployProcessorVersionRequest;
27use Google\Service\Document\GoogleLongrunningOperation;
28
29/**
30 * The "processorVersions" collection of methods.
31 * Typical usage is:
32 *  <code>
33 *   $documentaiService = new Google\Service\Document(...);
34 *   $processorVersions = $documentaiService->processorVersions;
35 *  </code>
36 */
37class ProjectsLocationsProcessorsProcessorVersions extends \Google\Service\Resource
38{
39  /**
40   * LRO endpoint to batch process many documents. The output is written to Cloud
41   * Storage as JSON in the [Document] format. (processorVersions.batchProcess)
42   *
43   * @param string $name Required. The resource name of Processor or
44   * ProcessorVersion. Format:
45   * `projects/{project}/locations/{location}/processors/{processor}`, or `project
46   * s/{project}/locations/{location}/processors/{processor}/processorVersions/{pr
47   * ocessorVersion}`
48   * @param GoogleCloudDocumentaiV1BatchProcessRequest $postBody
49   * @param array $optParams Optional parameters.
50   * @return GoogleLongrunningOperation
51   */
52  public function batchProcess($name, GoogleCloudDocumentaiV1BatchProcessRequest $postBody, $optParams = [])
53  {
54    $params = ['name' => $name, 'postBody' => $postBody];
55    $params = array_merge($params, $optParams);
56    return $this->call('batchProcess', [$params], GoogleLongrunningOperation::class);
57  }
58  /**
59   * Deletes the processor version, all artifacts under the processor version will
60   * be deleted. (processorVersions.delete)
61   *
62   * @param string $name Required. The processor version resource name to be
63   * deleted.
64   * @param array $optParams Optional parameters.
65   * @return GoogleLongrunningOperation
66   */
67  public function delete($name, $optParams = [])
68  {
69    $params = ['name' => $name];
70    $params = array_merge($params, $optParams);
71    return $this->call('delete', [$params], GoogleLongrunningOperation::class);
72  }
73  /**
74   * Deploys the processor version. (processorVersions.deploy)
75   *
76   * @param string $name Required. The processor version resource name to be
77   * deployed.
78   * @param GoogleCloudDocumentaiV1DeployProcessorVersionRequest $postBody
79   * @param array $optParams Optional parameters.
80   * @return GoogleLongrunningOperation
81   */
82  public function deploy($name, GoogleCloudDocumentaiV1DeployProcessorVersionRequest $postBody, $optParams = [])
83  {
84    $params = ['name' => $name, 'postBody' => $postBody];
85    $params = array_merge($params, $optParams);
86    return $this->call('deploy', [$params], GoogleLongrunningOperation::class);
87  }
88  /**
89   * Gets a processor version detail. (processorVersions.get)
90   *
91   * @param string $name Required. The processor resource name.
92   * @param array $optParams Optional parameters.
93   * @return GoogleCloudDocumentaiV1ProcessorVersion
94   */
95  public function get($name, $optParams = [])
96  {
97    $params = ['name' => $name];
98    $params = array_merge($params, $optParams);
99    return $this->call('get', [$params], GoogleCloudDocumentaiV1ProcessorVersion::class);
100  }
101  /**
102   * Lists all versions of a processor.
103   * (processorVersions.listProjectsLocationsProcessorsProcessorVersions)
104   *
105   * @param string $parent Required. The parent (project, location and processor)
106   * to list all versions. Format:
107   * `projects/{project}/locations/{location}/processors/{processor}`
108   * @param array $optParams Optional parameters.
109   *
110   * @opt_param int pageSize The maximum number of processor versions to return.
111   * If unspecified, at most 10 processor versions will be returned. The maximum
112   * value is 20; values above 20 will be coerced to 20.
113   * @opt_param string pageToken We will return the processor versions sorted by
114   * creation time. The page token will point to the next processor version.
115   * @return GoogleCloudDocumentaiV1ListProcessorVersionsResponse
116   */
117  public function listProjectsLocationsProcessorsProcessorVersions($parent, $optParams = [])
118  {
119    $params = ['parent' => $parent];
120    $params = array_merge($params, $optParams);
121    return $this->call('list', [$params], GoogleCloudDocumentaiV1ListProcessorVersionsResponse::class);
122  }
123  /**
124   * Processes a single document. (processorVersions.process)
125   *
126   * @param string $name Required. The resource name of the Processor or
127   * ProcessorVersion to use for processing. If a Processor is specified, the
128   * server will use its default version. Format:
129   * `projects/{project}/locations/{location}/processors/{processor}`, or `project
130   * s/{project}/locations/{location}/processors/{processor}/processorVersions/{pr
131   * ocessorVersion}`
132   * @param GoogleCloudDocumentaiV1ProcessRequest $postBody
133   * @param array $optParams Optional parameters.
134   * @return GoogleCloudDocumentaiV1ProcessResponse
135   */
136  public function process($name, GoogleCloudDocumentaiV1ProcessRequest $postBody, $optParams = [])
137  {
138    $params = ['name' => $name, 'postBody' => $postBody];
139    $params = array_merge($params, $optParams);
140    return $this->call('process', [$params], GoogleCloudDocumentaiV1ProcessResponse::class);
141  }
142  /**
143   * Undeploys the processor version. (processorVersions.undeploy)
144   *
145   * @param string $name Required. The processor version resource name to be
146   * undeployed.
147   * @param GoogleCloudDocumentaiV1UndeployProcessorVersionRequest $postBody
148   * @param array $optParams Optional parameters.
149   * @return GoogleLongrunningOperation
150   */
151  public function undeploy($name, GoogleCloudDocumentaiV1UndeployProcessorVersionRequest $postBody, $optParams = [])
152  {
153    $params = ['name' => $name, 'postBody' => $postBody];
154    $params = array_merge($params, $optParams);
155    return $this->call('undeploy', [$params], GoogleLongrunningOperation::class);
156  }
157}
158
159// Adding a class alias for backwards compatibility with the previous class name.
160class_alias(ProjectsLocationsProcessorsProcessorVersions::class, 'Google_Service_Document_Resource_ProjectsLocationsProcessorsProcessorVersions');
161