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
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
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
|
+
#
|
|
10
|
+
# @overload create(template_id, channel:, notification:, provider_key: nil, state: nil, request_options: {})
|
|
11
|
+
#
|
|
12
|
+
# @param template_id [String] Journey id
|
|
13
|
+
#
|
|
14
|
+
# @param channel [String]
|
|
15
|
+
#
|
|
16
|
+
# @param notification [Courier::Models::JourneyTemplateCreateRequest::Notification]
|
|
17
|
+
#
|
|
18
|
+
# @param provider_key [String]
|
|
19
|
+
#
|
|
20
|
+
# @param state [String]
|
|
21
|
+
#
|
|
22
|
+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
23
|
+
#
|
|
24
|
+
# @return [Courier::Models::JourneyTemplateGetResponse]
|
|
25
|
+
#
|
|
26
|
+
# @see Courier::Models::Journeys::TemplateCreateParams
|
|
27
|
+
def create(template_id, params)
|
|
28
|
+
parsed, options = Courier::Journeys::TemplateCreateParams.dump_request(params)
|
|
29
|
+
@client.request(
|
|
30
|
+
method: :post,
|
|
31
|
+
path: ["journeys/%1$s/templates", template_id],
|
|
32
|
+
body: parsed,
|
|
33
|
+
model: Courier::JourneyTemplateGetResponse,
|
|
34
|
+
options: options
|
|
35
|
+
)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Fetch a journey-scoped notification template by id. Pass `?version=draft`
|
|
39
|
+
# (default `published`) to retrieve the working draft, or `?version=vN` for a
|
|
40
|
+
# historical version.
|
|
41
|
+
#
|
|
42
|
+
# @overload retrieve(notification_id, template_id:, request_options: {})
|
|
43
|
+
#
|
|
44
|
+
# @param notification_id [String] Notification template id
|
|
45
|
+
#
|
|
46
|
+
# @param template_id [String] Journey id
|
|
47
|
+
#
|
|
48
|
+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
49
|
+
#
|
|
50
|
+
# @return [Courier::Models::JourneyTemplateGetResponse]
|
|
51
|
+
#
|
|
52
|
+
# @see Courier::Models::Journeys::TemplateRetrieveParams
|
|
53
|
+
def retrieve(notification_id, params)
|
|
54
|
+
parsed, options = Courier::Journeys::TemplateRetrieveParams.dump_request(params)
|
|
55
|
+
template_id =
|
|
56
|
+
parsed.delete(:template_id) do
|
|
57
|
+
raise ArgumentError.new("missing required path argument #{_1}")
|
|
58
|
+
end
|
|
59
|
+
@client.request(
|
|
60
|
+
method: :get,
|
|
61
|
+
path: ["journeys/%1$s/templates/%2$s", template_id, notification_id],
|
|
62
|
+
model: Courier::JourneyTemplateGetResponse,
|
|
63
|
+
options: options
|
|
64
|
+
)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# List notification templates scoped to this journey. Journey-scoped notification
|
|
68
|
+
# templates can only be referenced from `send` nodes within the same journey.
|
|
69
|
+
#
|
|
70
|
+
# @overload list(template_id, cursor: nil, limit: nil, request_options: {})
|
|
71
|
+
#
|
|
72
|
+
# @param template_id [String] Journey id
|
|
73
|
+
#
|
|
74
|
+
# @param cursor [String] Pagination cursor from a prior response.
|
|
75
|
+
#
|
|
76
|
+
# @param limit [Integer] Page size. Minimum 1, maximum 100.
|
|
77
|
+
#
|
|
78
|
+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
79
|
+
#
|
|
80
|
+
# @return [Courier::Models::JourneyTemplateListResponse]
|
|
81
|
+
#
|
|
82
|
+
# @see Courier::Models::Journeys::TemplateListParams
|
|
83
|
+
def list(template_id, params = {})
|
|
84
|
+
parsed, options = Courier::Journeys::TemplateListParams.dump_request(params)
|
|
85
|
+
query = Courier::Internal::Util.encode_query_params(parsed)
|
|
86
|
+
@client.request(
|
|
87
|
+
method: :get,
|
|
88
|
+
path: ["journeys/%1$s/templates", template_id],
|
|
89
|
+
query: query,
|
|
90
|
+
model: Courier::JourneyTemplateListResponse,
|
|
91
|
+
options: options
|
|
92
|
+
)
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Archive the journey-scoped notification template. Archived templates cannot be
|
|
96
|
+
# sent.
|
|
97
|
+
#
|
|
98
|
+
# @overload archive(notification_id, template_id:, request_options: {})
|
|
99
|
+
#
|
|
100
|
+
# @param notification_id [String] Notification template id
|
|
101
|
+
#
|
|
102
|
+
# @param template_id [String] Journey id
|
|
103
|
+
#
|
|
104
|
+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
105
|
+
#
|
|
106
|
+
# @return [nil]
|
|
107
|
+
#
|
|
108
|
+
# @see Courier::Models::Journeys::TemplateArchiveParams
|
|
109
|
+
def archive(notification_id, params)
|
|
110
|
+
parsed, options = Courier::Journeys::TemplateArchiveParams.dump_request(params)
|
|
111
|
+
template_id =
|
|
112
|
+
parsed.delete(:template_id) do
|
|
113
|
+
raise ArgumentError.new("missing required path argument #{_1}")
|
|
114
|
+
end
|
|
115
|
+
@client.request(
|
|
116
|
+
method: :delete,
|
|
117
|
+
path: ["journeys/%1$s/templates/%2$s", template_id, notification_id],
|
|
118
|
+
model: NilClass,
|
|
119
|
+
options: options
|
|
120
|
+
)
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# List published versions of the journey-scoped notification template, ordered
|
|
124
|
+
# most recent first.
|
|
125
|
+
#
|
|
126
|
+
# @overload list_versions(notification_id, template_id:, request_options: {})
|
|
127
|
+
#
|
|
128
|
+
# @param notification_id [String] Notification template id
|
|
129
|
+
#
|
|
130
|
+
# @param template_id [String] Journey id
|
|
131
|
+
#
|
|
132
|
+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
133
|
+
#
|
|
134
|
+
# @return [Courier::Models::NotificationTemplateVersionListResponse]
|
|
135
|
+
#
|
|
136
|
+
# @see Courier::Models::Journeys::TemplateListVersionsParams
|
|
137
|
+
def list_versions(notification_id, params)
|
|
138
|
+
parsed, options = Courier::Journeys::TemplateListVersionsParams.dump_request(params)
|
|
139
|
+
template_id =
|
|
140
|
+
parsed.delete(:template_id) do
|
|
141
|
+
raise ArgumentError.new("missing required path argument #{_1}")
|
|
142
|
+
end
|
|
143
|
+
@client.request(
|
|
144
|
+
method: :get,
|
|
145
|
+
path: ["journeys/%1$s/templates/%2$s/versions", template_id, notification_id],
|
|
146
|
+
model: Courier::NotificationTemplateVersionListResponse,
|
|
147
|
+
options: options
|
|
148
|
+
)
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# Publish the current draft of the journey-scoped notification template as a new
|
|
152
|
+
# version. Optionally roll back to a prior version by passing
|
|
153
|
+
# `{ "version": "vN" }`.
|
|
154
|
+
#
|
|
155
|
+
# @overload publish(notification_id, template_id:, version: nil, request_options: {})
|
|
156
|
+
#
|
|
157
|
+
# @param notification_id [String] Path param: Notification template id
|
|
158
|
+
#
|
|
159
|
+
# @param template_id [String] Path param: Journey id
|
|
160
|
+
#
|
|
161
|
+
# @param version [String] Body param
|
|
162
|
+
#
|
|
163
|
+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
164
|
+
#
|
|
165
|
+
# @return [nil]
|
|
166
|
+
#
|
|
167
|
+
# @see Courier::Models::Journeys::TemplatePublishParams
|
|
168
|
+
def publish(notification_id, params)
|
|
169
|
+
parsed, options = Courier::Journeys::TemplatePublishParams.dump_request(params)
|
|
170
|
+
template_id =
|
|
171
|
+
parsed.delete(:template_id) do
|
|
172
|
+
raise ArgumentError.new("missing required path argument #{_1}")
|
|
173
|
+
end
|
|
174
|
+
@client.request(
|
|
175
|
+
method: :post,
|
|
176
|
+
path: ["journeys/%1$s/templates/%2$s/publish", template_id, notification_id],
|
|
177
|
+
body: parsed,
|
|
178
|
+
model: NilClass,
|
|
179
|
+
options: options
|
|
180
|
+
)
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
# Replace the journey-scoped notification template draft.
|
|
184
|
+
#
|
|
185
|
+
# @overload replace(notification_id, template_id:, notification:, state: nil, request_options: {})
|
|
186
|
+
#
|
|
187
|
+
# @param notification_id [String] Path param: Notification template id
|
|
188
|
+
#
|
|
189
|
+
# @param template_id [String] Path param: Journey id
|
|
190
|
+
#
|
|
191
|
+
# @param notification [Courier::Models::JourneyTemplateReplaceRequest::Notification] Body param
|
|
192
|
+
#
|
|
193
|
+
# @param state [String] Body param
|
|
194
|
+
#
|
|
195
|
+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
196
|
+
#
|
|
197
|
+
# @return [Courier::Models::JourneyTemplateGetResponse]
|
|
198
|
+
#
|
|
199
|
+
# @see Courier::Models::Journeys::TemplateReplaceParams
|
|
200
|
+
def replace(notification_id, params)
|
|
201
|
+
parsed, options = Courier::Journeys::TemplateReplaceParams.dump_request(params)
|
|
202
|
+
template_id =
|
|
203
|
+
parsed.delete(:template_id) do
|
|
204
|
+
raise ArgumentError.new("missing required path argument #{_1}")
|
|
205
|
+
end
|
|
206
|
+
@client.request(
|
|
207
|
+
method: :put,
|
|
208
|
+
path: ["journeys/%1$s/templates/%2$s", template_id, notification_id],
|
|
209
|
+
body: parsed,
|
|
210
|
+
model: Courier::JourneyTemplateGetResponse,
|
|
211
|
+
options: options
|
|
212
|
+
)
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
# @api private
|
|
216
|
+
#
|
|
217
|
+
# @param client [Courier::Client]
|
|
218
|
+
def initialize(client:)
|
|
219
|
+
@client = client
|
|
220
|
+
end
|
|
221
|
+
end
|
|
222
|
+
end
|
|
223
|
+
end
|
|
224
|
+
end
|
|
@@ -3,6 +3,68 @@
|
|
|
3
3
|
module Courier
|
|
4
4
|
module Resources
|
|
5
5
|
class Journeys
|
|
6
|
+
# @return [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
|
+
#
|
|
16
|
+
# @overload create(name:, nodes:, enabled: nil, state: nil, request_options: {})
|
|
17
|
+
#
|
|
18
|
+
# @param name [String]
|
|
19
|
+
#
|
|
20
|
+
# @param nodes [Array<Courier::Models::JourneyAPIInvokeTriggerNode, Courier::Models::JourneySegmentTriggerNode, Courier::Models::JourneySendNode, Courier::Models::JourneyDelayDurationNode, Courier::Models::JourneyDelayUntilNode, Courier::Models::JourneyFetchGetDeleteNode, Courier::Models::JourneyFetchPostPutNode, Courier::Models::JourneyAINode, Courier::Models::JourneyThrottleStaticNode, Courier::Models::JourneyThrottleDynamicNode, Courier::Models::JourneyExitNode, Courier::Models::JourneyNode::JourneyBranchNode>]
|
|
21
|
+
#
|
|
22
|
+
# @param enabled [Boolean]
|
|
23
|
+
#
|
|
24
|
+
# @param state [Symbol, Courier::Models::JourneyState] Lifecycle state of a journey.
|
|
25
|
+
#
|
|
26
|
+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
27
|
+
#
|
|
28
|
+
# @return [Courier::Models::JourneyResponse]
|
|
29
|
+
#
|
|
30
|
+
# @see Courier::Models::JourneyCreateParams
|
|
31
|
+
def create(params)
|
|
32
|
+
parsed, options = Courier::JourneyCreateParams.dump_request(params)
|
|
33
|
+
@client.request(
|
|
34
|
+
method: :post,
|
|
35
|
+
path: "journeys",
|
|
36
|
+
body: parsed,
|
|
37
|
+
model: Courier::JourneyResponse,
|
|
38
|
+
options: options
|
|
39
|
+
)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Fetch a journey by id. Pass `?version=draft` (default `published`) to retrieve
|
|
43
|
+
# the working draft, or `?version=vN` to retrieve a historical version.
|
|
44
|
+
#
|
|
45
|
+
# @overload retrieve(template_id, version: nil, request_options: {})
|
|
46
|
+
#
|
|
47
|
+
# @param template_id [String] Journey id
|
|
48
|
+
#
|
|
49
|
+
# @param version [String] Version selector: `draft`, `published` (default), or `vN`.
|
|
50
|
+
#
|
|
51
|
+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
52
|
+
#
|
|
53
|
+
# @return [Courier::Models::JourneyResponse]
|
|
54
|
+
#
|
|
55
|
+
# @see Courier::Models::JourneyRetrieveParams
|
|
56
|
+
def retrieve(template_id, params = {})
|
|
57
|
+
parsed, options = Courier::JourneyRetrieveParams.dump_request(params)
|
|
58
|
+
query = Courier::Internal::Util.encode_query_params(parsed)
|
|
59
|
+
@client.request(
|
|
60
|
+
method: :get,
|
|
61
|
+
path: ["journeys/%1$s", template_id],
|
|
62
|
+
query: query,
|
|
63
|
+
model: Courier::JourneyResponse,
|
|
64
|
+
options: options
|
|
65
|
+
)
|
|
66
|
+
end
|
|
67
|
+
|
|
6
68
|
# Some parameter documentations has been truncated, see
|
|
7
69
|
# {Courier::Models::JourneyListParams} for more details.
|
|
8
70
|
#
|
|
@@ -31,14 +93,36 @@ module Courier
|
|
|
31
93
|
)
|
|
32
94
|
end
|
|
33
95
|
|
|
96
|
+
# Archive a journey. Archived journeys cannot be invoked. Existing journey runs
|
|
97
|
+
# continue to completion.
|
|
98
|
+
#
|
|
99
|
+
# @overload archive(template_id, request_options: {})
|
|
100
|
+
#
|
|
101
|
+
# @param template_id [String] Journey id
|
|
102
|
+
#
|
|
103
|
+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
104
|
+
#
|
|
105
|
+
# @return [nil]
|
|
106
|
+
#
|
|
107
|
+
# @see Courier::Models::JourneyArchiveParams
|
|
108
|
+
def archive(template_id, params = {})
|
|
109
|
+
@client.request(
|
|
110
|
+
method: :delete,
|
|
111
|
+
path: ["journeys/%1$s", template_id],
|
|
112
|
+
model: NilClass,
|
|
113
|
+
options: params[:request_options]
|
|
114
|
+
)
|
|
115
|
+
end
|
|
116
|
+
|
|
34
117
|
# Some parameter documentations has been truncated, see
|
|
35
118
|
# {Courier::Models::JourneyInvokeParams} for more details.
|
|
36
119
|
#
|
|
37
|
-
# Invoke a journey
|
|
120
|
+
# Invoke a journey by id or alias to start a new run. The response includes a
|
|
121
|
+
# `runId` identifying the run.
|
|
38
122
|
#
|
|
39
123
|
# @overload invoke(template_id, data: nil, profile: nil, user_id: nil, request_options: {})
|
|
40
124
|
#
|
|
41
|
-
# @param template_id [String] A unique identifier representing the journey
|
|
125
|
+
# @param template_id [String] A unique identifier representing the journey to be invoked. Accepts a Journey ID
|
|
42
126
|
#
|
|
43
127
|
# @param data [Hash{Symbol=>Object}] Data payload passed to the journey. The expected shape can be predefined using t
|
|
44
128
|
#
|
|
@@ -62,11 +146,92 @@ module Courier
|
|
|
62
146
|
)
|
|
63
147
|
end
|
|
64
148
|
|
|
149
|
+
# List published versions of a journey, ordered most recent first.
|
|
150
|
+
#
|
|
151
|
+
# @overload list_versions(template_id, request_options: {})
|
|
152
|
+
#
|
|
153
|
+
# @param template_id [String] Journey id
|
|
154
|
+
#
|
|
155
|
+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
156
|
+
#
|
|
157
|
+
# @return [Courier::Models::JourneyVersionsListResponse]
|
|
158
|
+
#
|
|
159
|
+
# @see Courier::Models::JourneyListVersionsParams
|
|
160
|
+
def list_versions(template_id, params = {})
|
|
161
|
+
@client.request(
|
|
162
|
+
method: :get,
|
|
163
|
+
path: ["journeys/%1$s/versions", template_id],
|
|
164
|
+
model: Courier::JourneyVersionsListResponse,
|
|
165
|
+
options: params[:request_options]
|
|
166
|
+
)
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# Publish the current draft as a new version. Body is optional; pass
|
|
170
|
+
# `{ "version": "vN" }` to roll back to a prior version instead. Returns 404 if
|
|
171
|
+
# the journey has no draft to publish.
|
|
172
|
+
#
|
|
173
|
+
# @overload publish(template_id, version: nil, request_options: {})
|
|
174
|
+
#
|
|
175
|
+
# @param template_id [String] Journey id
|
|
176
|
+
#
|
|
177
|
+
# @param version [String]
|
|
178
|
+
#
|
|
179
|
+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
180
|
+
#
|
|
181
|
+
# @return [Courier::Models::JourneyResponse]
|
|
182
|
+
#
|
|
183
|
+
# @see Courier::Models::JourneyPublishParams
|
|
184
|
+
def publish(template_id, params = {})
|
|
185
|
+
parsed, options = Courier::JourneyPublishParams.dump_request(params)
|
|
186
|
+
@client.request(
|
|
187
|
+
method: :post,
|
|
188
|
+
path: ["journeys/%1$s/publish", template_id],
|
|
189
|
+
body: parsed,
|
|
190
|
+
model: Courier::JourneyResponse,
|
|
191
|
+
options: options
|
|
192
|
+
)
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# Replace the journey draft. Updates the working draft only; call
|
|
196
|
+
# `POST /journeys/{templateId}/publish` to make it live, or pass
|
|
197
|
+
# `state: "PUBLISHED"` in this request to publish immediately. Send-node
|
|
198
|
+
# `template` ids must already exist and be scoped to this journey, and node ids
|
|
199
|
+
# must not be claimed by another journey.
|
|
200
|
+
#
|
|
201
|
+
# @overload replace(template_id, name:, nodes:, enabled: nil, state: nil, request_options: {})
|
|
202
|
+
#
|
|
203
|
+
# @param template_id [String] Journey id
|
|
204
|
+
#
|
|
205
|
+
# @param name [String]
|
|
206
|
+
#
|
|
207
|
+
# @param nodes [Array<Courier::Models::JourneyAPIInvokeTriggerNode, Courier::Models::JourneySegmentTriggerNode, Courier::Models::JourneySendNode, Courier::Models::JourneyDelayDurationNode, Courier::Models::JourneyDelayUntilNode, Courier::Models::JourneyFetchGetDeleteNode, Courier::Models::JourneyFetchPostPutNode, Courier::Models::JourneyAINode, Courier::Models::JourneyThrottleStaticNode, Courier::Models::JourneyThrottleDynamicNode, Courier::Models::JourneyExitNode, Courier::Models::JourneyNode::JourneyBranchNode>]
|
|
208
|
+
#
|
|
209
|
+
# @param enabled [Boolean]
|
|
210
|
+
#
|
|
211
|
+
# @param state [Symbol, Courier::Models::JourneyState] Lifecycle state of a journey.
|
|
212
|
+
#
|
|
213
|
+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
214
|
+
#
|
|
215
|
+
# @return [Courier::Models::JourneyResponse]
|
|
216
|
+
#
|
|
217
|
+
# @see Courier::Models::JourneyReplaceParams
|
|
218
|
+
def replace(template_id, params)
|
|
219
|
+
parsed, options = Courier::JourneyReplaceParams.dump_request(params)
|
|
220
|
+
@client.request(
|
|
221
|
+
method: :put,
|
|
222
|
+
path: ["journeys/%1$s", template_id],
|
|
223
|
+
body: parsed,
|
|
224
|
+
model: Courier::JourneyResponse,
|
|
225
|
+
options: options
|
|
226
|
+
)
|
|
227
|
+
end
|
|
228
|
+
|
|
65
229
|
# @api private
|
|
66
230
|
#
|
|
67
231
|
# @param client [Courier::Client]
|
|
68
232
|
def initialize(client:)
|
|
69
233
|
@client = client
|
|
234
|
+
@templates = Courier::Resources::Journeys::Templates.new(client: client)
|
|
70
235
|
end
|
|
71
236
|
end
|
|
72
237
|
end
|
|
@@ -61,6 +61,38 @@ module Courier
|
|
|
61
61
|
)
|
|
62
62
|
end
|
|
63
63
|
|
|
64
|
+
# Deletes the tenant's notification template with the given `template_id`.
|
|
65
|
+
#
|
|
66
|
+
# Returns **204 No Content** with an empty body on success.
|
|
67
|
+
#
|
|
68
|
+
# Returns **404** if there is no template with this ID for the tenant, including a
|
|
69
|
+
# second `DELETE` after a successful removal.
|
|
70
|
+
#
|
|
71
|
+
# @overload delete(template_id, tenant_id:, request_options: {})
|
|
72
|
+
#
|
|
73
|
+
# @param template_id [String] Id of the template to remove from the tenant.
|
|
74
|
+
#
|
|
75
|
+
# @param tenant_id [String] Id of the tenant that owns the template.
|
|
76
|
+
#
|
|
77
|
+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
78
|
+
#
|
|
79
|
+
# @return [nil]
|
|
80
|
+
#
|
|
81
|
+
# @see Courier::Models::Tenants::TemplateDeleteParams
|
|
82
|
+
def delete(template_id, params)
|
|
83
|
+
parsed, options = Courier::Tenants::TemplateDeleteParams.dump_request(params)
|
|
84
|
+
tenant_id =
|
|
85
|
+
parsed.delete(:tenant_id) do
|
|
86
|
+
raise ArgumentError.new("missing required path argument #{_1}")
|
|
87
|
+
end
|
|
88
|
+
@client.request(
|
|
89
|
+
method: :delete,
|
|
90
|
+
path: ["tenants/%1$s/templates/%2$s", tenant_id, template_id],
|
|
91
|
+
model: NilClass,
|
|
92
|
+
options: options
|
|
93
|
+
)
|
|
94
|
+
end
|
|
95
|
+
|
|
64
96
|
# Some parameter documentations has been truncated, see
|
|
65
97
|
# {Courier::Models::Tenants::TemplatePublishParams} for more details.
|
|
66
98
|
#
|
data/lib/courier/version.rb
CHANGED
data/lib/courier.rb
CHANGED
|
@@ -58,7 +58,12 @@ require_relative "courier/models/inbound_bulk_message_user"
|
|
|
58
58
|
require_relative "courier/models/base_check"
|
|
59
59
|
require_relative "courier/models/subscription_topic_new"
|
|
60
60
|
require_relative "courier/models/elemental_channel_node"
|
|
61
|
+
require_relative "courier/models/create_journey_request"
|
|
61
62
|
require_relative "courier/models/journeys_invoke_request"
|
|
63
|
+
require_relative "courier/models/journey_publish_request"
|
|
64
|
+
require_relative "courier/models/journey_template_create_request"
|
|
65
|
+
require_relative "courier/models/journey_template_publish_request"
|
|
66
|
+
require_relative "courier/models/journey_template_replace_request"
|
|
62
67
|
require_relative "courier/models/message_details"
|
|
63
68
|
require_relative "courier/models/notification_template_create_request"
|
|
64
69
|
require_relative "courier/models/notification_template_publish_request"
|
|
@@ -154,10 +159,47 @@ require_relative "courier/models/inbound_track_event_response"
|
|
|
154
159
|
require_relative "courier/models/intercom"
|
|
155
160
|
require_relative "courier/models/intercom_recipient"
|
|
156
161
|
require_relative "courier/models/journey"
|
|
162
|
+
require_relative "courier/models/journey_ai_node"
|
|
163
|
+
require_relative "courier/models/journey_api_invoke_trigger_node"
|
|
164
|
+
require_relative "courier/models/journey_archive_params"
|
|
165
|
+
require_relative "courier/models/journey_condition_atom"
|
|
166
|
+
require_relative "courier/models/journey_condition_group"
|
|
167
|
+
require_relative "courier/models/journey_condition_nested_group"
|
|
168
|
+
require_relative "courier/models/journey_conditions_field"
|
|
169
|
+
require_relative "courier/models/journey_create_params"
|
|
170
|
+
require_relative "courier/models/journey_delay_duration_node"
|
|
171
|
+
require_relative "courier/models/journey_delay_until_node"
|
|
172
|
+
require_relative "courier/models/journey_exit_node"
|
|
173
|
+
require_relative "courier/models/journey_fetch_get_delete_node"
|
|
174
|
+
require_relative "courier/models/journey_fetch_post_put_node"
|
|
157
175
|
require_relative "courier/models/journey_invoke_params"
|
|
158
176
|
require_relative "courier/models/journey_list_params"
|
|
177
|
+
require_relative "courier/models/journey_list_versions_params"
|
|
178
|
+
require_relative "courier/models/journey_merge_strategy"
|
|
179
|
+
require_relative "courier/models/journey_node"
|
|
180
|
+
require_relative "courier/models/journey_publish_params"
|
|
181
|
+
require_relative "courier/models/journey_replace_params"
|
|
182
|
+
require_relative "courier/models/journey_response"
|
|
183
|
+
require_relative "courier/models/journey_retrieve_params"
|
|
184
|
+
require_relative "courier/models/journeys/template_archive_params"
|
|
185
|
+
require_relative "courier/models/journeys/template_create_params"
|
|
186
|
+
require_relative "courier/models/journeys/template_list_params"
|
|
187
|
+
require_relative "courier/models/journeys/template_list_versions_params"
|
|
188
|
+
require_relative "courier/models/journeys/template_publish_params"
|
|
189
|
+
require_relative "courier/models/journeys/template_replace_params"
|
|
190
|
+
require_relative "courier/models/journeys/template_retrieve_params"
|
|
191
|
+
require_relative "courier/models/journey_segment_trigger_node"
|
|
192
|
+
require_relative "courier/models/journey_send_node"
|
|
159
193
|
require_relative "courier/models/journeys_invoke_response"
|
|
160
194
|
require_relative "courier/models/journeys_list_response"
|
|
195
|
+
require_relative "courier/models/journey_state"
|
|
196
|
+
require_relative "courier/models/journey_template_get_response"
|
|
197
|
+
require_relative "courier/models/journey_template_list_response"
|
|
198
|
+
require_relative "courier/models/journey_template_summary"
|
|
199
|
+
require_relative "courier/models/journey_throttle_dynamic_node"
|
|
200
|
+
require_relative "courier/models/journey_throttle_static_node"
|
|
201
|
+
require_relative "courier/models/journey_version_item"
|
|
202
|
+
require_relative "courier/models/journey_versions_list_response"
|
|
161
203
|
require_relative "courier/models/list_delete_params"
|
|
162
204
|
require_relative "courier/models/list_filter"
|
|
163
205
|
require_relative "courier/models/list_list_params"
|
|
@@ -291,6 +333,7 @@ require_relative "courier/models/tenant_list_users_response"
|
|
|
291
333
|
require_relative "courier/models/tenant_retrieve_params"
|
|
292
334
|
require_relative "courier/models/tenants/preferences/item_delete_params"
|
|
293
335
|
require_relative "courier/models/tenants/preferences/item_update_params"
|
|
336
|
+
require_relative "courier/models/tenants/template_delete_params"
|
|
294
337
|
require_relative "courier/models/tenants/template_list_params"
|
|
295
338
|
require_relative "courier/models/tenants/template_list_response"
|
|
296
339
|
require_relative "courier/models/tenants/template_publish_params"
|
|
@@ -348,6 +391,7 @@ require_relative "courier/resources/brands"
|
|
|
348
391
|
require_relative "courier/resources/bulk"
|
|
349
392
|
require_relative "courier/resources/inbound"
|
|
350
393
|
require_relative "courier/resources/journeys"
|
|
394
|
+
require_relative "courier/resources/journeys/templates"
|
|
351
395
|
require_relative "courier/resources/lists"
|
|
352
396
|
require_relative "courier/resources/lists/subscriptions"
|
|
353
397
|
require_relative "courier/resources/messages"
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Courier
|
|
4
|
+
module Models
|
|
5
|
+
class CreateJourneyRequest < Courier::Internal::Type::BaseModel
|
|
6
|
+
OrHash =
|
|
7
|
+
T.type_alias do
|
|
8
|
+
T.any(Courier::CreateJourneyRequest, Courier::Internal::AnyHash)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
sig { returns(String) }
|
|
12
|
+
attr_accessor :name
|
|
13
|
+
|
|
14
|
+
sig do
|
|
15
|
+
returns(
|
|
16
|
+
T::Array[
|
|
17
|
+
T.any(
|
|
18
|
+
Courier::JourneyAPIInvokeTriggerNode,
|
|
19
|
+
Courier::JourneySegmentTriggerNode,
|
|
20
|
+
Courier::JourneySendNode,
|
|
21
|
+
Courier::JourneyDelayDurationNode,
|
|
22
|
+
Courier::JourneyDelayUntilNode,
|
|
23
|
+
Courier::JourneyFetchGetDeleteNode,
|
|
24
|
+
Courier::JourneyFetchPostPutNode,
|
|
25
|
+
Courier::JourneyAINode,
|
|
26
|
+
Courier::JourneyThrottleStaticNode,
|
|
27
|
+
Courier::JourneyThrottleDynamicNode,
|
|
28
|
+
Courier::JourneyExitNode,
|
|
29
|
+
Courier::JourneyNode::JourneyBranchNode
|
|
30
|
+
)
|
|
31
|
+
]
|
|
32
|
+
)
|
|
33
|
+
end
|
|
34
|
+
attr_accessor :nodes
|
|
35
|
+
|
|
36
|
+
sig { returns(T.nilable(T::Boolean)) }
|
|
37
|
+
attr_reader :enabled
|
|
38
|
+
|
|
39
|
+
sig { params(enabled: T::Boolean).void }
|
|
40
|
+
attr_writer :enabled
|
|
41
|
+
|
|
42
|
+
# Lifecycle state of a journey.
|
|
43
|
+
sig { returns(T.nilable(Courier::JourneyState::OrSymbol)) }
|
|
44
|
+
attr_reader :state
|
|
45
|
+
|
|
46
|
+
sig { params(state: Courier::JourneyState::OrSymbol).void }
|
|
47
|
+
attr_writer :state
|
|
48
|
+
|
|
49
|
+
# Request body for creating a journey.
|
|
50
|
+
sig do
|
|
51
|
+
params(
|
|
52
|
+
name: String,
|
|
53
|
+
nodes:
|
|
54
|
+
T::Array[
|
|
55
|
+
T.any(
|
|
56
|
+
Courier::JourneyAPIInvokeTriggerNode::OrHash,
|
|
57
|
+
Courier::JourneySegmentTriggerNode::OrHash,
|
|
58
|
+
Courier::JourneySendNode::OrHash,
|
|
59
|
+
Courier::JourneyDelayDurationNode::OrHash,
|
|
60
|
+
Courier::JourneyDelayUntilNode::OrHash,
|
|
61
|
+
Courier::JourneyFetchGetDeleteNode::OrHash,
|
|
62
|
+
Courier::JourneyFetchPostPutNode::OrHash,
|
|
63
|
+
Courier::JourneyAINode::OrHash,
|
|
64
|
+
Courier::JourneyThrottleStaticNode::OrHash,
|
|
65
|
+
Courier::JourneyThrottleDynamicNode::OrHash,
|
|
66
|
+
Courier::JourneyExitNode::OrHash,
|
|
67
|
+
Courier::JourneyNode::JourneyBranchNode::OrHash
|
|
68
|
+
)
|
|
69
|
+
],
|
|
70
|
+
enabled: T::Boolean,
|
|
71
|
+
state: Courier::JourneyState::OrSymbol
|
|
72
|
+
).returns(T.attached_class)
|
|
73
|
+
end
|
|
74
|
+
def self.new(
|
|
75
|
+
name:,
|
|
76
|
+
nodes:,
|
|
77
|
+
enabled: nil,
|
|
78
|
+
# Lifecycle state of a journey.
|
|
79
|
+
state: nil
|
|
80
|
+
)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
sig do
|
|
84
|
+
override.returns(
|
|
85
|
+
{
|
|
86
|
+
name: String,
|
|
87
|
+
nodes:
|
|
88
|
+
T::Array[
|
|
89
|
+
T.any(
|
|
90
|
+
Courier::JourneyAPIInvokeTriggerNode,
|
|
91
|
+
Courier::JourneySegmentTriggerNode,
|
|
92
|
+
Courier::JourneySendNode,
|
|
93
|
+
Courier::JourneyDelayDurationNode,
|
|
94
|
+
Courier::JourneyDelayUntilNode,
|
|
95
|
+
Courier::JourneyFetchGetDeleteNode,
|
|
96
|
+
Courier::JourneyFetchPostPutNode,
|
|
97
|
+
Courier::JourneyAINode,
|
|
98
|
+
Courier::JourneyThrottleStaticNode,
|
|
99
|
+
Courier::JourneyThrottleDynamicNode,
|
|
100
|
+
Courier::JourneyExitNode,
|
|
101
|
+
Courier::JourneyNode::JourneyBranchNode
|
|
102
|
+
)
|
|
103
|
+
],
|
|
104
|
+
enabled: T::Boolean,
|
|
105
|
+
state: Courier::JourneyState::OrSymbol
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
end
|
|
109
|
+
def to_hash
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
end
|