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\Gmail\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\Gmail\Delegate;
|
---|
21 | use Google\Service\Gmail\ListDelegatesResponse;
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * The "delegates" collection of methods.
|
---|
25 | * Typical usage is:
|
---|
26 | * <code>
|
---|
27 | * $gmailService = new Google\Service\Gmail(...);
|
---|
28 | * $delegates = $gmailService->users_settings_delegates;
|
---|
29 | * </code>
|
---|
30 | */
|
---|
31 | class UsersSettingsDelegates extends \Google\Service\Resource
|
---|
32 | {
|
---|
33 | /**
|
---|
34 | * Adds a delegate with its verification status set directly to `accepted`,
|
---|
35 | * without sending any verification email. The delegate user must be a member of
|
---|
36 | * the same Google Workspace organization as the delegator user. Gmail imposes
|
---|
37 | * limitations on the number of delegates and delegators each user in a Google
|
---|
38 | * Workspace organization can have. These limits depend on your organization,
|
---|
39 | * but in general each user can have up to 25 delegates and up to 10 delegators.
|
---|
40 | * Note that a delegate user must be referred to by their primary email address,
|
---|
41 | * and not an email alias. Also note that when a new delegate is created, there
|
---|
42 | * may be up to a one minute delay before the new delegate is available for use.
|
---|
43 | * This method is only available to service account clients that have been
|
---|
44 | * delegated domain-wide authority. (delegates.create)
|
---|
45 | *
|
---|
46 | * @param string $userId User's email address. The special value "me" can be
|
---|
47 | * used to indicate the authenticated user.
|
---|
48 | * @param Delegate $postBody
|
---|
49 | * @param array $optParams Optional parameters.
|
---|
50 | * @return Delegate
|
---|
51 | * @throws \Google\Service\Exception
|
---|
52 | */
|
---|
53 | public function create($userId, Delegate $postBody, $optParams = [])
|
---|
54 | {
|
---|
55 | $params = ['userId' => $userId, 'postBody' => $postBody];
|
---|
56 | $params = array_merge($params, $optParams);
|
---|
57 | return $this->call('create', [$params], Delegate::class);
|
---|
58 | }
|
---|
59 | /**
|
---|
60 | * Removes the specified delegate (which can be of any verification status), and
|
---|
61 | * revokes any verification that may have been required for using it. Note that
|
---|
62 | * a delegate user must be referred to by their primary email address, and not
|
---|
63 | * an email alias. This method is only available to service account clients that
|
---|
64 | * have been delegated domain-wide authority. (delegates.delete)
|
---|
65 | *
|
---|
66 | * @param string $userId User's email address. The special value "me" can be
|
---|
67 | * used to indicate the authenticated user.
|
---|
68 | * @param string $delegateEmail The email address of the user to be removed as a
|
---|
69 | * delegate.
|
---|
70 | * @param array $optParams Optional parameters.
|
---|
71 | * @throws \Google\Service\Exception
|
---|
72 | */
|
---|
73 | public function delete($userId, $delegateEmail, $optParams = [])
|
---|
74 | {
|
---|
75 | $params = ['userId' => $userId, 'delegateEmail' => $delegateEmail];
|
---|
76 | $params = array_merge($params, $optParams);
|
---|
77 | return $this->call('delete', [$params]);
|
---|
78 | }
|
---|
79 | /**
|
---|
80 | * Gets the specified delegate. Note that a delegate user must be referred to by
|
---|
81 | * their primary email address, and not an email alias. This method is only
|
---|
82 | * available to service account clients that have been delegated domain-wide
|
---|
83 | * authority. (delegates.get)
|
---|
84 | *
|
---|
85 | * @param string $userId User's email address. The special value "me" can be
|
---|
86 | * used to indicate the authenticated user.
|
---|
87 | * @param string $delegateEmail The email address of the user whose delegate
|
---|
88 | * relationship is to be retrieved.
|
---|
89 | * @param array $optParams Optional parameters.
|
---|
90 | * @return Delegate
|
---|
91 | * @throws \Google\Service\Exception
|
---|
92 | */
|
---|
93 | public function get($userId, $delegateEmail, $optParams = [])
|
---|
94 | {
|
---|
95 | $params = ['userId' => $userId, 'delegateEmail' => $delegateEmail];
|
---|
96 | $params = array_merge($params, $optParams);
|
---|
97 | return $this->call('get', [$params], Delegate::class);
|
---|
98 | }
|
---|
99 | /**
|
---|
100 | * Lists the delegates for the specified account. This method is only available
|
---|
101 | * to service account clients that have been delegated domain-wide authority.
|
---|
102 | * (delegates.listUsersSettingsDelegates)
|
---|
103 | *
|
---|
104 | * @param string $userId User's email address. The special value "me" can be
|
---|
105 | * used to indicate the authenticated user.
|
---|
106 | * @param array $optParams Optional parameters.
|
---|
107 | * @return ListDelegatesResponse
|
---|
108 | * @throws \Google\Service\Exception
|
---|
109 | */
|
---|
110 | public function listUsersSettingsDelegates($userId, $optParams = [])
|
---|
111 | {
|
---|
112 | $params = ['userId' => $userId];
|
---|
113 | $params = array_merge($params, $optParams);
|
---|
114 | return $this->call('list', [$params], ListDelegatesResponse::class);
|
---|
115 | }
|
---|
116 | }
|
---|
117 |
|
---|
118 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
119 | class_alias(UsersSettingsDelegates::class, 'Google_Service_Gmail_Resource_UsersSettingsDelegates');
|
---|