listBenefits method

Future<ListBenefitsOutput> listBenefits({
  1. required String catalog,
  2. List<FulfillmentType>? fulfillmentTypes,
  3. int? maxResults,
  4. String? nextToken,
  5. List<String>? programs,
  6. List<BenefitStatus>? status,
})

Retrieves a paginated list of available benefits based on specified filter criteria.

May throw AccessDeniedException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter catalog : The catalog identifier to filter benefits by catalog.

Parameter fulfillmentTypes : Filter benefits by specific fulfillment types.

Parameter maxResults : The maximum number of benefits to return in a single response.

Parameter nextToken : A pagination token to retrieve the next set of results from a previous request.

Parameter programs : Filter benefits by specific AWS partner programs.

Parameter status : Filter benefits by their current status.

Implementation

Future<ListBenefitsOutput> listBenefits({
  required String catalog,
  List<FulfillmentType>? fulfillmentTypes,
  int? maxResults,
  String? nextToken,
  List<String>? programs,
  List<BenefitStatus>? status,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'PartnerCentralBenefitsService.ListBenefits'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Catalog': catalog,
      if (fulfillmentTypes != null)
        'FulfillmentTypes': fulfillmentTypes.map((e) => e.value).toList(),
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
      if (programs != null) 'Programs': programs,
      if (status != null) 'Status': status.map((e) => e.value).toList(),
    },
  );

  return ListBenefitsOutput.fromJson(jsonResponse.body);
}