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;
19
20use Google\Client;
21
22/**
23 * Service definition for YouTubeAnalytics (v2).
24 *
25 * <p>
26 * Retrieves your YouTube Analytics data.</p>
27 *
28 * <p>
29 * For more information about this service, see the API
30 * <a href="https://developers.google.com/youtube/analytics" target="_blank">Documentation</a>
31 * </p>
32 *
33 * @author Google, Inc.
34 */
35class YouTubeAnalytics extends \Google\Service
36{
37  /** Manage your YouTube account. */
38  const YOUTUBE =
39      "https://www.googleapis.com/auth/youtube";
40  /** View your YouTube account. */
41  const YOUTUBE_READONLY =
42      "https://www.googleapis.com/auth/youtube.readonly";
43  /** View and manage your assets and associated content on YouTube. */
44  const YOUTUBEPARTNER =
45      "https://www.googleapis.com/auth/youtubepartner";
46  /** View monetary and non-monetary YouTube Analytics reports for your YouTube content. */
47  const YT_ANALYTICS_MONETARY_READONLY =
48      "https://www.googleapis.com/auth/yt-analytics-monetary.readonly";
49  /** View YouTube Analytics reports for your YouTube content. */
50  const YT_ANALYTICS_READONLY =
51      "https://www.googleapis.com/auth/yt-analytics.readonly";
52
53  public $groupItems;
54  public $groups;
55  public $reports;
56
57  /**
58   * Constructs the internal representation of the YouTubeAnalytics service.
59   *
60   * @param Client|array $clientOrConfig The client used to deliver requests, or a
61   *                                     config array to pass to a new Client instance.
62   * @param string $rootUrl The root URL used for requests to the service.
63   */
64  public function __construct($clientOrConfig = [], $rootUrl = null)
65  {
66    parent::__construct($clientOrConfig);
67    $this->rootUrl = $rootUrl ?: 'https://youtubeanalytics.googleapis.com/';
68    $this->servicePath = '';
69    $this->batchPath = 'batch';
70    $this->version = 'v2';
71    $this->serviceName = 'youtubeAnalytics';
72
73    $this->groupItems = new YouTubeAnalytics\Resource\GroupItems(
74        $this,
75        $this->serviceName,
76        'groupItems',
77        [
78          'methods' => [
79            'delete' => [
80              'path' => 'v2/groupItems',
81              'httpMethod' => 'DELETE',
82              'parameters' => [
83                'id' => [
84                  'location' => 'query',
85                  'type' => 'string',
86                ],
87                'onBehalfOfContentOwner' => [
88                  'location' => 'query',
89                  'type' => 'string',
90                ],
91              ],
92            ],'insert' => [
93              'path' => 'v2/groupItems',
94              'httpMethod' => 'POST',
95              'parameters' => [
96                'onBehalfOfContentOwner' => [
97                  'location' => 'query',
98                  'type' => 'string',
99                ],
100              ],
101            ],'list' => [
102              'path' => 'v2/groupItems',
103              'httpMethod' => 'GET',
104              'parameters' => [
105                'groupId' => [
106                  'location' => 'query',
107                  'type' => 'string',
108                ],
109                'onBehalfOfContentOwner' => [
110                  'location' => 'query',
111                  'type' => 'string',
112                ],
113              ],
114            ],
115          ]
116        ]
117    );
118    $this->groups = new YouTubeAnalytics\Resource\Groups(
119        $this,
120        $this->serviceName,
121        'groups',
122        [
123          'methods' => [
124            'delete' => [
125              'path' => 'v2/groups',
126              'httpMethod' => 'DELETE',
127              'parameters' => [
128                'id' => [
129                  'location' => 'query',
130                  'type' => 'string',
131                ],
132                'onBehalfOfContentOwner' => [
133                  'location' => 'query',
134                  'type' => 'string',
135                ],
136              ],
137            ],'insert' => [
138              'path' => 'v2/groups',
139              'httpMethod' => 'POST',
140              'parameters' => [
141                'onBehalfOfContentOwner' => [
142                  'location' => 'query',
143                  'type' => 'string',
144                ],
145              ],
146            ],'list' => [
147              'path' => 'v2/groups',
148              'httpMethod' => 'GET',
149              'parameters' => [
150                'id' => [
151                  'location' => 'query',
152                  'type' => 'string',
153                ],
154                'mine' => [
155                  'location' => 'query',
156                  'type' => 'boolean',
157                ],
158                'onBehalfOfContentOwner' => [
159                  'location' => 'query',
160                  'type' => 'string',
161                ],
162                'pageToken' => [
163                  'location' => 'query',
164                  'type' => 'string',
165                ],
166              ],
167            ],'update' => [
168              'path' => 'v2/groups',
169              'httpMethod' => 'PUT',
170              'parameters' => [
171                'onBehalfOfContentOwner' => [
172                  'location' => 'query',
173                  'type' => 'string',
174                ],
175              ],
176            ],
177          ]
178        ]
179    );
180    $this->reports = new YouTubeAnalytics\Resource\Reports(
181        $this,
182        $this->serviceName,
183        'reports',
184        [
185          'methods' => [
186            'query' => [
187              'path' => 'v2/reports',
188              'httpMethod' => 'GET',
189              'parameters' => [
190                'currency' => [
191                  'location' => 'query',
192                  'type' => 'string',
193                ],
194                'dimensions' => [
195                  'location' => 'query',
196                  'type' => 'string',
197                ],
198                'endDate' => [
199                  'location' => 'query',
200                  'type' => 'string',
201                ],
202                'filters' => [
203                  'location' => 'query',
204                  'type' => 'string',
205                ],
206                'ids' => [
207                  'location' => 'query',
208                  'type' => 'string',
209                ],
210                'includeHistoricalChannelData' => [
211                  'location' => 'query',
212                  'type' => 'boolean',
213                ],
214                'maxResults' => [
215                  'location' => 'query',
216                  'type' => 'integer',
217                ],
218                'metrics' => [
219                  'location' => 'query',
220                  'type' => 'string',
221                ],
222                'sort' => [
223                  'location' => 'query',
224                  'type' => 'string',
225                ],
226                'startDate' => [
227                  'location' => 'query',
228                  'type' => 'string',
229                ],
230                'startIndex' => [
231                  'location' => 'query',
232                  'type' => 'integer',
233                ],
234              ],
235            ],
236          ]
237        ]
238    );
239  }
240}
241
242// Adding a class alias for backwards compatibility with the previous class name.
243class_alias(YouTubeAnalytics::class, 'Google_Service_YouTubeAnalytics');
244