Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403] [Versions 400 and 403] [Versions 401 and 403]
1 <?php 2 /* 3 * Copyright 2010 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 /** 19 * Service definition for Translate (v2). 20 * 21 * <p> 22 * Lets you translate text from one language to another</p> 23 * 24 * <p> 25 * For more information about this service, see the API 26 * <a href="https://developers.google.com/translate/v2/using_rest" target="_blank">Documentation</a> 27 * </p> 28 * 29 * @author Google, Inc. 30 */ 31 #[AllowDynamicProperties] 32 class Google_Service_Translate extends Google_Service 33 { 34 35 36 public $detections; 37 public $languages; 38 public $translations; 39 40 41 /** 42 * Constructs the internal representation of the Translate service. 43 * 44 * @param Google_Client $client 45 */ 46 public function __construct(Google_Client $client) 47 { 48 parent::__construct($client); 49 $this->rootUrl = 'https://www.googleapis.com/'; 50 $this->servicePath = 'language/translate/'; 51 $this->version = 'v2'; 52 $this->serviceName = 'translate'; 53 54 $this->detections = new Google_Service_Translate_Detections_Resource( 55 $this, 56 $this->serviceName, 57 'detections', 58 array( 59 'methods' => array( 60 'list' => array( 61 'path' => 'v2/detect', 62 'httpMethod' => 'GET', 63 'parameters' => array( 64 'q' => array( 65 'location' => 'query', 66 'type' => 'string', 67 'repeated' => true, 68 'required' => true, 69 ), 70 ), 71 ), 72 ) 73 ) 74 ); 75 $this->languages = new Google_Service_Translate_Languages_Resource( 76 $this, 77 $this->serviceName, 78 'languages', 79 array( 80 'methods' => array( 81 'list' => array( 82 'path' => 'v2/languages', 83 'httpMethod' => 'GET', 84 'parameters' => array( 85 'target' => array( 86 'location' => 'query', 87 'type' => 'string', 88 ), 89 ), 90 ), 91 ) 92 ) 93 ); 94 $this->translations = new Google_Service_Translate_Translations_Resource( 95 $this, 96 $this->serviceName, 97 'translations', 98 array( 99 'methods' => array( 100 'list' => array( 101 'path' => 'v2', 102 'httpMethod' => 'GET', 103 'parameters' => array( 104 'q' => array( 105 'location' => 'query', 106 'type' => 'string', 107 'repeated' => true, 108 'required' => true, 109 ), 110 'target' => array( 111 'location' => 'query', 112 'type' => 'string', 113 'required' => true, 114 ), 115 'source' => array( 116 'location' => 'query', 117 'type' => 'string', 118 ), 119 'format' => array( 120 'location' => 'query', 121 'type' => 'string', 122 ), 123 'cid' => array( 124 'location' => 'query', 125 'type' => 'string', 126 'repeated' => true, 127 ), 128 ), 129 ), 130 ) 131 ) 132 ); 133 } 134 } 135 136 137 /** 138 * The "detections" collection of methods. 139 * Typical usage is: 140 * <code> 141 * $translateService = new Google_Service_Translate(...); 142 * $detections = $translateService->detections; 143 * </code> 144 */ 145 #[AllowDynamicProperties] 146 class Google_Service_Translate_Detections_Resource extends Google_Service_Resource 147 { 148 149 /** 150 * Detect the language of text. (detections.listDetections) 151 * 152 * @param string $q The text to detect 153 * @param array $optParams Optional parameters. 154 * @return Google_Service_Translate_DetectionsListResponse 155 */ 156 public function listDetections($q, $optParams = array()) 157 { 158 $params = array('q' => $q); 159 $params = array_merge($params, $optParams); 160 return $this->call('list', array($params), "Google_Service_Translate_DetectionsListResponse"); 161 } 162 } 163 164 /** 165 * The "languages" collection of methods. 166 * Typical usage is: 167 * <code> 168 * $translateService = new Google_Service_Translate(...); 169 * $languages = $translateService->languages; 170 * </code> 171 */ 172 #[AllowDynamicProperties] 173 class Google_Service_Translate_Languages_Resource extends Google_Service_Resource 174 { 175 176 /** 177 * List the source/target languages supported by the API 178 * (languages.listLanguages) 179 * 180 * @param array $optParams Optional parameters. 181 * 182 * @opt_param string target the language and collation in which the localized 183 * results should be returned 184 * @return Google_Service_Translate_LanguagesListResponse 185 */ 186 public function listLanguages($optParams = array()) 187 { 188 $params = array(); 189 $params = array_merge($params, $optParams); 190 return $this->call('list', array($params), "Google_Service_Translate_LanguagesListResponse"); 191 } 192 } 193 194 /** 195 * The "translations" collection of methods. 196 * Typical usage is: 197 * <code> 198 * $translateService = new Google_Service_Translate(...); 199 * $translations = $translateService->translations; 200 * </code> 201 */ 202 #[AllowDynamicProperties] 203 class Google_Service_Translate_Translations_Resource extends Google_Service_Resource 204 { 205 206 /** 207 * Returns text translations from one language to another. 208 * (translations.listTranslations) 209 * 210 * @param string $q The text to translate 211 * @param string $target The target language into which the text should be 212 * translated 213 * @param array $optParams Optional parameters. 214 * 215 * @opt_param string source The source language of the text 216 * @opt_param string format The format of the text 217 * @opt_param string cid The customization id for translate 218 * @return Google_Service_Translate_TranslationsListResponse 219 */ 220 public function listTranslations($q, $target, $optParams = array()) 221 { 222 $params = array('q' => $q, 'target' => $target); 223 $params = array_merge($params, $optParams); 224 return $this->call('list', array($params), "Google_Service_Translate_TranslationsListResponse"); 225 } 226 } 227 228 229 230 231 #[AllowDynamicProperties] 232 class Google_Service_Translate_DetectionsListResponse extends Google_Collection 233 { 234 protected $collection_key = 'detections'; 235 protected $internal_gapi_mappings = array( 236 ); 237 protected $detectionsType = 'Google_Service_Translate_DetectionsResourceItems'; 238 protected $detectionsDataType = 'array'; 239 240 241 public function setDetections($detections) 242 { 243 $this->detections = $detections; 244 } 245 public function getDetections() 246 { 247 return $this->detections; 248 } 249 } 250 251 #[AllowDynamicProperties] 252 class Google_Service_Translate_DetectionsResourceItems extends Google_Model 253 { 254 protected $internal_gapi_mappings = array( 255 ); 256 public $confidence; 257 public $isReliable; 258 public $language; 259 260 261 public function setConfidence($confidence) 262 { 263 $this->confidence = $confidence; 264 } 265 public function getConfidence() 266 { 267 return $this->confidence; 268 } 269 public function setIsReliable($isReliable) 270 { 271 $this->isReliable = $isReliable; 272 } 273 public function getIsReliable() 274 { 275 return $this->isReliable; 276 } 277 public function setLanguage($language) 278 { 279 $this->language = $language; 280 } 281 public function getLanguage() 282 { 283 return $this->language; 284 } 285 } 286 287 #[AllowDynamicProperties] 288 class Google_Service_Translate_LanguagesListResponse extends Google_Collection 289 { 290 protected $collection_key = 'languages'; 291 protected $internal_gapi_mappings = array( 292 ); 293 protected $languagesType = 'Google_Service_Translate_LanguagesResource'; 294 protected $languagesDataType = 'array'; 295 296 297 public function setLanguages($languages) 298 { 299 $this->languages = $languages; 300 } 301 public function getLanguages() 302 { 303 return $this->languages; 304 } 305 } 306 307 #[AllowDynamicProperties] 308 class Google_Service_Translate_LanguagesResource extends Google_Model 309 { 310 protected $internal_gapi_mappings = array( 311 ); 312 public $language; 313 public $name; 314 315 316 public function setLanguage($language) 317 { 318 $this->language = $language; 319 } 320 public function getLanguage() 321 { 322 return $this->language; 323 } 324 public function setName($name) 325 { 326 $this->name = $name; 327 } 328 public function getName() 329 { 330 return $this->name; 331 } 332 } 333 334 #[AllowDynamicProperties] 335 class Google_Service_Translate_TranslationsListResponse extends Google_Collection 336 { 337 protected $collection_key = 'translations'; 338 protected $internal_gapi_mappings = array( 339 ); 340 protected $translationsType = 'Google_Service_Translate_TranslationsResource'; 341 protected $translationsDataType = 'array'; 342 343 344 public function setTranslations($translations) 345 { 346 $this->translations = $translations; 347 } 348 public function getTranslations() 349 { 350 return $this->translations; 351 } 352 } 353 354 #[AllowDynamicProperties] 355 class Google_Service_Translate_TranslationsResource extends Google_Model 356 { 357 protected $internal_gapi_mappings = array( 358 ); 359 public $detectedSourceLanguage; 360 public $translatedText; 361 362 363 public function setDetectedSourceLanguage($detectedSourceLanguage) 364 { 365 $this->detectedSourceLanguage = $detectedSourceLanguage; 366 } 367 public function getDetectedSourceLanguage() 368 { 369 return $this->detectedSourceLanguage; 370 } 371 public function setTranslatedText($translatedText) 372 { 373 $this->translatedText = $translatedText; 374 } 375 public function getTranslatedText() 376 { 377 return $this->translatedText; 378 } 379 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body