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\Translate\Resource;
19
20use Google\Service\Translate\Glossary;
21use Google\Service\Translate\ListGlossariesResponse;
22use Google\Service\Translate\Operation;
23
24/**
25 * The "glossaries" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $translateService = new Google\Service\Translate(...);
29 *   $glossaries = $translateService->glossaries;
30 *  </code>
31 */
32class ProjectsLocationsGlossaries extends \Google\Service\Resource
33{
34  /**
35   * Creates a glossary and returns the long-running operation. Returns NOT_FOUND,
36   * if the project doesn't exist. (glossaries.create)
37   *
38   * @param string $parent Required. The project name.
39   * @param Glossary $postBody
40   * @param array $optParams Optional parameters.
41   * @return Operation
42   */
43  public function create($parent, Glossary $postBody, $optParams = [])
44  {
45    $params = ['parent' => $parent, 'postBody' => $postBody];
46    $params = array_merge($params, $optParams);
47    return $this->call('create', [$params], Operation::class);
48  }
49  /**
50   * Deletes a glossary, or cancels glossary construction if the glossary isn't
51   * created yet. Returns NOT_FOUND, if the glossary doesn't exist.
52   * (glossaries.delete)
53   *
54   * @param string $name Required. The name of the glossary to delete.
55   * @param array $optParams Optional parameters.
56   * @return Operation
57   */
58  public function delete($name, $optParams = [])
59  {
60    $params = ['name' => $name];
61    $params = array_merge($params, $optParams);
62    return $this->call('delete', [$params], Operation::class);
63  }
64  /**
65   * Gets a glossary. Returns NOT_FOUND, if the glossary doesn't exist.
66   * (glossaries.get)
67   *
68   * @param string $name Required. The name of the glossary to retrieve.
69   * @param array $optParams Optional parameters.
70   * @return Glossary
71   */
72  public function get($name, $optParams = [])
73  {
74    $params = ['name' => $name];
75    $params = array_merge($params, $optParams);
76    return $this->call('get', [$params], Glossary::class);
77  }
78  /**
79   * Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't
80   * exist. (glossaries.listProjectsLocationsGlossaries)
81   *
82   * @param string $parent Required. The name of the project from which to list
83   * all of the glossaries.
84   * @param array $optParams Optional parameters.
85   *
86   * @opt_param string filter Optional. Filter specifying constraints of a list
87   * operation. Specify the constraint by the format of "key=value", where key
88   * must be "src" or "tgt", and the value must be a valid language code. For
89   * multiple restrictions, concatenate them by "AND" (uppercase only), such as:
90   * "src=en-US AND tgt=zh-CN". Notice that the exact match is used here, which
91   * means using 'en-US' and 'en' can lead to different results, which depends on
92   * the language code you used when you create the glossary. For the
93   * unidirectional glossaries, the "src" and "tgt" add restrictions on the source
94   * and target language code separately. For the equivalent term set glossaries,
95   * the "src" and/or "tgt" add restrictions on the term set. For example: "src
96   * =en-US AND tgt=zh-CN" will only pick the unidirectional glossaries which
97   * exactly match the source language code as "en-US" and the target language
98   * code "zh-CN", but all equivalent term set glossaries which contain "en-US"
99   * and "zh-CN" in their language set will be picked. If missing, no filtering is
100   * performed.
101   * @opt_param int pageSize Optional. Requested page size. The server may return
102   * fewer glossaries than requested. If unspecified, the server picks an
103   * appropriate default.
104   * @opt_param string pageToken Optional. A token identifying a page of results
105   * the server should return. Typically, this is the value of
106   * [ListGlossariesResponse.next_page_token] returned from the previous call to
107   * `ListGlossaries` method. The first page is returned if `page_token`is empty
108   * or missing.
109   * @return ListGlossariesResponse
110   */
111  public function listProjectsLocationsGlossaries($parent, $optParams = [])
112  {
113    $params = ['parent' => $parent];
114    $params = array_merge($params, $optParams);
115    return $this->call('list', [$params], ListGlossariesResponse::class);
116  }
117}
118
119// Adding a class alias for backwards compatibility with the previous class name.
120class_alias(ProjectsLocationsGlossaries::class, 'Google_Service_Translate_Resource_ProjectsLocationsGlossaries');
121