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\Directory\Resource;
19
20use Google\Service\Directory\Token;
21use Google\Service\Directory\Tokens as TokensModel;
22
23/**
24 * The "tokens" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $adminService = new Google\Service\Directory(...);
28 *   $tokens = $adminService->tokens;
29 *  </code>
30 */
31class Tokens extends \Google\Service\Resource
32{
33  /**
34   * Deletes all access tokens issued by a user for an application.
35   * (tokens.delete)
36   *
37   * @param string $userKey Identifies the user in the API request. The value can
38   * be the user's primary email address, alias email address, or unique user ID.
39   * @param string $clientId The Client ID of the application the token is issued
40   * to.
41   * @param array $optParams Optional parameters.
42   */
43  public function delete($userKey, $clientId, $optParams = [])
44  {
45    $params = ['userKey' => $userKey, 'clientId' => $clientId];
46    $params = array_merge($params, $optParams);
47    return $this->call('delete', [$params]);
48  }
49  /**
50   * Gets information about an access token issued by a user. (tokens.get)
51   *
52   * @param string $userKey Identifies the user in the API request. The value can
53   * be the user's primary email address, alias email address, or unique user ID.
54   * @param string $clientId The Client ID of the application the token is issued
55   * to.
56   * @param array $optParams Optional parameters.
57   * @return Token
58   */
59  public function get($userKey, $clientId, $optParams = [])
60  {
61    $params = ['userKey' => $userKey, 'clientId' => $clientId];
62    $params = array_merge($params, $optParams);
63    return $this->call('get', [$params], Token::class);
64  }
65  /**
66   * Returns the set of tokens specified user has issued to 3rd party
67   * applications. (tokens.listTokens)
68   *
69   * @param string $userKey Identifies the user in the API request. The value can
70   * be the user's primary email address, alias email address, or unique user ID.
71   * @param array $optParams Optional parameters.
72   * @return TokensModel
73   */
74  public function listTokens($userKey, $optParams = [])
75  {
76    $params = ['userKey' => $userKey];
77    $params = array_merge($params, $optParams);
78    return $this->call('list', [$params], TokensModel::class);
79  }
80}
81
82// Adding a class alias for backwards compatibility with the previous class name.
83class_alias(Tokens::class, 'Google_Service_Directory_Resource_Tokens');
84