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 Firestore (v1).
24 *
25 * <p>
26 * Accesses the NoSQL document database built for automatic scaling, high
27 * performance, and ease of application development.</p>
28 *
29 * <p>
30 * For more information about this service, see the API
31 * <a href="https://cloud.google.com/firestore" target="_blank">Documentation</a>
32 * </p>
33 *
34 * @author Google, Inc.
35 */
36class Firestore extends \Google\Service
37{
38  /** See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.. */
39  const CLOUD_PLATFORM =
40      "https://www.googleapis.com/auth/cloud-platform";
41  /** View and manage your Google Cloud Datastore data. */
42  const DATASTORE =
43      "https://www.googleapis.com/auth/datastore";
44
45  public $projects_databases;
46  public $projects_databases_collectionGroups_fields;
47  public $projects_databases_collectionGroups_indexes;
48  public $projects_databases_documents;
49  public $projects_databases_operations;
50  public $projects_locations;
51
52  /**
53   * Constructs the internal representation of the Firestore service.
54   *
55   * @param Client|array $clientOrConfig The client used to deliver requests, or a
56   *                                     config array to pass to a new Client instance.
57   * @param string $rootUrl The root URL used for requests to the service.
58   */
59  public function __construct($clientOrConfig = [], $rootUrl = null)
60  {
61    parent::__construct($clientOrConfig);
62    $this->rootUrl = $rootUrl ?: 'https://firestore.googleapis.com/';
63    $this->servicePath = '';
64    $this->batchPath = 'batch';
65    $this->version = 'v1';
66    $this->serviceName = 'firestore';
67
68    $this->projects_databases = new Firestore\Resource\ProjectsDatabases(
69        $this,
70        $this->serviceName,
71        'databases',
72        [
73          'methods' => [
74            'exportDocuments' => [
75              'path' => 'v1/{+name}:exportDocuments',
76              'httpMethod' => 'POST',
77              'parameters' => [
78                'name' => [
79                  'location' => 'path',
80                  'type' => 'string',
81                  'required' => true,
82                ],
83              ],
84            ],'get' => [
85              'path' => 'v1/{+name}',
86              'httpMethod' => 'GET',
87              'parameters' => [
88                'name' => [
89                  'location' => 'path',
90                  'type' => 'string',
91                  'required' => true,
92                ],
93              ],
94            ],'importDocuments' => [
95              'path' => 'v1/{+name}:importDocuments',
96              'httpMethod' => 'POST',
97              'parameters' => [
98                'name' => [
99                  'location' => 'path',
100                  'type' => 'string',
101                  'required' => true,
102                ],
103              ],
104            ],'list' => [
105              'path' => 'v1/{+parent}/databases',
106              'httpMethod' => 'GET',
107              'parameters' => [
108                'parent' => [
109                  'location' => 'path',
110                  'type' => 'string',
111                  'required' => true,
112                ],
113              ],
114            ],'patch' => [
115              'path' => 'v1/{+name}',
116              'httpMethod' => 'PATCH',
117              'parameters' => [
118                'name' => [
119                  'location' => 'path',
120                  'type' => 'string',
121                  'required' => true,
122                ],
123                'updateMask' => [
124                  'location' => 'query',
125                  'type' => 'string',
126                ],
127              ],
128            ],
129          ]
130        ]
131    );
132    $this->projects_databases_collectionGroups_fields = new Firestore\Resource\ProjectsDatabasesCollectionGroupsFields(
133        $this,
134        $this->serviceName,
135        'fields',
136        [
137          'methods' => [
138            'get' => [
139              'path' => 'v1/{+name}',
140              'httpMethod' => 'GET',
141              'parameters' => [
142                'name' => [
143                  'location' => 'path',
144                  'type' => 'string',
145                  'required' => true,
146                ],
147              ],
148            ],'list' => [
149              'path' => 'v1/{+parent}/fields',
150              'httpMethod' => 'GET',
151              'parameters' => [
152                'parent' => [
153                  'location' => 'path',
154                  'type' => 'string',
155                  'required' => true,
156                ],
157                'filter' => [
158                  'location' => 'query',
159                  'type' => 'string',
160                ],
161                'pageSize' => [
162                  'location' => 'query',
163                  'type' => 'integer',
164                ],
165                'pageToken' => [
166                  'location' => 'query',
167                  'type' => 'string',
168                ],
169              ],
170            ],'patch' => [
171              'path' => 'v1/{+name}',
172              'httpMethod' => 'PATCH',
173              'parameters' => [
174                'name' => [
175                  'location' => 'path',
176                  'type' => 'string',
177                  'required' => true,
178                ],
179                'updateMask' => [
180                  'location' => 'query',
181                  'type' => 'string',
182                ],
183              ],
184            ],
185          ]
186        ]
187    );
188    $this->projects_databases_collectionGroups_indexes = new Firestore\Resource\ProjectsDatabasesCollectionGroupsIndexes(
189        $this,
190        $this->serviceName,
191        'indexes',
192        [
193          'methods' => [
194            'create' => [
195              'path' => 'v1/{+parent}/indexes',
196              'httpMethod' => 'POST',
197              'parameters' => [
198                'parent' => [
199                  'location' => 'path',
200                  'type' => 'string',
201                  'required' => true,
202                ],
203              ],
204            ],'delete' => [
205              'path' => 'v1/{+name}',
206              'httpMethod' => 'DELETE',
207              'parameters' => [
208                'name' => [
209                  'location' => 'path',
210                  'type' => 'string',
211                  'required' => true,
212                ],
213              ],
214            ],'get' => [
215              'path' => 'v1/{+name}',
216              'httpMethod' => 'GET',
217              'parameters' => [
218                'name' => [
219                  'location' => 'path',
220                  'type' => 'string',
221                  'required' => true,
222                ],
223              ],
224            ],'list' => [
225              'path' => 'v1/{+parent}/indexes',
226              'httpMethod' => 'GET',
227              'parameters' => [
228                'parent' => [
229                  'location' => 'path',
230                  'type' => 'string',
231                  'required' => true,
232                ],
233                'filter' => [
234                  'location' => 'query',
235                  'type' => 'string',
236                ],
237                'pageSize' => [
238                  'location' => 'query',
239                  'type' => 'integer',
240                ],
241                'pageToken' => [
242                  'location' => 'query',
243                  'type' => 'string',
244                ],
245              ],
246            ],
247          ]
248        ]
249    );
250    $this->projects_databases_documents = new Firestore\Resource\ProjectsDatabasesDocuments(
251        $this,
252        $this->serviceName,
253        'documents',
254        [
255          'methods' => [
256            'batchGet' => [
257              'path' => 'v1/{+database}/documents:batchGet',
258              'httpMethod' => 'POST',
259              'parameters' => [
260                'database' => [
261                  'location' => 'path',
262                  'type' => 'string',
263                  'required' => true,
264                ],
265              ],
266            ],'batchWrite' => [
267              'path' => 'v1/{+database}/documents:batchWrite',
268              'httpMethod' => 'POST',
269              'parameters' => [
270                'database' => [
271                  'location' => 'path',
272                  'type' => 'string',
273                  'required' => true,
274                ],
275              ],
276            ],'beginTransaction' => [
277              'path' => 'v1/{+database}/documents:beginTransaction',
278              'httpMethod' => 'POST',
279              'parameters' => [
280                'database' => [
281                  'location' => 'path',
282                  'type' => 'string',
283                  'required' => true,
284                ],
285              ],
286            ],'commit' => [
287              'path' => 'v1/{+database}/documents:commit',
288              'httpMethod' => 'POST',
289              'parameters' => [
290                'database' => [
291                  'location' => 'path',
292                  'type' => 'string',
293                  'required' => true,
294                ],
295              ],
296            ],'createDocument' => [
297              'path' => 'v1/{+parent}/{collectionId}',
298              'httpMethod' => 'POST',
299              'parameters' => [
300                'parent' => [
301                  'location' => 'path',
302                  'type' => 'string',
303                  'required' => true,
304                ],
305                'collectionId' => [
306                  'location' => 'path',
307                  'type' => 'string',
308                  'required' => true,
309                ],
310                'documentId' => [
311                  'location' => 'query',
312                  'type' => 'string',
313                ],
314                'mask.fieldPaths' => [
315                  'location' => 'query',
316                  'type' => 'string',
317                  'repeated' => true,
318                ],
319              ],
320            ],'delete' => [
321              'path' => 'v1/{+name}',
322              'httpMethod' => 'DELETE',
323              'parameters' => [
324                'name' => [
325                  'location' => 'path',
326                  'type' => 'string',
327                  'required' => true,
328                ],
329                'currentDocument.exists' => [
330                  'location' => 'query',
331                  'type' => 'boolean',
332                ],
333                'currentDocument.updateTime' => [
334                  'location' => 'query',
335                  'type' => 'string',
336                ],
337              ],
338            ],'get' => [
339              'path' => 'v1/{+name}',
340              'httpMethod' => 'GET',
341              'parameters' => [
342                'name' => [
343                  'location' => 'path',
344                  'type' => 'string',
345                  'required' => true,
346                ],
347                'mask.fieldPaths' => [
348                  'location' => 'query',
349                  'type' => 'string',
350                  'repeated' => true,
351                ],
352                'readTime' => [
353                  'location' => 'query',
354                  'type' => 'string',
355                ],
356                'transaction' => [
357                  'location' => 'query',
358                  'type' => 'string',
359                ],
360              ],
361            ],'list' => [
362              'path' => 'v1/{+parent}/{collectionId}',
363              'httpMethod' => 'GET',
364              'parameters' => [
365                'parent' => [
366                  'location' => 'path',
367                  'type' => 'string',
368                  'required' => true,
369                ],
370                'collectionId' => [
371                  'location' => 'path',
372                  'type' => 'string',
373                  'required' => true,
374                ],
375                'mask.fieldPaths' => [
376                  'location' => 'query',
377                  'type' => 'string',
378                  'repeated' => true,
379                ],
380                'orderBy' => [
381                  'location' => 'query',
382                  'type' => 'string',
383                ],
384                'pageSize' => [
385                  'location' => 'query',
386                  'type' => 'integer',
387                ],
388                'pageToken' => [
389                  'location' => 'query',
390                  'type' => 'string',
391                ],
392                'readTime' => [
393                  'location' => 'query',
394                  'type' => 'string',
395                ],
396                'showMissing' => [
397                  'location' => 'query',
398                  'type' => 'boolean',
399                ],
400                'transaction' => [
401                  'location' => 'query',
402                  'type' => 'string',
403                ],
404              ],
405            ],'listCollectionIds' => [
406              'path' => 'v1/{+parent}:listCollectionIds',
407              'httpMethod' => 'POST',
408              'parameters' => [
409                'parent' => [
410                  'location' => 'path',
411                  'type' => 'string',
412                  'required' => true,
413                ],
414              ],
415            ],'listDocuments' => [
416              'path' => 'v1/{+parent}/{collectionId}',
417              'httpMethod' => 'GET',
418              'parameters' => [
419                'parent' => [
420                  'location' => 'path',
421                  'type' => 'string',
422                  'required' => true,
423                ],
424                'collectionId' => [
425                  'location' => 'path',
426                  'type' => 'string',
427                  'required' => true,
428                ],
429                'mask.fieldPaths' => [
430                  'location' => 'query',
431                  'type' => 'string',
432                  'repeated' => true,
433                ],
434                'orderBy' => [
435                  'location' => 'query',
436                  'type' => 'string',
437                ],
438                'pageSize' => [
439                  'location' => 'query',
440                  'type' => 'integer',
441                ],
442                'pageToken' => [
443                  'location' => 'query',
444                  'type' => 'string',
445                ],
446                'readTime' => [
447                  'location' => 'query',
448                  'type' => 'string',
449                ],
450                'showMissing' => [
451                  'location' => 'query',
452                  'type' => 'boolean',
453                ],
454                'transaction' => [
455                  'location' => 'query',
456                  'type' => 'string',
457                ],
458              ],
459            ],'listen' => [
460              'path' => 'v1/{+database}/documents:listen',
461              'httpMethod' => 'POST',
462              'parameters' => [
463                'database' => [
464                  'location' => 'path',
465                  'type' => 'string',
466                  'required' => true,
467                ],
468              ],
469            ],'partitionQuery' => [
470              'path' => 'v1/{+parent}:partitionQuery',
471              'httpMethod' => 'POST',
472              'parameters' => [
473                'parent' => [
474                  'location' => 'path',
475                  'type' => 'string',
476                  'required' => true,
477                ],
478              ],
479            ],'patch' => [
480              'path' => 'v1/{+name}',
481              'httpMethod' => 'PATCH',
482              'parameters' => [
483                'name' => [
484                  'location' => 'path',
485                  'type' => 'string',
486                  'required' => true,
487                ],
488                'currentDocument.exists' => [
489                  'location' => 'query',
490                  'type' => 'boolean',
491                ],
492                'currentDocument.updateTime' => [
493                  'location' => 'query',
494                  'type' => 'string',
495                ],
496                'mask.fieldPaths' => [
497                  'location' => 'query',
498                  'type' => 'string',
499                  'repeated' => true,
500                ],
501                'updateMask.fieldPaths' => [
502                  'location' => 'query',
503                  'type' => 'string',
504                  'repeated' => true,
505                ],
506              ],
507            ],'rollback' => [
508              'path' => 'v1/{+database}/documents:rollback',
509              'httpMethod' => 'POST',
510              'parameters' => [
511                'database' => [
512                  'location' => 'path',
513                  'type' => 'string',
514                  'required' => true,
515                ],
516              ],
517            ],'runAggregationQuery' => [
518              'path' => 'v1/{+parent}:runAggregationQuery',
519              'httpMethod' => 'POST',
520              'parameters' => [
521                'parent' => [
522                  'location' => 'path',
523                  'type' => 'string',
524                  'required' => true,
525                ],
526              ],
527            ],'runQuery' => [
528              'path' => 'v1/{+parent}:runQuery',
529              'httpMethod' => 'POST',
530              'parameters' => [
531                'parent' => [
532                  'location' => 'path',
533                  'type' => 'string',
534                  'required' => true,
535                ],
536              ],
537            ],'write' => [
538              'path' => 'v1/{+database}/documents:write',
539              'httpMethod' => 'POST',
540              'parameters' => [
541                'database' => [
542                  'location' => 'path',
543                  'type' => 'string',
544                  'required' => true,
545                ],
546              ],
547            ],
548          ]
549        ]
550    );
551    $this->projects_databases_operations = new Firestore\Resource\ProjectsDatabasesOperations(
552        $this,
553        $this->serviceName,
554        'operations',
555        [
556          'methods' => [
557            'cancel' => [
558              'path' => 'v1/{+name}:cancel',
559              'httpMethod' => 'POST',
560              'parameters' => [
561                'name' => [
562                  'location' => 'path',
563                  'type' => 'string',
564                  'required' => true,
565                ],
566              ],
567            ],'delete' => [
568              'path' => 'v1/{+name}',
569              'httpMethod' => 'DELETE',
570              'parameters' => [
571                'name' => [
572                  'location' => 'path',
573                  'type' => 'string',
574                  'required' => true,
575                ],
576              ],
577            ],'get' => [
578              'path' => 'v1/{+name}',
579              'httpMethod' => 'GET',
580              'parameters' => [
581                'name' => [
582                  'location' => 'path',
583                  'type' => 'string',
584                  'required' => true,
585                ],
586              ],
587            ],'list' => [
588              'path' => 'v1/{+name}/operations',
589              'httpMethod' => 'GET',
590              'parameters' => [
591                'name' => [
592                  'location' => 'path',
593                  'type' => 'string',
594                  'required' => true,
595                ],
596                'filter' => [
597                  'location' => 'query',
598                  'type' => 'string',
599                ],
600                'pageSize' => [
601                  'location' => 'query',
602                  'type' => 'integer',
603                ],
604                'pageToken' => [
605                  'location' => 'query',
606                  'type' => 'string',
607                ],
608              ],
609            ],
610          ]
611        ]
612    );
613    $this->projects_locations = new Firestore\Resource\ProjectsLocations(
614        $this,
615        $this->serviceName,
616        'locations',
617        [
618          'methods' => [
619            'get' => [
620              'path' => 'v1/{+name}',
621              'httpMethod' => 'GET',
622              'parameters' => [
623                'name' => [
624                  'location' => 'path',
625                  'type' => 'string',
626                  'required' => true,
627                ],
628              ],
629            ],'list' => [
630              'path' => 'v1/{+name}/locations',
631              'httpMethod' => 'GET',
632              'parameters' => [
633                'name' => [
634                  'location' => 'path',
635                  'type' => 'string',
636                  'required' => true,
637                ],
638                'filter' => [
639                  'location' => 'query',
640                  'type' => 'string',
641                ],
642                'pageSize' => [
643                  'location' => 'query',
644                  'type' => 'integer',
645                ],
646                'pageToken' => [
647                  'location' => 'query',
648                  'type' => 'string',
649                ],
650              ],
651            ],
652          ]
653        ]
654    );
655  }
656}
657
658// Adding a class alias for backwards compatibility with the previous class name.
659class_alias(Firestore::class, 'Google_Service_Firestore');
660