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