createCampaign method

Future<CreateCampaignResponse> createCampaign({
  1. required String connectInstanceId,
  2. required String name,
  3. ChannelSubtypeConfig? channelSubtypeConfig,
  4. CommunicationLimitsConfig? communicationLimitsOverride,
  5. CommunicationTimeConfig? communicationTimeConfig,
  6. String? connectCampaignFlowArn,
  7. EntryLimitsConfig? entryLimitsConfig,
  8. Schedule? schedule,
  9. Source? source,
  10. Map<String, String>? tags,
  11. ExternalCampaignType? type,
})

Creates a campaign for the specified Amazon Connect account. This API is idempotent.

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

Implementation

Future<CreateCampaignResponse> createCampaign({
  required String connectInstanceId,
  required String name,
  ChannelSubtypeConfig? channelSubtypeConfig,
  CommunicationLimitsConfig? communicationLimitsOverride,
  CommunicationTimeConfig? communicationTimeConfig,
  String? connectCampaignFlowArn,
  EntryLimitsConfig? entryLimitsConfig,
  Schedule? schedule,
  Source? source,
  Map<String, String>? tags,
  ExternalCampaignType? type,
}) async {
  final $payload = <String, dynamic>{
    'connectInstanceId': connectInstanceId,
    'name': name,
    if (channelSubtypeConfig != null)
      'channelSubtypeConfig': channelSubtypeConfig,
    if (communicationLimitsOverride != null)
      'communicationLimitsOverride': communicationLimitsOverride,
    if (communicationTimeConfig != null)
      'communicationTimeConfig': communicationTimeConfig,
    if (connectCampaignFlowArn != null)
      'connectCampaignFlowArn': connectCampaignFlowArn,
    if (entryLimitsConfig != null) 'entryLimitsConfig': entryLimitsConfig,
    if (schedule != null) 'schedule': schedule,
    if (source != null) 'source': source,
    if (tags != null) 'tags': tags,
    if (type != null) 'type': type.value,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/v2/campaigns',
    exceptionFnMap: _exceptionFns,
  );
  return CreateCampaignResponse.fromJson(response);
}