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 Sheets (v4).
24 *
25 * <p>
26 * Reads and writes Google Sheets.</p>
27 *
28 * <p>
29 * For more information about this service, see the API
30 * <a href="https://developers.google.com/sheets/" target="_blank">Documentation</a>
31 * </p>
32 *
33 * @author Google, Inc.
34 */
35class Sheets extends \Google\Service
36{
37  /** See, edit, create, and delete all of your Google Drive files. */
38  const DRIVE =
39      "https://www.googleapis.com/auth/drive";
40  /** See, edit, create, and delete only the specific Google Drive files you use with this app. */
41  const DRIVE_FILE =
42      "https://www.googleapis.com/auth/drive.file";
43  /** See and download all your Google Drive files. */
44  const DRIVE_READONLY =
45      "https://www.googleapis.com/auth/drive.readonly";
46  /** See, edit, create, and delete all your Google Sheets spreadsheets. */
47  const SPREADSHEETS =
48      "https://www.googleapis.com/auth/spreadsheets";
49  /** See all your Google Sheets spreadsheets. */
50  const SPREADSHEETS_READONLY =
51      "https://www.googleapis.com/auth/spreadsheets.readonly";
52
53  public $spreadsheets;
54  public $spreadsheets_developerMetadata;
55  public $spreadsheets_sheets;
56  public $spreadsheets_values;
57
58  /**
59   * Constructs the internal representation of the Sheets service.
60   *
61   * @param Client|array $clientOrConfig The client used to deliver requests, or a
62   *                                     config array to pass to a new Client instance.
63   * @param string $rootUrl The root URL used for requests to the service.
64   */
65  public function __construct($clientOrConfig = [], $rootUrl = null)
66  {
67    parent::__construct($clientOrConfig);
68    $this->rootUrl = $rootUrl ?: 'https://sheets.googleapis.com/';
69    $this->servicePath = '';
70    $this->batchPath = 'batch';
71    $this->version = 'v4';
72    $this->serviceName = 'sheets';
73
74    $this->spreadsheets = new Sheets\Resource\Spreadsheets(
75        $this,
76        $this->serviceName,
77        'spreadsheets',
78        [
79          'methods' => [
80            'batchUpdate' => [
81              'path' => 'v4/spreadsheets/{spreadsheetId}:batchUpdate',
82              'httpMethod' => 'POST',
83              'parameters' => [
84                'spreadsheetId' => [
85                  'location' => 'path',
86                  'type' => 'string',
87                  'required' => true,
88                ],
89              ],
90            ],'create' => [
91              'path' => 'v4/spreadsheets',
92              'httpMethod' => 'POST',
93              'parameters' => [],
94            ],'get' => [
95              'path' => 'v4/spreadsheets/{spreadsheetId}',
96              'httpMethod' => 'GET',
97              'parameters' => [
98                'spreadsheetId' => [
99                  'location' => 'path',
100                  'type' => 'string',
101                  'required' => true,
102                ],
103                'includeGridData' => [
104                  'location' => 'query',
105                  'type' => 'boolean',
106                ],
107                'ranges' => [
108                  'location' => 'query',
109                  'type' => 'string',
110                  'repeated' => true,
111                ],
112              ],
113            ],'getByDataFilter' => [
114              'path' => 'v4/spreadsheets/{spreadsheetId}:getByDataFilter',
115              'httpMethod' => 'POST',
116              'parameters' => [
117                'spreadsheetId' => [
118                  'location' => 'path',
119                  'type' => 'string',
120                  'required' => true,
121                ],
122              ],
123            ],
124          ]
125        ]
126    );
127    $this->spreadsheets_developerMetadata = new Sheets\Resource\SpreadsheetsDeveloperMetadata(
128        $this,
129        $this->serviceName,
130        'developerMetadata',
131        [
132          'methods' => [
133            'get' => [
134              'path' => 'v4/spreadsheets/{spreadsheetId}/developerMetadata/{metadataId}',
135              'httpMethod' => 'GET',
136              'parameters' => [
137                'spreadsheetId' => [
138                  'location' => 'path',
139                  'type' => 'string',
140                  'required' => true,
141                ],
142                'metadataId' => [
143                  'location' => 'path',
144                  'type' => 'integer',
145                  'required' => true,
146                ],
147              ],
148            ],'search' => [
149              'path' => 'v4/spreadsheets/{spreadsheetId}/developerMetadata:search',
150              'httpMethod' => 'POST',
151              'parameters' => [
152                'spreadsheetId' => [
153                  'location' => 'path',
154                  'type' => 'string',
155                  'required' => true,
156                ],
157              ],
158            ],
159          ]
160        ]
161    );
162    $this->spreadsheets_sheets = new Sheets\Resource\SpreadsheetsSheets(
163        $this,
164        $this->serviceName,
165        'sheets',
166        [
167          'methods' => [
168            'copyTo' => [
169              'path' => 'v4/spreadsheets/{spreadsheetId}/sheets/{sheetId}:copyTo',
170              'httpMethod' => 'POST',
171              'parameters' => [
172                'spreadsheetId' => [
173                  'location' => 'path',
174                  'type' => 'string',
175                  'required' => true,
176                ],
177                'sheetId' => [
178                  'location' => 'path',
179                  'type' => 'integer',
180                  'required' => true,
181                ],
182              ],
183            ],
184          ]
185        ]
186    );
187    $this->spreadsheets_values = new Sheets\Resource\SpreadsheetsValues(
188        $this,
189        $this->serviceName,
190        'values',
191        [
192          'methods' => [
193            'append' => [
194              'path' => 'v4/spreadsheets/{spreadsheetId}/values/{range}:append',
195              'httpMethod' => 'POST',
196              'parameters' => [
197                'spreadsheetId' => [
198                  'location' => 'path',
199                  'type' => 'string',
200                  'required' => true,
201                ],
202                'range' => [
203                  'location' => 'path',
204                  'type' => 'string',
205                  'required' => true,
206                ],
207                'includeValuesInResponse' => [
208                  'location' => 'query',
209                  'type' => 'boolean',
210                ],
211                'insertDataOption' => [
212                  'location' => 'query',
213                  'type' => 'string',
214                ],
215                'responseDateTimeRenderOption' => [
216                  'location' => 'query',
217                  'type' => 'string',
218                ],
219                'responseValueRenderOption' => [
220                  'location' => 'query',
221                  'type' => 'string',
222                ],
223                'valueInputOption' => [
224                  'location' => 'query',
225                  'type' => 'string',
226                ],
227              ],
228            ],'batchClear' => [
229              'path' => 'v4/spreadsheets/{spreadsheetId}/values:batchClear',
230              'httpMethod' => 'POST',
231              'parameters' => [
232                'spreadsheetId' => [
233                  'location' => 'path',
234                  'type' => 'string',
235                  'required' => true,
236                ],
237              ],
238            ],'batchClearByDataFilter' => [
239              'path' => 'v4/spreadsheets/{spreadsheetId}/values:batchClearByDataFilter',
240              'httpMethod' => 'POST',
241              'parameters' => [
242                'spreadsheetId' => [
243                  'location' => 'path',
244                  'type' => 'string',
245                  'required' => true,
246                ],
247              ],
248            ],'batchGet' => [
249              'path' => 'v4/spreadsheets/{spreadsheetId}/values:batchGet',
250              'httpMethod' => 'GET',
251              'parameters' => [
252                'spreadsheetId' => [
253                  'location' => 'path',
254                  'type' => 'string',
255                  'required' => true,
256                ],
257                'dateTimeRenderOption' => [
258                  'location' => 'query',
259                  'type' => 'string',
260                ],
261                'majorDimension' => [
262                  'location' => 'query',
263                  'type' => 'string',
264                ],
265                'ranges' => [
266                  'location' => 'query',
267                  'type' => 'string',
268                  'repeated' => true,
269                ],
270                'valueRenderOption' => [
271                  'location' => 'query',
272                  'type' => 'string',
273                ],
274              ],
275            ],'batchGetByDataFilter' => [
276              'path' => 'v4/spreadsheets/{spreadsheetId}/values:batchGetByDataFilter',
277              'httpMethod' => 'POST',
278              'parameters' => [
279                'spreadsheetId' => [
280                  'location' => 'path',
281                  'type' => 'string',
282                  'required' => true,
283                ],
284              ],
285            ],'batchUpdate' => [
286              'path' => 'v4/spreadsheets/{spreadsheetId}/values:batchUpdate',
287              'httpMethod' => 'POST',
288              'parameters' => [
289                'spreadsheetId' => [
290                  'location' => 'path',
291                  'type' => 'string',
292                  'required' => true,
293                ],
294              ],
295            ],'batchUpdateByDataFilter' => [
296              'path' => 'v4/spreadsheets/{spreadsheetId}/values:batchUpdateByDataFilter',
297              'httpMethod' => 'POST',
298              'parameters' => [
299                'spreadsheetId' => [
300                  'location' => 'path',
301                  'type' => 'string',
302                  'required' => true,
303                ],
304              ],
305            ],'clear' => [
306              'path' => 'v4/spreadsheets/{spreadsheetId}/values/{range}:clear',
307              'httpMethod' => 'POST',
308              'parameters' => [
309                'spreadsheetId' => [
310                  'location' => 'path',
311                  'type' => 'string',
312                  'required' => true,
313                ],
314                'range' => [
315                  'location' => 'path',
316                  'type' => 'string',
317                  'required' => true,
318                ],
319              ],
320            ],'get' => [
321              'path' => 'v4/spreadsheets/{spreadsheetId}/values/{range}',
322              'httpMethod' => 'GET',
323              'parameters' => [
324                'spreadsheetId' => [
325                  'location' => 'path',
326                  'type' => 'string',
327                  'required' => true,
328                ],
329                'range' => [
330                  'location' => 'path',
331                  'type' => 'string',
332                  'required' => true,
333                ],
334                'dateTimeRenderOption' => [
335                  'location' => 'query',
336                  'type' => 'string',
337                ],
338                'majorDimension' => [
339                  'location' => 'query',
340                  'type' => 'string',
341                ],
342                'valueRenderOption' => [
343                  'location' => 'query',
344                  'type' => 'string',
345                ],
346              ],
347            ],'update' => [
348              'path' => 'v4/spreadsheets/{spreadsheetId}/values/{range}',
349              'httpMethod' => 'PUT',
350              'parameters' => [
351                'spreadsheetId' => [
352                  'location' => 'path',
353                  'type' => 'string',
354                  'required' => true,
355                ],
356                'range' => [
357                  'location' => 'path',
358                  'type' => 'string',
359                  'required' => true,
360                ],
361                'includeValuesInResponse' => [
362                  'location' => 'query',
363                  'type' => 'boolean',
364                ],
365                'responseDateTimeRenderOption' => [
366                  'location' => 'query',
367                  'type' => 'string',
368                ],
369                'responseValueRenderOption' => [
370                  'location' => 'query',
371                  'type' => 'string',
372                ],
373                'valueInputOption' => [
374                  'location' => 'query',
375                  'type' => 'string',
376                ],
377              ],
378            ],
379          ]
380        ]
381    );
382  }
383}
384
385// Adding a class alias for backwards compatibility with the previous class name.
386class_alias(Sheets::class, 'Google_Service_Sheets');
387