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