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\Filter;
21use Google\Service\Gmail\ListFiltersResponse;
22
23/**
24 * The "filters" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $gmailService = new Google\Service\Gmail(...);
28 *   $filters = $gmailService->filters;
29 *  </code>
30 */
31class UsersSettingsFilters extends \Google\Service\Resource
32{
33  /**
34   * Creates a filter. Note: you can only create a maximum of 1,000 filters.
35   * (filters.create)
36   *
37   * @param string $userId User's email address. The special value "me" can be
38   * used to indicate the authenticated user.
39   * @param Filter $postBody
40   * @param array $optParams Optional parameters.
41   * @return Filter
42   */
43  public function create($userId, Filter $postBody, $optParams = [])
44  {
45    $params = ['userId' => $userId, 'postBody' => $postBody];
46    $params = array_merge($params, $optParams);
47    return $this->call('create', [$params], Filter::class);
48  }
49  /**
50   * Immediately and permanently deletes the specified filter. (filters.delete)
51   *
52   * @param string $userId User's email address. The special value "me" can be
53   * used to indicate the authenticated user.
54   * @param string $id The ID of the filter to be deleted.
55   * @param array $optParams Optional parameters.
56   */
57  public function delete($userId, $id, $optParams = [])
58  {
59    $params = ['userId' => $userId, 'id' => $id];
60    $params = array_merge($params, $optParams);
61    return $this->call('delete', [$params]);
62  }
63  /**
64   * Gets a filter. (filters.get)
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 $id The ID of the filter to be fetched.
69   * @param array $optParams Optional parameters.
70   * @return Filter
71   */
72  public function get($userId, $id, $optParams = [])
73  {
74    $params = ['userId' => $userId, 'id' => $id];
75    $params = array_merge($params, $optParams);
76    return $this->call('get', [$params], Filter::class);
77  }
78  /**
79   * Lists the message filters of a Gmail user. (filters.listUsersSettingsFilters)
80   *
81   * @param string $userId User's email address. The special value "me" can be
82   * used to indicate the authenticated user.
83   * @param array $optParams Optional parameters.
84   * @return ListFiltersResponse
85   */
86  public function listUsersSettingsFilters($userId, $optParams = [])
87  {
88    $params = ['userId' => $userId];
89    $params = array_merge($params, $optParams);
90    return $this->call('list', [$params], ListFiltersResponse::class);
91  }
92}
93
94// Adding a class alias for backwards compatibility with the previous class name.
95class_alias(UsersSettingsFilters::class, 'Google_Service_Gmail_Resource_UsersSettingsFilters');
96