getQueryResults method

Future<GetQueryResultsResponse> getQueryResults({
  1. required String queryId,
  2. required String workspaceName,
  3. int? maxResults,
  4. String? nextToken,
})

Retrieves the paginated results of a query. Returns empty rows if the query is not yet complete.

May throw AccessDeniedException. May throw InternalFailureException. May throw InvalidRequestException. May throw ResourceNotFoundException. May throw ThrottlingException.

Parameter queryId : The unique identifier for the query execution.

Parameter workspaceName : The name of the workspace associated with the query.

Parameter maxResults : The maximum number of results to return for each paginated request.

Parameter nextToken : The token to be used for the next set of paginated results.

Implementation

Future<GetQueryResultsResponse> getQueryResults({
  required String queryId,
  required String workspaceName,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    10000,
  );
  final $query = <String, List<String>>{
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (nextToken != null) 'nextToken': [nextToken],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri:
        '/workspaces/${Uri.encodeComponent(workspaceName)}/queries/${Uri.encodeComponent(queryId)}/results',
    queryParams: $query,
    hostPrefix: 'data.',
    exceptionFnMap: _exceptionFns,
  );
  return GetQueryResultsResponse.fromJson(response);
}