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\Vision\Resource;
19
20use Google\Service\Vision\AsyncBatchAnnotateFilesRequest;
21use Google\Service\Vision\BatchAnnotateFilesRequest;
22use Google\Service\Vision\BatchAnnotateFilesResponse;
23use 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->files;
31 *  </code>
32 */
33class Files 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 BatchAnnotateFilesRequest $postBody
44   * @param array $optParams Optional parameters.
45   * @return BatchAnnotateFilesResponse
46   */
47  public function annotate(BatchAnnotateFilesRequest $postBody, $optParams = [])
48  {
49    $params = ['postBody' => $postBody];
50    $params = array_merge($params, $optParams);
51    return $this->call('annotate', [$params], BatchAnnotateFilesResponse::class);
52  }
53  /**
54   * Run asynchronous image detection and annotation for a list of generic files,
55   * such as PDF files, which may contain multiple pages and multiple images per
56   * page. Progress and results can be retrieved through the
57   * `google.longrunning.Operations` interface. `Operation.metadata` contains
58   * `OperationMetadata` (metadata). `Operation.response` contains
59   * `AsyncBatchAnnotateFilesResponse` (results). (files.asyncBatchAnnotate)
60   *
61   * @param AsyncBatchAnnotateFilesRequest $postBody
62   * @param array $optParams Optional parameters.
63   * @return Operation
64   */
65  public function asyncBatchAnnotate(AsyncBatchAnnotateFilesRequest $postBody, $optParams = [])
66  {
67    $params = ['postBody' => $postBody];
68    $params = array_merge($params, $optParams);
69    return $this->call('asyncBatchAnnotate', [$params], Operation::class);
70  }
71}
72
73// Adding a class alias for backwards compatibility with the previous class name.
74class_alias(Files::class, 'Google_Service_Vision_Resource_Files');
75