createPushTemplate method
Future<CreatePushTemplateResponse>
createPushTemplate({
- required PushNotificationTemplateRequest pushNotificationTemplateRequest,
- required String templateName,
Creates a message template for messages that are sent through a push notification 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<CreatePushTemplateResponse> createPushTemplate({
required PushNotificationTemplateRequest pushNotificationTemplateRequest,
required String templateName,
}) async {
ArgumentError.checkNotNull(
pushNotificationTemplateRequest, 'pushNotificationTemplateRequest');
ArgumentError.checkNotNull(templateName, 'templateName');
final response = await _protocol.sendRaw(
payload: pushNotificationTemplateRequest,
method: 'POST',
requestUri: '/v1/templates/${Uri.encodeComponent(templateName)}/push',
exceptionFnMap: _exceptionFns,
);
final $json = await _s.jsonFromResponse(response);
return CreatePushTemplateResponse(
createTemplateMessageBody: CreateTemplateMessageBody.fromJson($json),
);
}