trycourier 4.21.0 → 4.22.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 (174) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/lib/courier/client.rb +39 -0
  4. data/lib/courier/models/automations/invoke_invoke_ad_hoc_params.rb +13 -1
  5. data/lib/courier/models/automations/invoke_invoke_by_template_params.rb +13 -1
  6. data/lib/courier/models/brand_create_params.rb +13 -1
  7. data/lib/courier/models/inbox/message_delete_params.rb +22 -0
  8. data/lib/courier/models/inbox/message_restore_params.rb +22 -0
  9. data/lib/courier/models/journey_cancel_params.rb +13 -1
  10. data/lib/courier/models/journey_create_params.rb +13 -1
  11. data/lib/courier/models/journey_invoke_params.rb +13 -1
  12. data/lib/courier/models/journey_publish_params.rb +13 -1
  13. data/lib/courier/models/journeys/template_create_params.rb +13 -1
  14. data/lib/courier/models/journeys/template_publish_params.rb +13 -1
  15. data/lib/courier/models/lists/subscription_add_params.rb +13 -1
  16. data/lib/courier/models/notification_create_params.rb +13 -1
  17. data/lib/courier/models/notification_publish_params.rb +13 -1
  18. data/lib/courier/models/profile_create_params.rb +13 -1
  19. data/lib/courier/models/profiles/list_subscribe_params.rb +13 -1
  20. data/lib/courier/models/provider_create_params.rb +15 -1
  21. data/lib/courier/models/routing_strategy_create_params.rb +13 -1
  22. data/lib/courier/models/send_message_params.rb +15 -1
  23. data/lib/courier/models/users/preference_bulk_update_params.rb +15 -1
  24. data/lib/courier/models/users/preference_update_or_create_topic_params.rb +14 -4
  25. data/lib/courier/models/users/topic_preference.rb +21 -7
  26. data/lib/courier/models/workspace_preference_create_params.rb +13 -1
  27. data/lib/courier/models/workspace_preference_publish_params.rb +13 -1
  28. data/lib/courier/models/workspace_preferences/topic_create_params.rb +13 -1
  29. data/lib/courier/models.rb +2 -0
  30. data/lib/courier/resources/audiences.rb +12 -5
  31. data/lib/courier/resources/audit_events.rb +5 -2
  32. data/lib/courier/resources/auth.rb +5 -1
  33. data/lib/courier/resources/automations/invoke.rb +47 -23
  34. data/lib/courier/resources/automations.rb +6 -1
  35. data/lib/courier/resources/brands.rb +38 -12
  36. data/lib/courier/resources/digests/schedules.rb +4 -3
  37. data/lib/courier/resources/digests.rb +2 -0
  38. data/lib/courier/resources/inbound.rb +3 -1
  39. data/lib/courier/resources/inbox/messages.rb +58 -0
  40. data/lib/courier/resources/inbox.rb +19 -0
  41. data/lib/courier/resources/journeys/templates.rb +43 -25
  42. data/lib/courier/resources/journeys.rb +73 -44
  43. data/lib/courier/resources/lists/subscriptions.rb +22 -8
  44. data/lib/courier/resources/lists.rb +14 -5
  45. data/lib/courier/resources/messages.rb +14 -14
  46. data/lib/courier/resources/notifications/checks.rb +8 -3
  47. data/lib/courier/resources/notifications.rb +48 -30
  48. data/lib/courier/resources/profiles/lists.rb +19 -8
  49. data/lib/courier/resources/profiles.rb +25 -14
  50. data/lib/courier/resources/providers/catalog.rb +4 -4
  51. data/lib/courier/resources/providers.rb +27 -18
  52. data/lib/courier/resources/requests.rb +4 -1
  53. data/lib/courier/resources/routing_strategies.rb +24 -12
  54. data/lib/courier/resources/send.rb +14 -4
  55. data/lib/courier/resources/tenants/preferences/items.rb +6 -2
  56. data/lib/courier/resources/tenants/preferences.rb +2 -0
  57. data/lib/courier/resources/tenants/templates/versions.rb +4 -7
  58. data/lib/courier/resources/tenants/templates.rb +14 -19
  59. data/lib/courier/resources/tenants.rb +14 -5
  60. data/lib/courier/resources/translations.rb +6 -2
  61. data/lib/courier/resources/users/preferences.rb +23 -42
  62. data/lib/courier/resources/users/tenants.rb +12 -10
  63. data/lib/courier/resources/users/tokens.rb +14 -6
  64. data/lib/courier/resources/users.rb +6 -0
  65. data/lib/courier/resources/workspace_preferences/topics.rb +27 -19
  66. data/lib/courier/resources/workspace_preferences.rb +40 -20
  67. data/lib/courier/version.rb +1 -1
  68. data/lib/courier.rb +4 -0
  69. data/rbi/courier/client.rbi +38 -0
  70. data/rbi/courier/models/automations/invoke_invoke_ad_hoc_params.rbi +18 -0
  71. data/rbi/courier/models/automations/invoke_invoke_by_template_params.rbi +18 -0
  72. data/rbi/courier/models/brand_create_params.rbi +18 -0
  73. data/rbi/courier/models/inbox/message_delete_params.rbi +40 -0
  74. data/rbi/courier/models/inbox/message_restore_params.rbi +40 -0
  75. data/rbi/courier/models/journey_cancel_params.rbi +31 -5
  76. data/rbi/courier/models/journey_create_params.rbi +31 -5
  77. data/rbi/courier/models/journey_invoke_params.rbi +26 -2
  78. data/rbi/courier/models/journey_publish_params.rbi +26 -2
  79. data/rbi/courier/models/journeys/template_create_params.rbi +26 -2
  80. data/rbi/courier/models/journeys/template_publish_params.rbi +23 -1
  81. data/rbi/courier/models/lists/subscription_add_params.rbi +23 -1
  82. data/rbi/courier/models/notification_create_params.rbi +31 -5
  83. data/rbi/courier/models/notification_publish_params.rbi +26 -2
  84. data/rbi/courier/models/profile_create_params.rbi +23 -1
  85. data/rbi/courier/models/profiles/list_subscribe_params.rbi +23 -1
  86. data/rbi/courier/models/provider_create_params.rbi +18 -0
  87. data/rbi/courier/models/routing_strategy_create_params.rbi +31 -5
  88. data/rbi/courier/models/send_message_params.rbi +18 -0
  89. data/rbi/courier/models/users/preference_bulk_update_params.rbi +18 -0
  90. data/rbi/courier/models/users/preference_update_or_create_topic_params.rbi +14 -2
  91. data/rbi/courier/models/users/topic_preference.rbi +24 -2
  92. data/rbi/courier/models/workspace_preference_create_params.rbi +31 -5
  93. data/rbi/courier/models/workspace_preference_publish_params.rbi +31 -5
  94. data/rbi/courier/models/workspace_preferences/topic_create_params.rbi +26 -2
  95. data/rbi/courier/models.rbi +2 -0
  96. data/rbi/courier/resources/audiences.rbi +12 -5
  97. data/rbi/courier/resources/audit_events.rbi +5 -2
  98. data/rbi/courier/resources/auth.rbi +5 -1
  99. data/rbi/courier/resources/automations/invoke.rbi +48 -7
  100. data/rbi/courier/resources/automations.rbi +6 -1
  101. data/rbi/courier/resources/brands.rbi +37 -7
  102. data/rbi/courier/resources/digests/schedules.rbi +4 -3
  103. data/rbi/courier/resources/digests.rbi +2 -0
  104. data/rbi/courier/resources/inbound.rbi +3 -1
  105. data/rbi/courier/resources/inbox/messages.rbi +44 -0
  106. data/rbi/courier/resources/inbox.rbi +16 -0
  107. data/rbi/courier/resources/journeys/templates.rbi +47 -17
  108. data/rbi/courier/resources/journeys.rbi +93 -39
  109. data/rbi/courier/resources/lists/subscriptions.rbi +24 -5
  110. data/rbi/courier/resources/lists.rbi +14 -5
  111. data/rbi/courier/resources/messages.rbi +14 -14
  112. data/rbi/courier/resources/notifications/checks.rbi +8 -3
  113. data/rbi/courier/resources/notifications.rbi +58 -28
  114. data/rbi/courier/resources/profiles/lists.rbi +25 -6
  115. data/rbi/courier/resources/profiles.rbi +31 -11
  116. data/rbi/courier/resources/providers/catalog.rbi +4 -4
  117. data/rbi/courier/resources/providers.rbi +35 -19
  118. data/rbi/courier/resources/requests.rbi +4 -1
  119. data/rbi/courier/resources/routing_strategies.rbi +26 -10
  120. data/rbi/courier/resources/send.rbi +20 -3
  121. data/rbi/courier/resources/tenants/preferences/items.rbi +6 -2
  122. data/rbi/courier/resources/tenants/preferences.rbi +2 -0
  123. data/rbi/courier/resources/tenants/templates/versions.rbi +4 -7
  124. data/rbi/courier/resources/tenants/templates.rbi +14 -19
  125. data/rbi/courier/resources/tenants.rbi +14 -5
  126. data/rbi/courier/resources/translations.rbi +6 -2
  127. data/rbi/courier/resources/users/preferences.rbi +28 -40
  128. data/rbi/courier/resources/users/tenants.rbi +12 -10
  129. data/rbi/courier/resources/users/tokens.rbi +14 -6
  130. data/rbi/courier/resources/users.rbi +6 -0
  131. data/rbi/courier/resources/workspace_preferences/topics.rbi +37 -18
  132. data/rbi/courier/resources/workspace_preferences.rbi +51 -17
  133. data/sig/courier/client.rbs +2 -0
  134. data/sig/courier/models/automations/invoke_invoke_ad_hoc_params.rbs +15 -1
  135. data/sig/courier/models/automations/invoke_invoke_by_template_params.rbs +15 -1
  136. data/sig/courier/models/brand_create_params.rbs +15 -1
  137. data/sig/courier/models/inbox/message_delete_params.rbs +25 -0
  138. data/sig/courier/models/inbox/message_restore_params.rbs +25 -0
  139. data/sig/courier/models/journey_cancel_params.rbs +20 -3
  140. data/sig/courier/models/journey_create_params.rbs +20 -3
  141. data/sig/courier/models/journey_invoke_params.rbs +18 -1
  142. data/sig/courier/models/journey_publish_params.rbs +18 -1
  143. data/sig/courier/models/journeys/template_create_params.rbs +18 -1
  144. data/sig/courier/models/journeys/template_publish_params.rbs +18 -1
  145. data/sig/courier/models/lists/subscription_add_params.rbs +15 -1
  146. data/sig/courier/models/notification_create_params.rbs +20 -3
  147. data/sig/courier/models/notification_publish_params.rbs +18 -2
  148. data/sig/courier/models/profile_create_params.rbs +18 -1
  149. data/sig/courier/models/profiles/list_subscribe_params.rbs +15 -1
  150. data/sig/courier/models/provider_create_params.rbs +15 -1
  151. data/sig/courier/models/routing_strategy_create_params.rbs +20 -3
  152. data/sig/courier/models/send_message_params.rbs +17 -1
  153. data/sig/courier/models/users/preference_bulk_update_params.rbs +15 -1
  154. data/sig/courier/models/workspace_preference_create_params.rbs +20 -3
  155. data/sig/courier/models/workspace_preference_publish_params.rbs +20 -3
  156. data/sig/courier/models/workspace_preferences/topic_create_params.rbs +18 -1
  157. data/sig/courier/models.rbs +2 -0
  158. data/sig/courier/resources/automations/invoke.rbs +4 -0
  159. data/sig/courier/resources/brands.rbs +2 -0
  160. data/sig/courier/resources/inbox/messages.rbs +19 -0
  161. data/sig/courier/resources/inbox.rbs +9 -0
  162. data/sig/courier/resources/journeys/templates.rbs +4 -0
  163. data/sig/courier/resources/journeys.rbs +8 -0
  164. data/sig/courier/resources/lists/subscriptions.rbs +2 -0
  165. data/sig/courier/resources/notifications.rbs +4 -0
  166. data/sig/courier/resources/profiles/lists.rbs +2 -0
  167. data/sig/courier/resources/profiles.rbs +2 -0
  168. data/sig/courier/resources/providers.rbs +2 -0
  169. data/sig/courier/resources/routing_strategies.rbs +2 -0
  170. data/sig/courier/resources/send.rbs +2 -0
  171. data/sig/courier/resources/users/preferences.rbs +2 -0
  172. data/sig/courier/resources/workspace_preferences/topics.rbs +2 -0
  173. data/sig/courier/resources/workspace_preferences.rbs +4 -0
  174. metadata +14 -2
@@ -3,21 +3,30 @@
3
3
  module Courier
4
4
  module Resources
5
5
  class Journeys
6
+ # Build, version, publish, invoke, and cancel multi-step notification workflows,
7
+ # along with the templates scoped to them.
6
8
  class Templates
9
+ # Some parameter documentations has been truncated, see
10
+ # {Courier::Models::Journeys::TemplateCreateParams} for more details.
11
+ #
7
12
  # Create a notification template scoped to this journey. Defaults to `DRAFT`
8
13
  # state; pass `state: "PUBLISHED"` to publish on create.
9
14
  #
10
- # @overload create(template_id, channel:, notification:, provider_key: nil, state: nil, request_options: {})
15
+ # @overload create(template_id, channel:, notification:, provider_key: nil, state: nil, idempotency_key: nil, x_idempotency_expiration: nil, request_options: {})
11
16
  #
12
- # @param template_id [String] Journey id
17
+ # @param template_id [String] Path param: Journey id
13
18
  #
14
- # @param channel [String]
19
+ # @param channel [String] Body param
15
20
  #
16
- # @param notification [Courier::Models::JourneyTemplateCreateRequest::Notification]
21
+ # @param notification [Courier::Models::JourneyTemplateCreateRequest::Notification] Body param
22
+ #
23
+ # @param provider_key [String] Body param
24
+ #
25
+ # @param state [String] Body param
17
26
  #
18
- # @param provider_key [String]
27
+ # @param idempotency_key [String] Header param: A unique key that makes this request idempotent. If Courier receiv
19
28
  #
20
- # @param state [String]
29
+ # @param x_idempotency_expiration [String] Header param: How long the idempotency key remains valid, as a Unix epoch timest
21
30
  #
22
31
  # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
23
32
  #
@@ -26,18 +35,20 @@ module Courier
26
35
  # @see Courier::Models::Journeys::TemplateCreateParams
27
36
  def create(template_id, params)
28
37
  parsed, options = Courier::Journeys::TemplateCreateParams.dump_request(params)
38
+ header_params =
39
+ {idempotency_key: "idempotency-key", x_idempotency_expiration: "x-idempotency-expiration"}
29
40
  @client.request(
30
41
  method: :post,
31
42
  path: ["journeys/%1$s/templates", template_id],
32
- body: parsed,
43
+ headers: parsed.slice(*header_params.keys).transform_keys(header_params),
44
+ body: parsed.except(*header_params.keys),
33
45
  model: Courier::JourneyTemplateGetResponse,
34
46
  options: options
35
47
  )
36
48
  end
37
49
 
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.
50
+ # Returns a journey's own notification template with its name, brand, subscription
51
+ # topic, and content. Defaults to the published version.
41
52
  #
42
53
  # @overload retrieve(notification_id, template_id:, request_options: {})
43
54
  #
@@ -92,8 +103,8 @@ module Courier
92
103
  )
93
104
  end
94
105
 
95
- # Archive the journey-scoped notification template. Archived templates cannot be
96
- # sent.
106
+ # Archives one journey's notification template, preventing further sends. Detach
107
+ # any send node referencing it beforehand.
97
108
  #
98
109
  # @overload archive(notification_id, template_id:, request_options: {})
99
110
  #
@@ -120,8 +131,8 @@ module Courier
120
131
  )
121
132
  end
122
133
 
123
- # List published versions of the journey-scoped notification template, ordered
124
- # most recent first.
134
+ # Lists the published versions of a template that belongs to a journey, most
135
+ # recent first. Paged by cursor.
125
136
  #
126
137
  # @overload list_versions(notification_id, template_id:, request_options: {})
127
138
  #
@@ -148,11 +159,13 @@ module Courier
148
159
  )
149
160
  end
150
161
 
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" }`.
162
+ # Some parameter documentations has been truncated, see
163
+ # {Courier::Models::Journeys::TemplatePublishParams} for more details.
164
+ #
165
+ # Publishes a journey-scoped template's draft as a new version. Pass a version
166
+ # instead to roll back the template to an earlier publish.
154
167
  #
155
- # @overload publish(notification_id, template_id:, version: nil, request_options: {})
168
+ # @overload publish(notification_id, template_id:, version: nil, idempotency_key: nil, x_idempotency_expiration: nil, request_options: {})
156
169
  #
157
170
  # @param notification_id [String] Path param: Notification template id
158
171
  #
@@ -160,6 +173,10 @@ module Courier
160
173
  #
161
174
  # @param version [String] Body param
162
175
  #
176
+ # @param idempotency_key [String] Header param: A unique key that makes this request idempotent. If Courier receiv
177
+ #
178
+ # @param x_idempotency_expiration [String] Header param: How long the idempotency key remains valid, as a Unix epoch timest
179
+ #
163
180
  # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
164
181
  #
165
182
  # @return [nil]
@@ -171,10 +188,13 @@ module Courier
171
188
  parsed.delete(:template_id) do
172
189
  raise ArgumentError.new("missing required path argument #{_1}")
173
190
  end
191
+ header_params =
192
+ {idempotency_key: "idempotency-key", x_idempotency_expiration: "x-idempotency-expiration"}
174
193
  @client.request(
175
194
  method: :post,
176
195
  path: ["journeys/%1$s/templates/%2$s/publish", template_id, notification_id],
177
- body: parsed,
196
+ headers: parsed.slice(*header_params.keys).transform_keys(header_params),
197
+ body: parsed.except(*header_params.keys),
178
198
  model: NilClass,
179
199
  options: options
180
200
  )
@@ -255,7 +275,8 @@ module Courier
255
275
  )
256
276
  end
257
277
 
258
- # Replace the journey-scoped notification template draft.
278
+ # Replaces the draft content of one journey's notification template. Publish it
279
+ # before send nodes referencing it render the change.
259
280
  #
260
281
  # @overload replace(notification_id, template_id:, notification:, state: nil, request_options: {})
261
282
  #
@@ -290,11 +311,8 @@ module Courier
290
311
  # Some parameter documentations has been truncated, see
291
312
  # {Courier::Models::Journeys::TemplateRetrieveContentParams} for more details.
292
313
  #
293
- # Retrieve the elemental content of a journey-scoped notification template. The
294
- # response contains the versioned elements along with their content checksums,
295
- # which can be used to detect changes between versions. Pass `?version=draft`
296
- # (default `published`) to retrieve the working draft, or `?version=vN` for a
297
- # historical version.
314
+ # Returns the Elemental elements and version of a journey-scoped template's
315
+ # content. Compare versions to see what changed between publishes.
298
316
  #
299
317
  # @overload retrieve_content(notification_id, template_id:, version: nil, request_options: {})
300
318
  #
@@ -2,26 +2,33 @@
2
2
 
3
3
  module Courier
4
4
  module Resources
5
+ # Build, version, publish, invoke, and cancel multi-step notification workflows,
6
+ # along with the templates scoped to them.
5
7
  class Journeys
8
+ # Build, version, publish, invoke, and cancel multi-step notification workflows,
9
+ # along with the templates scoped to them.
6
10
  # @return [Courier::Resources::Journeys::Templates]
7
11
  attr_reader :templates
8
12
 
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.
13
+ # Some parameter documentations has been truncated, see
14
+ # {Courier::Models::JourneyCreateParams} for more details.
15
15
  #
16
- # @overload create(name:, nodes:, enabled: nil, state: nil, request_options: {})
16
+ # Creates a journey from a set of nodes, in draft state unless you pass a
17
+ # published state. Send nodes cannot be included until their templates exist.
17
18
  #
18
- # @param name [String]
19
+ # @overload create(name:, nodes:, enabled: nil, state: nil, idempotency_key: nil, x_idempotency_expiration: nil, request_options: {})
19
20
  #
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::JourneyNode::JourneyBatchNode, Courier::Models::JourneyNode::JourneyAddToDigestNode, Courier::Models::JourneyExitNode, Courier::Models::JourneyNode::JourneyBranchNode>]
21
+ # @param name [String] Body param
21
22
  #
22
- # @param enabled [Boolean]
23
+ # @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::JourneyNode::JourneyBatchNode, Courier::Models::JourneyNode::JourneyAddToDigestNode, Courier::Models::JourneyExitNode, Courier::Models::JourneyNode::JourneyBranchNode>] Body param
23
24
  #
24
- # @param state [Symbol, Courier::Models::JourneyState] Lifecycle state of a journey.
25
+ # @param enabled [Boolean] Body param
26
+ #
27
+ # @param state [Symbol, Courier::Models::JourneyState] Body param: Lifecycle state of a journey.
28
+ #
29
+ # @param idempotency_key [String] Header param: A unique key that makes this request idempotent. If Courier receiv
30
+ #
31
+ # @param x_idempotency_expiration [String] Header param: How long the idempotency key remains valid, as a Unix epoch timest
25
32
  #
26
33
  # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
27
34
  #
@@ -30,10 +37,13 @@ module Courier
30
37
  # @see Courier::Models::JourneyCreateParams
31
38
  def create(params)
32
39
  parsed, options = Courier::JourneyCreateParams.dump_request(params)
40
+ header_params =
41
+ {idempotency_key: "idempotency-key", x_idempotency_expiration: "x-idempotency-expiration"}
33
42
  @client.request(
34
43
  method: :post,
35
44
  path: "journeys",
36
- body: parsed,
45
+ headers: parsed.slice(*header_params.keys).transform_keys(header_params),
46
+ body: parsed.except(*header_params.keys),
37
47
  model: Courier::JourneyResponse,
38
48
  options: options
39
49
  )
@@ -68,7 +78,8 @@ module Courier
68
78
  # Some parameter documentations has been truncated, see
69
79
  # {Courier::Models::JourneyListParams} for more details.
70
80
  #
71
- # Get the list of journeys.
81
+ # Lists the workspace's journeys, each carrying a name, state, and enabled flag.
82
+ # Paged by cursor.
72
83
  #
73
84
  # @overload list(cursor: nil, version: nil, request_options: {})
74
85
  #
@@ -93,8 +104,8 @@ module Courier
93
104
  )
94
105
  end
95
106
 
96
- # Archive a journey. Archived journeys cannot be invoked. Existing journey runs
97
- # continue to completion.
107
+ # Archives a journey so it can no longer be invoked. Runs already in flight
108
+ # continue to completion, so archiving never strands a user mid-sequence.
98
109
  #
99
110
  # @overload archive(template_id, request_options: {})
100
111
  #
@@ -117,16 +128,16 @@ module Courier
117
128
  # Some parameter documentations has been truncated, see
118
129
  # {Courier::Models::JourneyCancelParams} for more details.
119
130
  #
120
- # Cancel journey runs. The request body must include EXACTLY ONE of
121
- # `cancelation_token` (cancels every run associated with the token) or `run_id`
122
- # (cancels a single tenant-scoped run). Supplying both or neither returns a `400`.
123
- # A `run_id` that does not match a run for the tenant returns `404`. Cancelation
124
- # is idempotent: a run that has already finished (`PROCESSED`/`ERROR`) or was
125
- # already `CANCELED` is left unchanged and its current status is returned.
131
+ # Cancels in-flight journey runs, either every run sharing a cancelation token or
132
+ # one run by id. Use it to stop a sequence when the event resolves.
133
+ #
134
+ # @overload cancel(cancel_journey_request:, idempotency_key: nil, x_idempotency_expiration: nil, request_options: {})
126
135
  #
127
- # @overload cancel(cancel_journey_request:, request_options: {})
136
+ # @param cancel_journey_request [Courier::Models::CancelJourneyRequest::ByCancelationToken, Courier::Models::CancelJourneyRequest::ByRunID] Body param: Request body for `POST /journeys/cancel`. Provide EXACTLY ONE of `ca
128
137
  #
129
- # @param cancel_journey_request [Courier::Models::CancelJourneyRequest::ByCancelationToken, Courier::Models::CancelJourneyRequest::ByRunID] Request body for `POST /journeys/cancel`. Provide EXACTLY ONE of `cancelation_to
138
+ # @param idempotency_key [String] Header param: A unique key that makes this request idempotent. If Courier receiv
139
+ #
140
+ # @param x_idempotency_expiration [String] Header param: How long the idempotency key remains valid, as a Unix epoch timest
130
141
  #
131
142
  # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
132
143
  #
@@ -138,6 +149,10 @@ module Courier
138
149
  @client.request(
139
150
  method: :post,
140
151
  path: "journeys/cancel",
152
+ headers: parsed.except(:cancel_journey_request).transform_keys(
153
+ idempotency_key: "idempotency-key",
154
+ x_idempotency_expiration: "x-idempotency-expiration"
155
+ ),
141
156
  body: parsed[:cancel_journey_request],
142
157
  model: Courier::CancelJourneyResponse,
143
158
  options: options
@@ -147,18 +162,22 @@ module Courier
147
162
  # Some parameter documentations has been truncated, see
148
163
  # {Courier::Models::JourneyInvokeParams} for more details.
149
164
  #
150
- # Invoke a journey by id or alias to start a new run. The response includes a
151
- # `runId` identifying the run.
165
+ # Starts a journey run for one user and returns a runId. Runs execute
166
+ # asynchronously, so the response arrives before any message is sent.
167
+ #
168
+ # @overload invoke(template_id, data: nil, profile: nil, user_id: nil, idempotency_key: nil, x_idempotency_expiration: nil, request_options: {})
169
+ #
170
+ # @param template_id [String] Path param: A unique identifier representing the journey to be invoked. Accepts
152
171
  #
153
- # @overload invoke(template_id, data: nil, profile: nil, user_id: nil, request_options: {})
172
+ # @param data [Hash{Symbol=>Object}] Body param: Data payload passed to the journey. The expected shape can be predef
154
173
  #
155
- # @param template_id [String] A unique identifier representing the journey to be invoked. Accepts a Journey ID
174
+ # @param profile [Hash{Symbol=>Object}] Body param: Profile data for the user. Can contain contact information (email, p
156
175
  #
157
- # @param data [Hash{Symbol=>Object}] Data payload passed to the journey. The expected shape can be predefined using t
176
+ # @param user_id [String] Body param: A unique identifier for the user. If not provided, the system will a
158
177
  #
159
- # @param profile [Hash{Symbol=>Object}] Profile data for the user. Can contain contact information (email, phone_number)
178
+ # @param idempotency_key [String] Header param: A unique key that makes this request idempotent. If Courier receiv
160
179
  #
161
- # @param user_id [String] A unique identifier for the user. If not provided, the system will attempt to re
180
+ # @param x_idempotency_expiration [String] Header param: How long the idempotency key remains valid, as a Unix epoch timest
162
181
  #
163
182
  # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
164
183
  #
@@ -167,16 +186,20 @@ module Courier
167
186
  # @see Courier::Models::JourneyInvokeParams
168
187
  def invoke(template_id, params = {})
169
188
  parsed, options = Courier::JourneyInvokeParams.dump_request(params)
189
+ header_params =
190
+ {idempotency_key: "idempotency-key", x_idempotency_expiration: "x-idempotency-expiration"}
170
191
  @client.request(
171
192
  method: :post,
172
193
  path: ["journeys/%1$s/invoke", template_id],
173
- body: parsed,
194
+ headers: parsed.slice(*header_params.keys).transform_keys(header_params),
195
+ body: parsed.except(*header_params.keys),
174
196
  model: Courier::JourneysInvokeResponse,
175
197
  options: options
176
198
  )
177
199
  end
178
200
 
179
- # List published versions of a journey, ordered most recent first.
201
+ # Lists a journey's published versions, most recent first, so you have a version
202
+ # id to roll back to. Paged by cursor.
180
203
  #
181
204
  # @overload list_versions(template_id, request_options: {})
182
205
  #
@@ -196,15 +219,21 @@ module Courier
196
219
  )
197
220
  end
198
221
 
199
- # Publish the current draft as a new version. Body is optional; pass
200
- # `{ "version": "vN" }` to roll back to a prior version instead. Returns 404 if
201
- # the journey has no draft to publish.
222
+ # Some parameter documentations has been truncated, see
223
+ # {Courier::Models::JourneyPublishParams} for more details.
202
224
  #
203
- # @overload publish(template_id, version: nil, request_options: {})
225
+ # Publishes a journey's current draft as a new version, making it live for new
226
+ # runs. Pass a version instead to roll back to an earlier one.
204
227
  #
205
- # @param template_id [String] Journey id
228
+ # @overload publish(template_id, version: nil, idempotency_key: nil, x_idempotency_expiration: nil, request_options: {})
229
+ #
230
+ # @param template_id [String] Path param: Journey id
231
+ #
232
+ # @param version [String] Body param
206
233
  #
207
- # @param version [String]
234
+ # @param idempotency_key [String] Header param: A unique key that makes this request idempotent. If Courier receiv
235
+ #
236
+ # @param x_idempotency_expiration [String] Header param: How long the idempotency key remains valid, as a Unix epoch timest
208
237
  #
209
238
  # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
210
239
  #
@@ -213,20 +242,20 @@ module Courier
213
242
  # @see Courier::Models::JourneyPublishParams
214
243
  def publish(template_id, params = {})
215
244
  parsed, options = Courier::JourneyPublishParams.dump_request(params)
245
+ header_params =
246
+ {idempotency_key: "idempotency-key", x_idempotency_expiration: "x-idempotency-expiration"}
216
247
  @client.request(
217
248
  method: :post,
218
249
  path: ["journeys/%1$s/publish", template_id],
219
- body: parsed,
250
+ headers: parsed.slice(*header_params.keys).transform_keys(header_params),
251
+ body: parsed.except(*header_params.keys),
220
252
  model: Courier::JourneyResponse,
221
253
  options: options
222
254
  )
223
255
  end
224
256
 
225
- # Replace the journey draft. Updates the working draft only; call
226
- # `POST /journeys/{templateId}/publish` to make it live, or pass
227
- # `state: "PUBLISHED"` in this request to publish immediately. Send-node
228
- # `template` ids must already exist and be scoped to this journey, and node ids
229
- # must not be claimed by another journey.
257
+ # Replaces a journey's working draft, leaving the published version live until you
258
+ # publish. Reach for this when editing a journey already running.
230
259
  #
231
260
  # @overload replace(template_id, name:, nodes:, enabled: nil, state: nil, request_options: {})
232
261
  #
@@ -3,8 +3,11 @@
3
3
  module Courier
4
4
  module Resources
5
5
  class Lists
6
+ # Manage static groups of users that you subscribe explicitly, and send to them by
7
+ # list id or list pattern.
6
8
  class Subscriptions
7
- # Get the list's subscriptions.
9
+ # Returns the users subscribed to a list with paging, each with the preferences
10
+ # recorded for that subscription.
8
11
  #
9
12
  # @overload list(list_id, cursor: nil, request_options: {})
10
13
  #
@@ -29,14 +32,21 @@ module Courier
29
32
  )
30
33
  end
31
34
 
35
+ # Some parameter documentations has been truncated, see
36
+ # {Courier::Models::Lists::SubscriptionAddParams} for more details.
37
+ #
32
38
  # Subscribes additional users to the list, without modifying existing
33
39
  # subscriptions. If the list does not exist, it will be automatically created.
34
40
  #
35
- # @overload add(list_id, recipients:, request_options: {})
41
+ # @overload add(list_id, recipients:, idempotency_key: nil, x_idempotency_expiration: nil, request_options: {})
36
42
  #
37
- # @param list_id [String] A unique identifier representing the list you wish to retrieve.
43
+ # @param list_id [String] Path param: A unique identifier representing the list you wish to retrieve.
38
44
  #
39
- # @param recipients [Array<Courier::Models::PutSubscriptionsRecipient>]
45
+ # @param recipients [Array<Courier::Models::PutSubscriptionsRecipient>] Body param
46
+ #
47
+ # @param idempotency_key [String] Header param: A unique key that makes this request idempotent. If Courier receiv
48
+ #
49
+ # @param x_idempotency_expiration [String] Header param: How long the idempotency key remains valid, as a Unix epoch timest
40
50
  #
41
51
  # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
42
52
  #
@@ -45,10 +55,13 @@ module Courier
45
55
  # @see Courier::Models::Lists::SubscriptionAddParams
46
56
  def add(list_id, params)
47
57
  parsed, options = Courier::Lists::SubscriptionAddParams.dump_request(params)
58
+ header_params =
59
+ {idempotency_key: "idempotency-key", x_idempotency_expiration: "x-idempotency-expiration"}
48
60
  @client.request(
49
61
  method: :post,
50
62
  path: ["lists/%1$s/subscriptions", list_id],
51
- body: parsed,
63
+ headers: parsed.slice(*header_params.keys).transform_keys(header_params),
64
+ body: parsed.except(*header_params.keys),
52
65
  model: NilClass,
53
66
  options: options
54
67
  )
@@ -82,8 +95,8 @@ module Courier
82
95
  # Some parameter documentations has been truncated, see
83
96
  # {Courier::Models::Lists::SubscriptionSubscribeUserParams} for more details.
84
97
  #
85
- # Subscribe a user to an existing list (note: if the List does not exist, it will
86
- # be automatically created).
98
+ # Subscribes one user to a list, creating the list if it does not yet exist.
99
+ # Optional preferences apply to this subscription only.
87
100
  #
88
101
  # @overload subscribe_user(user_id, list_id:, preferences: nil, request_options: {})
89
102
  #
@@ -113,7 +126,8 @@ module Courier
113
126
  )
114
127
  end
115
128
 
116
- # Delete a subscription to a list by list ID and user ID.
129
+ # Removes one user's subscription to a list, addressed by list id and user id. The
130
+ # user's profile and other subscriptions are separate resources.
117
131
  #
118
132
  # @overload unsubscribe_user(user_id, list_id:, request_options: {})
119
133
  #
@@ -2,11 +2,16 @@
2
2
 
3
3
  module Courier
4
4
  module Resources
5
+ # Manage static groups of users that you subscribe explicitly, and send to them by
6
+ # list id or list pattern.
5
7
  class Lists
8
+ # Manage static groups of users that you subscribe explicitly, and send to them by
9
+ # list id or list pattern.
6
10
  # @return [Courier::Resources::Lists::Subscriptions]
7
11
  attr_reader :subscriptions
8
12
 
9
- # Returns a list based on the list ID provided.
13
+ # Returns one list by id with its name and created and updated timestamps. Fetch
14
+ # its subscribers separately with the subscriptions endpoint.
10
15
  #
11
16
  # @overload retrieve(list_id, request_options: {})
12
17
  #
@@ -26,7 +31,8 @@ module Courier
26
31
  )
27
32
  end
28
33
 
29
- # Create or replace an existing list with the supplied values.
34
+ # Creates or replaces a list from a name and preferences. Subscribers are managed
35
+ # through the separate subscriptions endpoints.
30
36
  #
31
37
  # @overload update(list_id, name:, preferences: nil, request_options: {})
32
38
  #
@@ -55,7 +61,8 @@ module Courier
55
61
  # Some parameter documentations has been truncated, see
56
62
  # {Courier::Models::ListListParams} for more details.
57
63
  #
58
- # Returns all of the lists, with the ability to filter based on a pattern.
64
+ # Returns the workspace's lists, filterable by a pattern to fetch a subset such as
65
+ # every regional list. Paged by cursor.
59
66
  #
60
67
  # @overload list(cursor: nil, pattern: nil, request_options: {})
61
68
  #
@@ -80,7 +87,8 @@ module Courier
80
87
  )
81
88
  end
82
89
 
83
- # Delete a list by list ID.
90
+ # Deletes a list, halting sends that target it. A previously deleted list can be
91
+ # brought back with the companion restore endpoint.
84
92
  #
85
93
  # @overload delete(list_id, request_options: {})
86
94
  #
@@ -100,7 +108,8 @@ module Courier
100
108
  )
101
109
  end
102
110
 
103
- # Restore a previously deleted list.
111
+ # Restores a previously deleted list along with its subscribers, so a list removed
112
+ # by mistake can be brought back rather than rebuilt.
104
113
  #
105
114
  # @overload restore(list_id, request_options: {})
106
115
  #
@@ -2,11 +2,14 @@
2
2
 
3
3
  module Courier
4
4
  module Resources
5
+ # Look up the messages Courier has accepted, inspect their delivery history and
6
+ # rendered output, and cancel, resend, or archive them.
5
7
  class Messages
6
8
  # Some parameter documentations has been truncated, see
7
9
  # {Courier::Models::MessageRetrieveParams} for more details.
8
10
  #
9
- # Fetch the status of a message you've previously sent.
11
+ # Returns a sent message's status, recipient, event, and per-provider delivery
12
+ # detail, with timestamps for enqueued, sent, delivered, opened, and clicked.
10
13
  #
11
14
  # @overload retrieve(message_id, request_options: {})
12
15
  #
@@ -29,7 +32,8 @@ module Courier
29
32
  # Some parameter documentations has been truncated, see
30
33
  # {Courier::Models::MessageListParams} for more details.
31
34
  #
32
- # Fetch the statuses of messages you've previously sent.
35
+ # Returns previously sent messages, most recent first, each carrying its status,
36
+ # recipient, channel, and provider. Paged by cursor.
33
37
  #
34
38
  # @overload list(archived: nil, cursor: nil, enqueued_after: nil, event: nil, list: nil, message_id: nil, notification: nil, provider: nil, recipient: nil, status: nil, tag: nil, tags: nil, tenant_id: nil, trace_id: nil, request_options: {})
35
39
  #
@@ -78,11 +82,8 @@ module Courier
78
82
  )
79
83
  end
80
84
 
81
- # Cancel a message that is currently in the process of being delivered. A
82
- # well-formatted API call to the cancel message API will return either `200`
83
- # status code for a successful cancellation or `409` status code for an
84
- # unsuccessful cancellation. Both cases will include the actual message record in
85
- # the response body (see details below).
85
+ # Cancels a message that is still in the delivery pipeline and returns the message
86
+ # record with its resulting canceled or failed status.
86
87
  #
87
88
  # @overload cancel(message_id, request_options: {})
88
89
  #
@@ -105,7 +106,8 @@ module Courier
105
106
  # Some parameter documentations has been truncated, see
106
107
  # {Courier::Models::MessageContentParams} for more details.
107
108
  #
108
- # Get message content
109
+ # Returns the rendered content Courier delivered for a message, broken out per
110
+ # channel, to confirm what the recipient received.
109
111
  #
110
112
  # @overload content(message_id, request_options: {})
111
113
  #
@@ -125,7 +127,8 @@ module Courier
125
127
  )
126
128
  end
127
129
 
128
- # Fetch the array of events of a message you've previously sent.
130
+ # Returns the ordered event history for a sent message, one entry per status
131
+ # transition with its timestamp.
129
132
  #
130
133
  # @overload history(message_id, type: nil, request_options: {})
131
134
  #
@@ -153,11 +156,8 @@ module Courier
153
156
  # Some parameter documentations has been truncated, see
154
157
  # {Courier::Models::MessageResendParams} for more details.
155
158
  #
156
- # Resend a previously sent message. The original send request is loaded from
157
- # storage and a brand-new send is enqueued for the same recipient and content,
158
- # producing a **new** `messageId` — the original message is not modified.
159
- # Throttled by a per-message rate limit; a repeat inside the limit window returns
160
- # `429 Too Many Requests`.
159
+ # Resends a previously sent message to the same recipient and content, returning a
160
+ # new messageId. The original send request is not modified.
161
161
  #
162
162
  # @overload resend(message_id, request_options: {})
163
163
  #
@@ -3,8 +3,11 @@
3
3
  module Courier
4
4
  module Resources
5
5
  class Notifications
6
+ # Create, update, version, publish, and localize notification templates and their
7
+ # content.
6
8
  class Checks
7
- # Replace the submission checks for a notification template.
9
+ # Replaces the approval checks on a template submission with the complete set
10
+ # supplied in the request body.
8
11
  #
9
12
  # @overload update(submission_id, id:, checks:, request_options: {})
10
13
  #
@@ -34,7 +37,8 @@ module Courier
34
37
  )
35
38
  end
36
39
 
37
- # Retrieve the submission checks for a notification template.
40
+ # Returns the approval checks recorded for a template submission, each with its
41
+ # pass or fail result.
38
42
  #
39
43
  # @overload list(submission_id, id:, request_options: {})
40
44
  #
@@ -61,7 +65,8 @@ module Courier
61
65
  )
62
66
  end
63
67
 
64
- # Cancel a submission for a notification template.
68
+ # Cancels a pending template submission, withdrawing it from the approval
69
+ # workflow. The template stays in draft and can be resubmitted later.
65
70
  #
66
71
  # @overload delete(submission_id, id:, request_options: {})
67
72
  #