startOpportunityFromEngagementTask method

Future<StartOpportunityFromEngagementTaskResponse> startOpportunityFromEngagementTask({
  1. required String catalog,
  2. required String contextIdentifier,
  3. required String identifier,
  4. String? clientToken,
  5. List<Tag>? tags,
})

This action creates an opportunity from an existing engagement context. The task is asynchronous and orchestrates the process of converting engagement contextual information into a structured opportunity record within the partner's account.

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

Parameter catalog : Specifies the catalog in which the opportunity creation task is executed. Acceptable values include AWS for production and Sandbox for testing environments.

Parameter contextIdentifier : The unique identifier of the engagement context from which to create the opportunity. This specifies the specific contextual information within the engagement that will be used for opportunity creation.

Parameter identifier : The unique identifier of the engagement from which the opportunity creation task is to be initiated. This helps ensure that the task is applied to the correct engagement.

Parameter clientToken : A unique token provided by the client to help ensure the idempotency of the request. It helps prevent the same task from being performed multiple times.

Parameter tags : A map of the key-value pairs of the tag or tags to assign.

Implementation

Future<StartOpportunityFromEngagementTaskResponse>
    startOpportunityFromEngagementTask({
  required String catalog,
  required String contextIdentifier,
  required String identifier,
  String? clientToken,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target':
        'AWSPartnerCentralSelling.StartOpportunityFromEngagementTask'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Catalog': catalog,
      'ContextIdentifier': contextIdentifier,
      'Identifier': identifier,
      'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
      if (tags != null) 'Tags': tags,
    },
  );

  return StartOpportunityFromEngagementTaskResponse.fromJson(
      jsonResponse.body);
}