[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\Translate\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\Translate\DetectLanguageRequest;
|
---|
| 21 | use Google\Service\Translate\DetectLanguageResponse;
|
---|
| 22 | use Google\Service\Translate\RomanizeTextRequest;
|
---|
| 23 | use Google\Service\Translate\RomanizeTextResponse;
|
---|
| 24 | use Google\Service\Translate\SupportedLanguages;
|
---|
| 25 | use Google\Service\Translate\TranslateTextRequest;
|
---|
| 26 | use Google\Service\Translate\TranslateTextResponse;
|
---|
| 27 |
|
---|
| 28 | /**
|
---|
| 29 | * The "projects" collection of methods.
|
---|
| 30 | * Typical usage is:
|
---|
| 31 | * <code>
|
---|
| 32 | * $translateService = new Google\Service\Translate(...);
|
---|
| 33 | * $projects = $translateService->projects;
|
---|
| 34 | * </code>
|
---|
| 35 | */
|
---|
| 36 | class Projects extends \Google\Service\Resource
|
---|
| 37 | {
|
---|
| 38 | /**
|
---|
| 39 | * Detects the language of text within a request. (projects.detectLanguage)
|
---|
| 40 | *
|
---|
| 41 | * @param string $parent Required. Project or location to make a call. Must
|
---|
| 42 | * refer to a caller's project. Format: `projects/{project-number-or-
|
---|
| 43 | * id}/locations/{location-id}` or `projects/{project-number-or-id}`. For global
|
---|
| 44 | * calls, use `projects/{project-number-or-id}/locations/global` or
|
---|
| 45 | * `projects/{project-number-or-id}`. Only models within the same region (has
|
---|
| 46 | * same location-id) can be used. Otherwise an INVALID_ARGUMENT (400) error is
|
---|
| 47 | * returned.
|
---|
| 48 | * @param DetectLanguageRequest $postBody
|
---|
| 49 | * @param array $optParams Optional parameters.
|
---|
| 50 | * @return DetectLanguageResponse
|
---|
| 51 | * @throws \Google\Service\Exception
|
---|
| 52 | */
|
---|
| 53 | public function detectLanguage($parent, DetectLanguageRequest $postBody, $optParams = [])
|
---|
| 54 | {
|
---|
| 55 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 56 | $params = array_merge($params, $optParams);
|
---|
| 57 | return $this->call('detectLanguage', [$params], DetectLanguageResponse::class);
|
---|
| 58 | }
|
---|
| 59 | /**
|
---|
| 60 | * Returns a list of supported languages for translation.
|
---|
| 61 | * (projects.getSupportedLanguages)
|
---|
| 62 | *
|
---|
| 63 | * @param string $parent Required. Project or location to make a call. Must
|
---|
| 64 | * refer to a caller's project. Format: `projects/{project-number-or-id}` or
|
---|
| 65 | * `projects/{project-number-or-id}/locations/{location-id}`. For global calls,
|
---|
| 66 | * use `projects/{project-number-or-id}/locations/global` or `projects/{project-
|
---|
| 67 | * number-or-id}`. Non-global location is required for AutoML models. Only
|
---|
| 68 | * models within the same region (have same location-id) can be used, otherwise
|
---|
| 69 | * an INVALID_ARGUMENT (400) error is returned.
|
---|
| 70 | * @param array $optParams Optional parameters.
|
---|
| 71 | *
|
---|
| 72 | * @opt_param string displayLanguageCode Optional. The language to use to return
|
---|
| 73 | * localized, human readable names of supported languages. If missing, then
|
---|
| 74 | * display names are not returned in a response.
|
---|
| 75 | * @opt_param string model Optional. Get supported languages of this model. The
|
---|
| 76 | * format depends on model type: - AutoML Translation models:
|
---|
| 77 | * `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` -
|
---|
| 78 | * General (built-in) models: `projects/{project-number-or-
|
---|
| 79 | * id}/locations/{location-id}/models/general/nmt`, Returns languages supported
|
---|
| 80 | * by the specified model. If missing, we get supported languages of Google
|
---|
| 81 | * general NMT model.
|
---|
| 82 | * @return SupportedLanguages
|
---|
| 83 | * @throws \Google\Service\Exception
|
---|
| 84 | */
|
---|
| 85 | public function getSupportedLanguages($parent, $optParams = [])
|
---|
| 86 | {
|
---|
| 87 | $params = ['parent' => $parent];
|
---|
| 88 | $params = array_merge($params, $optParams);
|
---|
| 89 | return $this->call('getSupportedLanguages', [$params], SupportedLanguages::class);
|
---|
| 90 | }
|
---|
| 91 | /**
|
---|
| 92 | * Romanize input text written in non-Latin scripts to Latin text.
|
---|
| 93 | * (projects.romanizeText)
|
---|
| 94 | *
|
---|
| 95 | * @param string $parent Required. Project or location to make a call. Must
|
---|
| 96 | * refer to a caller's project. Format: `projects/{project-number-or-
|
---|
| 97 | * id}/locations/{location-id}` or `projects/{project-number-or-id}`. For global
|
---|
| 98 | * calls, use `projects/{project-number-or-id}/locations/global` or
|
---|
| 99 | * `projects/{project-number-or-id}`.
|
---|
| 100 | * @param RomanizeTextRequest $postBody
|
---|
| 101 | * @param array $optParams Optional parameters.
|
---|
| 102 | * @return RomanizeTextResponse
|
---|
| 103 | * @throws \Google\Service\Exception
|
---|
| 104 | */
|
---|
| 105 | public function romanizeText($parent, RomanizeTextRequest $postBody, $optParams = [])
|
---|
| 106 | {
|
---|
| 107 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 108 | $params = array_merge($params, $optParams);
|
---|
| 109 | return $this->call('romanizeText', [$params], RomanizeTextResponse::class);
|
---|
| 110 | }
|
---|
| 111 | /**
|
---|
| 112 | * Translates input text and returns translated text. (projects.translateText)
|
---|
| 113 | *
|
---|
| 114 | * @param string $parent Required. Project or location to make a call. Must
|
---|
| 115 | * refer to a caller's project. Format: `projects/{project-number-or-id}` or
|
---|
| 116 | * `projects/{project-number-or-id}/locations/{location-id}`. For global calls,
|
---|
| 117 | * use `projects/{project-number-or-id}/locations/global` or `projects/{project-
|
---|
| 118 | * number-or-id}`. Non-global location is required for requests using AutoML
|
---|
| 119 | * models or custom glossaries. Models and glossaries must be within the same
|
---|
| 120 | * region (have same location-id), otherwise an INVALID_ARGUMENT (400) error is
|
---|
| 121 | * returned.
|
---|
| 122 | * @param TranslateTextRequest $postBody
|
---|
| 123 | * @param array $optParams Optional parameters.
|
---|
| 124 | * @return TranslateTextResponse
|
---|
| 125 | * @throws \Google\Service\Exception
|
---|
| 126 | */
|
---|
| 127 | public function translateText($parent, TranslateTextRequest $postBody, $optParams = [])
|
---|
| 128 | {
|
---|
| 129 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 130 | $params = array_merge($params, $optParams);
|
---|
| 131 | return $this->call('translateText', [$params], TranslateTextResponse::class);
|
---|
| 132 | }
|
---|
| 133 | }
|
---|
| 134 |
|
---|
| 135 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 136 | class_alias(Projects::class, 'Google_Service_Translate_Resource_Projects');
|
---|