createCampaign method

Future<CreateCampaignResponse> createCampaign({
  1. required String applicationId,
  2. required WriteCampaignRequest writeCampaignRequest,
})

Creates a new campaign for an application or updates the settings of an existing campaign for an application.

May throw BadRequestException. May throw InternalServerErrorException. May throw PayloadTooLargeException. May throw ForbiddenException. May throw NotFoundException. May throw MethodNotAllowedException. May throw TooManyRequestsException.

Parameter applicationId : The unique identifier for the application. This identifier is displayed as the Project ID on the Amazon Pinpoint console.

Implementation

Future<CreateCampaignResponse> createCampaign({
  required String applicationId,
  required WriteCampaignRequest writeCampaignRequest,
}) async {
  ArgumentError.checkNotNull(applicationId, 'applicationId');
  ArgumentError.checkNotNull(writeCampaignRequest, 'writeCampaignRequest');
  final response = await _protocol.sendRaw(
    payload: writeCampaignRequest,
    method: 'POST',
    requestUri: '/v1/apps/${Uri.encodeComponent(applicationId)}/campaigns',
    exceptionFnMap: _exceptionFns,
  );
  final $json = await _s.jsonFromResponse(response);
  return CreateCampaignResponse(
    campaignResponse: CampaignResponse.fromJson($json),
  );
}