searchAgreements method

Future<SearchAgreementsOutput> searchAgreements({
  1. String? catalog,
  2. List<Filter>? filters,
  3. int? maxResults,
  4. String? nextToken,
  5. Sort? sort,
})

Searches across all agreements that a proposer or an acceptor has in AWS Marketplace. The search returns a list of agreements with basic agreement information.

The following filter combinations are supported when the PartyType is Proposer:

  • AgreementType
  • AgreementType + EndTime
  • AgreementType + ResourceType
  • AgreementType + ResourceType + EndTime
  • AgreementType + ResourceType + Status
  • AgreementType + ResourceType + Status + EndTime
  • AgreementType + ResourceIdentifier
  • AgreementType + ResourceIdentifier + EndTime
  • AgreementType + ResourceIdentifier + Status
  • AgreementType + ResourceIdentifier + Status + EndTime
  • AgreementType + AcceptorAccountId
  • AgreementType + AcceptorAccountId + EndTime
  • AgreementType + AcceptorAccountId + Status
  • AgreementType + AcceptorAccountId + Status + EndTime
  • AgreementType + AcceptorAccountId + OfferId
  • AgreementType + AcceptorAccountId + OfferId + Status
  • AgreementType + AcceptorAccountId + OfferId + EndTime
  • AgreementType + AcceptorAccountId + OfferId + Status + EndTime
  • AgreementType + AcceptorAccountId + ResourceIdentifier
  • AgreementType + AcceptorAccountId + ResourceIdentifier + Status
  • AgreementType + AcceptorAccountId + ResourceIdentifier + EndTime
  • AgreementType + AcceptorAccountId + ResourceIdentifier + Status + EndTime
  • AgreementType + AcceptorAccountId + ResourceType
  • AgreementType + AcceptorAccountId + ResourceType + EndTime
  • AgreementType + AcceptorAccountId + ResourceType + Status
  • AgreementType + AcceptorAccountId + ResourceType + Status + EndTime
  • AgreementType + Status
  • AgreementType + Status + EndTime
  • AgreementType + OfferId
  • AgreementType + OfferId + EndTime
  • AgreementType + OfferId + Status
  • AgreementType + OfferId + Status + EndTime
  • AgreementType + OfferSetId
  • AgreementType + OfferSetId + EndTime
  • AgreementType + OfferSetId + Status
  • AgreementType + OfferSetId + Status + EndTime
The following filter combinations are supported when the PartyType is Acceptor:
  • AgreementType
  • AgreementType + Status
  • AgreementType + EndTime
  • AgreementType + Status + EndTime
  • AgreementType + ResourceIdentifier
  • AgreementType + ResourceIdentifier + EndTime
  • AgreementType + ResourceIdentifier + Status
  • AgreementType + ResourceIdentifier + Status + EndTime
  • AgreementType + ResourceType
  • AgreementType + ResourceType + EndTime
  • AgreementType + OfferId
  • AgreementType + OfferId + EndTime
  • AgreementType + OfferId + Status
  • AgreementType + OfferId + Status + EndTime
  • AgreementType + OfferSetId
  • AgreementType + OfferSetId + EndTime
  • AgreementType + OfferSetId + Status
  • AgreementType + OfferSetId + Status + EndTime

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

Parameter catalog : The catalog in which the agreement was created.

Parameter filters : The filter name and value pair used to return a specific list of results.

The following filters are supported:

  • ResourceIdentifier – The unique identifier of the resource.
  • ResourceType – Type of the resource, which is the product (AmiProduct, ContainerProduct, SaaSProduct, ProfessionalServicesProduct, or MachineLearningProduct).
  • PartyType – The party type of the caller. Use Proposer or Acceptor.
  • AcceptorAccountId – The AWS account ID of the party accepting the agreement terms.
  • OfferId – The unique identifier of the offer in which the terms are registered in the agreement token.
  • Status – The current status of the agreement. Values include ACTIVE, ARCHIVED, CANCELLED, EXPIRED, RENEWED, REPLACED, and TERMINATED.
  • BeforeEndTime – A date used to filter agreements with a date before the endTime of an agreement.
  • AfterEndTime – A date used to filter agreements with a date after the endTime of an agreement.
  • AgreementType – The type of agreement. Supported value includes PurchaseAgreement.
  • OfferSetId – A unique identifier for the offer set containing this offer. All agreements created from offers in this set include this identifier as context.

Parameter maxResults : The maximum number of agreements to return in the response.

Parameter nextToken : A token to specify where to start pagination.

Parameter sort : An object that contains the SortBy and SortOrder attributes. Only EndTime is supported for SearchAgreements. The default sort is EndTime descending.

Implementation

Future<SearchAgreementsOutput> searchAgreements({
  String? catalog,
  List<Filter>? filters,
  int? maxResults,
  String? nextToken,
  Sort? sort,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    50,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'AWSMPCommerceService_v20200301.SearchAgreements'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (catalog != null) 'catalog': catalog,
      if (filters != null) 'filters': filters,
      if (maxResults != null) 'maxResults': maxResults,
      if (nextToken != null) 'nextToken': nextToken,
      if (sort != null) 'sort': sort,
    },
  );

  return SearchAgreementsOutput.fromJson(jsonResponse.body);
}