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\Adsense\Resource; 19 20use Google\Service\Adsense\HttpBody; 21use Google\Service\Adsense\ReportResult; 22 23/** 24 * The "reports" collection of methods. 25 * Typical usage is: 26 * <code> 27 * $adsenseService = new Google\Service\Adsense(...); 28 * $reports = $adsenseService->reports; 29 * </code> 30 */ 31class AccountsReports extends \Google\Service\Resource 32{ 33 /** 34 * Generates an ad hoc report. (reports.generate) 35 * 36 * @param string $account Required. The account which owns the collection of 37 * reports. Format: accounts/{account} 38 * @param array $optParams Optional parameters. 39 * 40 * @opt_param string currencyCode The [ISO-4217 currency 41 * code](https://en.wikipedia.org/wiki/ISO_4217) to use when reporting on 42 * monetary metrics. Defaults to the account's currency if not set. 43 * @opt_param string dateRange Date range of the report, if unset the range will 44 * be considered CUSTOM. 45 * @opt_param string dimensions Dimensions to base the report on. 46 * @opt_param int endDate.day Day of a month. Must be from 1 to 31 and valid for 47 * the year and month, or 0 to specify a year by itself or a year and month 48 * where the day isn't significant. 49 * @opt_param int endDate.month Month of a year. Must be from 1 to 12, or 0 to 50 * specify a year without a month and day. 51 * @opt_param int endDate.year Year of the date. Must be from 1 to 9999, or 0 to 52 * specify a date without a year. 53 * @opt_param string filters Filters to be run on the report. 54 * @opt_param string languageCode The language to use for translating report 55 * output. If unspecified, this defaults to English ("en"). If the given 56 * language is not supported, report output will be returned in English. The 57 * language is specified as an [IETF BCP-47 language 58 * code](https://en.wikipedia.org/wiki/IETF_language_tag). 59 * @opt_param int limit The maximum number of rows of report data to return. 60 * Reports producing more rows than the requested limit will be truncated. If 61 * unset, this defaults to 100,000 rows for `Reports.GenerateReport` and 62 * 1,000,000 rows for `Reports.GenerateCsvReport`, which are also the maximum 63 * values permitted here. Report truncation can be identified (for 64 * `Reports.GenerateReport` only) by comparing the number of rows returned to 65 * the value returned in `total_matched_rows`. 66 * @opt_param string metrics Required. Reporting metrics. 67 * @opt_param string orderBy The name of a dimension or metric to sort the 68 * resulting report on, can be prefixed with "+" to sort ascending or "-" to 69 * sort descending. If no prefix is specified, the column is sorted ascending. 70 * @opt_param string reportingTimeZone Timezone in which to generate the report. 71 * If unspecified, this defaults to the account timezone. For more information, 72 * see [changing the time zone of your 73 * reports](https://support.google.com/adsense/answer/9830725). 74 * @opt_param int startDate.day Day of a month. Must be from 1 to 31 and valid 75 * for the year and month, or 0 to specify a year by itself or a year and month 76 * where the day isn't significant. 77 * @opt_param int startDate.month Month of a year. Must be from 1 to 12, or 0 to 78 * specify a year without a month and day. 79 * @opt_param int startDate.year Year of the date. Must be from 1 to 9999, or 0 80 * to specify a date without a year. 81 * @return ReportResult 82 */ 83 public function generate($account, $optParams = []) 84 { 85 $params = ['account' => $account]; 86 $params = array_merge($params, $optParams); 87 return $this->call('generate', [$params], ReportResult::class); 88 } 89 /** 90 * Generates a csv formatted ad hoc report. (reports.generateCsv) 91 * 92 * @param string $account Required. The account which owns the collection of 93 * reports. Format: accounts/{account} 94 * @param array $optParams Optional parameters. 95 * 96 * @opt_param string currencyCode The [ISO-4217 currency 97 * code](https://en.wikipedia.org/wiki/ISO_4217) to use when reporting on 98 * monetary metrics. Defaults to the account's currency if not set. 99 * @opt_param string dateRange Date range of the report, if unset the range will 100 * be considered CUSTOM. 101 * @opt_param string dimensions Dimensions to base the report on. 102 * @opt_param int endDate.day Day of a month. Must be from 1 to 31 and valid for 103 * the year and month, or 0 to specify a year by itself or a year and month 104 * where the day isn't significant. 105 * @opt_param int endDate.month Month of a year. Must be from 1 to 12, or 0 to 106 * specify a year without a month and day. 107 * @opt_param int endDate.year Year of the date. Must be from 1 to 9999, or 0 to 108 * specify a date without a year. 109 * @opt_param string filters Filters to be run on the report. 110 * @opt_param string languageCode The language to use for translating report 111 * output. If unspecified, this defaults to English ("en"). If the given 112 * language is not supported, report output will be returned in English. The 113 * language is specified as an [IETF BCP-47 language 114 * code](https://en.wikipedia.org/wiki/IETF_language_tag). 115 * @opt_param int limit The maximum number of rows of report data to return. 116 * Reports producing more rows than the requested limit will be truncated. If 117 * unset, this defaults to 100,000 rows for `Reports.GenerateReport` and 118 * 1,000,000 rows for `Reports.GenerateCsvReport`, which are also the maximum 119 * values permitted here. Report truncation can be identified (for 120 * `Reports.GenerateReport` only) by comparing the number of rows returned to 121 * the value returned in `total_matched_rows`. 122 * @opt_param string metrics Required. Reporting metrics. 123 * @opt_param string orderBy The name of a dimension or metric to sort the 124 * resulting report on, can be prefixed with "+" to sort ascending or "-" to 125 * sort descending. If no prefix is specified, the column is sorted ascending. 126 * @opt_param string reportingTimeZone Timezone in which to generate the report. 127 * If unspecified, this defaults to the account timezone. For more information, 128 * see [changing the time zone of your 129 * reports](https://support.google.com/adsense/answer/9830725). 130 * @opt_param int startDate.day Day of a month. Must be from 1 to 31 and valid 131 * for the year and month, or 0 to specify a year by itself or a year and month 132 * where the day isn't significant. 133 * @opt_param int startDate.month Month of a year. Must be from 1 to 12, or 0 to 134 * specify a year without a month and day. 135 * @opt_param int startDate.year Year of the date. Must be from 1 to 9999, or 0 136 * to specify a date without a year. 137 * @return HttpBody 138 */ 139 public function generateCsv($account, $optParams = []) 140 { 141 $params = ['account' => $account]; 142 $params = array_merge($params, $optParams); 143 return $this->call('generateCsv', [$params], HttpBody::class); 144 } 145} 146 147// Adding a class alias for backwards compatibility with the previous class name. 148class_alias(AccountsReports::class, 'Google_Service_Adsense_Resource_AccountsReports'); 149