[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\Vision\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\Vision\AsyncBatchAnnotateFilesRequest;
|
---|
| 21 | use Google\Service\Vision\BatchAnnotateFilesRequest;
|
---|
| 22 | use Google\Service\Vision\BatchAnnotateFilesResponse;
|
---|
| 23 | use Google\Service\Vision\Operation;
|
---|
| 24 |
|
---|
| 25 | /**
|
---|
| 26 | * The "files" collection of methods.
|
---|
| 27 | * Typical usage is:
|
---|
| 28 | * <code>
|
---|
| 29 | * $visionService = new Google\Service\Vision(...);
|
---|
| 30 | * $files = $visionService->projects_locations_files;
|
---|
| 31 | * </code>
|
---|
| 32 | */
|
---|
| 33 | class ProjectsLocationsFiles extends \Google\Service\Resource
|
---|
| 34 | {
|
---|
| 35 | /**
|
---|
| 36 | * Service that performs image detection and annotation for a batch of files.
|
---|
| 37 | * Now only "application/pdf", "image/tiff" and "image/gif" are supported. This
|
---|
| 38 | * service will extract at most 5 (customers can specify which 5 in
|
---|
| 39 | * AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each file
|
---|
| 40 | * provided and perform detection and annotation for each image extracted.
|
---|
| 41 | * (files.annotate)
|
---|
| 42 | *
|
---|
| 43 | * @param string $parent Optional. Target project and location to make a call.
|
---|
| 44 | * Format: `projects/{project-id}/locations/{location-id}`. If no parent is
|
---|
| 45 | * specified, a region will be chosen automatically. Supported location-ids:
|
---|
| 46 | * `us`: USA country only, `asia`: East asia areas, like Japan, Taiwan, `eu`:
|
---|
| 47 | * The European Union. Example: `projects/project-A/locations/eu`.
|
---|
| 48 | * @param BatchAnnotateFilesRequest $postBody
|
---|
| 49 | * @param array $optParams Optional parameters.
|
---|
| 50 | * @return BatchAnnotateFilesResponse
|
---|
| 51 | * @throws \Google\Service\Exception
|
---|
| 52 | */
|
---|
| 53 | public function annotate($parent, BatchAnnotateFilesRequest $postBody, $optParams = [])
|
---|
| 54 | {
|
---|
| 55 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 56 | $params = array_merge($params, $optParams);
|
---|
| 57 | return $this->call('annotate', [$params], BatchAnnotateFilesResponse::class);
|
---|
| 58 | }
|
---|
| 59 | /**
|
---|
| 60 | * Run asynchronous image detection and annotation for a list of generic files,
|
---|
| 61 | * such as PDF files, which may contain multiple pages and multiple images per
|
---|
| 62 | * page. Progress and results can be retrieved through the
|
---|
| 63 | * `google.longrunning.Operations` interface. `Operation.metadata` contains
|
---|
| 64 | * `OperationMetadata` (metadata). `Operation.response` contains
|
---|
| 65 | * `AsyncBatchAnnotateFilesResponse` (results). (files.asyncBatchAnnotate)
|
---|
| 66 | *
|
---|
| 67 | * @param string $parent Optional. Target project and location to make a call.
|
---|
| 68 | * Format: `projects/{project-id}/locations/{location-id}`. If no parent is
|
---|
| 69 | * specified, a region will be chosen automatically. Supported location-ids:
|
---|
| 70 | * `us`: USA country only, `asia`: East asia areas, like Japan, Taiwan, `eu`:
|
---|
| 71 | * The European Union. Example: `projects/project-A/locations/eu`.
|
---|
| 72 | * @param AsyncBatchAnnotateFilesRequest $postBody
|
---|
| 73 | * @param array $optParams Optional parameters.
|
---|
| 74 | * @return Operation
|
---|
| 75 | * @throws \Google\Service\Exception
|
---|
| 76 | */
|
---|
| 77 | public function asyncBatchAnnotate($parent, AsyncBatchAnnotateFilesRequest $postBody, $optParams = [])
|
---|
| 78 | {
|
---|
| 79 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 80 | $params = array_merge($params, $optParams);
|
---|
| 81 | return $this->call('asyncBatchAnnotate', [$params], Operation::class);
|
---|
| 82 | }
|
---|
| 83 | }
|
---|
| 84 |
|
---|
| 85 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 86 | class_alias(ProjectsLocationsFiles::class, 'Google_Service_Vision_Resource_ProjectsLocationsFiles');
|
---|