createEngagementInvitation method

Future<CreateEngagementInvitationResponse> createEngagementInvitation({
  1. required String catalog,
  2. required String engagementIdentifier,
  3. required Invitation invitation,
  4. String? clientToken,
})

This action creates an invitation from a sender to a single receiver to join an engagement.

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 related to the engagement. Accepted values are AWS and Sandbox, which determine the environment in which the engagement is managed.

Parameter engagementIdentifier : The unique identifier of the Engagement associated with the invitation. This parameter ensures the invitation is created within the correct Engagement context.

Parameter invitation : The Invitation object all information necessary to initiate an engagement invitation to a partner. It contains a personalized message from the sender, the invitation's receiver, and a payload. The Payload can be the OpportunityInvitation, which includes detailed structures for sender contacts, partner responsibilities, customer information, and project details, or LeadInvitation, which includes structures for customer information and interaction details.

Parameter clientToken : Specifies a unique, client-generated UUID to ensure that the request is handled exactly once. This token helps prevent duplicate invitation creations.

Implementation

Future<CreateEngagementInvitationResponse> createEngagementInvitation({
  required String catalog,
  required String engagementIdentifier,
  required Invitation invitation,
  String? clientToken,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'AWSPartnerCentralSelling.CreateEngagementInvitation'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Catalog': catalog,
      'EngagementIdentifier': engagementIdentifier,
      'Invitation': invitation,
      'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
    },
  );

  return CreateEngagementInvitationResponse.fromJson(jsonResponse.body);
}