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\Firestore\Resource;
19
20use Google\Service\Firestore\FirestoreEmpty;
21use Google\Service\Firestore\GoogleFirestoreAdminV1Index;
22use Google\Service\Firestore\GoogleFirestoreAdminV1ListIndexesResponse;
23use Google\Service\Firestore\GoogleLongrunningOperation;
24
25/**
26 * The "indexes" collection of methods.
27 * Typical usage is:
28 *  <code>
29 *   $firestoreService = new Google\Service\Firestore(...);
30 *   $indexes = $firestoreService->indexes;
31 *  </code>
32 */
33class ProjectsDatabasesCollectionGroupsIndexes extends \Google\Service\Resource
34{
35  /**
36   * Creates a composite index. This returns a google.longrunning.Operation which
37   * may be used to track the status of the creation. The metadata for the
38   * operation will be the type IndexOperationMetadata. (indexes.create)
39   *
40   * @param string $parent Required. A parent name of the form `projects/{project_
41   * id}/databases/{database_id}/collectionGroups/{collection_id}`
42   * @param GoogleFirestoreAdminV1Index $postBody
43   * @param array $optParams Optional parameters.
44   * @return GoogleLongrunningOperation
45   */
46  public function create($parent, GoogleFirestoreAdminV1Index $postBody, $optParams = [])
47  {
48    $params = ['parent' => $parent, 'postBody' => $postBody];
49    $params = array_merge($params, $optParams);
50    return $this->call('create', [$params], GoogleLongrunningOperation::class);
51  }
52  /**
53   * Deletes a composite index. (indexes.delete)
54   *
55   * @param string $name Required. A name of the form `projects/{project_id}/datab
56   * ases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`
57   * @param array $optParams Optional parameters.
58   * @return FirestoreEmpty
59   */
60  public function delete($name, $optParams = [])
61  {
62    $params = ['name' => $name];
63    $params = array_merge($params, $optParams);
64    return $this->call('delete', [$params], FirestoreEmpty::class);
65  }
66  /**
67   * Gets a composite index. (indexes.get)
68   *
69   * @param string $name Required. A name of the form `projects/{project_id}/datab
70   * ases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`
71   * @param array $optParams Optional parameters.
72   * @return GoogleFirestoreAdminV1Index
73   */
74  public function get($name, $optParams = [])
75  {
76    $params = ['name' => $name];
77    $params = array_merge($params, $optParams);
78    return $this->call('get', [$params], GoogleFirestoreAdminV1Index::class);
79  }
80  /**
81   * Lists composite indexes.
82   * (indexes.listProjectsDatabasesCollectionGroupsIndexes)
83   *
84   * @param string $parent Required. A parent name of the form `projects/{project_
85   * id}/databases/{database_id}/collectionGroups/{collection_id}`
86   * @param array $optParams Optional parameters.
87   *
88   * @opt_param string filter The filter to apply to list results.
89   * @opt_param int pageSize The number of results to return.
90   * @opt_param string pageToken A page token, returned from a previous call to
91   * FirestoreAdmin.ListIndexes, that may be used to get the next page of results.
92   * @return GoogleFirestoreAdminV1ListIndexesResponse
93   */
94  public function listProjectsDatabasesCollectionGroupsIndexes($parent, $optParams = [])
95  {
96    $params = ['parent' => $parent];
97    $params = array_merge($params, $optParams);
98    return $this->call('list', [$params], GoogleFirestoreAdminV1ListIndexesResponse::class);
99  }
100}
101
102// Adding a class alias for backwards compatibility with the previous class name.
103class_alias(ProjectsDatabasesCollectionGroupsIndexes::class, 'Google_Service_Firestore_Resource_ProjectsDatabasesCollectionGroupsIndexes');
104