[e3d4e0a] | 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 |
|
---|
| 18 | namespace Google\Service\Directory\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\Directory\Token;
|
---|
| 21 | use 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 | */
|
---|
| 31 | class 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 | * @throws \Google\Service\Exception
|
---|
| 43 | */
|
---|
| 44 | public function delete($userKey, $clientId, $optParams = [])
|
---|
| 45 | {
|
---|
| 46 | $params = ['userKey' => $userKey, 'clientId' => $clientId];
|
---|
| 47 | $params = array_merge($params, $optParams);
|
---|
| 48 | return $this->call('delete', [$params]);
|
---|
| 49 | }
|
---|
| 50 | /**
|
---|
| 51 | * Gets information about an access token issued by a user. (tokens.get)
|
---|
| 52 | *
|
---|
| 53 | * @param string $userKey Identifies the user in the API request. The value can
|
---|
| 54 | * be the user's primary email address, alias email address, or unique user ID.
|
---|
| 55 | * @param string $clientId The Client ID of the application the token is issued
|
---|
| 56 | * to.
|
---|
| 57 | * @param array $optParams Optional parameters.
|
---|
| 58 | * @return Token
|
---|
| 59 | * @throws \Google\Service\Exception
|
---|
| 60 | */
|
---|
| 61 | public function get($userKey, $clientId, $optParams = [])
|
---|
| 62 | {
|
---|
| 63 | $params = ['userKey' => $userKey, 'clientId' => $clientId];
|
---|
| 64 | $params = array_merge($params, $optParams);
|
---|
| 65 | return $this->call('get', [$params], Token::class);
|
---|
| 66 | }
|
---|
| 67 | /**
|
---|
| 68 | * Returns the set of tokens specified user has issued to 3rd party
|
---|
| 69 | * applications. (tokens.listTokens)
|
---|
| 70 | *
|
---|
| 71 | * @param string $userKey Identifies the user in the API request. The value can
|
---|
| 72 | * be the user's primary email address, alias email address, or unique user ID.
|
---|
| 73 | * @param array $optParams Optional parameters.
|
---|
| 74 | * @return TokensModel
|
---|
| 75 | * @throws \Google\Service\Exception
|
---|
| 76 | */
|
---|
| 77 | public function listTokens($userKey, $optParams = [])
|
---|
| 78 | {
|
---|
| 79 | $params = ['userKey' => $userKey];
|
---|
| 80 | $params = array_merge($params, $optParams);
|
---|
| 81 | return $this->call('list', [$params], TokensModel::class);
|
---|
| 82 | }
|
---|
| 83 | }
|
---|
| 84 |
|
---|
| 85 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 86 | class_alias(Tokens::class, 'Google_Service_Directory_Resource_Tokens');
|
---|