get method

Future<UsageReports> get(
  1. String date, {
  2. String? customerId,
  3. String? pageToken,
  4. String? parameters,
  5. String? $fields,
})

Retrieves a report which is a collection of properties and statistics for a specific customer's account.

For more information, see the Customers Usage Report guide. For more information about the customer report's parameters, see the Customers Usage parameters reference guides.

Request parameters:

date - Represents the date the usage occurred, based on UTC-8:00 (Pacific Standard Time). The timestamp is in the ISO 8601 format, yyyy-mm-dd. Value must have pattern (\d){4}-(\d){2}-(\d){2}.

customerId - The unique ID of the customer to retrieve data for. Value must have pattern C.+|my_customer.

pageToken - Token to specify next page. A report with multiple pages has a nextPageToken property in the response. For your follow-on requests getting all of the report's pages, enter the nextPageToken value in the pageToken query string.

parameters - The parameters query string is a comma-separated list of event parameters that refine a report's results. The parameter is associated with a specific application. The application values for the Customers usage report include accounts, app_maker, apps_scripts, calendar, classroom, cros, docs, gmail, gplus, device_management, meet, and sites. A parameters query string is in the CSV form of app_name1:param_name1, app_name2:param_name2. Note: The API doesn't accept multiple values of a parameter. If a particular parameter is supplied more than once in the API request, the API only accepts the last value of that request parameter. In addition, if an invalid request parameter is supplied in the API request, the API ignores that request parameter and returns the response corresponding to the remaining valid request parameters. An example of an invalid request parameter is one that does not belong to the application. If no parameters are requested, all parameters are returned. Value must have pattern (((accounts)|(app_maker)|(apps_scripts)|(classroom)|(cros)|(gmail)|(calendar)|(docs)|(gplus)|(sites)|(device_management)|(drive)|(meet)):\[^,\]+,)*(((accounts)|(app_maker)|(apps_scripts)|(classroom)|(cros)|(gmail)|(calendar)|(docs)|(gplus)|(sites)|(device_management)|(drive)|(meet)):\[^,\]+).

$fields - Selector specifying which fields to include in a partial response.

Completes with a UsageReports.

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<UsageReports> get(
  core.String date, {
  core.String? customerId,
  core.String? pageToken,
  core.String? parameters,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (customerId != null) 'customerId': [customerId],
    if (pageToken != null) 'pageToken': [pageToken],
    if (parameters != null) 'parameters': [parameters],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ =
      'admin/reports/v1/usage/dates/' + commons.escapeVariable('$date');

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