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\Firebaseappcheck\Resource;
19
20use Google\Service\Firebaseappcheck\GoogleFirebaseAppcheckV1betaAppCheckToken;
21use Google\Service\Firebaseappcheck\GoogleFirebaseAppcheckV1betaExchangeAppAttestAssertionRequest;
22use Google\Service\Firebaseappcheck\GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationRequest;
23use Google\Service\Firebaseappcheck\GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationResponse;
24use Google\Service\Firebaseappcheck\GoogleFirebaseAppcheckV1betaExchangeCustomTokenRequest;
25use Google\Service\Firebaseappcheck\GoogleFirebaseAppcheckV1betaExchangeDebugTokenRequest;
26use Google\Service\Firebaseappcheck\GoogleFirebaseAppcheckV1betaExchangeDeviceCheckTokenRequest;
27use Google\Service\Firebaseappcheck\GoogleFirebaseAppcheckV1betaExchangeRecaptchaEnterpriseTokenRequest;
28use Google\Service\Firebaseappcheck\GoogleFirebaseAppcheckV1betaExchangeRecaptchaTokenRequest;
29use Google\Service\Firebaseappcheck\GoogleFirebaseAppcheckV1betaExchangeRecaptchaV3TokenRequest;
30use Google\Service\Firebaseappcheck\GoogleFirebaseAppcheckV1betaExchangeSafetyNetTokenRequest;
31use Google\Service\Firebaseappcheck\GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeRequest;
32use Google\Service\Firebaseappcheck\GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeResponse;
33
34/**
35 * The "apps" collection of methods.
36 * Typical usage is:
37 *  <code>
38 *   $firebaseappcheckService = new Google\Service\Firebaseappcheck(...);
39 *   $apps = $firebaseappcheckService->apps;
40 *  </code>
41 */
42class ProjectsApps extends \Google\Service\Resource
43{
44  /**
45   * Accepts an App Attest assertion and an artifact previously obtained from
46   * ExchangeAppAttestAttestation and verifies those with Apple. If valid, returns
47   * an AppCheckToken. (apps.exchangeAppAttestAssertion)
48   *
49   * @param string $app Required. The relative resource name of the iOS app, in
50   * the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the
51   * `project_number` element can be replaced with the project ID of the Firebase
52   * project. Learn more about using project identifiers in Google's [AIP
53   * 2510](https://google.aip.dev/cloud/2510) standard.
54   * @param GoogleFirebaseAppcheckV1betaExchangeAppAttestAssertionRequest $postBody
55   * @param array $optParams Optional parameters.
56   * @return GoogleFirebaseAppcheckV1betaAppCheckToken
57   */
58  public function exchangeAppAttestAssertion($app, GoogleFirebaseAppcheckV1betaExchangeAppAttestAssertionRequest $postBody, $optParams = [])
59  {
60    $params = ['app' => $app, 'postBody' => $postBody];
61    $params = array_merge($params, $optParams);
62    return $this->call('exchangeAppAttestAssertion', [$params], GoogleFirebaseAppcheckV1betaAppCheckToken::class);
63  }
64  /**
65   * Accepts an App Attest CBOR attestation and verifies it with Apple using your
66   * preconfigured team and bundle IDs. If valid, returns an attestation artifact
67   * that can later be exchanged for an AppCheckToken using
68   * ExchangeAppAttestAssertion. For convenience and performance, this method's
69   * response object will also contain an AppCheckToken (if the verification is
70   * successful). (apps.exchangeAppAttestAttestation)
71   *
72   * @param string $app Required. The relative resource name of the iOS app, in
73   * the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the
74   * `project_number` element can be replaced with the project ID of the Firebase
75   * project. Learn more about using project identifiers in Google's [AIP
76   * 2510](https://google.aip.dev/cloud/2510) standard.
77   * @param GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationRequest $postBody
78   * @param array $optParams Optional parameters.
79   * @return GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationResponse
80   */
81  public function exchangeAppAttestAttestation($app, GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationRequest $postBody, $optParams = [])
82  {
83    $params = ['app' => $app, 'postBody' => $postBody];
84    $params = array_merge($params, $optParams);
85    return $this->call('exchangeAppAttestAttestation', [$params], GoogleFirebaseAppcheckV1betaExchangeAppAttestAttestationResponse::class);
86  }
87  /**
88   * Validates a custom token signed using your project's Admin SDK service
89   * account credentials. If valid, returns an AppCheckToken.
90   * (apps.exchangeCustomToken)
91   *
92   * @param string $app Required. The relative resource name of the app, in the
93   * format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the
94   * `project_number` element can be replaced with the project ID of the Firebase
95   * project. Learn more about using project identifiers in Google's [AIP
96   * 2510](https://google.aip.dev/cloud/2510) standard.
97   * @param GoogleFirebaseAppcheckV1betaExchangeCustomTokenRequest $postBody
98   * @param array $optParams Optional parameters.
99   * @return GoogleFirebaseAppcheckV1betaAppCheckToken
100   */
101  public function exchangeCustomToken($app, GoogleFirebaseAppcheckV1betaExchangeCustomTokenRequest $postBody, $optParams = [])
102  {
103    $params = ['app' => $app, 'postBody' => $postBody];
104    $params = array_merge($params, $optParams);
105    return $this->call('exchangeCustomToken', [$params], GoogleFirebaseAppcheckV1betaAppCheckToken::class);
106  }
107  /**
108   * Validates a debug token secret that you have previously created using
109   * CreateDebugToken. If valid, returns an AppCheckToken. Note that a restrictive
110   * quota is enforced on this method to prevent accidental exposure of the app to
111   * abuse. (apps.exchangeDebugToken)
112   *
113   * @param string $app Required. The relative resource name of the app, in the
114   * format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the
115   * `project_number` element can be replaced with the project ID of the Firebase
116   * project. Learn more about using project identifiers in Google's [AIP
117   * 2510](https://google.aip.dev/cloud/2510) standard.
118   * @param GoogleFirebaseAppcheckV1betaExchangeDebugTokenRequest $postBody
119   * @param array $optParams Optional parameters.
120   * @return GoogleFirebaseAppcheckV1betaAppCheckToken
121   */
122  public function exchangeDebugToken($app, GoogleFirebaseAppcheckV1betaExchangeDebugTokenRequest $postBody, $optParams = [])
123  {
124    $params = ['app' => $app, 'postBody' => $postBody];
125    $params = array_merge($params, $optParams);
126    return $this->call('exchangeDebugToken', [$params], GoogleFirebaseAppcheckV1betaAppCheckToken::class);
127  }
128  /**
129   * Accepts a [`device_token`](https://developer.apple.com/documentation/devicech
130   * eck/dcdevice) issued by DeviceCheck, and attempts to validate it with Apple.
131   * If valid, returns an AppCheckToken. (apps.exchangeDeviceCheckToken)
132   *
133   * @param string $app Required. The relative resource name of the iOS app, in
134   * the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the
135   * `project_number` element can be replaced with the project ID of the Firebase
136   * project. Learn more about using project identifiers in Google's [AIP
137   * 2510](https://google.aip.dev/cloud/2510) standard.
138   * @param GoogleFirebaseAppcheckV1betaExchangeDeviceCheckTokenRequest $postBody
139   * @param array $optParams Optional parameters.
140   * @return GoogleFirebaseAppcheckV1betaAppCheckToken
141   */
142  public function exchangeDeviceCheckToken($app, GoogleFirebaseAppcheckV1betaExchangeDeviceCheckTokenRequest $postBody, $optParams = [])
143  {
144    $params = ['app' => $app, 'postBody' => $postBody];
145    $params = array_merge($params, $optParams);
146    return $this->call('exchangeDeviceCheckToken', [$params], GoogleFirebaseAppcheckV1betaAppCheckToken::class);
147  }
148  /**
149   * Validates a [reCAPTCHA Enterprise response token](https://cloud.google.com
150   * /recaptcha-enterprise/docs/create-assessment#retrieve_token). If valid,
151   * returns an App Check token AppCheckToken.
152   * (apps.exchangeRecaptchaEnterpriseToken)
153   *
154   * @param string $app Required. The relative resource name of the web app, in
155   * the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the
156   * `project_number` element can be replaced with the project ID of the Firebase
157   * project. Learn more about using project identifiers in Google's [AIP
158   * 2510](https://google.aip.dev/cloud/2510) standard.
159   * @param GoogleFirebaseAppcheckV1betaExchangeRecaptchaEnterpriseTokenRequest $postBody
160   * @param array $optParams Optional parameters.
161   * @return GoogleFirebaseAppcheckV1betaAppCheckToken
162   */
163  public function exchangeRecaptchaEnterpriseToken($app, GoogleFirebaseAppcheckV1betaExchangeRecaptchaEnterpriseTokenRequest $postBody, $optParams = [])
164  {
165    $params = ['app' => $app, 'postBody' => $postBody];
166    $params = array_merge($params, $optParams);
167    return $this->call('exchangeRecaptchaEnterpriseToken', [$params], GoogleFirebaseAppcheckV1betaAppCheckToken::class);
168  }
169  /**
170   * Validates a [reCAPTCHA v3 response
171   * token](https://developers.google.com/recaptcha/docs/v3). If valid, returns an
172   * AppCheckToken. (apps.exchangeRecaptchaToken)
173   *
174   * @param string $app Required. The relative resource name of the web app, in
175   * the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the
176   * `project_number` element can be replaced with the project ID of the Firebase
177   * project. Learn more about using project identifiers in Google's [AIP
178   * 2510](https://google.aip.dev/cloud/2510) standard.
179   * @param GoogleFirebaseAppcheckV1betaExchangeRecaptchaTokenRequest $postBody
180   * @param array $optParams Optional parameters.
181   * @return GoogleFirebaseAppcheckV1betaAppCheckToken
182   */
183  public function exchangeRecaptchaToken($app, GoogleFirebaseAppcheckV1betaExchangeRecaptchaTokenRequest $postBody, $optParams = [])
184  {
185    $params = ['app' => $app, 'postBody' => $postBody];
186    $params = array_merge($params, $optParams);
187    return $this->call('exchangeRecaptchaToken', [$params], GoogleFirebaseAppcheckV1betaAppCheckToken::class);
188  }
189  /**
190   * Validates a [reCAPTCHA v3 response
191   * token](https://developers.google.com/recaptcha/docs/v3). If valid, returns an
192   * AppCheckToken. (apps.exchangeRecaptchaV3Token)
193   *
194   * @param string $app Required. The relative resource name of the web app, in
195   * the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the
196   * `project_number` element can be replaced with the project ID of the Firebase
197   * project. Learn more about using project identifiers in Google's [AIP
198   * 2510](https://google.aip.dev/cloud/2510) standard.
199   * @param GoogleFirebaseAppcheckV1betaExchangeRecaptchaV3TokenRequest $postBody
200   * @param array $optParams Optional parameters.
201   * @return GoogleFirebaseAppcheckV1betaAppCheckToken
202   */
203  public function exchangeRecaptchaV3Token($app, GoogleFirebaseAppcheckV1betaExchangeRecaptchaV3TokenRequest $postBody, $optParams = [])
204  {
205    $params = ['app' => $app, 'postBody' => $postBody];
206    $params = array_merge($params, $optParams);
207    return $this->call('exchangeRecaptchaV3Token', [$params], GoogleFirebaseAppcheckV1betaAppCheckToken::class);
208  }
209  /**
210   * Validates a [SafetyNet
211   * token](https://developer.android.com/training/safetynet/attestation#request-
212   * attestation-step). If valid, returns an AppCheckToken.
213   * (apps.exchangeSafetyNetToken)
214   *
215   * @param string $app Required. The relative resource name of the Android app,
216   * in the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary,
217   * the `project_number` element can be replaced with the project ID of the
218   * Firebase project. Learn more about using project identifiers in Google's [AIP
219   * 2510](https://google.aip.dev/cloud/2510) standard.
220   * @param GoogleFirebaseAppcheckV1betaExchangeSafetyNetTokenRequest $postBody
221   * @param array $optParams Optional parameters.
222   * @return GoogleFirebaseAppcheckV1betaAppCheckToken
223   */
224  public function exchangeSafetyNetToken($app, GoogleFirebaseAppcheckV1betaExchangeSafetyNetTokenRequest $postBody, $optParams = [])
225  {
226    $params = ['app' => $app, 'postBody' => $postBody];
227    $params = array_merge($params, $optParams);
228    return $this->call('exchangeSafetyNetToken', [$params], GoogleFirebaseAppcheckV1betaAppCheckToken::class);
229  }
230  /**
231   * Generates a challenge that protects the integrity of an immediately following
232   * call to ExchangeAppAttestAttestation or ExchangeAppAttestAssertion. A
233   * challenge should not be reused for multiple calls.
234   * (apps.generateAppAttestChallenge)
235   *
236   * @param string $app Required. The relative resource name of the iOS app, in
237   * the format: ``` projects/{project_number}/apps/{app_id} ``` If necessary, the
238   * `project_number` element can be replaced with the project ID of the Firebase
239   * project. Learn more about using project identifiers in Google's [AIP
240   * 2510](https://google.aip.dev/cloud/2510) standard.
241   * @param GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeRequest $postBody
242   * @param array $optParams Optional parameters.
243   * @return GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeResponse
244   */
245  public function generateAppAttestChallenge($app, GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeRequest $postBody, $optParams = [])
246  {
247    $params = ['app' => $app, 'postBody' => $postBody];
248    $params = array_merge($params, $optParams);
249    return $this->call('generateAppAttestChallenge', [$params], GoogleFirebaseAppcheckV1betaGenerateAppAttestChallengeResponse::class);
250  }
251}
252
253// Adding a class alias for backwards compatibility with the previous class name.
254class_alias(ProjectsApps::class, 'Google_Service_Firebaseappcheck_Resource_ProjectsApps');
255