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