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