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\ListSendAsResponse; 21use Google\Service\Gmail\SendAs; 22 23/** 24 * The "sendAs" collection of methods. 25 * Typical usage is: 26 * <code> 27 * $gmailService = new Google\Service\Gmail(...); 28 * $sendAs = $gmailService->sendAs; 29 * </code> 30 */ 31class UsersSettingsSendAs extends \Google\Service\Resource 32{ 33 /** 34 * Creates a custom "from" send-as alias. If an SMTP MSA is specified, Gmail 35 * will attempt to connect to the SMTP service to validate the configuration 36 * before creating the alias. If ownership verification is required for the 37 * alias, a message will be sent to the email address and the resource's 38 * verification status will be set to `pending`; otherwise, the resource will be 39 * created with verification status set to `accepted`. If a signature is 40 * provided, Gmail will sanitize the HTML before saving it with the alias. This 41 * method is only available to service account clients that have been delegated 42 * domain-wide authority. (sendAs.create) 43 * 44 * @param string $userId User's email address. The special value "me" can be 45 * used to indicate the authenticated user. 46 * @param SendAs $postBody 47 * @param array $optParams Optional parameters. 48 * @return SendAs 49 */ 50 public function create($userId, SendAs $postBody, $optParams = []) 51 { 52 $params = ['userId' => $userId, 'postBody' => $postBody]; 53 $params = array_merge($params, $optParams); 54 return $this->call('create', [$params], SendAs::class); 55 } 56 /** 57 * Deletes the specified send-as alias. Revokes any verification that may have 58 * been required for using it. This method is only available to service account 59 * clients that have been delegated domain-wide authority. (sendAs.delete) 60 * 61 * @param string $userId User's email address. The special value "me" can be 62 * used to indicate the authenticated user. 63 * @param string $sendAsEmail The send-as alias to be deleted. 64 * @param array $optParams Optional parameters. 65 */ 66 public function delete($userId, $sendAsEmail, $optParams = []) 67 { 68 $params = ['userId' => $userId, 'sendAsEmail' => $sendAsEmail]; 69 $params = array_merge($params, $optParams); 70 return $this->call('delete', [$params]); 71 } 72 /** 73 * Gets the specified send-as alias. Fails with an HTTP 404 error if the 74 * specified address is not a member of the collection. (sendAs.get) 75 * 76 * @param string $userId User's email address. The special value "me" can be 77 * used to indicate the authenticated user. 78 * @param string $sendAsEmail The send-as alias to be retrieved. 79 * @param array $optParams Optional parameters. 80 * @return SendAs 81 */ 82 public function get($userId, $sendAsEmail, $optParams = []) 83 { 84 $params = ['userId' => $userId, 'sendAsEmail' => $sendAsEmail]; 85 $params = array_merge($params, $optParams); 86 return $this->call('get', [$params], SendAs::class); 87 } 88 /** 89 * Lists the send-as aliases for the specified account. The result includes the 90 * primary send-as address associated with the account as well as any custom 91 * "from" aliases. (sendAs.listUsersSettingsSendAs) 92 * 93 * @param string $userId User's email address. The special value "me" can be 94 * used to indicate the authenticated user. 95 * @param array $optParams Optional parameters. 96 * @return ListSendAsResponse 97 */ 98 public function listUsersSettingsSendAs($userId, $optParams = []) 99 { 100 $params = ['userId' => $userId]; 101 $params = array_merge($params, $optParams); 102 return $this->call('list', [$params], ListSendAsResponse::class); 103 } 104 /** 105 * Patch the specified send-as alias. (sendAs.patch) 106 * 107 * @param string $userId User's email address. The special value "me" can be 108 * used to indicate the authenticated user. 109 * @param string $sendAsEmail The send-as alias to be updated. 110 * @param SendAs $postBody 111 * @param array $optParams Optional parameters. 112 * @return SendAs 113 */ 114 public function patch($userId, $sendAsEmail, SendAs $postBody, $optParams = []) 115 { 116 $params = ['userId' => $userId, 'sendAsEmail' => $sendAsEmail, 'postBody' => $postBody]; 117 $params = array_merge($params, $optParams); 118 return $this->call('patch', [$params], SendAs::class); 119 } 120 /** 121 * Updates a send-as alias. If a signature is provided, Gmail will sanitize the 122 * HTML before saving it with the alias. Addresses other than the primary 123 * address for the account can only be updated by service account clients that 124 * have been delegated domain-wide authority. (sendAs.update) 125 * 126 * @param string $userId User's email address. The special value "me" can be 127 * used to indicate the authenticated user. 128 * @param string $sendAsEmail The send-as alias to be updated. 129 * @param SendAs $postBody 130 * @param array $optParams Optional parameters. 131 * @return SendAs 132 */ 133 public function update($userId, $sendAsEmail, SendAs $postBody, $optParams = []) 134 { 135 $params = ['userId' => $userId, 'sendAsEmail' => $sendAsEmail, 'postBody' => $postBody]; 136 $params = array_merge($params, $optParams); 137 return $this->call('update', [$params], SendAs::class); 138 } 139 /** 140 * Sends a verification email to the specified send-as alias address. The 141 * verification status must be `pending`. This method is only available to 142 * service account clients that have been delegated domain-wide authority. 143 * (sendAs.verify) 144 * 145 * @param string $userId User's email address. The special value "me" can be 146 * used to indicate the authenticated user. 147 * @param string $sendAsEmail The send-as alias to be verified. 148 * @param array $optParams Optional parameters. 149 */ 150 public function verify($userId, $sendAsEmail, $optParams = []) 151 { 152 $params = ['userId' => $userId, 'sendAsEmail' => $sendAsEmail]; 153 $params = array_merge($params, $optParams); 154 return $this->call('verify', [$params]); 155 } 156} 157 158// Adding a class alias for backwards compatibility with the previous class name. 159class_alias(UsersSettingsSendAs::class, 'Google_Service_Gmail_Resource_UsersSettingsSendAs'); 160