@@ -6,8 +6,7 @@ const getSecret = require('../get-secret');
6
6
const { templates } = require ( '../templates' ) ;
7
7
const Boom = require ( '@hapi/boom' ) ;
8
8
const Joi = require ( 'joi' ) ;
9
- const { failAction, validationHelper } = require ( '../tools' ) ;
10
- const { joiLocales } = require ( '../translations' ) ;
9
+ const { failAction } = require ( '../tools' ) ;
11
10
12
11
const { templateSchemas, accountIdSchema } = require ( '../schemas' ) ;
13
12
@@ -77,36 +76,33 @@ async function init(args) {
77
76
} ,
78
77
failAction,
79
78
80
- payload : validationHelper (
81
- joiLocales ,
82
- Joi . object ( {
83
- account : Joi . string ( )
84
- . empty ( '' )
85
- . trim ( )
86
- . allow ( null )
87
- . max ( 256 )
88
- . example ( 'example' )
89
- . description ( 'Account ID. Use `null` for public templates.' )
90
- . required ( ) ,
91
-
92
- name : Joi . string ( ) . max ( 256 ) . example ( 'Transaction receipt' ) . description ( 'Name of the template' ) . label ( 'TemplateName' ) . required ( ) ,
93
- description : Joi . string ( )
94
- . allow ( '' )
95
- . max ( 1024 )
96
- . example ( 'Something about the template' )
97
- . description ( 'Optional description of the template' )
98
- . label ( 'TemplateDescription' ) ,
99
- format : Joi . string ( ) . valid ( 'html' , 'markdown' ) . default ( 'html' ) . description ( 'Markup language for HTML ("html" or "markdown")' ) ,
100
- content : Joi . object ( {
101
- subject : templateSchemas . subject ,
102
- text : templateSchemas . text ,
103
- html : templateSchemas . html ,
104
- previewText : templateSchemas . previewText
105
- } )
106
- . required ( )
107
- . label ( 'CreateTemplateContent' )
108
- } ) . label ( 'CreateTemplate' )
109
- )
79
+ payload : Joi . object ( {
80
+ account : Joi . string ( )
81
+ . empty ( '' )
82
+ . trim ( )
83
+ . allow ( null )
84
+ . max ( 256 )
85
+ . example ( 'example' )
86
+ . description ( 'Account ID. Use `null` for public templates.' )
87
+ . required ( ) ,
88
+
89
+ name : Joi . string ( ) . max ( 256 ) . example ( 'Transaction receipt' ) . description ( 'Name of the template' ) . label ( 'TemplateName' ) . required ( ) ,
90
+ description : Joi . string ( )
91
+ . allow ( '' )
92
+ . max ( 1024 )
93
+ . example ( 'Something about the template' )
94
+ . description ( 'Optional description of the template' )
95
+ . label ( 'TemplateDescription' ) ,
96
+ format : Joi . string ( ) . valid ( 'html' , 'markdown' ) . default ( 'html' ) . description ( 'Markup language for HTML ("html" or "markdown")' ) ,
97
+ content : Joi . object ( {
98
+ subject : templateSchemas . subject ,
99
+ text : templateSchemas . text ,
100
+ html : templateSchemas . html ,
101
+ previewText : templateSchemas . previewText
102
+ } )
103
+ . required ( )
104
+ . label ( 'CreateTemplateContent' )
105
+ } ) . label ( 'CreateTemplate' )
110
106
} ,
111
107
112
108
response : {
@@ -172,25 +168,22 @@ async function init(args) {
172
168
template : Joi . string ( ) . max ( 256 ) . required ( ) . example ( 'example' ) . description ( 'Template ID' )
173
169
} ) . label ( 'GetTemplateRequest' ) ,
174
170
175
- payload : validationHelper (
176
- joiLocales ,
177
- Joi . object ( {
178
- name : Joi . string ( ) . empty ( '' ) . max ( 256 ) . example ( 'Transaction receipt' ) . description ( 'Name of the template' ) . label ( 'TemplateName' ) ,
179
- description : Joi . string ( )
180
- . allow ( '' )
181
- . max ( 1024 )
182
- . example ( 'Something about the template' )
183
- . description ( 'Optional description of the template' )
184
- . label ( 'TemplateDescription' ) ,
185
- format : Joi . string ( ) . empty ( '' ) . valid ( 'html' , 'markdown' ) . default ( 'html' ) . description ( 'Markup language for HTML ("html" or "markdown")' ) ,
186
- content : Joi . object ( {
187
- subject : templateSchemas . subject ,
188
- text : templateSchemas . text ,
189
- html : templateSchemas . html ,
190
- previewText : templateSchemas . previewText
191
- } ) . label ( 'UpdateTemplateContent' )
192
- } ) . label ( 'UpdateTemplate' )
193
- )
171
+ payload : Joi . object ( {
172
+ name : Joi . string ( ) . empty ( '' ) . max ( 256 ) . example ( 'Transaction receipt' ) . description ( 'Name of the template' ) . label ( 'TemplateName' ) ,
173
+ description : Joi . string ( )
174
+ . allow ( '' )
175
+ . max ( 1024 )
176
+ . example ( 'Something about the template' )
177
+ . description ( 'Optional description of the template' )
178
+ . label ( 'TemplateDescription' ) ,
179
+ format : Joi . string ( ) . empty ( '' ) . valid ( 'html' , 'markdown' ) . default ( 'html' ) . description ( 'Markup language for HTML ("html" or "markdown")' ) ,
180
+ content : Joi . object ( {
181
+ subject : templateSchemas . subject ,
182
+ text : templateSchemas . text ,
183
+ html : templateSchemas . html ,
184
+ previewText : templateSchemas . previewText
185
+ } ) . label ( 'UpdateTemplateContent' )
186
+ } ) . label ( 'UpdateTemplate' )
194
187
} ,
195
188
196
189
response : {
0 commit comments