1<?php
2/*
3 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
4 * use this file except in compliance with the License. You may obtain a copy of
5 * the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 * License for the specific language governing permissions and limitations under
13 * the License.
14 */
15
16
17  /**
18   * The "reports" collection of methods.
19   * Typical usage is:
20   *  <code>
21   *   $youtubeAnalyticsService = new Google_YouTubeAnalyticsService(...);
22   *   $reports = $youtubeAnalyticsService->reports;
23   *  </code>
24   */
25  class Google_ReportsServiceResource extends Google_ServiceResource {
26
27    /**
28     * Retrieve your YouTube Analytics reports. (reports.query)
29     *
30     * @param string $ids Identifies the YouTube channel or content owner for which you are retrieving YouTube Analytics data.
31    - To request data for a YouTube user, set the ids parameter value to channel==CHANNEL_ID, where CHANNEL_ID specifies the unique YouTube channel ID.
32    - To request data for a YouTube CMS content owner, set the ids parameter value to contentOwner==OWNER_NAME, where OWNER_NAME is the CMS name of the content owner.
33     * @param string $start_date The start date for fetching YouTube Analytics data. The value should be in YYYY-MM-DD format.
34     * @param string $end_date The end date for fetching YouTube Analytics data. The value should be in YYYY-MM-DD format.
35     * @param string $metrics A comma-separated list of YouTube Analytics metrics, such as views or likes,dislikes. See the Available Reports document for a list of the reports that you can retrieve and the metrics available in each report, and see the Metrics document for definitions of those metrics.
36     * @param array $optParams Optional parameters.
37     *
38     * @opt_param string dimensions A comma-separated list of YouTube Analytics dimensions, such as views or ageGroup,gender. See the Available Reports document for a list of the reports that you can retrieve and the dimensions used for those reports. Also see the Dimensions document for definitions of those dimensions.
39     * @opt_param string filters A list of filters that should be applied when retrieving YouTube Analytics data. The Available Reports document identifies the dimensions that can be used to filter each report, and the Dimensions document defines those dimensions. If a request uses multiple filters, join them together with a semicolon (;), and the returned result table will satisfy both filters. For example, a filters parameter value of video==dMH0bHeiRNg;country==IT restricts the result set to include data for the given video in Italy.
40     * @opt_param int max-results The maximum number of rows to include in the response.
41     * @opt_param string sort A comma-separated list of dimensions or metrics that determine the sort order for YouTube Analytics data. By default the sort order is ascending. The '-' prefix causes descending sort order.
42     * @opt_param int start-index An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter (one-based, inclusive).
43     * @return Google_ResultTable
44     */
45    public function query($ids, $start_date, $end_date, $metrics, $optParams = array()) {
46      $params = array('ids' => $ids, 'start-date' => $start_date, 'end-date' => $end_date, 'metrics' => $metrics);
47      $params = array_merge($params, $optParams);
48      $data = $this->__call('query', array($params));
49      if ($this->useObjects()) {
50        return new Google_ResultTable($data);
51      } else {
52        return $data;
53      }
54    }
55  }
56
57/**
58 * Service definition for Google_YouTubeAnalytics (v1).
59 *
60 * <p>
61 * Retrieve your YouTube Analytics reports.
62 * </p>
63 *
64 * <p>
65 * For more information about this service, see the
66 * <a href="http://developers.google.com/youtube/analytics/" target="_blank">API Documentation</a>
67 * </p>
68 *
69 * @author Google, Inc.
70 */
71class Google_YouTubeAnalyticsService extends Google_Service {
72  public $reports;
73  /**
74   * Constructs the internal representation of the YouTubeAnalytics service.
75   *
76   * @param Google_Client $client
77   */
78  public function __construct(Google_Client $client) {
79    $this->servicePath = 'youtube/analytics/v1/';
80    $this->version = 'v1';
81    $this->serviceName = 'youtubeAnalytics';
82
83    $client->addService($this->serviceName, $this->version);
84    $this->reports = new Google_ReportsServiceResource($this, $this->serviceName, 'reports', json_decode('{"methods": {"query": {"id": "youtubeAnalytics.reports.query", "path": "reports", "httpMethod": "GET", "parameters": {"dimensions": {"type": "string", "location": "query"}, "end-date": {"type": "string", "required": true, "location": "query"}, "filters": {"type": "string", "location": "query"}, "ids": {"type": "string", "required": true, "location": "query"}, "max-results": {"type": "integer", "format": "int32", "minimum": "1", "location": "query"}, "metrics": {"type": "string", "required": true, "location": "query"}, "sort": {"type": "string", "location": "query"}, "start-date": {"type": "string", "required": true, "location": "query"}, "start-index": {"type": "integer", "format": "int32", "minimum": "1", "location": "query"}}, "response": {"$ref": "ResultTable"}, "scopes": ["https://www.googleapis.com/auth/yt-analytics-monetary.readonly", "https://www.googleapis.com/auth/yt-analytics.readonly"]}}}', true));
85
86  }
87}
88
89
90
91class Google_ResultTable extends Google_Model {
92  protected $__columnHeadersType = 'Google_ResultTableColumnHeaders';
93  protected $__columnHeadersDataType = 'array';
94  public $columnHeaders;
95  public $kind;
96  public $rows;
97  public function setColumnHeaders(/* array(Google_ResultTableColumnHeaders) */ $columnHeaders) {
98    $this->assertIsArray($columnHeaders, 'Google_ResultTableColumnHeaders', __METHOD__);
99    $this->columnHeaders = $columnHeaders;
100  }
101  public function getColumnHeaders() {
102    return $this->columnHeaders;
103  }
104  public function setKind( $kind) {
105    $this->kind = $kind;
106  }
107  public function getKind() {
108    return $this->kind;
109  }
110  public function setRows(/* array(Google_object) */ $rows) {
111    $this->assertIsArray($rows, 'Google_object', __METHOD__);
112    $this->rows = $rows;
113  }
114  public function getRows() {
115    return $this->rows;
116  }
117}
118
119class Google_ResultTableColumnHeaders extends Google_Model {
120  public $columnType;
121  public $dataType;
122  public $name;
123  public function setColumnType( $columnType) {
124    $this->columnType = $columnType;
125  }
126  public function getColumnType() {
127    return $this->columnType;
128  }
129  public function setDataType( $dataType) {
130    $this->dataType = $dataType;
131  }
132  public function getDataType() {
133    return $this->dataType;
134  }
135  public function setName( $name) {
136    $this->name = $name;
137  }
138  public function getName() {
139    return $this->name;
140  }
141}
142