listJobExecutionsForThing method

Future<ListJobExecutionsForThingResponse> listJobExecutionsForThing({
  1. required String thingName,
  2. int? maxResults,
  3. String? namespaceId,
  4. String? nextToken,
  5. JobExecutionStatus? status,
})

Lists the job executions for the specified thing.

May throw InvalidRequestException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ServiceUnavailableException.

Parameter thingName : The thing name.

Parameter maxResults : The maximum number of results to be returned per request.

Parameter namespaceId : The namespace used to indicate that a job is a customer-managed job.

When you specify a value for this parameter, AWS IoT Core sends jobs notifications to MQTT topics that contain the value in the following format.

$aws/things/THING_NAME/jobs/JOB_ID/notify-namespace-NAMESPACE_ID/

Parameter nextToken : The token to retrieve the next set of results.

Parameter status : An optional filter that lets you search for jobs that have the specified status.

Implementation

Future<ListJobExecutionsForThingResponse> listJobExecutionsForThing({
  required String thingName,
  int? maxResults,
  String? namespaceId,
  String? nextToken,
  JobExecutionStatus? status,
}) async {
  ArgumentError.checkNotNull(thingName, 'thingName');
  _s.validateStringLength(
    'thingName',
    thingName,
    1,
    128,
    isRequired: true,
  );
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    250,
  );
  _s.validateStringLength(
    'namespaceId',
    namespaceId,
    1,
    64,
  );
  final $query = <String, List<String>>{
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (namespaceId != null) 'namespaceId': [namespaceId],
    if (nextToken != null) 'nextToken': [nextToken],
    if (status != null) 'status': [status.toValue()],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/things/${Uri.encodeComponent(thingName)}/jobs',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListJobExecutionsForThingResponse.fromJson(response);
}