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\Analytics\Resource;
19
20use Google\Service\Analytics\Filter;
21use Google\Service\Analytics\Filters;
22
23/**
24 * The "filters" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $analyticsService = new Google\Service\Analytics(...);
28 *   $filters = $analyticsService->filters;
29 *  </code>
30 */
31class ManagementFilters extends \Google\Service\Resource
32{
33  /**
34   * Delete a filter. (filters.delete)
35   *
36   * @param string $accountId Account ID to delete the filter for.
37   * @param string $filterId ID of the filter to be deleted.
38   * @param array $optParams Optional parameters.
39   * @return Filter
40   */
41  public function delete($accountId, $filterId, $optParams = [])
42  {
43    $params = ['accountId' => $accountId, 'filterId' => $filterId];
44    $params = array_merge($params, $optParams);
45    return $this->call('delete', [$params], Filter::class);
46  }
47  /**
48   * Returns filters to which the user has access. (filters.get)
49   *
50   * @param string $accountId Account ID to retrieve filters for.
51   * @param string $filterId Filter ID to retrieve filters for.
52   * @param array $optParams Optional parameters.
53   * @return Filter
54   */
55  public function get($accountId, $filterId, $optParams = [])
56  {
57    $params = ['accountId' => $accountId, 'filterId' => $filterId];
58    $params = array_merge($params, $optParams);
59    return $this->call('get', [$params], Filter::class);
60  }
61  /**
62   * Create a new filter. (filters.insert)
63   *
64   * @param string $accountId Account ID to create filter for.
65   * @param Filter $postBody
66   * @param array $optParams Optional parameters.
67   * @return Filter
68   */
69  public function insert($accountId, Filter $postBody, $optParams = [])
70  {
71    $params = ['accountId' => $accountId, 'postBody' => $postBody];
72    $params = array_merge($params, $optParams);
73    return $this->call('insert', [$params], Filter::class);
74  }
75  /**
76   * Lists all filters for an account (filters.listManagementFilters)
77   *
78   * @param string $accountId Account ID to retrieve filters for.
79   * @param array $optParams Optional parameters.
80   *
81   * @opt_param int max-results The maximum number of filters to include in this
82   * response.
83   * @opt_param int start-index An index of the first entity to retrieve. Use this
84   * parameter as a pagination mechanism along with the max-results parameter.
85   * @return Filters
86   */
87  public function listManagementFilters($accountId, $optParams = [])
88  {
89    $params = ['accountId' => $accountId];
90    $params = array_merge($params, $optParams);
91    return $this->call('list', [$params], Filters::class);
92  }
93  /**
94   * Updates an existing filter. This method supports patch semantics.
95   * (filters.patch)
96   *
97   * @param string $accountId Account ID to which the filter belongs.
98   * @param string $filterId ID of the filter to be updated.
99   * @param Filter $postBody
100   * @param array $optParams Optional parameters.
101   * @return Filter
102   */
103  public function patch($accountId, $filterId, Filter $postBody, $optParams = [])
104  {
105    $params = ['accountId' => $accountId, 'filterId' => $filterId, 'postBody' => $postBody];
106    $params = array_merge($params, $optParams);
107    return $this->call('patch', [$params], Filter::class);
108  }
109  /**
110   * Updates an existing filter. (filters.update)
111   *
112   * @param string $accountId Account ID to which the filter belongs.
113   * @param string $filterId ID of the filter to be updated.
114   * @param Filter $postBody
115   * @param array $optParams Optional parameters.
116   * @return Filter
117   */
118  public function update($accountId, $filterId, Filter $postBody, $optParams = [])
119  {
120    $params = ['accountId' => $accountId, 'filterId' => $filterId, 'postBody' => $postBody];
121    $params = array_merge($params, $optParams);
122    return $this->call('update', [$params], Filter::class);
123  }
124}
125
126// Adding a class alias for backwards compatibility with the previous class name.
127class_alias(ManagementFilters::class, 'Google_Service_Analytics_Resource_ManagementFilters');
128