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
@@ -97,6 +97,8 @@ module Courier
97
97
 
98
98
  Check = Courier::Models::Check
99
99
 
100
+ CreateJourneyRequest = Courier::Models::CreateJourneyRequest
101
+
100
102
  DefaultPreferences = Courier::Models::DefaultPreferences
101
103
 
102
104
  DeviceType = Courier::Models::DeviceType
@@ -155,16 +157,90 @@ module Courier
155
157
 
156
158
  Journey = Courier::Models::Journey
157
159
 
160
+ JourneyAINode = Courier::Models::JourneyAINode
161
+
162
+ JourneyAPIInvokeTriggerNode = Courier::Models::JourneyAPIInvokeTriggerNode
163
+
164
+ JourneyArchiveParams = Courier::Models::JourneyArchiveParams
165
+
166
+ JourneyConditionAtom =
167
+ T.let(
168
+ Courier::Models::JourneyConditionAtom,
169
+ Courier::Internal::Type::Converter
170
+ )
171
+
172
+ JourneyConditionGroup = Courier::Models::JourneyConditionGroup
173
+
174
+ JourneyConditionNestedGroup = Courier::Models::JourneyConditionNestedGroup
175
+
176
+ JourneyConditionsField = Courier::Models::JourneyConditionsField
177
+
178
+ JourneyCreateParams = Courier::Models::JourneyCreateParams
179
+
180
+ JourneyDelayDurationNode = Courier::Models::JourneyDelayDurationNode
181
+
182
+ JourneyDelayUntilNode = Courier::Models::JourneyDelayUntilNode
183
+
184
+ JourneyExitNode = Courier::Models::JourneyExitNode
185
+
186
+ JourneyFetchGetDeleteNode = Courier::Models::JourneyFetchGetDeleteNode
187
+
188
+ JourneyFetchPostPutNode = Courier::Models::JourneyFetchPostPutNode
189
+
158
190
  JourneyInvokeParams = Courier::Models::JourneyInvokeParams
159
191
 
160
192
  JourneyListParams = Courier::Models::JourneyListParams
161
193
 
194
+ JourneyListVersionsParams = Courier::Models::JourneyListVersionsParams
195
+
196
+ JourneyMergeStrategy = Courier::Models::JourneyMergeStrategy
197
+
198
+ JourneyNode = Courier::Models::JourneyNode
199
+
200
+ JourneyPublishParams = Courier::Models::JourneyPublishParams
201
+
202
+ JourneyPublishRequest = Courier::Models::JourneyPublishRequest
203
+
204
+ JourneyReplaceParams = Courier::Models::JourneyReplaceParams
205
+
206
+ JourneyResponse = Courier::Models::JourneyResponse
207
+
208
+ JourneyRetrieveParams = Courier::Models::JourneyRetrieveParams
209
+
210
+ Journeys = Courier::Models::Journeys
211
+
212
+ JourneySegmentTriggerNode = Courier::Models::JourneySegmentTriggerNode
213
+
214
+ JourneySendNode = Courier::Models::JourneySendNode
215
+
162
216
  JourneysInvokeRequest = Courier::Models::JourneysInvokeRequest
163
217
 
164
218
  JourneysInvokeResponse = Courier::Models::JourneysInvokeResponse
165
219
 
166
220
  JourneysListResponse = Courier::Models::JourneysListResponse
167
221
 
222
+ JourneyState = Courier::Models::JourneyState
223
+
224
+ JourneyTemplateCreateRequest = Courier::Models::JourneyTemplateCreateRequest
225
+
226
+ JourneyTemplateGetResponse = Courier::Models::JourneyTemplateGetResponse
227
+
228
+ JourneyTemplateListResponse = Courier::Models::JourneyTemplateListResponse
229
+
230
+ JourneyTemplatePublishRequest = Courier::Models::JourneyTemplatePublishRequest
231
+
232
+ JourneyTemplateReplaceRequest = Courier::Models::JourneyTemplateReplaceRequest
233
+
234
+ JourneyTemplateSummary = Courier::Models::JourneyTemplateSummary
235
+
236
+ JourneyThrottleDynamicNode = Courier::Models::JourneyThrottleDynamicNode
237
+
238
+ JourneyThrottleStaticNode = Courier::Models::JourneyThrottleStaticNode
239
+
240
+ JourneyVersionItem = Courier::Models::JourneyVersionItem
241
+
242
+ JourneyVersionsListResponse = Courier::Models::JourneyVersionsListResponse
243
+
168
244
  ListDeleteParams = Courier::Models::ListDeleteParams
169
245
 
170
246
  ListFilter = Courier::Models::ListFilter
@@ -3,23 +3,18 @@
3
3
  module Courier
4
4
  module Resources
5
5
  class Brands
6
- # Create a new brand
6
+ # Create a new brand. Requires `name` and `settings` (with at least
7
+ # `colors.primary` and `colors.secondary`).
7
8
  sig do
8
9
  params(
9
10
  name: String,
11
+ settings: Courier::BrandSettings::OrHash,
10
12
  id: T.nilable(String),
11
- settings: T.nilable(Courier::BrandSettings::OrHash),
12
13
  snippets: T.nilable(Courier::BrandSnippets::OrHash),
13
14
  request_options: Courier::RequestOptions::OrHash
14
15
  ).returns(Courier::Brand)
15
16
  end
16
- def create(
17
- name:,
18
- id: nil,
19
- settings: nil,
20
- snippets: nil,
21
- request_options: {}
22
- )
17
+ def create(name:, settings:, id: nil, snippets: nil, request_options: {})
23
18
  end
24
19
 
25
20
  # Fetch a specific brand by brand ID.
@@ -0,0 +1,160 @@
1
+ # typed: strong
2
+
3
+ module Courier
4
+ module Resources
5
+ class Journeys
6
+ class Templates
7
+ # Create a notification template scoped to this journey. Defaults to `DRAFT`
8
+ # state; pass `state: "PUBLISHED"` to publish on create.
9
+ sig do
10
+ params(
11
+ template_id: String,
12
+ channel: String,
13
+ notification:
14
+ Courier::JourneyTemplateCreateRequest::Notification::OrHash,
15
+ provider_key: String,
16
+ state: String,
17
+ request_options: Courier::RequestOptions::OrHash
18
+ ).returns(Courier::JourneyTemplateGetResponse)
19
+ end
20
+ def create(
21
+ # Journey id
22
+ template_id,
23
+ channel:,
24
+ notification:,
25
+ provider_key: nil,
26
+ state: nil,
27
+ request_options: {}
28
+ )
29
+ end
30
+
31
+ # Fetch a journey-scoped notification template by id. Pass `?version=draft`
32
+ # (default `published`) to retrieve the working draft, or `?version=vN` for a
33
+ # historical version.
34
+ sig do
35
+ params(
36
+ notification_id: String,
37
+ template_id: String,
38
+ request_options: Courier::RequestOptions::OrHash
39
+ ).returns(Courier::JourneyTemplateGetResponse)
40
+ end
41
+ def retrieve(
42
+ # Notification template id
43
+ notification_id,
44
+ # Journey id
45
+ template_id:,
46
+ request_options: {}
47
+ )
48
+ end
49
+
50
+ # List notification templates scoped to this journey. Journey-scoped notification
51
+ # templates can only be referenced from `send` nodes within the same journey.
52
+ sig do
53
+ params(
54
+ template_id: String,
55
+ cursor: String,
56
+ limit: Integer,
57
+ request_options: Courier::RequestOptions::OrHash
58
+ ).returns(Courier::JourneyTemplateListResponse)
59
+ end
60
+ def list(
61
+ # Journey id
62
+ template_id,
63
+ # Pagination cursor from a prior response.
64
+ cursor: nil,
65
+ # Page size. Minimum 1, maximum 100.
66
+ limit: nil,
67
+ request_options: {}
68
+ )
69
+ end
70
+
71
+ # Archive the journey-scoped notification template. Archived templates cannot be
72
+ # sent.
73
+ sig do
74
+ params(
75
+ notification_id: String,
76
+ template_id: String,
77
+ request_options: Courier::RequestOptions::OrHash
78
+ ).void
79
+ end
80
+ def archive(
81
+ # Notification template id
82
+ notification_id,
83
+ # Journey id
84
+ template_id:,
85
+ request_options: {}
86
+ )
87
+ end
88
+
89
+ # List published versions of the journey-scoped notification template, ordered
90
+ # most recent first.
91
+ sig do
92
+ params(
93
+ notification_id: String,
94
+ template_id: String,
95
+ request_options: Courier::RequestOptions::OrHash
96
+ ).returns(Courier::NotificationTemplateVersionListResponse)
97
+ end
98
+ def list_versions(
99
+ # Notification template id
100
+ notification_id,
101
+ # Journey id
102
+ template_id:,
103
+ request_options: {}
104
+ )
105
+ end
106
+
107
+ # Publish the current draft of the journey-scoped notification template as a new
108
+ # version. Optionally roll back to a prior version by passing
109
+ # `{ "version": "vN" }`.
110
+ sig do
111
+ params(
112
+ notification_id: String,
113
+ template_id: String,
114
+ version: String,
115
+ request_options: Courier::RequestOptions::OrHash
116
+ ).void
117
+ end
118
+ def publish(
119
+ # Path param: Notification template id
120
+ notification_id,
121
+ # Path param: Journey id
122
+ template_id:,
123
+ # Body param
124
+ version: nil,
125
+ request_options: {}
126
+ )
127
+ end
128
+
129
+ # Replace the journey-scoped notification template draft.
130
+ sig do
131
+ params(
132
+ notification_id: String,
133
+ template_id: String,
134
+ notification:
135
+ Courier::JourneyTemplateReplaceRequest::Notification::OrHash,
136
+ state: String,
137
+ request_options: Courier::RequestOptions::OrHash
138
+ ).returns(Courier::JourneyTemplateGetResponse)
139
+ end
140
+ def replace(
141
+ # Path param: Notification template id
142
+ notification_id,
143
+ # Path param: Journey id
144
+ template_id:,
145
+ # Body param
146
+ notification:,
147
+ # Body param
148
+ state: nil,
149
+ request_options: {}
150
+ )
151
+ end
152
+
153
+ # @api private
154
+ sig { params(client: Courier::Client).returns(T.attached_class) }
155
+ def self.new(client:)
156
+ end
157
+ end
158
+ end
159
+ end
160
+ end
@@ -3,6 +3,69 @@
3
3
  module Courier
4
4
  module Resources
5
5
  class Journeys
6
+ sig { returns(Courier::Resources::Journeys::Templates) }
7
+ attr_reader :templates
8
+
9
+ # Create a journey. Defaults to `DRAFT` state; pass `state: "PUBLISHED"` to
10
+ # publish on create. Send nodes are not allowed on `POST`. The standard flow is:
11
+ # create the journey shell here, add notification templates with
12
+ # `POST /journeys/{templateId}/templates`, then wire them into the journey with
13
+ # `PUT /journeys/{templateId}`. Call `POST /journeys/{templateId}/publish` to
14
+ # publish a draft after the fact.
15
+ sig do
16
+ params(
17
+ name: String,
18
+ nodes:
19
+ T::Array[
20
+ T.any(
21
+ Courier::JourneyAPIInvokeTriggerNode::OrHash,
22
+ Courier::JourneySegmentTriggerNode::OrHash,
23
+ Courier::JourneySendNode::OrHash,
24
+ Courier::JourneyDelayDurationNode::OrHash,
25
+ Courier::JourneyDelayUntilNode::OrHash,
26
+ Courier::JourneyFetchGetDeleteNode::OrHash,
27
+ Courier::JourneyFetchPostPutNode::OrHash,
28
+ Courier::JourneyAINode::OrHash,
29
+ Courier::JourneyThrottleStaticNode::OrHash,
30
+ Courier::JourneyThrottleDynamicNode::OrHash,
31
+ Courier::JourneyNode::JourneyBatchNode::OrHash,
32
+ Courier::JourneyExitNode::OrHash,
33
+ Courier::JourneyNode::JourneyBranchNode::OrHash
34
+ )
35
+ ],
36
+ enabled: T::Boolean,
37
+ state: Courier::JourneyState::OrSymbol,
38
+ request_options: Courier::RequestOptions::OrHash
39
+ ).returns(Courier::JourneyResponse)
40
+ end
41
+ def create(
42
+ name:,
43
+ nodes:,
44
+ enabled: nil,
45
+ # Lifecycle state of a journey.
46
+ state: nil,
47
+ request_options: {}
48
+ )
49
+ end
50
+
51
+ # Fetch a journey by id. Pass `?version=draft` (default `published`) to retrieve
52
+ # the working draft, or `?version=vN` to retrieve a historical version.
53
+ sig do
54
+ params(
55
+ template_id: String,
56
+ version: String,
57
+ request_options: Courier::RequestOptions::OrHash
58
+ ).returns(Courier::JourneyResponse)
59
+ end
60
+ def retrieve(
61
+ # Journey id
62
+ template_id,
63
+ # Version selector: `draft`, `published` (default), or `vN`.
64
+ version: nil,
65
+ request_options: {}
66
+ )
67
+ end
68
+
6
69
  # Get the list of journeys.
7
70
  sig do
8
71
  params(
@@ -22,7 +85,23 @@ module Courier
22
85
  )
23
86
  end
24
87
 
25
- # Invoke a journey run from a journey template.
88
+ # Archive a journey. Archived journeys cannot be invoked. Existing journey runs
89
+ # continue to completion.
90
+ sig do
91
+ params(
92
+ template_id: String,
93
+ request_options: Courier::RequestOptions::OrHash
94
+ ).void
95
+ end
96
+ def archive(
97
+ # Journey id
98
+ template_id,
99
+ request_options: {}
100
+ )
101
+ end
102
+
103
+ # Invoke a journey by id or alias to start a new run. The response includes a
104
+ # `runId` identifying the run.
26
105
  sig do
27
106
  params(
28
107
  template_id: String,
@@ -33,8 +112,8 @@ module Courier
33
112
  ).returns(Courier::JourneysInvokeResponse)
34
113
  end
35
114
  def invoke(
36
- # A unique identifier representing the journey template to be invoked. This could
37
- # be the Journey Template ID or the Journey Template Alias.
115
+ # A unique identifier representing the journey to be invoked. Accepts a Journey ID
116
+ # or Journey Alias.
38
117
  template_id,
39
118
  # Data payload passed to the journey. The expected shape can be predefined using
40
119
  # the schema builder in the journey editor. This data is available in journey
@@ -55,6 +134,82 @@ module Courier
55
134
  )
56
135
  end
57
136
 
137
+ # List published versions of a journey, ordered most recent first.
138
+ sig do
139
+ params(
140
+ template_id: String,
141
+ request_options: Courier::RequestOptions::OrHash
142
+ ).returns(Courier::JourneyVersionsListResponse)
143
+ end
144
+ def list_versions(
145
+ # Journey id
146
+ template_id,
147
+ request_options: {}
148
+ )
149
+ end
150
+
151
+ # Publish the current draft as a new version. Body is optional; pass
152
+ # `{ "version": "vN" }` to roll back to a prior version instead. Returns 404 if
153
+ # the journey has no draft to publish.
154
+ sig do
155
+ params(
156
+ template_id: String,
157
+ version: String,
158
+ request_options: Courier::RequestOptions::OrHash
159
+ ).returns(Courier::JourneyResponse)
160
+ end
161
+ def publish(
162
+ # Journey id
163
+ template_id,
164
+ version: nil,
165
+ request_options: {}
166
+ )
167
+ end
168
+
169
+ # Replace the journey draft. Updates the working draft only; call
170
+ # `POST /journeys/{templateId}/publish` to make it live, or pass
171
+ # `state: "PUBLISHED"` in this request to publish immediately. Send-node
172
+ # `template` ids must already exist and be scoped to this journey, and node ids
173
+ # must not be claimed by another journey.
174
+ sig do
175
+ params(
176
+ template_id: String,
177
+ name: String,
178
+ nodes:
179
+ T::Array[
180
+ T.any(
181
+ Courier::JourneyAPIInvokeTriggerNode::OrHash,
182
+ Courier::JourneySegmentTriggerNode::OrHash,
183
+ Courier::JourneySendNode::OrHash,
184
+ Courier::JourneyDelayDurationNode::OrHash,
185
+ Courier::JourneyDelayUntilNode::OrHash,
186
+ Courier::JourneyFetchGetDeleteNode::OrHash,
187
+ Courier::JourneyFetchPostPutNode::OrHash,
188
+ Courier::JourneyAINode::OrHash,
189
+ Courier::JourneyThrottleStaticNode::OrHash,
190
+ Courier::JourneyThrottleDynamicNode::OrHash,
191
+ Courier::JourneyNode::JourneyBatchNode::OrHash,
192
+ Courier::JourneyExitNode::OrHash,
193
+ Courier::JourneyNode::JourneyBranchNode::OrHash
194
+ )
195
+ ],
196
+ enabled: T::Boolean,
197
+ state: Courier::JourneyState::OrSymbol,
198
+ request_options: Courier::RequestOptions::OrHash
199
+ ).returns(Courier::JourneyResponse)
200
+ end
201
+ def replace(
202
+ # Journey id
203
+ template_id,
204
+ name:,
205
+ nodes:,
206
+ enabled: nil,
207
+ # Lifecycle state of a journey.
208
+ state: nil,
209
+ request_options: {}
210
+ )
211
+ end
212
+
58
213
  # @api private
59
214
  sig { params(client: Courier::Client).returns(T.attached_class) }
60
215
  def self.new(client:)
@@ -44,6 +44,28 @@ module Courier
44
44
  )
45
45
  end
46
46
 
47
+ # Deletes the tenant's notification template with the given `template_id`.
48
+ #
49
+ # Returns **204 No Content** with an empty body on success.
50
+ #
51
+ # Returns **404** if there is no template with this ID for the tenant, including a
52
+ # second `DELETE` after a successful removal.
53
+ sig do
54
+ params(
55
+ template_id: String,
56
+ tenant_id: String,
57
+ request_options: Courier::RequestOptions::OrHash
58
+ ).void
59
+ end
60
+ def delete(
61
+ # Id of the template to remove from the tenant.
62
+ template_id,
63
+ # Id of the tenant that owns the template.
64
+ tenant_id:,
65
+ request_options: {}
66
+ )
67
+ end
68
+
47
69
  # Publishes a specific version of a notification template for a tenant.
48
70
  #
49
71
  # The template must already exist in the tenant's notification map. If no version
@@ -3,8 +3,8 @@ module Courier
3
3
  type brand_create_params =
4
4
  {
5
5
  name: String,
6
+ settings: Courier::BrandSettings,
6
7
  id: String?,
7
- settings: Courier::BrandSettings?,
8
8
  snippets: Courier::BrandSnippets?
9
9
  }
10
10
  & Courier::Internal::Type::request_parameters
@@ -15,24 +15,24 @@ module Courier
15
15
 
16
16
  attr_accessor name: String
17
17
 
18
- attr_accessor id: String?
18
+ attr_accessor settings: Courier::BrandSettings
19
19
 
20
- attr_accessor settings: Courier::BrandSettings?
20
+ attr_accessor id: String?
21
21
 
22
22
  attr_accessor snippets: Courier::BrandSnippets?
23
23
 
24
24
  def initialize: (
25
25
  name: String,
26
+ settings: Courier::BrandSettings,
26
27
  ?id: String?,
27
- ?settings: Courier::BrandSettings?,
28
28
  ?snippets: Courier::BrandSnippets?,
29
29
  ?request_options: Courier::request_opts
30
30
  ) -> void
31
31
 
32
32
  def to_hash: -> {
33
33
  name: String,
34
+ settings: Courier::BrandSettings,
34
35
  id: String?,
35
- settings: Courier::BrandSettings?,
36
36
  snippets: Courier::BrandSnippets?,
37
37
  request_options: Courier::RequestOptions
38
38
  }
@@ -0,0 +1,41 @@
1
+ module Courier
2
+ module Models
3
+ type create_journey_request =
4
+ {
5
+ name: String,
6
+ nodes: ::Array[Courier::Models::journey_node],
7
+ enabled: bool,
8
+ state: Courier::Models::journey_state
9
+ }
10
+
11
+ class CreateJourneyRequest < Courier::Internal::Type::BaseModel
12
+ attr_accessor name: String
13
+
14
+ attr_accessor nodes: ::Array[Courier::Models::journey_node]
15
+
16
+ attr_reader enabled: bool?
17
+
18
+ def enabled=: (bool) -> bool
19
+
20
+ attr_reader state: Courier::Models::journey_state?
21
+
22
+ def state=: (
23
+ Courier::Models::journey_state
24
+ ) -> Courier::Models::journey_state
25
+
26
+ def initialize: (
27
+ name: String,
28
+ nodes: ::Array[Courier::Models::journey_node],
29
+ ?enabled: bool,
30
+ ?state: Courier::Models::journey_state
31
+ ) -> void
32
+
33
+ def to_hash: -> {
34
+ name: String,
35
+ nodes: ::Array[Courier::Models::journey_node],
36
+ enabled: bool,
37
+ state: Courier::Models::journey_state
38
+ }
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,72 @@
1
+ module Courier
2
+ module Models
3
+ type journey_ai_node =
4
+ {
5
+ output_schema: ::Hash[Symbol, top],
6
+ type: Courier::Models::JourneyAINode::type_,
7
+ id: String,
8
+ conditions: Courier::Models::journey_conditions_field,
9
+ model: String,
10
+ user_prompt: String,
11
+ web_search: bool
12
+ }
13
+
14
+ class JourneyAINode < Courier::Internal::Type::BaseModel
15
+ attr_accessor output_schema: ::Hash[Symbol, top]
16
+
17
+ attr_accessor type: Courier::Models::JourneyAINode::type_
18
+
19
+ attr_reader id: String?
20
+
21
+ def id=: (String) -> String
22
+
23
+ attr_reader conditions: Courier::Models::journey_conditions_field?
24
+
25
+ def conditions=: (
26
+ Courier::Models::journey_conditions_field
27
+ ) -> Courier::Models::journey_conditions_field
28
+
29
+ attr_reader model: String?
30
+
31
+ def model=: (String) -> String
32
+
33
+ attr_reader user_prompt: String?
34
+
35
+ def user_prompt=: (String) -> String
36
+
37
+ attr_reader web_search: bool?
38
+
39
+ def web_search=: (bool) -> bool
40
+
41
+ def initialize: (
42
+ output_schema: ::Hash[Symbol, top],
43
+ type: Courier::Models::JourneyAINode::type_,
44
+ ?id: String,
45
+ ?conditions: Courier::Models::journey_conditions_field,
46
+ ?model: String,
47
+ ?user_prompt: String,
48
+ ?web_search: bool
49
+ ) -> void
50
+
51
+ def to_hash: -> {
52
+ output_schema: ::Hash[Symbol, top],
53
+ type: Courier::Models::JourneyAINode::type_,
54
+ id: String,
55
+ conditions: Courier::Models::journey_conditions_field,
56
+ model: String,
57
+ user_prompt: String,
58
+ web_search: bool
59
+ }
60
+
61
+ type type_ = :ai
62
+
63
+ module Type
64
+ extend Courier::Internal::Type::Enum
65
+
66
+ AI: :ai
67
+
68
+ def self?.values: -> ::Array[Courier::Models::JourneyAINode::type_]
69
+ end
70
+ end
71
+ end
72
+ end