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