createPartnership method

Future<CreatePartnershipResponse> createPartnership({
  1. required List<String> capabilities,
  2. required String email,
  3. required String name,
  4. required String profileId,
  5. CapabilityOptions? capabilityOptions,
  6. String? clientToken,
  7. String? phone,
  8. List<Tag>? tags,
})

Creates a partnership between a customer and a trading partner, based on the supplied parameters. A partnership represents the connection between you and your trading partner. It ties together a profile and one or more trading capabilities.

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

Parameter capabilities : Specifies a list of the capabilities associated with this partnership.

Parameter email : Specifies the email address associated with this trading partner.

Parameter name : Specifies a descriptive name for the partnership.

Parameter profileId : Specifies the unique, system-generated identifier for the profile connected to this partnership.

Parameter capabilityOptions : Specify the structure that contains the details for the associated capabilities.

Parameter clientToken : Reserved for future use.

Parameter phone : Specifies the phone number associated with the partnership.

Parameter tags : Specifies the key-value pairs assigned to ARNs that you can use to group and search for resources by type. You can attach this metadata to resources (capabilities, partnerships, and so on) for any purpose.

Implementation

Future<CreatePartnershipResponse> createPartnership({
  required List<String> capabilities,
  required String email,
  required String name,
  required String profileId,
  CapabilityOptions? capabilityOptions,
  String? clientToken,
  String? phone,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'B2BI.CreatePartnership'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'capabilities': capabilities,
      'email': email,
      'name': name,
      'profileId': profileId,
      if (capabilityOptions != null) 'capabilityOptions': capabilityOptions,
      'clientToken': clientToken ?? _s.generateIdempotencyToken(),
      if (phone != null) 'phone': phone,
      if (tags != null) 'tags': tags,
    },
  );

  return CreatePartnershipResponse.fromJson(jsonResponse.body);
}