trycourier 4.10.2 → 4.12.0

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.
Files changed (154) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +30 -0
  3. data/lib/courier/client.rb +15 -1
  4. data/lib/courier/internal/transport/base_client.rb +2 -0
  5. data/lib/courier/models/brand_create_params.rb +7 -7
  6. data/lib/courier/models/create_journey_request.rb +39 -0
  7. data/lib/courier/models/journey_ai_node.rb +77 -0
  8. data/lib/courier/models/journey_api_invoke_trigger_node.rb +73 -0
  9. data/lib/courier/models/journey_archive_params.rb +20 -0
  10. data/lib/courier/models/journey_condition_atom.rb +8 -0
  11. data/lib/courier/models/journey_condition_group.rb +26 -0
  12. data/lib/courier/models/journey_condition_nested_group.rb +24 -0
  13. data/lib/courier/models/journey_conditions_field.rb +37 -0
  14. data/lib/courier/models/journey_create_params.rb +14 -0
  15. data/lib/courier/models/journey_delay_duration_node.rb +71 -0
  16. data/lib/courier/models/journey_delay_until_node.rb +71 -0
  17. data/lib/courier/models/journey_exit_node.rb +33 -0
  18. data/lib/courier/models/journey_fetch_get_delete_node.rb +103 -0
  19. data/lib/courier/models/journey_fetch_post_put_node.rb +110 -0
  20. data/lib/courier/models/journey_list_versions_params.rb +20 -0
  21. data/lib/courier/models/journey_merge_strategy.rb +18 -0
  22. data/lib/courier/models/journey_node.rb +295 -0
  23. data/lib/courier/models/journey_publish_params.rb +20 -0
  24. data/lib/courier/models/journey_publish_request.rb +18 -0
  25. data/lib/courier/models/journey_replace_params.rb +20 -0
  26. data/lib/courier/models/journey_response.rb +82 -0
  27. data/lib/courier/models/journey_retrieve_params.rb +29 -0
  28. data/lib/courier/models/journey_segment_trigger_node.rb +90 -0
  29. data/lib/courier/models/journey_send_node.rb +124 -0
  30. data/lib/courier/models/journey_state.rb +16 -0
  31. data/lib/courier/models/journey_template_create_request.rb +138 -0
  32. data/lib/courier/models/journey_template_get_response.rb +154 -0
  33. data/lib/courier/models/journey_template_list_response.rb +23 -0
  34. data/lib/courier/models/journey_template_publish_request.rb +18 -0
  35. data/lib/courier/models/journey_template_replace_request.rb +126 -0
  36. data/lib/courier/models/journey_template_summary.rb +60 -0
  37. data/lib/courier/models/journey_throttle_dynamic_node.rb +86 -0
  38. data/lib/courier/models/journey_throttle_static_node.rb +80 -0
  39. data/lib/courier/models/journey_version_item.rb +41 -0
  40. data/lib/courier/models/journey_versions_list_response.rb +24 -0
  41. data/lib/courier/models/journeys/template_archive_params.rb +28 -0
  42. data/lib/courier/models/journeys/template_create_params.rb +22 -0
  43. data/lib/courier/models/journeys/template_list_params.rb +39 -0
  44. data/lib/courier/models/journeys/template_list_versions_params.rb +28 -0
  45. data/lib/courier/models/journeys/template_publish_params.rb +28 -0
  46. data/lib/courier/models/journeys/template_replace_params.rb +28 -0
  47. data/lib/courier/models/journeys/template_retrieve_params.rb +28 -0
  48. data/lib/courier/models/tenants/template_delete_params.rb +28 -0
  49. data/lib/courier/models.rb +73 -0
  50. data/lib/courier/resources/brands.rb +4 -3
  51. data/lib/courier/resources/journeys/templates.rb +224 -0
  52. data/lib/courier/resources/journeys.rb +167 -2
  53. data/lib/courier/resources/tenants/templates.rb +32 -0
  54. data/lib/courier/version.rb +1 -1
  55. data/lib/courier.rb +44 -0
  56. data/rbi/courier/models/brand_create_params.rbi +8 -8
  57. data/rbi/courier/models/create_journey_request.rbi +116 -0
  58. data/rbi/courier/models/journey_ai_node.rbi +141 -0
  59. data/rbi/courier/models/journey_api_invoke_trigger_node.rbi +164 -0
  60. data/rbi/courier/models/journey_archive_params.rbi +35 -0
  61. data/rbi/courier/models/journey_condition_atom.rbi +11 -0
  62. data/rbi/courier/models/journey_condition_group.rbi +43 -0
  63. data/rbi/courier/models/journey_condition_nested_group.rbi +51 -0
  64. data/rbi/courier/models/journey_conditions_field.rbi +27 -0
  65. data/rbi/courier/models/journey_create_params.rbi +27 -0
  66. data/rbi/courier/models/journey_delay_duration_node.rbi +146 -0
  67. data/rbi/courier/models/journey_delay_until_node.rbi +139 -0
  68. data/rbi/courier/models/journey_exit_node.rbi +57 -0
  69. data/rbi/courier/models/journey_fetch_get_delete_node.rbi +186 -0
  70. data/rbi/courier/models/journey_fetch_post_put_node.rbi +190 -0
  71. data/rbi/courier/models/journey_list_versions_params.rbi +35 -0
  72. data/rbi/courier/models/journey_merge_strategy.rbi +26 -0
  73. data/rbi/courier/models/journey_node.rbi +542 -0
  74. data/rbi/courier/models/journey_publish_params.rbi +35 -0
  75. data/rbi/courier/models/journey_publish_request.rbi +28 -0
  76. data/rbi/courier/models/journey_replace_params.rbi +35 -0
  77. data/rbi/courier/models/journey_response.rbi +109 -0
  78. data/rbi/courier/models/journey_retrieve_params.rbi +52 -0
  79. data/rbi/courier/models/journey_segment_trigger_node.rbi +200 -0
  80. data/rbi/courier/models/journey_send_node.rbi +254 -0
  81. data/rbi/courier/models/journey_state.rbi +20 -0
  82. data/rbi/courier/models/journey_template_create_request.rbi +381 -0
  83. data/rbi/courier/models/journey_template_get_response.rbi +334 -0
  84. data/rbi/courier/models/journey_template_list_response.rbi +45 -0
  85. data/rbi/courier/models/journey_template_publish_request.rbi +31 -0
  86. data/rbi/courier/models/journey_template_replace_request.rbi +368 -0
  87. data/rbi/courier/models/journey_template_summary.rbi +85 -0
  88. data/rbi/courier/models/journey_throttle_dynamic_node.rbi +162 -0
  89. data/rbi/courier/models/journey_throttle_static_node.rbi +158 -0
  90. data/rbi/courier/models/journey_version_item.rbi +54 -0
  91. data/rbi/courier/models/journey_versions_list_response.rbi +45 -0
  92. data/rbi/courier/models/journeys/template_archive_params.rbi +48 -0
  93. data/rbi/courier/models/journeys/template_create_params.rbi +40 -0
  94. data/rbi/courier/models/journeys/template_list_params.rbi +68 -0
  95. data/rbi/courier/models/journeys/template_list_versions_params.rbi +48 -0
  96. data/rbi/courier/models/journeys/template_publish_params.rbi +48 -0
  97. data/rbi/courier/models/journeys/template_replace_params.rbi +48 -0
  98. data/rbi/courier/models/journeys/template_retrieve_params.rbi +48 -0
  99. data/rbi/courier/models/tenants/template_delete_params.rbi +48 -0
  100. data/rbi/courier/models.rbi +76 -0
  101. data/rbi/courier/resources/brands.rbi +4 -9
  102. data/rbi/courier/resources/journeys/templates.rbi +160 -0
  103. data/rbi/courier/resources/journeys.rbi +158 -3
  104. data/rbi/courier/resources/tenants/templates.rbi +22 -0
  105. data/sig/courier/models/brand_create_params.rbs +5 -5
  106. data/sig/courier/models/create_journey_request.rbs +41 -0
  107. data/sig/courier/models/journey_ai_node.rbs +72 -0
  108. data/sig/courier/models/journey_api_invoke_trigger_node.rbs +68 -0
  109. data/sig/courier/models/journey_archive_params.rbs +23 -0
  110. data/sig/courier/models/journey_condition_atom.rbs +7 -0
  111. data/sig/courier/models/journey_condition_group.rbs +33 -0
  112. data/sig/courier/models/journey_condition_nested_group.rbs +33 -0
  113. data/sig/courier/models/journey_conditions_field.rbs +14 -0
  114. data/sig/courier/models/journey_create_params.rbs +15 -0
  115. data/sig/courier/models/journey_delay_duration_node.rbs +66 -0
  116. data/sig/courier/models/journey_delay_until_node.rbs +66 -0
  117. data/sig/courier/models/journey_exit_node.rbs +34 -0
  118. data/sig/courier/models/journey_fetch_get_delete_node.rbs +93 -0
  119. data/sig/courier/models/journey_fetch_post_put_node.rbs +100 -0
  120. data/sig/courier/models/journey_list_versions_params.rbs +23 -0
  121. data/sig/courier/models/journey_merge_strategy.rbs +16 -0
  122. data/sig/courier/models/journey_node.rbs +247 -0
  123. data/sig/courier/models/journey_publish_params.rbs +25 -0
  124. data/sig/courier/models/journey_publish_request.rbs +15 -0
  125. data/sig/courier/models/journey_replace_params.rbs +25 -0
  126. data/sig/courier/models/journey_response.rbs +65 -0
  127. data/sig/courier/models/journey_retrieve_params.rbs +30 -0
  128. data/sig/courier/models/journey_segment_trigger_node.rbs +85 -0
  129. data/sig/courier/models/journey_send_node.rbs +140 -0
  130. data/sig/courier/models/journey_state.rbs +14 -0
  131. data/sig/courier/models/journey_template_create_request.rbs +148 -0
  132. data/sig/courier/models/journey_template_get_response.rbs +157 -0
  133. data/sig/courier/models/journey_template_list_response.rbs +25 -0
  134. data/sig/courier/models/journey_template_publish_request.rbs +15 -0
  135. data/sig/courier/models/journey_template_replace_request.rbs +136 -0
  136. data/sig/courier/models/journey_template_summary.rbs +59 -0
  137. data/sig/courier/models/journey_throttle_dynamic_node.rbs +76 -0
  138. data/sig/courier/models/journey_throttle_static_node.rbs +72 -0
  139. data/sig/courier/models/journey_version_item.rbs +40 -0
  140. data/sig/courier/models/journey_versions_list_response.rbs +22 -0
  141. data/sig/courier/models/journeys/template_archive_params.rbs +30 -0
  142. data/sig/courier/models/journeys/template_create_params.rbs +27 -0
  143. data/sig/courier/models/journeys/template_list_params.rbs +38 -0
  144. data/sig/courier/models/journeys/template_list_versions_params.rbs +30 -0
  145. data/sig/courier/models/journeys/template_publish_params.rbs +34 -0
  146. data/sig/courier/models/journeys/template_replace_params.rbs +34 -0
  147. data/sig/courier/models/journeys/template_retrieve_params.rbs +30 -0
  148. data/sig/courier/models/tenants/template_delete_params.rbs +30 -0
  149. data/sig/courier/models.rbs +72 -0
  150. data/sig/courier/resources/brands.rbs +1 -1
  151. data/sig/courier/resources/journeys/templates.rbs +58 -0
  152. data/sig/courier/resources/journeys.rbs +41 -0
  153. data/sig/courier/resources/tenants/templates.rbs +6 -0
  154. metadata +134 -2
@@ -0,0 +1,35 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ class JourneyListVersionsParams < Courier::Internal::Type::BaseModel
6
+ extend Courier::Internal::Type::RequestParameters::Converter
7
+ include Courier::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(Courier::JourneyListVersionsParams, Courier::Internal::AnyHash)
12
+ end
13
+
14
+ sig { returns(String) }
15
+ attr_accessor :template_id
16
+
17
+ sig do
18
+ params(
19
+ template_id: String,
20
+ request_options: Courier::RequestOptions::OrHash
21
+ ).returns(T.attached_class)
22
+ end
23
+ def self.new(template_id:, request_options: {})
24
+ end
25
+
26
+ sig do
27
+ override.returns(
28
+ { template_id: String, request_options: Courier::RequestOptions }
29
+ )
30
+ end
31
+ def to_hash
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,26 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ # Strategy for merging a fetch response into the journey run state.
6
+ module JourneyMergeStrategy
7
+ extend Courier::Internal::Type::Enum
8
+
9
+ TaggedSymbol =
10
+ T.type_alias { T.all(Symbol, Courier::JourneyMergeStrategy) }
11
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
12
+
13
+ OVERWRITE = T.let(:overwrite, Courier::JourneyMergeStrategy::TaggedSymbol)
14
+ SOFT_MERGE =
15
+ T.let(:"soft-merge", Courier::JourneyMergeStrategy::TaggedSymbol)
16
+ REPLACE = T.let(:replace, Courier::JourneyMergeStrategy::TaggedSymbol)
17
+ NONE = T.let(:none, Courier::JourneyMergeStrategy::TaggedSymbol)
18
+
19
+ sig do
20
+ override.returns(T::Array[Courier::JourneyMergeStrategy::TaggedSymbol])
21
+ end
22
+ def self.values
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,542 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ # A single node in a journey DAG. Discriminated by `type`, with a secondary
6
+ # discriminator on some variants (`trigger_type` for trigger, `mode` for delay,
7
+ # `method` for fetch, `scope` for throttle).
8
+ module JourneyNode
9
+ extend Courier::Internal::Type::Union
10
+
11
+ Variants =
12
+ T.type_alias do
13
+ T.any(
14
+ Courier::JourneyAPIInvokeTriggerNode,
15
+ Courier::JourneySegmentTriggerNode,
16
+ Courier::JourneySendNode,
17
+ Courier::JourneyDelayDurationNode,
18
+ Courier::JourneyDelayUntilNode,
19
+ Courier::JourneyFetchGetDeleteNode,
20
+ Courier::JourneyFetchPostPutNode,
21
+ Courier::JourneyAINode,
22
+ Courier::JourneyThrottleStaticNode,
23
+ Courier::JourneyThrottleDynamicNode,
24
+ Courier::JourneyNode::JourneyBatchNode,
25
+ Courier::JourneyExitNode,
26
+ Courier::JourneyNode::JourneyBranchNode
27
+ )
28
+ end
29
+
30
+ class JourneyBatchNode < Courier::Internal::Type::BaseModel
31
+ OrHash =
32
+ T.type_alias do
33
+ T.any(
34
+ Courier::JourneyNode::JourneyBatchNode,
35
+ Courier::Internal::AnyHash
36
+ )
37
+ end
38
+
39
+ # ISO 8601 duration. Hard ceiling from the first event into the batch; releases
40
+ # the batch unconditionally when it elapses.
41
+ sig { returns(String) }
42
+ attr_accessor :max_wait_period
43
+
44
+ # How to select which collected events to retain in the aggregated payload when
45
+ # the batch releases.
46
+ sig { returns(Courier::JourneyNode::JourneyBatchNode::Retain) }
47
+ attr_reader :retain
48
+
49
+ sig do
50
+ params(
51
+ retain: Courier::JourneyNode::JourneyBatchNode::Retain::OrHash
52
+ ).void
53
+ end
54
+ attr_writer :retain
55
+
56
+ sig { returns(Courier::JourneyNode::JourneyBatchNode::Scope::OrSymbol) }
57
+ attr_accessor :scope
58
+
59
+ sig { returns(Courier::JourneyNode::JourneyBatchNode::Type::OrSymbol) }
60
+ attr_accessor :type
61
+
62
+ # ISO 8601 duration. Quiet window that releases the batch when it elapses with no
63
+ # new contributing events. Must be less than `max_wait_period`.
64
+ sig { returns(String) }
65
+ attr_accessor :wait_period
66
+
67
+ sig { returns(T.nilable(String)) }
68
+ attr_reader :id
69
+
70
+ sig { params(id: String).void }
71
+ attr_writer :id
72
+
73
+ # Optional partition key. Events with the same `category_key` are batched
74
+ # together; events with different values are batched separately.
75
+ sig { returns(T.nilable(String)) }
76
+ attr_reader :category_key
77
+
78
+ sig { params(category_key: String).void }
79
+ attr_writer :category_key
80
+
81
+ # Condition spec for a journey node. Accepts a single condition atom, an AND/OR
82
+ # group, or an AND/OR nested group. Omit the `conditions` property entirely to
83
+ # express "no conditions".
84
+ sig do
85
+ returns(
86
+ T.nilable(
87
+ T.any(
88
+ T::Array[String],
89
+ Courier::JourneyConditionGroup,
90
+ Courier::JourneyConditionNestedGroup
91
+ )
92
+ )
93
+ )
94
+ end
95
+ attr_reader :conditions
96
+
97
+ sig do
98
+ params(
99
+ conditions:
100
+ T.any(
101
+ T::Array[String],
102
+ Courier::JourneyConditionGroup::OrHash,
103
+ Courier::JourneyConditionNestedGroup::OrHash
104
+ )
105
+ ).void
106
+ end
107
+ attr_writer :conditions
108
+
109
+ # Releases the batch once this many events have been collected.
110
+ sig { returns(T.nilable(Integer)) }
111
+ attr_reader :max_items
112
+
113
+ sig { params(max_items: Integer).void }
114
+ attr_writer :max_items
115
+
116
+ # Collect events arriving at the node into a single batch and fire one downstream
117
+ # step with the aggregated payload. The first event into a batch owns the run;
118
+ # later contributing events terminate at the batch step. The batch releases when
119
+ # any of `max_items` is reached, a quiet window of `wait_period` elapses, or the
120
+ # `max_wait_period` ceiling hits.
121
+ sig do
122
+ params(
123
+ max_wait_period: String,
124
+ retain: Courier::JourneyNode::JourneyBatchNode::Retain::OrHash,
125
+ scope: Courier::JourneyNode::JourneyBatchNode::Scope::OrSymbol,
126
+ type: Courier::JourneyNode::JourneyBatchNode::Type::OrSymbol,
127
+ wait_period: String,
128
+ id: String,
129
+ category_key: String,
130
+ conditions:
131
+ T.any(
132
+ T::Array[String],
133
+ Courier::JourneyConditionGroup::OrHash,
134
+ Courier::JourneyConditionNestedGroup::OrHash
135
+ ),
136
+ max_items: Integer
137
+ ).returns(T.attached_class)
138
+ end
139
+ def self.new(
140
+ # ISO 8601 duration. Hard ceiling from the first event into the batch; releases
141
+ # the batch unconditionally when it elapses.
142
+ max_wait_period:,
143
+ # How to select which collected events to retain in the aggregated payload when
144
+ # the batch releases.
145
+ retain:,
146
+ scope:,
147
+ type:,
148
+ # ISO 8601 duration. Quiet window that releases the batch when it elapses with no
149
+ # new contributing events. Must be less than `max_wait_period`.
150
+ wait_period:,
151
+ id: nil,
152
+ # Optional partition key. Events with the same `category_key` are batched
153
+ # together; events with different values are batched separately.
154
+ category_key: nil,
155
+ # Condition spec for a journey node. Accepts a single condition atom, an AND/OR
156
+ # group, or an AND/OR nested group. Omit the `conditions` property entirely to
157
+ # express "no conditions".
158
+ conditions: nil,
159
+ # Releases the batch once this many events have been collected.
160
+ max_items: nil
161
+ )
162
+ end
163
+
164
+ sig do
165
+ override.returns(
166
+ {
167
+ max_wait_period: String,
168
+ retain: Courier::JourneyNode::JourneyBatchNode::Retain,
169
+ scope: Courier::JourneyNode::JourneyBatchNode::Scope::OrSymbol,
170
+ type: Courier::JourneyNode::JourneyBatchNode::Type::OrSymbol,
171
+ wait_period: String,
172
+ id: String,
173
+ category_key: String,
174
+ conditions:
175
+ T.any(
176
+ T::Array[String],
177
+ Courier::JourneyConditionGroup,
178
+ Courier::JourneyConditionNestedGroup
179
+ ),
180
+ max_items: Integer
181
+ }
182
+ )
183
+ end
184
+ def to_hash
185
+ end
186
+
187
+ class Retain < Courier::Internal::Type::BaseModel
188
+ OrHash =
189
+ T.type_alias do
190
+ T.any(
191
+ Courier::JourneyNode::JourneyBatchNode::Retain,
192
+ Courier::Internal::AnyHash
193
+ )
194
+ end
195
+
196
+ sig { returns(Integer) }
197
+ attr_accessor :count
198
+
199
+ sig do
200
+ returns(
201
+ Courier::JourneyNode::JourneyBatchNode::Retain::Type::OrSymbol
202
+ )
203
+ end
204
+ attr_accessor :type
205
+
206
+ # Dot-path into the event payload (e.g. `data.priority`). Required when `type` is
207
+ # `highest` or `lowest`.
208
+ sig { returns(T.nilable(String)) }
209
+ attr_reader :sort_key
210
+
211
+ sig { params(sort_key: String).void }
212
+ attr_writer :sort_key
213
+
214
+ # How to select which collected events to retain in the aggregated payload when
215
+ # the batch releases.
216
+ sig do
217
+ params(
218
+ count: Integer,
219
+ type:
220
+ Courier::JourneyNode::JourneyBatchNode::Retain::Type::OrSymbol,
221
+ sort_key: String
222
+ ).returns(T.attached_class)
223
+ end
224
+ def self.new(
225
+ count:,
226
+ type:,
227
+ # Dot-path into the event payload (e.g. `data.priority`). Required when `type` is
228
+ # `highest` or `lowest`.
229
+ sort_key: nil
230
+ )
231
+ end
232
+
233
+ sig do
234
+ override.returns(
235
+ {
236
+ count: Integer,
237
+ type:
238
+ Courier::JourneyNode::JourneyBatchNode::Retain::Type::OrSymbol,
239
+ sort_key: String
240
+ }
241
+ )
242
+ end
243
+ def to_hash
244
+ end
245
+
246
+ module Type
247
+ extend Courier::Internal::Type::Enum
248
+
249
+ TaggedSymbol =
250
+ T.type_alias do
251
+ T.all(
252
+ Symbol,
253
+ Courier::JourneyNode::JourneyBatchNode::Retain::Type
254
+ )
255
+ end
256
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
257
+
258
+ FIRST =
259
+ T.let(
260
+ :first,
261
+ Courier::JourneyNode::JourneyBatchNode::Retain::Type::TaggedSymbol
262
+ )
263
+ LAST =
264
+ T.let(
265
+ :last,
266
+ Courier::JourneyNode::JourneyBatchNode::Retain::Type::TaggedSymbol
267
+ )
268
+ HIGHEST =
269
+ T.let(
270
+ :highest,
271
+ Courier::JourneyNode::JourneyBatchNode::Retain::Type::TaggedSymbol
272
+ )
273
+ LOWEST =
274
+ T.let(
275
+ :lowest,
276
+ Courier::JourneyNode::JourneyBatchNode::Retain::Type::TaggedSymbol
277
+ )
278
+
279
+ sig do
280
+ override.returns(
281
+ T::Array[
282
+ Courier::JourneyNode::JourneyBatchNode::Retain::Type::TaggedSymbol
283
+ ]
284
+ )
285
+ end
286
+ def self.values
287
+ end
288
+ end
289
+ end
290
+
291
+ module Scope
292
+ extend Courier::Internal::Type::Enum
293
+
294
+ TaggedSymbol =
295
+ T.type_alias do
296
+ T.all(Symbol, Courier::JourneyNode::JourneyBatchNode::Scope)
297
+ end
298
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
299
+
300
+ USER =
301
+ T.let(
302
+ :user,
303
+ Courier::JourneyNode::JourneyBatchNode::Scope::TaggedSymbol
304
+ )
305
+
306
+ sig do
307
+ override.returns(
308
+ T::Array[
309
+ Courier::JourneyNode::JourneyBatchNode::Scope::TaggedSymbol
310
+ ]
311
+ )
312
+ end
313
+ def self.values
314
+ end
315
+ end
316
+
317
+ module Type
318
+ extend Courier::Internal::Type::Enum
319
+
320
+ TaggedSymbol =
321
+ T.type_alias do
322
+ T.all(Symbol, Courier::JourneyNode::JourneyBatchNode::Type)
323
+ end
324
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
325
+
326
+ BATCH =
327
+ T.let(
328
+ :batch,
329
+ Courier::JourneyNode::JourneyBatchNode::Type::TaggedSymbol
330
+ )
331
+
332
+ sig do
333
+ override.returns(
334
+ T::Array[
335
+ Courier::JourneyNode::JourneyBatchNode::Type::TaggedSymbol
336
+ ]
337
+ )
338
+ end
339
+ def self.values
340
+ end
341
+ end
342
+ end
343
+
344
+ class JourneyBranchNode < Courier::Internal::Type::BaseModel
345
+ OrHash =
346
+ T.type_alias do
347
+ T.any(
348
+ Courier::JourneyNode::JourneyBranchNode,
349
+ Courier::Internal::AnyHash
350
+ )
351
+ end
352
+
353
+ sig { returns(Courier::JourneyNode::JourneyBranchNode::Default) }
354
+ attr_reader :default
355
+
356
+ sig do
357
+ params(
358
+ default: Courier::JourneyNode::JourneyBranchNode::Default::OrHash
359
+ ).void
360
+ end
361
+ attr_writer :default
362
+
363
+ sig { returns(T::Array[Courier::JourneyNode::JourneyBranchNode::Path]) }
364
+ attr_accessor :paths
365
+
366
+ sig { returns(Courier::JourneyNode::JourneyBranchNode::Type::OrSymbol) }
367
+ attr_accessor :type
368
+
369
+ sig { returns(T.nilable(String)) }
370
+ attr_reader :id
371
+
372
+ sig { params(id: String).void }
373
+ attr_writer :id
374
+
375
+ # Branch node. Routes to the first entry in `paths[]` whose `conditions` match,
376
+ # else falls through to `default.nodes`.
377
+ sig do
378
+ params(
379
+ default: Courier::JourneyNode::JourneyBranchNode::Default::OrHash,
380
+ paths:
381
+ T::Array[Courier::JourneyNode::JourneyBranchNode::Path::OrHash],
382
+ type: Courier::JourneyNode::JourneyBranchNode::Type::OrSymbol,
383
+ id: String
384
+ ).returns(T.attached_class)
385
+ end
386
+ def self.new(default:, paths:, type:, id: nil)
387
+ end
388
+
389
+ sig do
390
+ override.returns(
391
+ {
392
+ default: Courier::JourneyNode::JourneyBranchNode::Default,
393
+ paths: T::Array[Courier::JourneyNode::JourneyBranchNode::Path],
394
+ type: Courier::JourneyNode::JourneyBranchNode::Type::OrSymbol,
395
+ id: String
396
+ }
397
+ )
398
+ end
399
+ def to_hash
400
+ end
401
+
402
+ class Default < Courier::Internal::Type::BaseModel
403
+ OrHash =
404
+ T.type_alias do
405
+ T.any(
406
+ Courier::JourneyNode::JourneyBranchNode::Default,
407
+ Courier::Internal::AnyHash
408
+ )
409
+ end
410
+
411
+ sig { returns(T::Array[Courier::JourneyNode]) }
412
+ attr_accessor :nodes
413
+
414
+ sig { returns(T.nilable(String)) }
415
+ attr_reader :label
416
+
417
+ sig { params(label: String).void }
418
+ attr_writer :label
419
+
420
+ sig do
421
+ params(
422
+ nodes: T::Array[Courier::JourneyNode],
423
+ label: String
424
+ ).returns(T.attached_class)
425
+ end
426
+ def self.new(nodes:, label: nil)
427
+ end
428
+
429
+ sig do
430
+ override.returns(
431
+ { nodes: T::Array[Courier::JourneyNode], label: String }
432
+ )
433
+ end
434
+ def to_hash
435
+ end
436
+ end
437
+
438
+ class Path < Courier::Internal::Type::BaseModel
439
+ OrHash =
440
+ T.type_alias do
441
+ T.any(
442
+ Courier::JourneyNode::JourneyBranchNode::Path,
443
+ Courier::Internal::AnyHash
444
+ )
445
+ end
446
+
447
+ # Condition spec for a journey node. Accepts a single condition atom, an AND/OR
448
+ # group, or an AND/OR nested group. Omit the `conditions` property entirely to
449
+ # express "no conditions".
450
+ sig do
451
+ returns(
452
+ T.any(
453
+ T::Array[String],
454
+ Courier::JourneyConditionGroup,
455
+ Courier::JourneyConditionNestedGroup
456
+ )
457
+ )
458
+ end
459
+ attr_accessor :conditions
460
+
461
+ sig { returns(T::Array[Courier::JourneyNode]) }
462
+ attr_accessor :nodes
463
+
464
+ sig { returns(T.nilable(String)) }
465
+ attr_reader :label
466
+
467
+ sig { params(label: String).void }
468
+ attr_writer :label
469
+
470
+ sig do
471
+ params(
472
+ conditions:
473
+ T.any(
474
+ T::Array[String],
475
+ Courier::JourneyConditionGroup::OrHash,
476
+ Courier::JourneyConditionNestedGroup::OrHash
477
+ ),
478
+ nodes: T::Array[Courier::JourneyNode],
479
+ label: String
480
+ ).returns(T.attached_class)
481
+ end
482
+ def self.new(
483
+ # Condition spec for a journey node. Accepts a single condition atom, an AND/OR
484
+ # group, or an AND/OR nested group. Omit the `conditions` property entirely to
485
+ # express "no conditions".
486
+ conditions:,
487
+ nodes:,
488
+ label: nil
489
+ )
490
+ end
491
+
492
+ sig do
493
+ override.returns(
494
+ {
495
+ conditions:
496
+ T.any(
497
+ T::Array[String],
498
+ Courier::JourneyConditionGroup,
499
+ Courier::JourneyConditionNestedGroup
500
+ ),
501
+ nodes: T::Array[Courier::JourneyNode],
502
+ label: String
503
+ }
504
+ )
505
+ end
506
+ def to_hash
507
+ end
508
+ end
509
+
510
+ module Type
511
+ extend Courier::Internal::Type::Enum
512
+
513
+ TaggedSymbol =
514
+ T.type_alias do
515
+ T.all(Symbol, Courier::JourneyNode::JourneyBranchNode::Type)
516
+ end
517
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
518
+
519
+ BRANCH =
520
+ T.let(
521
+ :branch,
522
+ Courier::JourneyNode::JourneyBranchNode::Type::TaggedSymbol
523
+ )
524
+
525
+ sig do
526
+ override.returns(
527
+ T::Array[
528
+ Courier::JourneyNode::JourneyBranchNode::Type::TaggedSymbol
529
+ ]
530
+ )
531
+ end
532
+ def self.values
533
+ end
534
+ end
535
+ end
536
+
537
+ sig { override.returns(T::Array[Courier::JourneyNode::Variants]) }
538
+ def self.variants
539
+ end
540
+ end
541
+ end
542
+ end
@@ -0,0 +1,35 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ class JourneyPublishParams < Courier::Models::JourneyPublishRequest
6
+ extend Courier::Internal::Type::RequestParameters::Converter
7
+ include Courier::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(Courier::JourneyPublishParams, Courier::Internal::AnyHash)
12
+ end
13
+
14
+ sig { returns(String) }
15
+ attr_accessor :template_id
16
+
17
+ sig do
18
+ params(
19
+ template_id: String,
20
+ request_options: Courier::RequestOptions::OrHash
21
+ ).returns(T.attached_class)
22
+ end
23
+ def self.new(template_id:, request_options: {})
24
+ end
25
+
26
+ sig do
27
+ override.returns(
28
+ { template_id: String, request_options: Courier::RequestOptions }
29
+ )
30
+ end
31
+ def to_hash
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,28 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ class JourneyPublishRequest < Courier::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Courier::JourneyPublishRequest, Courier::Internal::AnyHash)
9
+ end
10
+
11
+ sig { returns(T.nilable(String)) }
12
+ attr_reader :version
13
+
14
+ sig { params(version: String).void }
15
+ attr_writer :version
16
+
17
+ # Request body for publishing a journey. Pass `version` to roll back to a prior
18
+ # version; omit to publish the current draft.
19
+ sig { params(version: String).returns(T.attached_class) }
20
+ def self.new(version: nil)
21
+ end
22
+
23
+ sig { override.returns({ version: String }) }
24
+ def to_hash
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,35 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Models
5
+ class JourneyReplaceParams < Courier::Models::CreateJourneyRequest
6
+ extend Courier::Internal::Type::RequestParameters::Converter
7
+ include Courier::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(Courier::JourneyReplaceParams, Courier::Internal::AnyHash)
12
+ end
13
+
14
+ sig { returns(String) }
15
+ attr_accessor :template_id
16
+
17
+ sig do
18
+ params(
19
+ template_id: String,
20
+ request_options: Courier::RequestOptions::OrHash
21
+ ).returns(T.attached_class)
22
+ end
23
+ def self.new(template_id:, request_options: {})
24
+ end
25
+
26
+ sig do
27
+ override.returns(
28
+ { template_id: String, request_options: Courier::RequestOptions }
29
+ )
30
+ end
31
+ def to_hash
32
+ end
33
+ end
34
+ end
35
+ end