generate method
- String account, {
- String? currencyCode,
- String? dateRange,
- List<
String> ? dimensions, - int? endDate_day,
- int? endDate_month,
- int? endDate_year,
- List<
String> ? filters, - String? languageCode,
- int? limit,
- List<
String> ? metrics, - List<
String> ? orderBy, - String? reportingTimeZone,
- int? startDate_day,
- int? startDate_month,
- int? startDate_year,
- String? $fields,
Generates an ad hoc report.
Request parameters:
account
- Required. The account which owns the collection of reports.
Format: accounts/{account}
Value must have pattern ^accounts/\[^/\]+$
.
currencyCode
- The [ISO-4217 currency
code](https://en.wikipedia.org/wiki/ISO_4217) to use when reporting on
monetary metrics. Defaults to the account's currency if not set.
dateRange
- Date range of the report, if unset the range will be
considered CUSTOM.
Possible string values are:
- "REPORTING_DATE_RANGE_UNSPECIFIED" : Unspecified date range.
- "CUSTOM" : A custom date range specified using the
start_date
andend_date
fields. This is the default if no ReportingDateRange is provided. - "TODAY" : Current day.
- "YESTERDAY" : Yesterday.
- "MONTH_TO_DATE" : From the start of the current month to the current day. e.g. if the current date is 2020-03-12 then the range will be [2020-03-01, 2020-03-12].
- "YEAR_TO_DATE" : From the start of the current year to the current day. e.g. if the current date is 2020-03-12 then the range will be [2020-01-01, 2020-03-12].
- "LAST_7_DAYS" : Last 7 days, excluding current day.
- "LAST_30_DAYS" : Last 30 days, excluding current day.
dimensions
- Dimensions to base the report on.
endDate_day
- Day of a month. Must be from 1 to 31 and valid for the
year and month, or 0 to specify a year by itself or a year and month where
the day isn't significant.
endDate_month
- Month of a year. Must be from 1 to 12, or 0 to specify a
year without a month and day.
endDate_year
- Year of the date. Must be from 1 to 9999, or 0 to specify
a date without a year.
filters
- A list of [filters](/adsense/management/reporting/filtering)
to apply to the report. All provided filters must match in order for the
data to be included in the report.
languageCode
- The language to use for translating report output. If
unspecified, this defaults to English ("en"). If the given language is not
supported, report output will be returned in English. The language is
specified as an [IETF BCP-47 language
code](https://en.wikipedia.org/wiki/IETF_language_tag).
limit
- The maximum number of rows of report data to return. Reports
producing more rows than the requested limit will be truncated. If unset,
this defaults to 100,000 rows for Reports.GenerateReport
and 1,000,000
rows for Reports.GenerateCsvReport
, which are also the maximum values
permitted here. Report truncation can be identified (for
Reports.GenerateReport
only) by comparing the number of rows returned to
the value returned in total_matched_rows
.
metrics
- Required. Reporting metrics.
orderBy
- The name of a dimension or metric to sort the resulting report
on, can be prefixed with "+" to sort ascending or "-" to sort descending.
If no prefix is specified, the column is sorted ascending.
reportingTimeZone
- Timezone in which to generate the report. If
unspecified, this defaults to the account timezone. For more information,
see
changing the time zone of your reports.
Possible string values are:
- "REPORTING_TIME_ZONE_UNSPECIFIED" : Unspecified timezone.
- "ACCOUNT_TIME_ZONE" : Use the account timezone in the report.
- "GOOGLE_TIME_ZONE" : Use the Google timezone in the report (America/Los_Angeles).
startDate_day
- Day of a month. Must be from 1 to 31 and valid for the
year and month, or 0 to specify a year by itself or a year and month where
the day isn't significant.
startDate_month
- Month of a year. Must be from 1 to 12, or 0 to specify
a year without a month and day.
startDate_year
- Year of the date. Must be from 1 to 9999, or 0 to
specify a date without a year.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a ReportResult.
Completes with a commons.ApiRequestError if the API endpoint returned an error.
If the used http.Client
completes with an error when making a REST call,
this method will complete with the same error.
Implementation
async.Future<ReportResult> generate(
core.String account, {
core.String? currencyCode,
core.String? dateRange,
core.List<core.String>? dimensions,
core.int? endDate_day,
core.int? endDate_month,
core.int? endDate_year,
core.List<core.String>? filters,
core.String? languageCode,
core.int? limit,
core.List<core.String>? metrics,
core.List<core.String>? orderBy,
core.String? reportingTimeZone,
core.int? startDate_day,
core.int? startDate_month,
core.int? startDate_year,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
if (currencyCode != null) 'currencyCode': [currencyCode],
if (dateRange != null) 'dateRange': [dateRange],
if (dimensions != null) 'dimensions': dimensions,
if (endDate_day != null) 'endDate.day': ['${endDate_day}'],
if (endDate_month != null) 'endDate.month': ['${endDate_month}'],
if (endDate_year != null) 'endDate.year': ['${endDate_year}'],
if (filters != null) 'filters': filters,
if (languageCode != null) 'languageCode': [languageCode],
if (limit != null) 'limit': ['${limit}'],
if (metrics != null) 'metrics': metrics,
if (orderBy != null) 'orderBy': orderBy,
if (reportingTimeZone != null) 'reportingTimeZone': [reportingTimeZone],
if (startDate_day != null) 'startDate.day': ['${startDate_day}'],
if (startDate_month != null) 'startDate.month': ['${startDate_month}'],
if (startDate_year != null) 'startDate.year': ['${startDate_year}'],
if ($fields != null) 'fields': [$fields],
};
final url_ = 'v2/' + core.Uri.encodeFull('$account') + '/reports:generate';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return ReportResult.fromJson(
response_ as core.Map<core.String, core.dynamic>);
}