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\GoogleFirestoreAdminV1Field; 21use Google\Service\Firestore\GoogleFirestoreAdminV1ListFieldsResponse; 22use Google\Service\Firestore\GoogleLongrunningOperation; 23 24/** 25 * The "fields" collection of methods. 26 * Typical usage is: 27 * <code> 28 * $firestoreService = new Google\Service\Firestore(...); 29 * $fields = $firestoreService->fields; 30 * </code> 31 */ 32class ProjectsDatabasesCollectionGroupsFields extends \Google\Service\Resource 33{ 34 /** 35 * Gets the metadata and configuration for a Field. (fields.get) 36 * 37 * @param string $name Required. A name of the form `projects/{project_id}/datab 38 * ases/{database_id}/collectionGroups/{collection_id}/fields/{field_id}` 39 * @param array $optParams Optional parameters. 40 * @return GoogleFirestoreAdminV1Field 41 */ 42 public function get($name, $optParams = []) 43 { 44 $params = ['name' => $name]; 45 $params = array_merge($params, $optParams); 46 return $this->call('get', [$params], GoogleFirestoreAdminV1Field::class); 47 } 48 /** 49 * Lists the field configuration and metadata for this database. Currently, 50 * FirestoreAdmin.ListFields only supports listing fields that have been 51 * explicitly overridden. To issue this query, call FirestoreAdmin.ListFields 52 * with the filter set to `indexConfig.usesAncestorConfig:false` . 53 * (fields.listProjectsDatabasesCollectionGroupsFields) 54 * 55 * @param string $parent Required. A parent name of the form `projects/{project_ 56 * id}/databases/{database_id}/collectionGroups/{collection_id}` 57 * @param array $optParams Optional parameters. 58 * 59 * @opt_param string filter The filter to apply to list results. Currently, 60 * FirestoreAdmin.ListFields only supports listing fields that have been 61 * explicitly overridden. To issue this query, call FirestoreAdmin.ListFields 62 * with a filter that includes `indexConfig.usesAncestorConfig:false` . 63 * @opt_param int pageSize The number of results to return. 64 * @opt_param string pageToken A page token, returned from a previous call to 65 * FirestoreAdmin.ListFields, that may be used to get the next page of results. 66 * @return GoogleFirestoreAdminV1ListFieldsResponse 67 */ 68 public function listProjectsDatabasesCollectionGroupsFields($parent, $optParams = []) 69 { 70 $params = ['parent' => $parent]; 71 $params = array_merge($params, $optParams); 72 return $this->call('list', [$params], GoogleFirestoreAdminV1ListFieldsResponse::class); 73 } 74 /** 75 * Updates a field configuration. Currently, field updates apply only to single 76 * field index configuration. However, calls to FirestoreAdmin.UpdateField 77 * should provide a field mask to avoid changing any configuration that the 78 * caller isn't aware of. The field mask should be specified as: `{ paths: 79 * "index_config" }`. This call returns a google.longrunning.Operation which may 80 * be used to track the status of the field update. The metadata for the 81 * operation will be the type FieldOperationMetadata. To configure the default 82 * field settings for the database, use the special `Field` with resource name: 83 * `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/f 84 * ields`. (fields.patch) 85 * 86 * @param string $name Required. A field name of the form `projects/{project_id} 87 * /databases/{database_id}/collectionGroups/{collection_id}/fields/{field_path} 88 * ` A field path may be a simple field name, e.g. `address` or a path to fields 89 * within map_value , e.g. `address.city`, or a special field path. The only 90 * valid special field is `*`, which represents any field. Field paths may be 91 * quoted using ` (backtick). The only character that needs to be escaped within 92 * a quoted field path is the backtick character itself, escaped using a 93 * backslash. Special characters in field paths that must be quoted include: 94 * `*`, `.`, ``` (backtick), `[`, `]`, as well as any ascii symbolic characters. 95 * Examples: (Note: Comments here are written in markdown syntax, so there is an 96 * additional layer of backticks to represent a code block) `\`address.city\`` 97 * represents a field named `address.city`, not the map key `city` in the field 98 * `address`. `\`*\`` represents a field named `*`, not any field. A special 99 * `Field` contains the default indexing settings for all fields. This field's 100 * resource name is: `projects/{project_id}/databases/{database_id}/collectionGr 101 * oups/__default__/fields` Indexes defined on this `Field` will be applied to 102 * all fields which do not have their own `Field` index configuration. 103 * @param GoogleFirestoreAdminV1Field $postBody 104 * @param array $optParams Optional parameters. 105 * 106 * @opt_param string updateMask A mask, relative to the field. If specified, 107 * only configuration specified by this field_mask will be updated in the field. 108 * @return GoogleLongrunningOperation 109 */ 110 public function patch($name, GoogleFirestoreAdminV1Field $postBody, $optParams = []) 111 { 112 $params = ['name' => $name, 'postBody' => $postBody]; 113 $params = array_merge($params, $optParams); 114 return $this->call('patch', [$params], GoogleLongrunningOperation::class); 115 } 116} 117 118// Adding a class alias for backwards compatibility with the previous class name. 119class_alias(ProjectsDatabasesCollectionGroupsFields::class, 'Google_Service_Firestore_Resource_ProjectsDatabasesCollectionGroupsFields'); 120