listCampaigns method

Future<ListCampaignsResponse> listCampaigns({
  1. ListResponseScope? listResponseScope,
  2. int? maxResults,
  3. String? nextToken,
  4. String? status,
})

Lists information about created campaigns.

May throw AccessDeniedException. May throw ThrottlingException. May throw ValidationException.

Parameter listResponseScope : When you set the listResponseScope parameter to METADATA_ONLY, the list response includes: campaign name, Amazon Resource Name (ARN), creation time, and last modification time.

Parameter maxResults : The maximum number of items to return, between 1 and 100, inclusive.

Parameter nextToken : A pagination token for the next set of results.

If the results of a search are large, only a portion of the results are returned, and a nextToken pagination token is returned in the response. To retrieve the next set of results, reissue the search request and include the returned token. When all results have been returned, the response does not contain a pagination token value.

Parameter status : An optional parameter to filter the results by the status of each created campaign in your account. The status can be one of: CREATING, WAITING_FOR_APPROVAL, RUNNING, or SUSPENDED.

Implementation

Future<ListCampaignsResponse> listCampaigns({
  ListResponseScope? listResponseScope,
  int? maxResults,
  String? nextToken,
  String? status,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'IoTAutobahnControlPlane.ListCampaigns'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (listResponseScope != null)
        'listResponseScope': listResponseScope.value,
      if (maxResults != null) 'maxResults': maxResults,
      if (nextToken != null) 'nextToken': nextToken,
      if (status != null) 'status': status,
    },
  );

  return ListCampaignsResponse.fromJson(jsonResponse.body);
}