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\Translate\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\Translate\Glossary;
|
---|
21 | use Google\Service\Translate\ListGlossariesResponse;
|
---|
22 | use 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->projects_locations_glossaries;
|
---|
30 | * </code>
|
---|
31 | */
|
---|
32 | class 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 | * @throws \Google\Service\Exception
|
---|
43 | */
|
---|
44 | public function create($parent, Glossary $postBody, $optParams = [])
|
---|
45 | {
|
---|
46 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
47 | $params = array_merge($params, $optParams);
|
---|
48 | return $this->call('create', [$params], Operation::class);
|
---|
49 | }
|
---|
50 | /**
|
---|
51 | * Deletes a glossary, or cancels glossary construction if the glossary isn't
|
---|
52 | * created yet. Returns NOT_FOUND, if the glossary doesn't exist.
|
---|
53 | * (glossaries.delete)
|
---|
54 | *
|
---|
55 | * @param string $name Required. The name of the glossary to delete.
|
---|
56 | * @param array $optParams Optional parameters.
|
---|
57 | * @return Operation
|
---|
58 | * @throws \Google\Service\Exception
|
---|
59 | */
|
---|
60 | public function delete($name, $optParams = [])
|
---|
61 | {
|
---|
62 | $params = ['name' => $name];
|
---|
63 | $params = array_merge($params, $optParams);
|
---|
64 | return $this->call('delete', [$params], Operation::class);
|
---|
65 | }
|
---|
66 | /**
|
---|
67 | * Gets a glossary. Returns NOT_FOUND, if the glossary doesn't exist.
|
---|
68 | * (glossaries.get)
|
---|
69 | *
|
---|
70 | * @param string $name Required. The name of the glossary to retrieve.
|
---|
71 | * @param array $optParams Optional parameters.
|
---|
72 | * @return Glossary
|
---|
73 | * @throws \Google\Service\Exception
|
---|
74 | */
|
---|
75 | public function get($name, $optParams = [])
|
---|
76 | {
|
---|
77 | $params = ['name' => $name];
|
---|
78 | $params = array_merge($params, $optParams);
|
---|
79 | return $this->call('get', [$params], Glossary::class);
|
---|
80 | }
|
---|
81 | /**
|
---|
82 | * Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't
|
---|
83 | * exist. (glossaries.listProjectsLocationsGlossaries)
|
---|
84 | *
|
---|
85 | * @param string $parent Required. The name of the project from which to list
|
---|
86 | * all of the glossaries.
|
---|
87 | * @param array $optParams Optional parameters.
|
---|
88 | *
|
---|
89 | * @opt_param string filter Optional. Filter specifying constraints of a list
|
---|
90 | * operation. Specify the constraint by the format of "key=value", where key
|
---|
91 | * must be "src" or "tgt", and the value must be a valid language code. For
|
---|
92 | * multiple restrictions, concatenate them by "AND" (uppercase only), such as:
|
---|
93 | * "src=en-US AND tgt=zh-CN". Notice that the exact match is used here, which
|
---|
94 | * means using 'en-US' and 'en' can lead to different results, which depends on
|
---|
95 | * the language code you used when you create the glossary. For the
|
---|
96 | * unidirectional glossaries, the "src" and "tgt" add restrictions on the source
|
---|
97 | * and target language code separately. For the equivalent term set glossaries,
|
---|
98 | * the "src" and/or "tgt" add restrictions on the term set. For example:
|
---|
99 | * "src=en-US AND tgt=zh-CN" will only pick the unidirectional glossaries which
|
---|
100 | * exactly match the source language code as "en-US" and the target language
|
---|
101 | * code "zh-CN", but all equivalent term set glossaries which contain "en-US"
|
---|
102 | * and "zh-CN" in their language set will be picked. If missing, no filtering is
|
---|
103 | * performed.
|
---|
104 | * @opt_param int pageSize Optional. Requested page size. The server may return
|
---|
105 | * fewer glossaries than requested. If unspecified, the server picks an
|
---|
106 | * appropriate default.
|
---|
107 | * @opt_param string pageToken Optional. A token identifying a page of results
|
---|
108 | * the server should return. Typically, this is the value of
|
---|
109 | * [ListGlossariesResponse.next_page_token] returned from the previous call to
|
---|
110 | * `ListGlossaries` method. The first page is returned if `page_token`is empty
|
---|
111 | * or missing.
|
---|
112 | * @return ListGlossariesResponse
|
---|
113 | * @throws \Google\Service\Exception
|
---|
114 | */
|
---|
115 | public function listProjectsLocationsGlossaries($parent, $optParams = [])
|
---|
116 | {
|
---|
117 | $params = ['parent' => $parent];
|
---|
118 | $params = array_merge($params, $optParams);
|
---|
119 | return $this->call('list', [$params], ListGlossariesResponse::class);
|
---|
120 | }
|
---|
121 | /**
|
---|
122 | * Updates a glossary. A LRO is used since the update can be async if the
|
---|
123 | * glossary's entry file is updated. (glossaries.patch)
|
---|
124 | *
|
---|
125 | * @param string $name Required. The resource name of the glossary. Glossary
|
---|
126 | * names have the form `projects/{project-number-or-id}/locations/{location-
|
---|
127 | * id}/glossaries/{glossary-id}`.
|
---|
128 | * @param Glossary $postBody
|
---|
129 | * @param array $optParams Optional parameters.
|
---|
130 | *
|
---|
131 | * @opt_param string updateMask The list of fields to be updated. Currently only
|
---|
132 | * `display_name` and 'input_config'
|
---|
133 | * @return Operation
|
---|
134 | * @throws \Google\Service\Exception
|
---|
135 | */
|
---|
136 | public function patch($name, Glossary $postBody, $optParams = [])
|
---|
137 | {
|
---|
138 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
139 | $params = array_merge($params, $optParams);
|
---|
140 | return $this->call('patch', [$params], Operation::class);
|
---|
141 | }
|
---|
142 | }
|
---|
143 |
|
---|
144 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
145 | class_alias(ProjectsLocationsGlossaries::class, 'Google_Service_Translate_Resource_ProjectsLocationsGlossaries');
|
---|