run method

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

Runs a stored query to generate a report.

request - The metadata request object.

Request parameters:

queryId - Required. ID of query to run.

synchronous - Whether the query should be run synchronously. When true, this method will not return until the query has finished running. When false or not specified, this method will return immediately.

$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>);
}