listOpportunities method
- required String catalog,
- CreatedDateFilter? createdDate,
- List<
String> ? customerCompanyName, - List<
String> ? identifier, - LastModifiedDate? lastModifiedDate,
- List<
ReviewStatus> ? lifeCycleReviewStatus, - List<
Stage> ? lifeCycleStage, - int? maxResults,
- String? nextToken,
- OpportunitySort? sort,
- TargetCloseDateFilter? targetCloseDate,
This request accepts a list of filters that retrieve opportunity subsets
as well as sort options. This feature is available to partners from Partner Central using
the ListOpportunities API action.
To synchronize your system with Amazon Web Services, list only the
opportunities that were newly created or updated. We recommend you rely on
events emitted by the service into your Amazon Web Services account’s
Amazon EventBridge default event bus. You can also use the
ListOpportunities action.
We recommend the following approach:
-
Find the latest
LastModifiedDatethat you stored, and only use the values that came from Amazon Web Services. Don’t use values generated by your system. -
When you send a
ListOpportunitiesrequest, submit the date in ISO 8601 format in theAfterLastModifiedDatefilter. -
Amazon Web Services only returns opportunities created or updated on or
after that date and time. Use
NextTokento iterate over all pages.
May throw AccessDeniedException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ThrottlingException.
May throw ValidationException.
Parameter catalog :
Specifies the catalog associated with the request. This field takes a
string value from a predefined list: AWS or
Sandbox. The catalog determines which environment the
opportunities are listed in. Use AWS for listing real
opportunities in the Amazon Web Services catalog, and Sandbox
for testing in secure, isolated environments.
Parameter createdDate :
Filter opportunities by creation date criteria.
Parameter customerCompanyName :
Filters the opportunities based on the customer's company name. This
allows partners to search for opportunities associated with a specific
customer by matching the provided company name string.
Parameter identifier :
Filters the opportunities based on the opportunity identifier. This allows
partners to retrieve specific opportunities by providing their unique
identifiers, ensuring precise results.
Parameter lastModifiedDate :
Filters the opportunities based on their last modified date. This filter
helps retrieve opportunities that were updated after the specified date,
allowing partners to track recent changes or updates.
Parameter lifeCycleReviewStatus :
Filters the opportunities based on their current lifecycle approval
status. Use this filter to retrieve opportunities with statuses such as
Pending Submission, In Review, Action
Required, or Approved.
Parameter lifeCycleStage :
Filters the opportunities based on their lifecycle stage. This filter
allows partners to retrieve opportunities at various stages in the sales
cycle, such as Qualified, Technical Validation,
Business Validation, or Closed Won.
Parameter maxResults :
Specifies the maximum number of results to return in a single call. This
limits the number of opportunities returned in the response to avoid
providing too many results at once.
Default: 20
Parameter nextToken :
A pagination token used to retrieve the next set of results in subsequent
calls. This token is included in the response only if there are additional
result pages available.
Parameter sort :
An object that specifies how the response is sorted. The default
Sort.SortBy value is LastModifiedDate.
Parameter targetCloseDate :
Filters opportunities based on their target close date. This filter helps
retrieve opportunities with an expected close date before or after a
specified date.
Implementation
Future<ListOpportunitiesResponse> listOpportunities({
required String catalog,
CreatedDateFilter? createdDate,
List<String>? customerCompanyName,
List<String>? identifier,
LastModifiedDate? lastModifiedDate,
List<ReviewStatus>? lifeCycleReviewStatus,
List<Stage>? lifeCycleStage,
int? maxResults,
String? nextToken,
OpportunitySort? sort,
TargetCloseDateFilter? targetCloseDate,
}) async {
_s.validateNumRange(
'maxResults',
maxResults,
1,
100,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target': 'AWSPartnerCentralSelling.ListOpportunities'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'Catalog': catalog,
if (createdDate != null) 'CreatedDate': createdDate,
if (customerCompanyName != null)
'CustomerCompanyName': customerCompanyName,
if (identifier != null) 'Identifier': identifier,
if (lastModifiedDate != null) 'LastModifiedDate': lastModifiedDate,
if (lifeCycleReviewStatus != null)
'LifeCycleReviewStatus':
lifeCycleReviewStatus.map((e) => e.value).toList(),
if (lifeCycleStage != null)
'LifeCycleStage': lifeCycleStage.map((e) => e.value).toList(),
if (maxResults != null) 'MaxResults': maxResults,
if (nextToken != null) 'NextToken': nextToken,
if (sort != null) 'Sort': sort,
if (targetCloseDate != null) 'TargetCloseDate': targetCloseDate,
},
);
return ListOpportunitiesResponse.fromJson(jsonResponse.body);
}