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\ForwardingAddress;
21use Google\Service\Gmail\ListForwardingAddressesResponse;
22
23/**
24 * The "forwardingAddresses" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $gmailService = new Google\Service\Gmail(...);
28 *   $forwardingAddresses = $gmailService->forwardingAddresses;
29 *  </code>
30 */
31class UsersSettingsForwardingAddresses extends \Google\Service\Resource
32{
33  /**
34   * Creates a forwarding address. If ownership verification is required, a
35   * message will be sent to the recipient and the resource's verification status
36   * will be set to `pending`; otherwise, the resource will be created with
37   * verification status set to `accepted`. This method is only available to
38   * service account clients that have been delegated domain-wide authority.
39   * (forwardingAddresses.create)
40   *
41   * @param string $userId User's email address. The special value "me" can be
42   * used to indicate the authenticated user.
43   * @param ForwardingAddress $postBody
44   * @param array $optParams Optional parameters.
45   * @return ForwardingAddress
46   */
47  public function create($userId, ForwardingAddress $postBody, $optParams = [])
48  {
49    $params = ['userId' => $userId, 'postBody' => $postBody];
50    $params = array_merge($params, $optParams);
51    return $this->call('create', [$params], ForwardingAddress::class);
52  }
53  /**
54   * Deletes the specified forwarding address and revokes any verification that
55   * may have been required. This method is only available to service account
56   * clients that have been delegated domain-wide authority.
57   * (forwardingAddresses.delete)
58   *
59   * @param string $userId User's email address. The special value "me" can be
60   * used to indicate the authenticated user.
61   * @param string $forwardingEmail The forwarding address to be deleted.
62   * @param array $optParams Optional parameters.
63   */
64  public function delete($userId, $forwardingEmail, $optParams = [])
65  {
66    $params = ['userId' => $userId, 'forwardingEmail' => $forwardingEmail];
67    $params = array_merge($params, $optParams);
68    return $this->call('delete', [$params]);
69  }
70  /**
71   * Gets the specified forwarding address. (forwardingAddresses.get)
72   *
73   * @param string $userId User's email address. The special value "me" can be
74   * used to indicate the authenticated user.
75   * @param string $forwardingEmail The forwarding address to be retrieved.
76   * @param array $optParams Optional parameters.
77   * @return ForwardingAddress
78   */
79  public function get($userId, $forwardingEmail, $optParams = [])
80  {
81    $params = ['userId' => $userId, 'forwardingEmail' => $forwardingEmail];
82    $params = array_merge($params, $optParams);
83    return $this->call('get', [$params], ForwardingAddress::class);
84  }
85  /**
86   * Lists the forwarding addresses for the specified account.
87   * (forwardingAddresses.listUsersSettingsForwardingAddresses)
88   *
89   * @param string $userId User's email address. The special value "me" can be
90   * used to indicate the authenticated user.
91   * @param array $optParams Optional parameters.
92   * @return ListForwardingAddressesResponse
93   */
94  public function listUsersSettingsForwardingAddresses($userId, $optParams = [])
95  {
96    $params = ['userId' => $userId];
97    $params = array_merge($params, $optParams);
98    return $this->call('list', [$params], ListForwardingAddressesResponse::class);
99  }
100}
101
102// Adding a class alias for backwards compatibility with the previous class name.
103class_alias(UsersSettingsForwardingAddresses::class, 'Google_Service_Gmail_Resource_UsersSettingsForwardingAddresses');
104