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