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 AccountsReports 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 $accountId Hosted account upon which to report. 38 * @param string $startDate Start of the date range to report on in "YYYY-MM-DD" 39 * format, inclusive. 40 * @param string $endDate End of the date range to report on in "YYYY-MM-DD" 41 * format, inclusive. 42 * @param array $optParams Optional parameters. 43 * 44 * @opt_param string dimension Dimensions to base the report on. 45 * @opt_param string filter Filters to be run on the report. 46 * @opt_param string locale Optional locale to use for translating report output 47 * to a local language. Defaults to "en_US" if not specified. 48 * @opt_param string maxResults The maximum number of rows of report data to 49 * return. 50 * @opt_param string metric Numeric columns to include in the report. 51 * @opt_param string sort The name of a dimension or metric to sort the 52 * resulting report on, optionally prefixed with "+" to sort ascending or "-" to 53 * sort descending. If no prefix is specified, the column is sorted ascending. 54 * @opt_param string startIndex Index of the first row of report data to return. 55 * @return Report 56 */ 57 public function generate($accountId, $startDate, $endDate, $optParams = []) 58 { 59 $params = ['accountId' => $accountId, 'startDate' => $startDate, 'endDate' => $endDate]; 60 $params = array_merge($params, $optParams); 61 return $this->call('generate', [$params], Report::class); 62 } 63} 64 65// Adding a class alias for backwards compatibility with the previous class name. 66class_alias(AccountsReports::class, 'Google_Service_AdSenseHost_Resource_AccountsReports'); 67