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\FirebaseManagement\Resource; 19 20use Google\Service\FirebaseManagement\AddFirebaseRequest; 21use Google\Service\FirebaseManagement\AddGoogleAnalyticsRequest; 22use Google\Service\FirebaseManagement\AdminSdkConfig; 23use Google\Service\FirebaseManagement\AnalyticsDetails; 24use Google\Service\FirebaseManagement\FirebaseEmpty; 25use Google\Service\FirebaseManagement\FirebaseProject; 26use Google\Service\FirebaseManagement\ListFirebaseProjectsResponse; 27use Google\Service\FirebaseManagement\Operation; 28use Google\Service\FirebaseManagement\RemoveAnalyticsRequest; 29use Google\Service\FirebaseManagement\SearchFirebaseAppsResponse; 30 31/** 32 * The "projects" collection of methods. 33 * Typical usage is: 34 * <code> 35 * $firebaseService = new Google\Service\FirebaseManagement(...); 36 * $projects = $firebaseService->projects; 37 * </code> 38 */ 39class Projects extends \Google\Service\Resource 40{ 41 /** 42 * Adds Firebase resources to the specified existing [Google Cloud Platform 43 * (GCP) `Project`] (https://cloud.google.com/resource- 44 * manager/reference/rest/v1/projects). Since a FirebaseProject is actually also 45 * a GCP `Project`, a `FirebaseProject` has the same underlying GCP identifiers 46 * (`projectNumber` and `projectId`). This allows for easy interop with Google 47 * APIs. The result of this call is an [`Operation`](../../v1beta1/operations). 48 * Poll the `Operation` to track the provisioning process by calling 49 * GetOperation until [`done`](../../v1beta1/operations#Operation.FIELDS.done) 50 * is `true`. When `done` is `true`, the `Operation` has either succeeded or 51 * failed. If the `Operation` succeeded, its 52 * [`response`](../../v1beta1/operations#Operation.FIELDS.response) is set to a 53 * FirebaseProject; if the `Operation` failed, its 54 * [`error`](../../v1beta1/operations#Operation.FIELDS.error) is set to a 55 * google.rpc.Status. The `Operation` is automatically deleted after completion, 56 * so there is no need to call DeleteOperation. This method does not modify any 57 * billing account information on the underlying GCP `Project`. To call 58 * `AddFirebase`, a project member or service account must have the following 59 * permissions (the IAM roles of Editor and Owner contain these permissions): 60 * `firebase.projects.update`, `resourcemanager.projects.get`, 61 * `serviceusage.services.enable`, and `serviceusage.services.get`. 62 * (projects.addFirebase) 63 * 64 * @param string $project The resource name of the GCP `Project` to which 65 * Firebase resources will be added, in the format: projects/PROJECT_IDENTIFIER 66 * Refer to the `FirebaseProject` 67 * [`name`](../projects#FirebaseProject.FIELDS.name) field for details about 68 * PROJECT_IDENTIFIER values. After calling `AddFirebase`, the unique Project 69 * identifiers ( [`projectNumber`](https://cloud.google.com/resource- 70 * manager/reference/rest/v1/projects#Project.FIELDS.project_number) and 71 * [`projectId`](https://cloud.google.com/resource- 72 * manager/reference/rest/v1/projects#Project.FIELDS.project_id)) of the 73 * underlying GCP `Project` are also the identifiers of the FirebaseProject. 74 * @param AddFirebaseRequest $postBody 75 * @param array $optParams Optional parameters. 76 * @return Operation 77 */ 78 public function addFirebase($project, AddFirebaseRequest $postBody, $optParams = []) 79 { 80 $params = ['project' => $project, 'postBody' => $postBody]; 81 $params = array_merge($params, $optParams); 82 return $this->call('addFirebase', [$params], Operation::class); 83 } 84 /** 85 * Links the specified FirebaseProject with an existing [Google Analytics 86 * account](http://www.google.com/analytics/). Using this call, you can either: 87 * - Specify an `analyticsAccountId` to provision a new Google Analytics 88 * property within the specified account and associate the new property with the 89 * `FirebaseProject`. - Specify an existing `analyticsPropertyId` to associate 90 * the property with the `FirebaseProject`. Note that when you call 91 * `AddGoogleAnalytics`: 1. The first check determines if any existing data 92 * streams in the Google Analytics property correspond to any existing Firebase 93 * Apps in the `FirebaseProject` (based on the `packageName` or `bundleId` 94 * associated with the data stream). Then, as applicable, the data streams and 95 * apps are linked. Note that this auto-linking only applies to `AndroidApps` 96 * and `IosApps`. 2. If no corresponding data streams are found for the Firebase 97 * Apps, new data streams are provisioned in the Google Analytics property for 98 * each of the Firebase Apps. Note that a new data stream is always provisioned 99 * for a Web App even if it was previously associated with a data stream in the 100 * Analytics property. Learn more about the hierarchy and structure of Google 101 * Analytics accounts in the [Analytics 102 * documentation](https://support.google.com/analytics/answer/9303323). The 103 * result of this call is an [`Operation`](../../v1beta1/operations). Poll the 104 * `Operation` to track the provisioning process by calling GetOperation until 105 * [`done`](../../v1beta1/operations#Operation.FIELDS.done) is `true`. When 106 * `done` is `true`, the `Operation` has either succeeded or failed. If the 107 * `Operation` succeeded, its 108 * [`response`](../../v1beta1/operations#Operation.FIELDS.response) is set to an 109 * AnalyticsDetails; if the `Operation` failed, its 110 * [`error`](../../v1beta1/operations#Operation.FIELDS.error) is set to a 111 * google.rpc.Status. To call `AddGoogleAnalytics`, a project member must be an 112 * Owner for the existing `FirebaseProject` and have the [`Edit` 113 * permission](https://support.google.com/analytics/answer/2884495) for the 114 * Google Analytics account. If the `FirebaseProject` already has Google 115 * Analytics enabled, and you call `AddGoogleAnalytics` using an 116 * `analyticsPropertyId` that's different from the currently associated 117 * property, then the call will fail. Analytics may have already been enabled in 118 * the Firebase console or by specifying `timeZone` and `regionCode` in the call 119 * to [`AddFirebase`](../../v1beta1/projects/addFirebase). 120 * (projects.addGoogleAnalytics) 121 * 122 * @param string $parent The resource name of the FirebaseProject to link to an 123 * existing Google Analytics account, in the format: projects/PROJECT_IDENTIFIER 124 * Refer to the `FirebaseProject` 125 * [`name`](../projects#FirebaseProject.FIELDS.name) field for details about 126 * PROJECT_IDENTIFIER values. 127 * @param AddGoogleAnalyticsRequest $postBody 128 * @param array $optParams Optional parameters. 129 * @return Operation 130 */ 131 public function addGoogleAnalytics($parent, AddGoogleAnalyticsRequest $postBody, $optParams = []) 132 { 133 $params = ['parent' => $parent, 'postBody' => $postBody]; 134 $params = array_merge($params, $optParams); 135 return $this->call('addGoogleAnalytics', [$params], Operation::class); 136 } 137 /** 138 * Gets the specified FirebaseProject. (projects.get) 139 * 140 * @param string $name The resource name of the FirebaseProject, in the format: 141 * projects/ PROJECT_IDENTIFIER Refer to the `FirebaseProject` 142 * [`name`](../projects#FirebaseProject.FIELDS.name) field for details about 143 * PROJECT_IDENTIFIER values. 144 * @param array $optParams Optional parameters. 145 * @return FirebaseProject 146 */ 147 public function get($name, $optParams = []) 148 { 149 $params = ['name' => $name]; 150 $params = array_merge($params, $optParams); 151 return $this->call('get', [$params], FirebaseProject::class); 152 } 153 /** 154 * Gets the configuration artifact associated with the specified 155 * FirebaseProject, which can be used by servers to simplify initialization. 156 * Typically, this configuration is used with the Firebase Admin SDK [initialize 157 * App](https://firebase.google.com/docs/admin/setup#initialize_the_sdk) 158 * command. (projects.getAdminSdkConfig) 159 * 160 * @param string $name The resource name of the FirebaseProject, in the format: 161 * projects/ PROJECT_IDENTIFIER/adminSdkConfig Refer to the `FirebaseProject` 162 * [`name`](../projects#FirebaseProject.FIELDS.name) field for details about 163 * PROJECT_IDENTIFIER values. 164 * @param array $optParams Optional parameters. 165 * @return AdminSdkConfig 166 */ 167 public function getAdminSdkConfig($name, $optParams = []) 168 { 169 $params = ['name' => $name]; 170 $params = array_merge($params, $optParams); 171 return $this->call('getAdminSdkConfig', [$params], AdminSdkConfig::class); 172 } 173 /** 174 * Gets the Google Analytics details currently associated with the specified 175 * FirebaseProject. If the `FirebaseProject` is not yet linked to Google 176 * Analytics, then the response to `GetAnalyticsDetails` is `NOT_FOUND`. 177 * (projects.getAnalyticsDetails) 178 * 179 * @param string $name The resource name of the FirebaseProject, in the format: 180 * projects/ PROJECT_IDENTIFIER/analyticsDetails Refer to the `FirebaseProject` 181 * [`name`](../projects#FirebaseProject.FIELDS.name) field for details about 182 * PROJECT_IDENTIFIER values. 183 * @param array $optParams Optional parameters. 184 * @return AnalyticsDetails 185 */ 186 public function getAnalyticsDetails($name, $optParams = []) 187 { 188 $params = ['name' => $name]; 189 $params = array_merge($params, $optParams); 190 return $this->call('getAnalyticsDetails', [$params], AnalyticsDetails::class); 191 } 192 /** 193 * Lists each FirebaseProject accessible to the caller. The elements are 194 * returned in no particular order, but they will be a consistent view of the 195 * Projects when additional requests are made with a `pageToken`. This method is 196 * eventually consistent with Project mutations, which means newly provisioned 197 * Projects and recent modifications to existing Projects might not be reflected 198 * in the set of Projects. The list will include only ACTIVE Projects. Use 199 * GetFirebaseProject for consistent reads as well as for additional Project 200 * details. (projects.listProjects) 201 * 202 * @param array $optParams Optional parameters. 203 * 204 * @opt_param int pageSize The maximum number of Projects to return in the 205 * response. The server may return fewer than this at its discretion. If no 206 * value is specified (or too large a value is specified), the server will 207 * impose its own limit. This value cannot be negative. 208 * @opt_param string pageToken Token returned from a previous call to 209 * `ListFirebaseProjects` indicating where in the set of Projects to resume 210 * listing. 211 * @return ListFirebaseProjectsResponse 212 */ 213 public function listProjects($optParams = []) 214 { 215 $params = []; 216 $params = array_merge($params, $optParams); 217 return $this->call('list', [$params], ListFirebaseProjectsResponse::class); 218 } 219 /** 220 * Updates the attributes of the specified FirebaseProject. All [query 221 * parameters](#query-parameters) are required. (projects.patch) 222 * 223 * @param string $name The resource name of the Project, in the format: 224 * projects/PROJECT_IDENTIFIER PROJECT_IDENTIFIER: the Project's 225 * [`ProjectNumber`](../projects#FirebaseProject.FIELDS.project_number) 226 * ***(recommended)*** or its 227 * [`ProjectId`](../projects#FirebaseProject.FIELDS.project_id). Learn more 228 * about using project identifiers in Google's [AIP 2510 229 * standard](https://google.aip.dev/cloud/2510). Note that the value for 230 * PROJECT_IDENTIFIER in any response body will be the `ProjectId`. 231 * @param FirebaseProject $postBody 232 * @param array $optParams Optional parameters. 233 * 234 * @opt_param string updateMask Specifies which fields to update. If this list 235 * is empty, then no state will be updated. Note that the fields `name`, 236 * `projectId`, and `projectNumber` are all immutable. 237 * @return FirebaseProject 238 */ 239 public function patch($name, FirebaseProject $postBody, $optParams = []) 240 { 241 $params = ['name' => $name, 'postBody' => $postBody]; 242 $params = array_merge($params, $optParams); 243 return $this->call('patch', [$params], FirebaseProject::class); 244 } 245 /** 246 * Unlinks the specified FirebaseProject from its Google Analytics account. This 247 * call removes the association of the specified `FirebaseProject` with its 248 * current Google Analytics property. However, this call does not delete the 249 * Google Analytics resources, such as the Google Analytics property or any data 250 * streams. These resources may be re-associated later to the `FirebaseProject` 251 * by calling [`AddGoogleAnalytics`](../../v1beta1/projects/addGoogleAnalytics) 252 * and specifying the same `analyticsPropertyId`. For Android Apps and iOS Apps, 253 * this call re-links data streams with their corresponding apps. However, for 254 * Web Apps, this call provisions a *new* data stream for each Web App. To call 255 * `RemoveAnalytics`, a project member must be an Owner for the 256 * `FirebaseProject`. (projects.removeAnalytics) 257 * 258 * @param string $parent The resource name of the FirebaseProject to unlink from 259 * its Google Analytics account, in the format: projects/PROJECT_IDENTIFIER 260 * Refer to the `FirebaseProject` 261 * [`name`](../projects#FirebaseProject.FIELDS.name) field for details about 262 * PROJECT_IDENTIFIER values. 263 * @param RemoveAnalyticsRequest $postBody 264 * @param array $optParams Optional parameters. 265 * @return FirebaseEmpty 266 */ 267 public function removeAnalytics($parent, RemoveAnalyticsRequest $postBody, $optParams = []) 268 { 269 $params = ['parent' => $parent, 'postBody' => $postBody]; 270 $params = array_merge($params, $optParams); 271 return $this->call('removeAnalytics', [$params], FirebaseEmpty::class); 272 } 273 /** 274 * Lists all available Apps for the specified FirebaseProject. This is a 275 * convenience method. Typically, interaction with an App should be done using 276 * the platform-specific service, but some tool use-cases require a summary of 277 * all known Apps (such as for App selector interfaces). (projects.searchApps) 278 * 279 * @param string $parent The parent FirebaseProject for which to list Apps, in 280 * the format: projects/ PROJECT_IDENTIFIER Refer to the `FirebaseProject` 281 * [`name`](../projects#FirebaseProject.FIELDS.name) field for details about 282 * PROJECT_IDENTIFIER values. 283 * @param array $optParams Optional parameters. 284 * 285 * @opt_param string filter A query string compatible with Google's 286 * [AIP-160](https://google.aip.dev/160) standard. Use any of the following 287 * fields in a query: * 288 * [`app_id`](../projects.apps#FirebaseAppInfo.FIELDS.app_id) * 289 * [`namespace`](../projects.apps#FirebaseAppInfo.FIELDS.namespace) * 290 * [`platform`](../projects.apps#FirebaseAppInfo.FIELDS.platform) We also 291 * support the following "virtual" fields (fields which are not actually part of 292 * the returned resource object, but can be queried as if they are pre-populated 293 * with specific values): * `sha1_hash`: This field is considered to be a 294 * repeated `string` field, populated with the list of all SHA-1 certificate 295 * fingerprints registered with the app. This list is empty if the app is not an 296 * Android app. * `sha256_hash`: This field is considered to be a repeated 297 * `string` field, populated with the list of all SHA-256 certificate 298 * fingerprints registered with the app. This list is empty if the app is not an 299 * Android app. * `app_store_id`: This field is considered to be a singular 300 * `string` field, populated with the Apple App Store ID registered with the 301 * app. This field is empty if the app is not an iOS app. * `team_id`: This 302 * field is considered to be a singular `string` field, populated with the Apple 303 * team ID registered with the app. This field is empty if the app is not an iOS 304 * app. 305 * @opt_param int pageSize The maximum number of Apps to return in the response. 306 * The server may return fewer than this value at its discretion. If no value is 307 * specified (or too large a value is specified), then the server will impose 308 * its own limit. This value cannot be negative. 309 * @opt_param string pageToken Token returned from a previous call to 310 * `SearchFirebaseApps` indicating where in the set of Apps to resume listing. 311 * @return SearchFirebaseAppsResponse 312 */ 313 public function searchApps($parent, $optParams = []) 314 { 315 $params = ['parent' => $parent]; 316 $params = array_merge($params, $optParams); 317 return $this->call('searchApps', [$params], SearchFirebaseAppsResponse::class); 318 } 319} 320 321// Adding a class alias for backwards compatibility with the previous class name. 322class_alias(Projects::class, 'Google_Service_FirebaseManagement_Resource_Projects'); 323