@@ -22,8 +22,8 @@ import kotlin.jvm.optionals.getOrNull
2222
2323/* *
2424 * Creates a new message template with header, body, footer, and buttons. The template can be
25- * submitted for review immediately or saved as draft for later submission. There is no `name` field
26- * on create — the display name is derived from the template's content and can be changed afterwards
25+ * submitted for review immediately or saved as draft for later submission. `name` is optional: when
26+ * omitted or blank, a name is generated from the template's content. It can be changed afterwards
2727 * with `PUT /v3/templates/{id}`.
2828 */
2929class TemplateCreateParams
@@ -91,6 +91,15 @@ private constructor(
9191 */
9292 fun language (): Optional <String > = body.language()
9393
94+ /* *
95+ * Template display name (optional). When omitted or blank, a name is generated from the
96+ * template's content. It can be changed afterwards with PUT /v3/templates/{id}.
97+ *
98+ * @throws SentInvalidDataException if the JSON field has an unexpected type (e.g. if the server
99+ * responded with an unexpected value).
100+ */
101+ fun name (): Optional <String > = body.name()
102+
94103 /* *
95104 * Whether to submit the template for review after creation (default: false)
96105 *
@@ -141,6 +150,13 @@ private constructor(
141150 */
142151 fun _language (): JsonField <String > = body._language ()
143152
153+ /* *
154+ * Returns the raw JSON value of [name].
155+ *
156+ * Unlike [name], this method doesn't throw if the JSON field has an unexpected type.
157+ */
158+ fun _name (): JsonField <String > = body._name ()
159+
144160 /* *
145161 * Returns the raw JSON value of [submitForReview].
146162 *
@@ -306,6 +322,23 @@ private constructor(
306322 */
307323 fun language (language : JsonField <String >) = apply { body.language(language) }
308324
325+ /* *
326+ * Template display name (optional). When omitted or blank, a name is generated from the
327+ * template's content. It can be changed afterwards with PUT /v3/templates/{id}.
328+ */
329+ fun name (name : String? ) = apply { body.name(name) }
330+
331+ /* * Alias for calling [Builder.name] with `name.orElse(null)`. */
332+ fun name (name : Optional <String >) = name(name.getOrNull())
333+
334+ /* *
335+ * Sets [Builder.name] to an arbitrary JSON value.
336+ *
337+ * You should usually call [Builder.name] with a well-typed [String] value instead. This
338+ * method is primarily for setting the field to an undocumented or not yet supported value.
339+ */
340+ fun name (name : JsonField <String >) = apply { body.name(name) }
341+
309342 /* * Whether to submit the template for review after creation (default: false) */
310343 fun submitForReview (submitForReview : Boolean ) = apply {
311344 body.submitForReview(submitForReview)
@@ -477,6 +510,7 @@ private constructor(
477510 private val creationSource: JsonField <String >,
478511 private val definition: JsonField <TemplateDefinition >,
479512 private val language: JsonField <String >,
513+ private val name: JsonField <String >,
480514 private val submitForReview: JsonField <Boolean >,
481515 private val additionalProperties: MutableMap <String , JsonValue >,
482516 ) {
@@ -499,6 +533,7 @@ private constructor(
499533 @JsonProperty(" language" )
500534 @ExcludeMissing
501535 language: JsonField <String > = JsonMissing .of(),
536+ @JsonProperty(" name" ) @ExcludeMissing name: JsonField <String > = JsonMissing .of(),
502537 @JsonProperty(" submit_for_review" )
503538 @ExcludeMissing
504539 submitForReview: JsonField <Boolean > = JsonMissing .of(),
@@ -509,6 +544,7 @@ private constructor(
509544 creationSource,
510545 definition,
511546 language,
547+ name,
512548 submitForReview,
513549 mutableMapOf (),
514550 )
@@ -568,6 +604,15 @@ private constructor(
568604 */
569605 fun language (): Optional <String > = language.getOptional(" language" )
570606
607+ /* *
608+ * Template display name (optional). When omitted or blank, a name is generated from the
609+ * template's content. It can be changed afterwards with PUT /v3/templates/{id}.
610+ *
611+ * @throws SentInvalidDataException if the JSON field has an unexpected type (e.g. if the
612+ * server responded with an unexpected value).
613+ */
614+ fun name (): Optional <String > = name.getOptional(" name" )
615+
571616 /* *
572617 * Whether to submit the template for review after creation (default: false)
573618 *
@@ -626,6 +671,13 @@ private constructor(
626671 */
627672 @JsonProperty(" language" ) @ExcludeMissing fun _language (): JsonField <String > = language
628673
674+ /* *
675+ * Returns the raw JSON value of [name].
676+ *
677+ * Unlike [name], this method doesn't throw if the JSON field has an unexpected type.
678+ */
679+ @JsonProperty(" name" ) @ExcludeMissing fun _name (): JsonField <String > = name
680+
629681 /* *
630682 * Returns the raw JSON value of [submitForReview].
631683 *
@@ -663,6 +715,7 @@ private constructor(
663715 private var creationSource: JsonField <String > = JsonMissing .of()
664716 private var definition: JsonField <TemplateDefinition > = JsonMissing .of()
665717 private var language: JsonField <String > = JsonMissing .of()
718+ private var name: JsonField <String > = JsonMissing .of()
666719 private var submitForReview: JsonField <Boolean > = JsonMissing .of()
667720 private var additionalProperties: MutableMap <String , JsonValue > = mutableMapOf ()
668721
@@ -674,6 +727,7 @@ private constructor(
674727 creationSource = body.creationSource
675728 definition = body.definition
676729 language = body.language
730+ name = body.name
677731 submitForReview = body.submitForReview
678732 additionalProperties = body.additionalProperties.toMutableMap()
679733 }
@@ -780,6 +834,24 @@ private constructor(
780834 */
781835 fun language (language : JsonField <String >) = apply { this .language = language }
782836
837+ /* *
838+ * Template display name (optional). When omitted or blank, a name is generated from the
839+ * template's content. It can be changed afterwards with PUT /v3/templates/{id}.
840+ */
841+ fun name (name : String? ) = name(JsonField .ofNullable(name))
842+
843+ /* * Alias for calling [Builder.name] with `name.orElse(null)`. */
844+ fun name (name : Optional <String >) = name(name.getOrNull())
845+
846+ /* *
847+ * Sets [Builder.name] to an arbitrary JSON value.
848+ *
849+ * You should usually call [Builder.name] with a well-typed [String] value instead. This
850+ * method is primarily for setting the field to an undocumented or not yet supported
851+ * value.
852+ */
853+ fun name (name : JsonField <String >) = apply { this .name = name }
854+
783855 /* * Whether to submit the template for review after creation (default: false) */
784856 fun submitForReview (submitForReview : Boolean ) =
785857 submitForReview(JsonField .of(submitForReview))
@@ -827,6 +899,7 @@ private constructor(
827899 creationSource,
828900 definition,
829901 language,
902+ name,
830903 submitForReview,
831904 additionalProperties.toMutableMap(),
832905 )
@@ -854,6 +927,7 @@ private constructor(
854927 creationSource()
855928 definition().ifPresent { it.validate() }
856929 language()
930+ name()
857931 submitForReview()
858932 validated = true
859933 }
@@ -880,6 +954,7 @@ private constructor(
880954 (if (creationSource.asKnown().isPresent) 1 else 0 ) +
881955 (definition.asKnown().getOrNull()?.validity() ? : 0 ) +
882956 (if (language.asKnown().isPresent) 1 else 0 ) +
957+ (if (name.asKnown().isPresent) 1 else 0 ) +
883958 (if (submitForReview.asKnown().isPresent) 1 else 0 )
884959
885960 override fun equals (other : Any? ): Boolean {
@@ -894,6 +969,7 @@ private constructor(
894969 creationSource == other.creationSource &&
895970 definition == other.definition &&
896971 language == other.language &&
972+ name == other.name &&
897973 submitForReview == other.submitForReview &&
898974 additionalProperties == other.additionalProperties
899975 }
@@ -906,6 +982,7 @@ private constructor(
906982 creationSource,
907983 definition,
908984 language,
985+ name,
909986 submitForReview,
910987 additionalProperties,
911988 )
@@ -914,7 +991,7 @@ private constructor(
914991 override fun hashCode (): Int = hashCode
915992
916993 override fun toString () =
917- " Body{sandbox=$sandbox , autoCreateForSp=$autoCreateForSp , category=$category , creationSource=$creationSource , definition=$definition , language=$language , submitForReview=$submitForReview , additionalProperties=$additionalProperties }"
994+ " Body{sandbox=$sandbox , autoCreateForSp=$autoCreateForSp , category=$category , creationSource=$creationSource , definition=$definition , language=$language , name= $name , submitForReview=$submitForReview , additionalProperties=$additionalProperties }"
918995 }
919996
920997 override fun equals (other : Any? ): Boolean {
0 commit comments