generate method

Future<ReportResult> generate(
  1. String name, {
  2. String? currencyCode,
  3. String? dateRange,
  4. int? endDate_day,
  5. int? endDate_month,
  6. int? endDate_year,
  7. String? languageCode,
  8. String? reportingTimeZone,
  9. int? startDate_day,
  10. int? startDate_month,
  11. int? startDate_year,
  12. String? $fields,
})

Generates a saved report.

Request parameters:

name - Required. Name of the saved report. Format: accounts/{account}/reports/{report} Value must have pattern ^accounts/\[^/\]+/reports/\[^/\]+$.

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 and end_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.

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.

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).

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 name, {
  core.String? currencyCode,
  core.String? dateRange,
  core.int? endDate_day,
  core.int? endDate_month,
  core.int? endDate_year,
  core.String? languageCode,
  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 (endDate_day != null) 'endDate.day': ['${endDate_day}'],
    if (endDate_month != null) 'endDate.month': ['${endDate_month}'],
    if (endDate_year != null) 'endDate.year': ['${endDate_year}'],
    if (languageCode != null) 'languageCode': [languageCode],
    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('$name') + '/saved:generate';

  final response_ = await _requester.request(
    url_,
    'GET',
    queryParams: queryParams_,
  );
  return ReportResult.fromJson(
      response_ as core.Map<core.String, core.dynamic>);
}