listCampaigns method

Future<ListCampaignsResponse> listCampaigns({
  1. int? maxResults,
  2. String? nextToken,
  3. String? solutionArn,
})

Returns a list of campaigns that use the given solution. When a solution is not specified, all the campaigns associated with the account are listed. The response provides the properties for each campaign, including the Amazon Resource Name (ARN). For more information on campaigns, see CreateCampaign.

May throw InvalidInputException. May throw InvalidNextTokenException.

Parameter maxResults : The maximum number of campaigns to return.

Parameter nextToken : A token returned from the previous call to ListCampaigns for getting the next set of campaigns (if they exist).

Parameter solutionArn : The Amazon Resource Name (ARN) of the solution to list the campaigns for. When a solution is not specified, all the campaigns associated with the account are listed.

Implementation

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

  return ListCampaignsResponse.fromJson(jsonResponse.body);
}