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