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/**
19 * Service definition for Translate (v2).
20 *
21 * <p>
22 * The Google Cloud Translation API lets websites and programs integrate with
23 * Google Translate programmatically.</p>
24 *
25 * <p>
26 * For more information about this service, see the API
27 * <a href="https://code.google.com/apis/language/translate/v2/getting_started.html" target="_blank">Documentation</a>
28 * </p>
29 *
30 * @author Google, Inc.
31 */
32class Google_Service_Translate extends Google_Service
33{
34  /** View and manage your data across Google Cloud Platform services. */
35  const CLOUD_PLATFORM =
36      "https://www.googleapis.com/auth/cloud-platform";
37  /** Translate text from one language to another using Google Translate. */
38  const CLOUD_TRANSLATION =
39      "https://www.googleapis.com/auth/cloud-translation";
40
41  public $detections;
42  public $languages;
43  public $translations;
44
45  /**
46   * Constructs the internal representation of the Translate service.
47   *
48   * @param Google_Client $client
49   */
50  public function __construct(Google_Client $client)
51  {
52    parent::__construct($client);
53    $this->rootUrl = 'https://translation.googleapis.com/';
54    $this->servicePath = 'language/translate/';
55    $this->batchPath = 'batch/translate';
56    $this->version = 'v2';
57    $this->serviceName = 'translate';
58
59    $this->detections = new Google_Service_Translate_Resource_Detections(
60        $this,
61        $this->serviceName,
62        'detections',
63        array(
64          'methods' => array(
65            'detect' => array(
66              'path' => 'v2/detect',
67              'httpMethod' => 'POST',
68              'parameters' => array(),
69            ),'list' => array(
70              'path' => 'v2/detect',
71              'httpMethod' => 'GET',
72              'parameters' => array(
73                'q' => array(
74                  'location' => 'query',
75                  'type' => 'string',
76                  'repeated' => true,
77                  'required' => true,
78                ),
79              ),
80            ),
81          )
82        )
83    );
84    $this->languages = new Google_Service_Translate_Resource_Languages(
85        $this,
86        $this->serviceName,
87        'languages',
88        array(
89          'methods' => array(
90            'list' => array(
91              'path' => 'v2/languages',
92              'httpMethod' => 'GET',
93              'parameters' => array(
94                'target' => array(
95                  'location' => 'query',
96                  'type' => 'string',
97                ),
98                'model' => array(
99                  'location' => 'query',
100                  'type' => 'string',
101                ),
102              ),
103            ),
104          )
105        )
106    );
107    $this->translations = new Google_Service_Translate_Resource_Translations(
108        $this,
109        $this->serviceName,
110        'translations',
111        array(
112          'methods' => array(
113            'list' => array(
114              'path' => 'v2',
115              'httpMethod' => 'GET',
116              'parameters' => array(
117                'q' => array(
118                  'location' => 'query',
119                  'type' => 'string',
120                  'repeated' => true,
121                  'required' => true,
122                ),
123                'target' => array(
124                  'location' => 'query',
125                  'type' => 'string',
126                  'required' => true,
127                ),
128                'model' => array(
129                  'location' => 'query',
130                  'type' => 'string',
131                ),
132                'source' => array(
133                  'location' => 'query',
134                  'type' => 'string',
135                ),
136                'cid' => array(
137                  'location' => 'query',
138                  'type' => 'string',
139                  'repeated' => true,
140                ),
141                'format' => array(
142                  'location' => 'query',
143                  'type' => 'string',
144                ),
145              ),
146            ),'translate' => array(
147              'path' => 'v2',
148              'httpMethod' => 'POST',
149              'parameters' => array(),
150            ),
151          )
152        )
153    );
154  }
155}
156