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\GoogleFirebaseAppcheckV1betaDebugToken;
21use Google\Service\Firebaseappcheck\GoogleFirebaseAppcheckV1betaListDebugTokensResponse;
22use Google\Service\Firebaseappcheck\GoogleProtobufEmpty;
23
24/**
25 * The "debugTokens" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $firebaseappcheckService = new Google\Service\Firebaseappcheck(...);
29 *   $debugTokens = $firebaseappcheckService->debugTokens;
30 *  </code>
31 */
32class ProjectsAppsDebugTokens extends \Google\Service\Resource
33{
34  /**
35   * Creates a new DebugToken for the specified app. For security reasons, after
36   * the creation operation completes, the `token` field cannot be updated or
37   * retrieved, but you can revoke the debug token using DeleteDebugToken. Each
38   * app can have a maximum of 20 debug tokens. (debugTokens.create)
39   *
40   * @param string $parent Required. The relative resource name of the parent app
41   * in which the specified DebugToken will be created, in the format: ```
42   * projects/{project_number}/apps/{app_id} ```
43   * @param GoogleFirebaseAppcheckV1betaDebugToken $postBody
44   * @param array $optParams Optional parameters.
45   * @return GoogleFirebaseAppcheckV1betaDebugToken
46   */
47  public function create($parent, GoogleFirebaseAppcheckV1betaDebugToken $postBody, $optParams = [])
48  {
49    $params = ['parent' => $parent, 'postBody' => $postBody];
50    $params = array_merge($params, $optParams);
51    return $this->call('create', [$params], GoogleFirebaseAppcheckV1betaDebugToken::class);
52  }
53  /**
54   * Deletes the specified DebugToken. A deleted debug token cannot be used to
55   * exchange for an App Check token. Use this method when you suspect the secret
56   * `token` has been compromised or when you no longer need the debug token.
57   * (debugTokens.delete)
58   *
59   * @param string $name Required. The relative resource name of the DebugToken to
60   * delete, in the format: ```
61   * projects/{project_number}/apps/{app_id}/debugTokens/{debug_token_id} ```
62   * @param array $optParams Optional parameters.
63   * @return GoogleProtobufEmpty
64   */
65  public function delete($name, $optParams = [])
66  {
67    $params = ['name' => $name];
68    $params = array_merge($params, $optParams);
69    return $this->call('delete', [$params], GoogleProtobufEmpty::class);
70  }
71  /**
72   * Gets the specified DebugToken. For security reasons, the `token` field is
73   * never populated in the response. (debugTokens.get)
74   *
75   * @param string $name Required. The relative resource name of the debug token,
76   * in the format: ```
77   * projects/{project_number}/apps/{app_id}/debugTokens/{debug_token_id} ```
78   * @param array $optParams Optional parameters.
79   * @return GoogleFirebaseAppcheckV1betaDebugToken
80   */
81  public function get($name, $optParams = [])
82  {
83    $params = ['name' => $name];
84    $params = array_merge($params, $optParams);
85    return $this->call('get', [$params], GoogleFirebaseAppcheckV1betaDebugToken::class);
86  }
87  /**
88   * Lists all DebugTokens for the specified app. For security reasons, the
89   * `token` field is never populated in the response.
90   * (debugTokens.listProjectsAppsDebugTokens)
91   *
92   * @param string $parent Required. The relative resource name of the parent app
93   * for which to list each associated DebugToken, in the format: ```
94   * projects/{project_number}/apps/{app_id} ```
95   * @param array $optParams Optional parameters.
96   *
97   * @opt_param int pageSize The maximum number of DebugTokens to return in the
98   * response. Note that an app can have at most 20 debug tokens. The server may
99   * return fewer than this at its own discretion. If no value is specified (or
100   * too large a value is specified), the server will impose its own limit.
101   * @opt_param string pageToken Token returned from a previous call to
102   * ListDebugTokens indicating where in the set of DebugTokens to resume listing.
103   * Provide this to retrieve the subsequent page. When paginating, all other
104   * parameters provided to ListDebugTokens must match the call that provided the
105   * page token; if they do not match, the result is undefined.
106   * @return GoogleFirebaseAppcheckV1betaListDebugTokensResponse
107   */
108  public function listProjectsAppsDebugTokens($parent, $optParams = [])
109  {
110    $params = ['parent' => $parent];
111    $params = array_merge($params, $optParams);
112    return $this->call('list', [$params], GoogleFirebaseAppcheckV1betaListDebugTokensResponse::class);
113  }
114  /**
115   * Updates the specified DebugToken. For security reasons, the `token` field
116   * cannot be updated, nor will it be populated in the response, but you can
117   * revoke the debug token using DeleteDebugToken. (debugTokens.patch)
118   *
119   * @param string $name Required. The relative resource name of the debug token,
120   * in the format: ```
121   * projects/{project_number}/apps/{app_id}/debugTokens/{debug_token_id} ```
122   * @param GoogleFirebaseAppcheckV1betaDebugToken $postBody
123   * @param array $optParams Optional parameters.
124   *
125   * @opt_param string updateMask Required. A comma-separated list of names of
126   * fields in the DebugToken to update. Example: `display_name`.
127   * @return GoogleFirebaseAppcheckV1betaDebugToken
128   */
129  public function patch($name, GoogleFirebaseAppcheckV1betaDebugToken $postBody, $optParams = [])
130  {
131    $params = ['name' => $name, 'postBody' => $postBody];
132    $params = array_merge($params, $optParams);
133    return $this->call('patch', [$params], GoogleFirebaseAppcheckV1betaDebugToken::class);
134  }
135}
136
137// Adding a class alias for backwards compatibility with the previous class name.
138class_alias(ProjectsAppsDebugTokens::class, 'Google_Service_Firebaseappcheck_Resource_ProjectsAppsDebugTokens');
139