createEmailTemplate method
Future<CreateEmailTemplateResponse>
createEmailTemplate({
- required EmailTemplateRequest emailTemplateRequest,
- required String templateName,
Creates a message template for messages that are sent through the email channel.
May throw MethodNotAllowedException. May throw TooManyRequestsException. May throw BadRequestException. May throw InternalServerErrorException. May throw ForbiddenException.
Parameter templateName
:
The name of the message template. A template name must start with an
alphanumeric character and can contain a maximum of 128 characters. The
characters can be alphanumeric characters, underscores (_), or hyphens
(-). Template names are case sensitive.
Implementation
Future<CreateEmailTemplateResponse> createEmailTemplate({
required EmailTemplateRequest emailTemplateRequest,
required String templateName,
}) async {
ArgumentError.checkNotNull(emailTemplateRequest, 'emailTemplateRequest');
ArgumentError.checkNotNull(templateName, 'templateName');
final response = await _protocol.sendRaw(
payload: emailTemplateRequest,
method: 'POST',
requestUri: '/v1/templates/${Uri.encodeComponent(templateName)}/email',
exceptionFnMap: _exceptionFns,
);
final $json = await _s.jsonFromResponse(response);
return CreateEmailTemplateResponse(
createTemplateMessageBody: CreateTemplateMessageBody.fromJson($json),
);
}