trycourier 4.10.2 → 4.11.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -0
- data/lib/courier/client.rb +15 -1
- data/lib/courier/internal/transport/base_client.rb +2 -0
- data/lib/courier/models/create_journey_request.rb +39 -0
- data/lib/courier/models/journey_ai_node.rb +77 -0
- data/lib/courier/models/journey_api_invoke_trigger_node.rb +73 -0
- data/lib/courier/models/journey_archive_params.rb +20 -0
- data/lib/courier/models/journey_condition_atom.rb +8 -0
- data/lib/courier/models/journey_condition_group.rb +26 -0
- data/lib/courier/models/journey_condition_nested_group.rb +24 -0
- data/lib/courier/models/journey_conditions_field.rb +37 -0
- data/lib/courier/models/journey_create_params.rb +14 -0
- data/lib/courier/models/journey_delay_duration_node.rb +71 -0
- data/lib/courier/models/journey_delay_until_node.rb +71 -0
- data/lib/courier/models/journey_exit_node.rb +33 -0
- data/lib/courier/models/journey_fetch_get_delete_node.rb +103 -0
- data/lib/courier/models/journey_fetch_post_put_node.rb +110 -0
- data/lib/courier/models/journey_list_versions_params.rb +20 -0
- data/lib/courier/models/journey_merge_strategy.rb +18 -0
- data/lib/courier/models/journey_node.rb +139 -0
- data/lib/courier/models/journey_publish_params.rb +20 -0
- data/lib/courier/models/journey_publish_request.rb +18 -0
- data/lib/courier/models/journey_replace_params.rb +20 -0
- data/lib/courier/models/journey_response.rb +82 -0
- data/lib/courier/models/journey_retrieve_params.rb +29 -0
- data/lib/courier/models/journey_segment_trigger_node.rb +90 -0
- data/lib/courier/models/journey_send_node.rb +124 -0
- data/lib/courier/models/journey_state.rb +16 -0
- data/lib/courier/models/journey_template_create_request.rb +138 -0
- data/lib/courier/models/journey_template_get_response.rb +154 -0
- data/lib/courier/models/journey_template_list_response.rb +23 -0
- data/lib/courier/models/journey_template_publish_request.rb +18 -0
- data/lib/courier/models/journey_template_replace_request.rb +126 -0
- data/lib/courier/models/journey_template_summary.rb +60 -0
- data/lib/courier/models/journey_throttle_dynamic_node.rb +86 -0
- data/lib/courier/models/journey_throttle_static_node.rb +80 -0
- data/lib/courier/models/journey_version_item.rb +41 -0
- data/lib/courier/models/journey_versions_list_response.rb +24 -0
- data/lib/courier/models/journeys/template_archive_params.rb +28 -0
- data/lib/courier/models/journeys/template_create_params.rb +22 -0
- data/lib/courier/models/journeys/template_list_params.rb +39 -0
- data/lib/courier/models/journeys/template_list_versions_params.rb +28 -0
- data/lib/courier/models/journeys/template_publish_params.rb +28 -0
- data/lib/courier/models/journeys/template_replace_params.rb +28 -0
- data/lib/courier/models/journeys/template_retrieve_params.rb +28 -0
- data/lib/courier/models/tenants/template_delete_params.rb +28 -0
- data/lib/courier/models.rb +73 -0
- data/lib/courier/resources/journeys/templates.rb +224 -0
- data/lib/courier/resources/journeys.rb +167 -2
- data/lib/courier/resources/tenants/templates.rb +32 -0
- data/lib/courier/version.rb +1 -1
- data/lib/courier.rb +44 -0
- data/rbi/courier/models/create_journey_request.rbi +113 -0
- data/rbi/courier/models/journey_ai_node.rbi +141 -0
- data/rbi/courier/models/journey_api_invoke_trigger_node.rbi +164 -0
- data/rbi/courier/models/journey_archive_params.rbi +35 -0
- data/rbi/courier/models/journey_condition_atom.rbi +11 -0
- data/rbi/courier/models/journey_condition_group.rbi +43 -0
- data/rbi/courier/models/journey_condition_nested_group.rbi +51 -0
- data/rbi/courier/models/journey_conditions_field.rbi +27 -0
- data/rbi/courier/models/journey_create_params.rbi +27 -0
- data/rbi/courier/models/journey_delay_duration_node.rbi +146 -0
- data/rbi/courier/models/journey_delay_until_node.rbi +139 -0
- data/rbi/courier/models/journey_exit_node.rbi +57 -0
- data/rbi/courier/models/journey_fetch_get_delete_node.rbi +186 -0
- data/rbi/courier/models/journey_fetch_post_put_node.rbi +190 -0
- data/rbi/courier/models/journey_list_versions_params.rbi +35 -0
- data/rbi/courier/models/journey_merge_strategy.rbi +26 -0
- data/rbi/courier/models/journey_node.rbi +227 -0
- data/rbi/courier/models/journey_publish_params.rbi +35 -0
- data/rbi/courier/models/journey_publish_request.rbi +28 -0
- data/rbi/courier/models/journey_replace_params.rbi +35 -0
- data/rbi/courier/models/journey_response.rbi +108 -0
- data/rbi/courier/models/journey_retrieve_params.rbi +52 -0
- data/rbi/courier/models/journey_segment_trigger_node.rbi +200 -0
- data/rbi/courier/models/journey_send_node.rbi +254 -0
- data/rbi/courier/models/journey_state.rbi +20 -0
- data/rbi/courier/models/journey_template_create_request.rbi +381 -0
- data/rbi/courier/models/journey_template_get_response.rbi +334 -0
- data/rbi/courier/models/journey_template_list_response.rbi +45 -0
- data/rbi/courier/models/journey_template_publish_request.rbi +31 -0
- data/rbi/courier/models/journey_template_replace_request.rbi +368 -0
- data/rbi/courier/models/journey_template_summary.rbi +85 -0
- data/rbi/courier/models/journey_throttle_dynamic_node.rbi +162 -0
- data/rbi/courier/models/journey_throttle_static_node.rbi +158 -0
- data/rbi/courier/models/journey_version_item.rbi +54 -0
- data/rbi/courier/models/journey_versions_list_response.rbi +45 -0
- data/rbi/courier/models/journeys/template_archive_params.rbi +48 -0
- data/rbi/courier/models/journeys/template_create_params.rbi +40 -0
- data/rbi/courier/models/journeys/template_list_params.rbi +68 -0
- data/rbi/courier/models/journeys/template_list_versions_params.rbi +48 -0
- data/rbi/courier/models/journeys/template_publish_params.rbi +48 -0
- data/rbi/courier/models/journeys/template_replace_params.rbi +48 -0
- data/rbi/courier/models/journeys/template_retrieve_params.rbi +48 -0
- data/rbi/courier/models/tenants/template_delete_params.rbi +48 -0
- data/rbi/courier/models.rbi +76 -0
- data/rbi/courier/resources/journeys/templates.rbi +160 -0
- data/rbi/courier/resources/journeys.rbi +156 -3
- data/rbi/courier/resources/tenants/templates.rbi +22 -0
- data/sig/courier/models/create_journey_request.rbs +41 -0
- data/sig/courier/models/journey_ai_node.rbs +72 -0
- data/sig/courier/models/journey_api_invoke_trigger_node.rbs +68 -0
- data/sig/courier/models/journey_archive_params.rbs +23 -0
- data/sig/courier/models/journey_condition_atom.rbs +7 -0
- data/sig/courier/models/journey_condition_group.rbs +33 -0
- data/sig/courier/models/journey_condition_nested_group.rbs +33 -0
- data/sig/courier/models/journey_conditions_field.rbs +14 -0
- data/sig/courier/models/journey_create_params.rbs +15 -0
- data/sig/courier/models/journey_delay_duration_node.rbs +66 -0
- data/sig/courier/models/journey_delay_until_node.rbs +66 -0
- data/sig/courier/models/journey_exit_node.rbs +34 -0
- data/sig/courier/models/journey_fetch_get_delete_node.rbs +93 -0
- data/sig/courier/models/journey_fetch_post_put_node.rbs +100 -0
- data/sig/courier/models/journey_list_versions_params.rbs +23 -0
- data/sig/courier/models/journey_merge_strategy.rbs +16 -0
- data/sig/courier/models/journey_node.rbs +117 -0
- data/sig/courier/models/journey_publish_params.rbs +25 -0
- data/sig/courier/models/journey_publish_request.rbs +15 -0
- data/sig/courier/models/journey_replace_params.rbs +25 -0
- data/sig/courier/models/journey_response.rbs +65 -0
- data/sig/courier/models/journey_retrieve_params.rbs +30 -0
- data/sig/courier/models/journey_segment_trigger_node.rbs +85 -0
- data/sig/courier/models/journey_send_node.rbs +140 -0
- data/sig/courier/models/journey_state.rbs +14 -0
- data/sig/courier/models/journey_template_create_request.rbs +148 -0
- data/sig/courier/models/journey_template_get_response.rbs +157 -0
- data/sig/courier/models/journey_template_list_response.rbs +25 -0
- data/sig/courier/models/journey_template_publish_request.rbs +15 -0
- data/sig/courier/models/journey_template_replace_request.rbs +136 -0
- data/sig/courier/models/journey_template_summary.rbs +59 -0
- data/sig/courier/models/journey_throttle_dynamic_node.rbs +76 -0
- data/sig/courier/models/journey_throttle_static_node.rbs +72 -0
- data/sig/courier/models/journey_version_item.rbs +40 -0
- data/sig/courier/models/journey_versions_list_response.rbs +22 -0
- data/sig/courier/models/journeys/template_archive_params.rbs +30 -0
- data/sig/courier/models/journeys/template_create_params.rbs +27 -0
- data/sig/courier/models/journeys/template_list_params.rbs +38 -0
- data/sig/courier/models/journeys/template_list_versions_params.rbs +30 -0
- data/sig/courier/models/journeys/template_publish_params.rbs +34 -0
- data/sig/courier/models/journeys/template_replace_params.rbs +34 -0
- data/sig/courier/models/journeys/template_retrieve_params.rbs +30 -0
- data/sig/courier/models/tenants/template_delete_params.rbs +30 -0
- data/sig/courier/models.rbs +72 -0
- data/sig/courier/resources/journeys/templates.rbs +58 -0
- data/sig/courier/resources/journeys.rbs +41 -0
- data/sig/courier/resources/tenants/templates.rbs +6 -0
- metadata +134 -2
data/rbi/courier/models.rbi
CHANGED
|
@@ -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
|
|
@@ -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,68 @@
|
|
|
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::JourneyExitNode::OrHash,
|
|
32
|
+
Courier::JourneyNode::JourneyBranchNode::OrHash
|
|
33
|
+
)
|
|
34
|
+
],
|
|
35
|
+
enabled: T::Boolean,
|
|
36
|
+
state: Courier::JourneyState::OrSymbol,
|
|
37
|
+
request_options: Courier::RequestOptions::OrHash
|
|
38
|
+
).returns(Courier::JourneyResponse)
|
|
39
|
+
end
|
|
40
|
+
def create(
|
|
41
|
+
name:,
|
|
42
|
+
nodes:,
|
|
43
|
+
enabled: nil,
|
|
44
|
+
# Lifecycle state of a journey.
|
|
45
|
+
state: nil,
|
|
46
|
+
request_options: {}
|
|
47
|
+
)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Fetch a journey by id. Pass `?version=draft` (default `published`) to retrieve
|
|
51
|
+
# the working draft, or `?version=vN` to retrieve a historical version.
|
|
52
|
+
sig do
|
|
53
|
+
params(
|
|
54
|
+
template_id: String,
|
|
55
|
+
version: String,
|
|
56
|
+
request_options: Courier::RequestOptions::OrHash
|
|
57
|
+
).returns(Courier::JourneyResponse)
|
|
58
|
+
end
|
|
59
|
+
def retrieve(
|
|
60
|
+
# Journey id
|
|
61
|
+
template_id,
|
|
62
|
+
# Version selector: `draft`, `published` (default), or `vN`.
|
|
63
|
+
version: nil,
|
|
64
|
+
request_options: {}
|
|
65
|
+
)
|
|
66
|
+
end
|
|
67
|
+
|
|
6
68
|
# Get the list of journeys.
|
|
7
69
|
sig do
|
|
8
70
|
params(
|
|
@@ -22,7 +84,23 @@ module Courier
|
|
|
22
84
|
)
|
|
23
85
|
end
|
|
24
86
|
|
|
25
|
-
#
|
|
87
|
+
# Archive a journey. Archived journeys cannot be invoked. Existing journey runs
|
|
88
|
+
# continue to completion.
|
|
89
|
+
sig do
|
|
90
|
+
params(
|
|
91
|
+
template_id: String,
|
|
92
|
+
request_options: Courier::RequestOptions::OrHash
|
|
93
|
+
).void
|
|
94
|
+
end
|
|
95
|
+
def archive(
|
|
96
|
+
# Journey id
|
|
97
|
+
template_id,
|
|
98
|
+
request_options: {}
|
|
99
|
+
)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Invoke a journey by id or alias to start a new run. The response includes a
|
|
103
|
+
# `runId` identifying the run.
|
|
26
104
|
sig do
|
|
27
105
|
params(
|
|
28
106
|
template_id: String,
|
|
@@ -33,8 +111,8 @@ module Courier
|
|
|
33
111
|
).returns(Courier::JourneysInvokeResponse)
|
|
34
112
|
end
|
|
35
113
|
def invoke(
|
|
36
|
-
# A unique identifier representing the journey
|
|
37
|
-
#
|
|
114
|
+
# A unique identifier representing the journey to be invoked. Accepts a Journey ID
|
|
115
|
+
# or Journey Alias.
|
|
38
116
|
template_id,
|
|
39
117
|
# Data payload passed to the journey. The expected shape can be predefined using
|
|
40
118
|
# the schema builder in the journey editor. This data is available in journey
|
|
@@ -55,6 +133,81 @@ module Courier
|
|
|
55
133
|
)
|
|
56
134
|
end
|
|
57
135
|
|
|
136
|
+
# List published versions of a journey, ordered most recent first.
|
|
137
|
+
sig do
|
|
138
|
+
params(
|
|
139
|
+
template_id: String,
|
|
140
|
+
request_options: Courier::RequestOptions::OrHash
|
|
141
|
+
).returns(Courier::JourneyVersionsListResponse)
|
|
142
|
+
end
|
|
143
|
+
def list_versions(
|
|
144
|
+
# Journey id
|
|
145
|
+
template_id,
|
|
146
|
+
request_options: {}
|
|
147
|
+
)
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# Publish the current draft as a new version. Body is optional; pass
|
|
151
|
+
# `{ "version": "vN" }` to roll back to a prior version instead. Returns 404 if
|
|
152
|
+
# the journey has no draft to publish.
|
|
153
|
+
sig do
|
|
154
|
+
params(
|
|
155
|
+
template_id: String,
|
|
156
|
+
version: String,
|
|
157
|
+
request_options: Courier::RequestOptions::OrHash
|
|
158
|
+
).returns(Courier::JourneyResponse)
|
|
159
|
+
end
|
|
160
|
+
def publish(
|
|
161
|
+
# Journey id
|
|
162
|
+
template_id,
|
|
163
|
+
version: nil,
|
|
164
|
+
request_options: {}
|
|
165
|
+
)
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
# Replace the journey draft. Updates the working draft only; call
|
|
169
|
+
# `POST /journeys/{templateId}/publish` to make it live, or pass
|
|
170
|
+
# `state: "PUBLISHED"` in this request to publish immediately. Send-node
|
|
171
|
+
# `template` ids must already exist and be scoped to this journey, and node ids
|
|
172
|
+
# must not be claimed by another journey.
|
|
173
|
+
sig do
|
|
174
|
+
params(
|
|
175
|
+
template_id: String,
|
|
176
|
+
name: String,
|
|
177
|
+
nodes:
|
|
178
|
+
T::Array[
|
|
179
|
+
T.any(
|
|
180
|
+
Courier::JourneyAPIInvokeTriggerNode::OrHash,
|
|
181
|
+
Courier::JourneySegmentTriggerNode::OrHash,
|
|
182
|
+
Courier::JourneySendNode::OrHash,
|
|
183
|
+
Courier::JourneyDelayDurationNode::OrHash,
|
|
184
|
+
Courier::JourneyDelayUntilNode::OrHash,
|
|
185
|
+
Courier::JourneyFetchGetDeleteNode::OrHash,
|
|
186
|
+
Courier::JourneyFetchPostPutNode::OrHash,
|
|
187
|
+
Courier::JourneyAINode::OrHash,
|
|
188
|
+
Courier::JourneyThrottleStaticNode::OrHash,
|
|
189
|
+
Courier::JourneyThrottleDynamicNode::OrHash,
|
|
190
|
+
Courier::JourneyExitNode::OrHash,
|
|
191
|
+
Courier::JourneyNode::JourneyBranchNode::OrHash
|
|
192
|
+
)
|
|
193
|
+
],
|
|
194
|
+
enabled: T::Boolean,
|
|
195
|
+
state: Courier::JourneyState::OrSymbol,
|
|
196
|
+
request_options: Courier::RequestOptions::OrHash
|
|
197
|
+
).returns(Courier::JourneyResponse)
|
|
198
|
+
end
|
|
199
|
+
def replace(
|
|
200
|
+
# Journey id
|
|
201
|
+
template_id,
|
|
202
|
+
name:,
|
|
203
|
+
nodes:,
|
|
204
|
+
enabled: nil,
|
|
205
|
+
# Lifecycle state of a journey.
|
|
206
|
+
state: nil,
|
|
207
|
+
request_options: {}
|
|
208
|
+
)
|
|
209
|
+
end
|
|
210
|
+
|
|
58
211
|
# @api private
|
|
59
212
|
sig { params(client: Courier::Client).returns(T.attached_class) }
|
|
60
213
|
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
|
|
@@ -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
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
module Courier
|
|
2
|
+
module Models
|
|
3
|
+
type journey_api_invoke_trigger_node =
|
|
4
|
+
{
|
|
5
|
+
trigger_type: Courier::Models::JourneyAPIInvokeTriggerNode::trigger_type,
|
|
6
|
+
type: Courier::Models::JourneyAPIInvokeTriggerNode::type_,
|
|
7
|
+
id: String,
|
|
8
|
+
conditions: Courier::Models::journey_conditions_field,
|
|
9
|
+
schema: ::Hash[Symbol, top]
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
class JourneyAPIInvokeTriggerNode < Courier::Internal::Type::BaseModel
|
|
13
|
+
attr_accessor trigger_type: Courier::Models::JourneyAPIInvokeTriggerNode::trigger_type
|
|
14
|
+
|
|
15
|
+
attr_accessor type: Courier::Models::JourneyAPIInvokeTriggerNode::type_
|
|
16
|
+
|
|
17
|
+
attr_reader id: String?
|
|
18
|
+
|
|
19
|
+
def id=: (String) -> String
|
|
20
|
+
|
|
21
|
+
attr_reader conditions: Courier::Models::journey_conditions_field?
|
|
22
|
+
|
|
23
|
+
def conditions=: (
|
|
24
|
+
Courier::Models::journey_conditions_field
|
|
25
|
+
) -> Courier::Models::journey_conditions_field
|
|
26
|
+
|
|
27
|
+
attr_reader schema: ::Hash[Symbol, top]?
|
|
28
|
+
|
|
29
|
+
def schema=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top]
|
|
30
|
+
|
|
31
|
+
def initialize: (
|
|
32
|
+
trigger_type: Courier::Models::JourneyAPIInvokeTriggerNode::trigger_type,
|
|
33
|
+
type: Courier::Models::JourneyAPIInvokeTriggerNode::type_,
|
|
34
|
+
?id: String,
|
|
35
|
+
?conditions: Courier::Models::journey_conditions_field,
|
|
36
|
+
?schema: ::Hash[Symbol, top]
|
|
37
|
+
) -> void
|
|
38
|
+
|
|
39
|
+
def to_hash: -> {
|
|
40
|
+
trigger_type: Courier::Models::JourneyAPIInvokeTriggerNode::trigger_type,
|
|
41
|
+
type: Courier::Models::JourneyAPIInvokeTriggerNode::type_,
|
|
42
|
+
id: String,
|
|
43
|
+
conditions: Courier::Models::journey_conditions_field,
|
|
44
|
+
schema: ::Hash[Symbol, top]
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
type trigger_type = :"api-invoke"
|
|
48
|
+
|
|
49
|
+
module TriggerType
|
|
50
|
+
extend Courier::Internal::Type::Enum
|
|
51
|
+
|
|
52
|
+
API_INVOKE: :"api-invoke"
|
|
53
|
+
|
|
54
|
+
def self?.values: -> ::Array[Courier::Models::JourneyAPIInvokeTriggerNode::trigger_type]
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
type type_ = :trigger
|
|
58
|
+
|
|
59
|
+
module Type
|
|
60
|
+
extend Courier::Internal::Type::Enum
|
|
61
|
+
|
|
62
|
+
TRIGGER: :trigger
|
|
63
|
+
|
|
64
|
+
def self?.values: -> ::Array[Courier::Models::JourneyAPIInvokeTriggerNode::type_]
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Courier
|
|
2
|
+
module Models
|
|
3
|
+
type journey_archive_params =
|
|
4
|
+
{ template_id: String } & Courier::Internal::Type::request_parameters
|
|
5
|
+
|
|
6
|
+
class JourneyArchiveParams < Courier::Internal::Type::BaseModel
|
|
7
|
+
extend Courier::Internal::Type::RequestParameters::Converter
|
|
8
|
+
include Courier::Internal::Type::RequestParameters
|
|
9
|
+
|
|
10
|
+
attr_accessor template_id: String
|
|
11
|
+
|
|
12
|
+
def initialize: (
|
|
13
|
+
template_id: String,
|
|
14
|
+
?request_options: Courier::request_opts
|
|
15
|
+
) -> void
|
|
16
|
+
|
|
17
|
+
def to_hash: -> {
|
|
18
|
+
template_id: String,
|
|
19
|
+
request_options: Courier::RequestOptions
|
|
20
|
+
}
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|