listJobs method

Future<ListJobsResponse> listJobs({
  1. int? maxResults,
  2. String? nextToken,
  3. Order? order,
  4. String? queue,
  5. JobStatus? status,
})

Retrieve a JSON array of up to twenty of your most recently created jobs. This array includes in-process, completed, and errored jobs. This will return the jobs themselves, not just a list of the jobs. To retrieve the twenty next most recent jobs, use the nextToken string returned with the array.

May throw BadRequestException. May throw InternalServerErrorException. May throw ForbiddenException. May throw NotFoundException. May throw TooManyRequestsException. May throw ConflictException.

Parameter maxResults : Optional. Number of jobs, up to twenty, that will be returned at one time.

Parameter nextToken : Optional. Use this string, provided with the response to a previous request, to request the next batch of jobs.

Parameter order : Optional. When you request lists of resources, you can specify whether they are sorted in ASCENDING or DESCENDING order. Default varies by resource.

Parameter queue : Optional. Provide a queue name to get back only jobs from that queue.

Parameter status : Optional. A job's status can be SUBMITTED, PROGRESSING, COMPLETE, CANCELED, or ERROR.

Implementation

Future<ListJobsResponse> listJobs({
  int? maxResults,
  String? nextToken,
  Order? order,
  String? queue,
  JobStatus? status,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    20,
  );
  final $query = <String, List<String>>{
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (nextToken != null) 'nextToken': [nextToken],
    if (order != null) 'order': [order.toValue()],
    if (queue != null) 'queue': [queue],
    if (status != null) 'status': [status.toValue()],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/2017-08-29/jobs',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListJobsResponse.fromJson(response);
}