run method

Future<Report> run(
  1. RunQueryRequest request,
  2. String queryId, {
  3. bool? synchronous,
  4. String? $fields,
})

Runs an existing query to generate a report.

request - The metadata request object.

Request parameters:

queryId - Required. The ID of the query to run.

synchronous - Whether the query should be run synchronously. When true, the request won't return until the resulting report has finished running. This parameter is false by default. Setting this parameter to true is not recommended.

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

Completes with a Report.

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<Report> run(
  RunQueryRequest request,
  core.String queryId, {
  core.bool? synchronous,
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    if (synchronous != null) 'synchronous': ['${synchronous}'],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'queries/' + commons.escapeVariable('$queryId') + ':run';

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