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\AdSenseHost\Resource;
19
20use Google\Service\AdSenseHost\Report;
21
22/**
23 * The "reports" collection of methods.
24 * Typical usage is:
25 *  <code>
26 *   $adsensehostService = new Google\Service\AdSenseHost(...);
27 *   $reports = $adsensehostService->reports;
28 *  </code>
29 */
30class Reports extends \Google\Service\Resource
31{
32  /**
33   * Generate an AdSense report based on the report request sent in the query
34   * parameters. Returns the result as JSON; to retrieve output in CSV format
35   * specify "alt=csv" as a query parameter. (reports.generate)
36   *
37   * @param string $startDate Start of the date range to report on in "YYYY-MM-DD"
38   * format, inclusive.
39   * @param string $endDate End of the date range to report on in "YYYY-MM-DD"
40   * format, inclusive.
41   * @param array $optParams Optional parameters.
42   *
43   * @opt_param string dimension Dimensions to base the report on.
44   * @opt_param string filter Filters to be run on the report.
45   * @opt_param string locale Optional locale to use for translating report output
46   * to a local language. Defaults to "en_US" if not specified.
47   * @opt_param string maxResults The maximum number of rows of report data to
48   * return.
49   * @opt_param string metric Numeric columns to include in the report.
50   * @opt_param string sort The name of a dimension or metric to sort the
51   * resulting report on, optionally prefixed with "+" to sort ascending or "-" to
52   * sort descending. If no prefix is specified, the column is sorted ascending.
53   * @opt_param string startIndex Index of the first row of report data to return.
54   * @return Report
55   */
56  public function generate($startDate, $endDate, $optParams = [])
57  {
58    $params = ['startDate' => $startDate, 'endDate' => $endDate];
59    $params = array_merge($params, $optParams);
60    return $this->call('generate', [$params], Report::class);
61  }
62}
63
64// Adding a class alias for backwards compatibility with the previous class name.
65class_alias(Reports::class, 'Google_Service_AdSenseHost_Resource_Reports');
66