trycourier 6.4.3 → 6.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,561 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ # Any Elemental node except a channel block. Channel elements are only valid as
6
+ # top-level elements, so the `elements` nested inside one can never be another
7
+ # channel. Keeping this union channel-free also keeps the schema acyclic; a
8
+ # recursive `$ref` here breaks the generated Python models.
9
+ module ElementalNodeNonChannel
10
+ extend Courier::Internal::Type::Union
11
+
12
+ Variants =
13
+ T.type_alias do
14
+ T.any(
15
+ Courier::ElementalNodeNonChannel::UnionMember0,
16
+ Courier::ElementalNodeNonChannel::UnionMember1,
17
+ Courier::ElementalNodeNonChannel::UnionMember2,
18
+ Courier::ElementalNodeNonChannel::UnionMember3,
19
+ Courier::ElementalNodeNonChannel::UnionMember4,
20
+ Courier::ElementalNodeNonChannel::UnionMember5,
21
+ Courier::ElementalNodeNonChannel::UnionMember6
22
+ )
23
+ end
24
+
25
+ class UnionMember0 < Courier::Models::ElementalTextNode
26
+ OrHash =
27
+ T.type_alias do
28
+ T.any(
29
+ Courier::ElementalNodeNonChannel::UnionMember0,
30
+ Courier::Internal::AnyHash
31
+ )
32
+ end
33
+
34
+ sig do
35
+ returns(
36
+ T.nilable(
37
+ Courier::ElementalNodeNonChannel::UnionMember0::Type::OrSymbol
38
+ )
39
+ )
40
+ end
41
+ attr_reader :type
42
+
43
+ sig do
44
+ params(
45
+ type: Courier::ElementalNodeNonChannel::UnionMember0::Type::OrSymbol
46
+ ).void
47
+ end
48
+ attr_writer :type
49
+
50
+ # Represents a body of text to be rendered inside of the notification.
51
+ sig do
52
+ params(
53
+ type: Courier::ElementalNodeNonChannel::UnionMember0::Type::OrSymbol
54
+ ).returns(T.attached_class)
55
+ end
56
+ def self.new(type: nil)
57
+ end
58
+
59
+ sig do
60
+ override.returns(
61
+ {
62
+ type:
63
+ Courier::ElementalNodeNonChannel::UnionMember0::Type::OrSymbol
64
+ }
65
+ )
66
+ end
67
+ def to_hash
68
+ end
69
+
70
+ module Type
71
+ extend Courier::Internal::Type::Enum
72
+
73
+ TaggedSymbol =
74
+ T.type_alias do
75
+ T.all(
76
+ Symbol,
77
+ Courier::ElementalNodeNonChannel::UnionMember0::Type
78
+ )
79
+ end
80
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
81
+
82
+ TEXT =
83
+ T.let(
84
+ :text,
85
+ Courier::ElementalNodeNonChannel::UnionMember0::Type::TaggedSymbol
86
+ )
87
+
88
+ sig do
89
+ override.returns(
90
+ T::Array[
91
+ Courier::ElementalNodeNonChannel::UnionMember0::Type::TaggedSymbol
92
+ ]
93
+ )
94
+ end
95
+ def self.values
96
+ end
97
+ end
98
+ end
99
+
100
+ class UnionMember1 < Courier::Models::ElementalMetaNode
101
+ OrHash =
102
+ T.type_alias do
103
+ T.any(
104
+ Courier::ElementalNodeNonChannel::UnionMember1,
105
+ Courier::Internal::AnyHash
106
+ )
107
+ end
108
+
109
+ sig do
110
+ returns(
111
+ T.nilable(
112
+ Courier::ElementalNodeNonChannel::UnionMember1::Type::OrSymbol
113
+ )
114
+ )
115
+ end
116
+ attr_reader :type
117
+
118
+ sig do
119
+ params(
120
+ type: Courier::ElementalNodeNonChannel::UnionMember1::Type::OrSymbol
121
+ ).void
122
+ end
123
+ attr_writer :type
124
+
125
+ # The meta element contains information describing the notification that may be
126
+ # used by a particular channel or provider. One important field is the title field
127
+ # which will be used as the title for channels that support it.
128
+ sig do
129
+ params(
130
+ type: Courier::ElementalNodeNonChannel::UnionMember1::Type::OrSymbol
131
+ ).returns(T.attached_class)
132
+ end
133
+ def self.new(type: nil)
134
+ end
135
+
136
+ sig do
137
+ override.returns(
138
+ {
139
+ type:
140
+ Courier::ElementalNodeNonChannel::UnionMember1::Type::OrSymbol
141
+ }
142
+ )
143
+ end
144
+ def to_hash
145
+ end
146
+
147
+ module Type
148
+ extend Courier::Internal::Type::Enum
149
+
150
+ TaggedSymbol =
151
+ T.type_alias do
152
+ T.all(
153
+ Symbol,
154
+ Courier::ElementalNodeNonChannel::UnionMember1::Type
155
+ )
156
+ end
157
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
158
+
159
+ META =
160
+ T.let(
161
+ :meta,
162
+ Courier::ElementalNodeNonChannel::UnionMember1::Type::TaggedSymbol
163
+ )
164
+
165
+ sig do
166
+ override.returns(
167
+ T::Array[
168
+ Courier::ElementalNodeNonChannel::UnionMember1::Type::TaggedSymbol
169
+ ]
170
+ )
171
+ end
172
+ def self.values
173
+ end
174
+ end
175
+ end
176
+
177
+ class UnionMember2 < Courier::Models::ElementalImageNode
178
+ OrHash =
179
+ T.type_alias do
180
+ T.any(
181
+ Courier::ElementalNodeNonChannel::UnionMember2,
182
+ Courier::Internal::AnyHash
183
+ )
184
+ end
185
+
186
+ sig do
187
+ returns(
188
+ T.nilable(
189
+ Courier::ElementalNodeNonChannel::UnionMember2::Type::OrSymbol
190
+ )
191
+ )
192
+ end
193
+ attr_reader :type
194
+
195
+ sig do
196
+ params(
197
+ type: Courier::ElementalNodeNonChannel::UnionMember2::Type::OrSymbol
198
+ ).void
199
+ end
200
+ attr_writer :type
201
+
202
+ # Used to embed an image into the notification.
203
+ sig do
204
+ params(
205
+ type: Courier::ElementalNodeNonChannel::UnionMember2::Type::OrSymbol
206
+ ).returns(T.attached_class)
207
+ end
208
+ def self.new(type: nil)
209
+ end
210
+
211
+ sig do
212
+ override.returns(
213
+ {
214
+ type:
215
+ Courier::ElementalNodeNonChannel::UnionMember2::Type::OrSymbol
216
+ }
217
+ )
218
+ end
219
+ def to_hash
220
+ end
221
+
222
+ module Type
223
+ extend Courier::Internal::Type::Enum
224
+
225
+ TaggedSymbol =
226
+ T.type_alias do
227
+ T.all(
228
+ Symbol,
229
+ Courier::ElementalNodeNonChannel::UnionMember2::Type
230
+ )
231
+ end
232
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
233
+
234
+ IMAGE =
235
+ T.let(
236
+ :image,
237
+ Courier::ElementalNodeNonChannel::UnionMember2::Type::TaggedSymbol
238
+ )
239
+
240
+ sig do
241
+ override.returns(
242
+ T::Array[
243
+ Courier::ElementalNodeNonChannel::UnionMember2::Type::TaggedSymbol
244
+ ]
245
+ )
246
+ end
247
+ def self.values
248
+ end
249
+ end
250
+ end
251
+
252
+ class UnionMember3 < Courier::Models::ElementalActionNode
253
+ OrHash =
254
+ T.type_alias do
255
+ T.any(
256
+ Courier::ElementalNodeNonChannel::UnionMember3,
257
+ Courier::Internal::AnyHash
258
+ )
259
+ end
260
+
261
+ sig do
262
+ returns(
263
+ T.nilable(
264
+ Courier::ElementalNodeNonChannel::UnionMember3::Type::OrSymbol
265
+ )
266
+ )
267
+ end
268
+ attr_reader :type
269
+
270
+ sig do
271
+ params(
272
+ type: Courier::ElementalNodeNonChannel::UnionMember3::Type::OrSymbol
273
+ ).void
274
+ end
275
+ attr_writer :type
276
+
277
+ # Allows the user to execute an action. Can be a button or a link.
278
+ sig do
279
+ params(
280
+ type: Courier::ElementalNodeNonChannel::UnionMember3::Type::OrSymbol
281
+ ).returns(T.attached_class)
282
+ end
283
+ def self.new(type: nil)
284
+ end
285
+
286
+ sig do
287
+ override.returns(
288
+ {
289
+ type:
290
+ Courier::ElementalNodeNonChannel::UnionMember3::Type::OrSymbol
291
+ }
292
+ )
293
+ end
294
+ def to_hash
295
+ end
296
+
297
+ module Type
298
+ extend Courier::Internal::Type::Enum
299
+
300
+ TaggedSymbol =
301
+ T.type_alias do
302
+ T.all(
303
+ Symbol,
304
+ Courier::ElementalNodeNonChannel::UnionMember3::Type
305
+ )
306
+ end
307
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
308
+
309
+ ACTION =
310
+ T.let(
311
+ :action,
312
+ Courier::ElementalNodeNonChannel::UnionMember3::Type::TaggedSymbol
313
+ )
314
+
315
+ sig do
316
+ override.returns(
317
+ T::Array[
318
+ Courier::ElementalNodeNonChannel::UnionMember3::Type::TaggedSymbol
319
+ ]
320
+ )
321
+ end
322
+ def self.values
323
+ end
324
+ end
325
+ end
326
+
327
+ class UnionMember4 < Courier::Models::ElementalDividerNode
328
+ OrHash =
329
+ T.type_alias do
330
+ T.any(
331
+ Courier::ElementalNodeNonChannel::UnionMember4,
332
+ Courier::Internal::AnyHash
333
+ )
334
+ end
335
+
336
+ sig do
337
+ returns(
338
+ T.nilable(
339
+ Courier::ElementalNodeNonChannel::UnionMember4::Type::OrSymbol
340
+ )
341
+ )
342
+ end
343
+ attr_reader :type
344
+
345
+ sig do
346
+ params(
347
+ type: Courier::ElementalNodeNonChannel::UnionMember4::Type::OrSymbol
348
+ ).void
349
+ end
350
+ attr_writer :type
351
+
352
+ # Renders a dividing line between elements.
353
+ sig do
354
+ params(
355
+ type: Courier::ElementalNodeNonChannel::UnionMember4::Type::OrSymbol
356
+ ).returns(T.attached_class)
357
+ end
358
+ def self.new(type: nil)
359
+ end
360
+
361
+ sig do
362
+ override.returns(
363
+ {
364
+ type:
365
+ Courier::ElementalNodeNonChannel::UnionMember4::Type::OrSymbol
366
+ }
367
+ )
368
+ end
369
+ def to_hash
370
+ end
371
+
372
+ module Type
373
+ extend Courier::Internal::Type::Enum
374
+
375
+ TaggedSymbol =
376
+ T.type_alias do
377
+ T.all(
378
+ Symbol,
379
+ Courier::ElementalNodeNonChannel::UnionMember4::Type
380
+ )
381
+ end
382
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
383
+
384
+ DIVIDER =
385
+ T.let(
386
+ :divider,
387
+ Courier::ElementalNodeNonChannel::UnionMember4::Type::TaggedSymbol
388
+ )
389
+
390
+ sig do
391
+ override.returns(
392
+ T::Array[
393
+ Courier::ElementalNodeNonChannel::UnionMember4::Type::TaggedSymbol
394
+ ]
395
+ )
396
+ end
397
+ def self.values
398
+ end
399
+ end
400
+ end
401
+
402
+ class UnionMember5 < Courier::Models::ElementalQuoteNode
403
+ OrHash =
404
+ T.type_alias do
405
+ T.any(
406
+ Courier::ElementalNodeNonChannel::UnionMember5,
407
+ Courier::Internal::AnyHash
408
+ )
409
+ end
410
+
411
+ sig do
412
+ returns(
413
+ T.nilable(
414
+ Courier::ElementalNodeNonChannel::UnionMember5::Type::OrSymbol
415
+ )
416
+ )
417
+ end
418
+ attr_reader :type
419
+
420
+ sig do
421
+ params(
422
+ type: Courier::ElementalNodeNonChannel::UnionMember5::Type::OrSymbol
423
+ ).void
424
+ end
425
+ attr_writer :type
426
+
427
+ # Renders a quote block.
428
+ sig do
429
+ params(
430
+ type: Courier::ElementalNodeNonChannel::UnionMember5::Type::OrSymbol
431
+ ).returns(T.attached_class)
432
+ end
433
+ def self.new(type: nil)
434
+ end
435
+
436
+ sig do
437
+ override.returns(
438
+ {
439
+ type:
440
+ Courier::ElementalNodeNonChannel::UnionMember5::Type::OrSymbol
441
+ }
442
+ )
443
+ end
444
+ def to_hash
445
+ end
446
+
447
+ module Type
448
+ extend Courier::Internal::Type::Enum
449
+
450
+ TaggedSymbol =
451
+ T.type_alias do
452
+ T.all(
453
+ Symbol,
454
+ Courier::ElementalNodeNonChannel::UnionMember5::Type
455
+ )
456
+ end
457
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
458
+
459
+ QUOTE =
460
+ T.let(
461
+ :quote,
462
+ Courier::ElementalNodeNonChannel::UnionMember5::Type::TaggedSymbol
463
+ )
464
+
465
+ sig do
466
+ override.returns(
467
+ T::Array[
468
+ Courier::ElementalNodeNonChannel::UnionMember5::Type::TaggedSymbol
469
+ ]
470
+ )
471
+ end
472
+ def self.values
473
+ end
474
+ end
475
+ end
476
+
477
+ class UnionMember6 < Courier::Models::ElementalHTMLNode
478
+ OrHash =
479
+ T.type_alias do
480
+ T.any(
481
+ Courier::ElementalNodeNonChannel::UnionMember6,
482
+ Courier::Internal::AnyHash
483
+ )
484
+ end
485
+
486
+ sig do
487
+ returns(
488
+ T.nilable(
489
+ Courier::ElementalNodeNonChannel::UnionMember6::Type::OrSymbol
490
+ )
491
+ )
492
+ end
493
+ attr_reader :type
494
+
495
+ sig do
496
+ params(
497
+ type: Courier::ElementalNodeNonChannel::UnionMember6::Type::OrSymbol
498
+ ).void
499
+ end
500
+ attr_writer :type
501
+
502
+ # Raw HTML string inside an Elemental document. When rendering a message, this
503
+ # node is turned into output only for the email channel; for other channels it
504
+ # produces no blocks.
505
+ sig do
506
+ params(
507
+ type: Courier::ElementalNodeNonChannel::UnionMember6::Type::OrSymbol
508
+ ).returns(T.attached_class)
509
+ end
510
+ def self.new(type: nil)
511
+ end
512
+
513
+ sig do
514
+ override.returns(
515
+ {
516
+ type:
517
+ Courier::ElementalNodeNonChannel::UnionMember6::Type::OrSymbol
518
+ }
519
+ )
520
+ end
521
+ def to_hash
522
+ end
523
+
524
+ module Type
525
+ extend Courier::Internal::Type::Enum
526
+
527
+ TaggedSymbol =
528
+ T.type_alias do
529
+ T.all(
530
+ Symbol,
531
+ Courier::ElementalNodeNonChannel::UnionMember6::Type
532
+ )
533
+ end
534
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
535
+
536
+ HTML =
537
+ T.let(
538
+ :html,
539
+ Courier::ElementalNodeNonChannel::UnionMember6::Type::TaggedSymbol
540
+ )
541
+
542
+ sig do
543
+ override.returns(
544
+ T::Array[
545
+ Courier::ElementalNodeNonChannel::UnionMember6::Type::TaggedSymbol
546
+ ]
547
+ )
548
+ end
549
+ def self.values
550
+ end
551
+ end
552
+ end
553
+
554
+ sig do
555
+ override.returns(T::Array[Courier::ElementalNodeNonChannel::Variants])
556
+ end
557
+ def self.variants
558
+ end
559
+ end
560
+ end
561
+ end
@@ -39,9 +39,12 @@ module Courier
39
39
  end
40
40
  attr_writer :state
41
41
 
42
- # Request body for replacing a notification template. Same shape as create. All
43
- # fields required (PUT = full replacement), except `alias`, whose omission means
44
- # "leave the existing aliases alone".
42
+ # Request body for replacing a notification template. All fields are required,
43
+ # since `PUT` is a full replacement, except `alias`, whose omission leaves the
44
+ # existing aliases in place. Unlike `NotificationTemplateCreateRequest`,
45
+ # `notification.content` is not required to place its elements inside a channel
46
+ # block: the requirement applies to creation only, so templates already stored
47
+ # without one stay editable.
45
48
  sig do
46
49
  params(
47
50
  notification: Courier::NotificationTemplateWritePayload::OrHash,
@@ -192,6 +192,8 @@ module Courier
192
192
 
193
193
  ElementalNode = Courier::Models::ElementalNode
194
194
 
195
+ ElementalNodeNonChannel = Courier::Models::ElementalNodeNonChannel
196
+
195
197
  ElementalQuoteNode = Courier::Models::ElementalQuoteNode
196
198
 
197
199
  ElementalQuoteNodeWithType = Courier::Models::ElementalQuoteNodeWithType
@@ -8,6 +8,13 @@ module Courier
8
8
  class Templates
9
9
  # Create a notification template scoped to this journey. Defaults to `DRAFT`
10
10
  # state; pass `state: "PUBLISHED"` to publish on create.
11
+ #
12
+ # The content tree must contain exactly one channel block whose `channel` matches
13
+ # the `channel` on the request — a journey-scoped template carries a single
14
+ # channel. Top-level elements, or a block for a different channel, return `400`.
15
+ # The template designer renders only the channel block matching the tab it draws,
16
+ # so content stored without one cannot be opened. An empty `elements` array is
17
+ # accepted.
11
18
  sig do
12
19
  params(
13
20
  template_id: String,
@@ -12,6 +12,16 @@ module Courier
12
12
 
13
13
  # Create a notification template. Requires all fields in the notification object.
14
14
  # Templates are created in draft state by default.
15
+ #
16
+ # Content must place its elements inside a channel block —
17
+ # `{ "type": "channel", "channel": "email", "elements": [...] }` — or the request
18
+ # returns `400`. The template designer renders only the channel block matching the
19
+ # tab it draws, so content stored without one cannot be opened. An empty
20
+ # `elements` array is accepted, and the requirement applies to creation only:
21
+ # `PUT /notifications/{id}` still accepts unwrapped content. Note this endpoint
22
+ # takes versioned content only — the `{ title, body }` shorthand accepted by
23
+ # `/send` is rejected here with an `invalid_request_error` on
24
+ # `notification.content.version`.
15
25
  sig do
16
26
  params(
17
27
  notification: Courier::NotificationTemplateWritePayload::OrHash,
@@ -92,6 +92,16 @@ module Courier
92
92
 
93
93
  # Creates or updates a notification template scoped to one tenant, letting a
94
94
  # tenant override the content the workspace template would send.
95
+ #
96
+ # This is an upsert: it creates when the tenant has no template under
97
+ # `template_id`, and updates when it does. On the create half, content must place
98
+ # its elements inside a channel block —
99
+ # `{ "type": "channel", "channel": "email", "elements": [...] }` — or the request
100
+ # returns `400`. The template designer renders only the channel block matching the
101
+ # tab it draws, so content stored without one cannot be opened. An empty
102
+ # `elements` array is accepted, as is the `{ title, body }` shorthand, which has
103
+ # no elements to wrap. Updates are not checked, so tenant templates already stored
104
+ # without a wrapper stay editable.
95
105
  sig do
96
106
  params(
97
107
  template_id: String,
@@ -3,6 +3,7 @@ module Courier
3
3
  type elemental_channel_node =
4
4
  {
5
5
  channel: String,
6
+ elements: ::Array[Courier::Models::elemental_node_non_channel]?,
6
7
  font_size: String?,
7
8
  line_height: String?,
8
9
  padding: String?,
@@ -14,6 +15,12 @@ module Courier
14
15
 
15
16
  def channel=: (String _) -> String
16
17
 
18
+ def elements: -> ::Array[Courier::Models::elemental_node_non_channel]?
19
+
20
+ def elements=: (
21
+ ::Array[Courier::Models::elemental_node_non_channel]? _
22
+ ) -> ::Array[Courier::Models::elemental_node_non_channel]?
23
+
17
24
  def font_size: -> String?
18
25
 
19
26
  def font_size=: (String? _) -> String?
@@ -32,6 +39,7 @@ module Courier
32
39
 
33
40
  def initialize: (
34
41
  ?channel: String,
42
+ ?elements: ::Array[Courier::Models::elemental_node_non_channel]?,
35
43
  ?font_size: String?,
36
44
  ?line_height: String?,
37
45
  ?padding: String?,
@@ -40,6 +48,7 @@ module Courier
40
48
 
41
49
  def to_hash: -> {
42
50
  channel: String,
51
+ elements: ::Array[Courier::Models::elemental_node_non_channel]?,
43
52
  font_size: String?,
44
53
  line_height: String?,
45
54
  padding: String?,