listTasks method

Future<ListTasksResponse> listTasks({
  1. List<TaskFilter>? filters,
  2. int? maxResults,
  3. String? nextToken,
})

Returns a list of all the tasks.

May throw InvalidRequestException. May throw InternalException.

Parameter filters : You can use API filters to narrow down the list of resources returned by ListTasks. For example, to retrieve all tasks on a specific source location, you can use ListTasks with filter name LocationId and Operator Equals with the ARN for the location.

Parameter maxResults : The maximum number of tasks to return.

Parameter nextToken : An opaque string that indicates the position at which to begin the next list of tasks.

Implementation

Future<ListTasksResponse> listTasks({
  List<TaskFilter>? filters,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    0,
    100,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    0,
    65535,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'FmrsService.ListTasks'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (filters != null) 'Filters': filters,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return ListTasksResponse.fromJson(jsonResponse.body);
}