Skip to content

Commit 6017f34

Browse files
author
stlc-bot
committed
feat(api): sync OpenAPI spec from production
Stainless-Generated-From: a8fb219
1 parent 16f8ea4 commit 6017f34

10 files changed

Lines changed: 100 additions & 12 deletions

File tree

‎sent-java-core/src/main/kotlin/dm/sent/models/messages/MessageSendParams.kt‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ import kotlin.jvm.optionals.getOrNull
5151
* release, not at acceptance. Quiet hours are not checked when the request is accepted: if the time
5252
* falls inside a legally protected quiet-hours window for a recipient, that message is moved to the
5353
* next allowed time at release and a second message.scheduled webhook reports the new scheduled_at.
54-
* An account may hold at most 1,000,000 scheduled messages at once (429 LIMIT_001).
54+
* An account may hold at most 1,000,000 scheduled messages at once: a message scheduled past that
55+
* is reported as BLOCKED (LIMIT_001) instead of being held.
5556
*/
5657
class MessageSendParams
5758
private constructor(

‎sent-java-core/src/main/kotlin/dm/sent/models/templates/TemplateCreateParams.kt‎

Lines changed: 80 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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
*/
2929
class 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 {

‎sent-java-core/src/main/kotlin/dm/sent/models/webhooks/MessageEventPayload.kt‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ private constructor(
212212
fun templateName(): Optional<String> = templateName.getOptional("template_name")
213213

214214
/**
215-
* When the message reached MessageStatus, in UTC (yyyy-MM-ddTHH:mm:ssZ).
215+
* When the message reached the status this event reports, in UTC (yyyy-MM-ddTHH:mm:ssZ).
216216
*
217217
* @throws SentInvalidDataException if the JSON field has an unexpected type (e.g. if the server
218218
* responded with an unexpected value).
@@ -613,7 +613,9 @@ private constructor(
613613
this.templateName = templateName
614614
}
615615

616-
/** When the message reached MessageStatus, in UTC (yyyy-MM-ddTHH:mm:ssZ). */
616+
/**
617+
* When the message reached the status this event reports, in UTC (yyyy-MM-ddTHH:mm:ssZ).
618+
*/
617619
fun updatedAt(updatedAt: String) = updatedAt(JsonField.of(updatedAt))
618620

619621
/**

‎sent-java-core/src/main/kotlin/dm/sent/services/async/MessageServiceAsync.kt‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ interface MessageServiceAsync {
218218
* request is accepted: if the time falls inside a legally protected quiet-hours window for a
219219
* recipient, that message is moved to the next allowed time at release and a second
220220
* message.scheduled webhook reports the new scheduled_at. An account may hold at most 1,000,000
221-
* scheduled messages at once (429 LIMIT_001).
221+
* scheduled messages at once: a message scheduled past that is reported as BLOCKED (LIMIT_001)
222+
* instead of being held.
222223
*/
223224
fun send(): CompletableFuture<MessageSendResponse> = send(MessageSendParams.none())
224225

‎sent-java-core/src/main/kotlin/dm/sent/services/async/TemplateServiceAsync.kt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ interface TemplateServiceAsync {
4040

4141
/**
4242
* Creates a new message template with header, body, footer, and buttons. The template can be
43-
* submitted for review immediately or saved as draft for later submission. There is no `name`
44-
* field on create — the display name is derived from the template's content and can be changed
43+
* submitted for review immediately or saved as draft for later submission. `name` is optional:
44+
* when omitted or blank, a name is generated from the template's content. It can be changed
4545
* afterwards with `PUT /v3/templates/{id}`.
4646
*/
4747
fun create(): CompletableFuture<ApiResponseTemplate> = create(TemplateCreateParams.none())

‎sent-java-core/src/main/kotlin/dm/sent/services/blocking/MessageService.kt‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ interface MessageService {
209209
* request is accepted: if the time falls inside a legally protected quiet-hours window for a
210210
* recipient, that message is moved to the next allowed time at release and a second
211211
* message.scheduled webhook reports the new scheduled_at. An account may hold at most 1,000,000
212-
* scheduled messages at once (429 LIMIT_001).
212+
* scheduled messages at once: a message scheduled past that is reported as BLOCKED (LIMIT_001)
213+
* instead of being held.
213214
*/
214215
fun send(): MessageSendResponse = send(MessageSendParams.none())
215216

‎sent-java-core/src/main/kotlin/dm/sent/services/blocking/TemplateService.kt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ interface TemplateService {
4040

4141
/**
4242
* Creates a new message template with header, body, footer, and buttons. The template can be
43-
* submitted for review immediately or saved as draft for later submission. There is no `name`
44-
* field on create — the display name is derived from the template's content and can be changed
43+
* submitted for review immediately or saved as draft for later submission. `name` is optional:
44+
* when omitted or blank, a name is generated from the template's content. It can be changed
4545
* afterwards with `PUT /v3/templates/{id}`.
4646
*/
4747
fun create(): ApiResponseTemplate = create(TemplateCreateParams.none())

‎sent-java-core/src/test/kotlin/dm/sent/models/templates/TemplateCreateParamsTest.kt‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ internal class TemplateCreateParamsTest {
278278
.build()
279279
)
280280
.language("en_US")
281+
.name("Welcome Message")
281282
.submitForReview(false)
282283
.build()
283284
}
@@ -553,6 +554,7 @@ internal class TemplateCreateParamsTest {
553554
.build()
554555
)
555556
.language("en_US")
557+
.name("Welcome Message")
556558
.submitForReview(false)
557559
.build()
558560

@@ -847,6 +849,7 @@ internal class TemplateCreateParamsTest {
847849
.build()
848850
)
849851
.language("en_US")
852+
.name("Welcome Message")
850853
.submitForReview(false)
851854
.build()
852855

@@ -1118,6 +1121,7 @@ internal class TemplateCreateParamsTest {
11181121
.build()
11191122
)
11201123
assertThat(body.language()).contains("en_US")
1124+
assertThat(body.name()).contains("Welcome Message")
11211125
assertThat(body.submitForReview()).contains(false)
11221126
}
11231127

‎sent-java-core/src/test/kotlin/dm/sent/services/async/TemplateServiceAsyncTest.kt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ internal class TemplateServiceAsyncTest {
297297
.build()
298298
)
299299
.language("en_US")
300+
.name("Welcome Message")
300301
.submitForReview(false)
301302
.build()
302303
)

‎sent-java-core/src/test/kotlin/dm/sent/services/blocking/TemplateServiceTest.kt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ internal class TemplateServiceTest {
297297
.build()
298298
)
299299
.language("en_US")
300+
.name("Welcome Message")
300301
.submitForReview(false)
301302
.build()
302303
)

0 commit comments

Comments
 (0)