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;
19
20use Google\Client;
21
22/**
23 * Service definition for Translate (v3).
24 *
25 * <p>
26 * Integrates text translation into your website or application.</p>
27 *
28 * <p>
29 * For more information about this service, see the API
30 * <a href="https://cloud.google.com/translate/docs/quickstarts" target="_blank">Documentation</a>
31 * </p>
32 *
33 * @author Google, Inc.
34 */
35class Translate extends \Google\Service
36{
37  /** See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.. */
38  const CLOUD_PLATFORM =
39      "https://www.googleapis.com/auth/cloud-platform";
40  /** Translate text from one language to another using Google Translate. */
41  const CLOUD_TRANSLATION =
42      "https://www.googleapis.com/auth/cloud-translation";
43
44  public $projects;
45  public $projects_locations;
46  public $projects_locations_glossaries;
47  public $projects_locations_operations;
48
49  /**
50   * Constructs the internal representation of the Translate service.
51   *
52   * @param Client|array $clientOrConfig The client used to deliver requests, or a
53   *                                     config array to pass to a new Client instance.
54   * @param string $rootUrl The root URL used for requests to the service.
55   */
56  public function __construct($clientOrConfig = [], $rootUrl = null)
57  {
58    parent::__construct($clientOrConfig);
59    $this->rootUrl = $rootUrl ?: 'https://translation.googleapis.com/';
60    $this->servicePath = '';
61    $this->batchPath = 'batch';
62    $this->version = 'v3';
63    $this->serviceName = 'translate';
64
65    $this->projects = new Translate\Resource\Projects(
66        $this,
67        $this->serviceName,
68        'projects',
69        [
70          'methods' => [
71            'detectLanguage' => [
72              'path' => 'v3/{+parent}:detectLanguage',
73              'httpMethod' => 'POST',
74              'parameters' => [
75                'parent' => [
76                  'location' => 'path',
77                  'type' => 'string',
78                  'required' => true,
79                ],
80              ],
81            ],'getSupportedLanguages' => [
82              'path' => 'v3/{+parent}/supportedLanguages',
83              'httpMethod' => 'GET',
84              'parameters' => [
85                'parent' => [
86                  'location' => 'path',
87                  'type' => 'string',
88                  'required' => true,
89                ],
90                'displayLanguageCode' => [
91                  'location' => 'query',
92                  'type' => 'string',
93                ],
94                'model' => [
95                  'location' => 'query',
96                  'type' => 'string',
97                ],
98              ],
99            ],'translateText' => [
100              'path' => 'v3/{+parent}:translateText',
101              'httpMethod' => 'POST',
102              'parameters' => [
103                'parent' => [
104                  'location' => 'path',
105                  'type' => 'string',
106                  'required' => true,
107                ],
108              ],
109            ],
110          ]
111        ]
112    );
113    $this->projects_locations = new Translate\Resource\ProjectsLocations(
114        $this,
115        $this->serviceName,
116        'locations',
117        [
118          'methods' => [
119            'batchTranslateDocument' => [
120              'path' => 'v3/{+parent}:batchTranslateDocument',
121              'httpMethod' => 'POST',
122              'parameters' => [
123                'parent' => [
124                  'location' => 'path',
125                  'type' => 'string',
126                  'required' => true,
127                ],
128              ],
129            ],'batchTranslateText' => [
130              'path' => 'v3/{+parent}:batchTranslateText',
131              'httpMethod' => 'POST',
132              'parameters' => [
133                'parent' => [
134                  'location' => 'path',
135                  'type' => 'string',
136                  'required' => true,
137                ],
138              ],
139            ],'detectLanguage' => [
140              'path' => 'v3/{+parent}:detectLanguage',
141              'httpMethod' => 'POST',
142              'parameters' => [
143                'parent' => [
144                  'location' => 'path',
145                  'type' => 'string',
146                  'required' => true,
147                ],
148              ],
149            ],'get' => [
150              'path' => 'v3/{+name}',
151              'httpMethod' => 'GET',
152              'parameters' => [
153                'name' => [
154                  'location' => 'path',
155                  'type' => 'string',
156                  'required' => true,
157                ],
158              ],
159            ],'getSupportedLanguages' => [
160              'path' => 'v3/{+parent}/supportedLanguages',
161              'httpMethod' => 'GET',
162              'parameters' => [
163                'parent' => [
164                  'location' => 'path',
165                  'type' => 'string',
166                  'required' => true,
167                ],
168                'displayLanguageCode' => [
169                  'location' => 'query',
170                  'type' => 'string',
171                ],
172                'model' => [
173                  'location' => 'query',
174                  'type' => 'string',
175                ],
176              ],
177            ],'list' => [
178              'path' => 'v3/{+name}/locations',
179              'httpMethod' => 'GET',
180              'parameters' => [
181                'name' => [
182                  'location' => 'path',
183                  'type' => 'string',
184                  'required' => true,
185                ],
186                'filter' => [
187                  'location' => 'query',
188                  'type' => 'string',
189                ],
190                'pageSize' => [
191                  'location' => 'query',
192                  'type' => 'integer',
193                ],
194                'pageToken' => [
195                  'location' => 'query',
196                  'type' => 'string',
197                ],
198              ],
199            ],'translateDocument' => [
200              'path' => 'v3/{+parent}:translateDocument',
201              'httpMethod' => 'POST',
202              'parameters' => [
203                'parent' => [
204                  'location' => 'path',
205                  'type' => 'string',
206                  'required' => true,
207                ],
208              ],
209            ],'translateText' => [
210              'path' => 'v3/{+parent}:translateText',
211              'httpMethod' => 'POST',
212              'parameters' => [
213                'parent' => [
214                  'location' => 'path',
215                  'type' => 'string',
216                  'required' => true,
217                ],
218              ],
219            ],
220          ]
221        ]
222    );
223    $this->projects_locations_glossaries = new Translate\Resource\ProjectsLocationsGlossaries(
224        $this,
225        $this->serviceName,
226        'glossaries',
227        [
228          'methods' => [
229            'create' => [
230              'path' => 'v3/{+parent}/glossaries',
231              'httpMethod' => 'POST',
232              'parameters' => [
233                'parent' => [
234                  'location' => 'path',
235                  'type' => 'string',
236                  'required' => true,
237                ],
238              ],
239            ],'delete' => [
240              'path' => 'v3/{+name}',
241              'httpMethod' => 'DELETE',
242              'parameters' => [
243                'name' => [
244                  'location' => 'path',
245                  'type' => 'string',
246                  'required' => true,
247                ],
248              ],
249            ],'get' => [
250              'path' => 'v3/{+name}',
251              'httpMethod' => 'GET',
252              'parameters' => [
253                'name' => [
254                  'location' => 'path',
255                  'type' => 'string',
256                  'required' => true,
257                ],
258              ],
259            ],'list' => [
260              'path' => 'v3/{+parent}/glossaries',
261              'httpMethod' => 'GET',
262              'parameters' => [
263                'parent' => [
264                  'location' => 'path',
265                  'type' => 'string',
266                  'required' => true,
267                ],
268                'filter' => [
269                  'location' => 'query',
270                  'type' => 'string',
271                ],
272                'pageSize' => [
273                  'location' => 'query',
274                  'type' => 'integer',
275                ],
276                'pageToken' => [
277                  'location' => 'query',
278                  'type' => 'string',
279                ],
280              ],
281            ],
282          ]
283        ]
284    );
285    $this->projects_locations_operations = new Translate\Resource\ProjectsLocationsOperations(
286        $this,
287        $this->serviceName,
288        'operations',
289        [
290          'methods' => [
291            'cancel' => [
292              'path' => 'v3/{+name}:cancel',
293              'httpMethod' => 'POST',
294              'parameters' => [
295                'name' => [
296                  'location' => 'path',
297                  'type' => 'string',
298                  'required' => true,
299                ],
300              ],
301            ],'delete' => [
302              'path' => 'v3/{+name}',
303              'httpMethod' => 'DELETE',
304              'parameters' => [
305                'name' => [
306                  'location' => 'path',
307                  'type' => 'string',
308                  'required' => true,
309                ],
310              ],
311            ],'get' => [
312              'path' => 'v3/{+name}',
313              'httpMethod' => 'GET',
314              'parameters' => [
315                'name' => [
316                  'location' => 'path',
317                  'type' => 'string',
318                  'required' => true,
319                ],
320              ],
321            ],'list' => [
322              'path' => 'v3/{+name}/operations',
323              'httpMethod' => 'GET',
324              'parameters' => [
325                'name' => [
326                  'location' => 'path',
327                  'type' => 'string',
328                  'required' => true,
329                ],
330                'filter' => [
331                  'location' => 'query',
332                  'type' => 'string',
333                ],
334                'pageSize' => [
335                  'location' => 'query',
336                  'type' => 'integer',
337                ],
338                'pageToken' => [
339                  'location' => 'query',
340                  'type' => 'string',
341                ],
342              ],
343            ],'wait' => [
344              'path' => 'v3/{+name}:wait',
345              'httpMethod' => 'POST',
346              'parameters' => [
347                'name' => [
348                  'location' => 'path',
349                  'type' => 'string',
350                  'required' => true,
351                ],
352              ],
353            ],
354          ]
355        ]
356    );
357  }
358}
359
360// Adding a class alias for backwards compatibility with the previous class name.
361class_alias(Translate::class, 'Google_Service_Translate');
362