trycourier 4.20.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 (207) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +24 -0
  3. data/lib/courier/client.rb +39 -4
  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 -14
  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 -11
  69. data/rbi/courier/client.rbi +38 -3
  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 -14
  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 -2
  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 -14
  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 -35
  175. data/lib/courier/models/bulk_add_users_params.rb +0 -26
  176. data/lib/courier/models/bulk_create_job_params.rb +0 -29
  177. data/lib/courier/models/bulk_create_job_response.rb +0 -16
  178. data/lib/courier/models/bulk_list_users_params.rb +0 -33
  179. data/lib/courier/models/bulk_list_users_response.rb +0 -49
  180. data/lib/courier/models/bulk_retrieve_job_params.rb +0 -20
  181. data/lib/courier/models/bulk_retrieve_job_response.rb +0 -76
  182. data/lib/courier/models/bulk_run_job_params.rb +0 -20
  183. data/lib/courier/models/inbound_bulk_message.rb +0 -91
  184. data/lib/courier/models/inbound_bulk_message_user.rb +0 -54
  185. data/lib/courier/resources/bulk.rb +0 -141
  186. data/rbi/courier/models/bulk_add_users_params.rbi +0 -43
  187. data/rbi/courier/models/bulk_create_job_params.rbi +0 -54
  188. data/rbi/courier/models/bulk_create_job_response.rbi +0 -26
  189. data/rbi/courier/models/bulk_list_users_params.rbi +0 -51
  190. data/rbi/courier/models/bulk_list_users_response.rbi +0 -125
  191. data/rbi/courier/models/bulk_retrieve_job_params.rbi +0 -35
  192. data/rbi/courier/models/bulk_retrieve_job_response.rbi +0 -157
  193. data/rbi/courier/models/bulk_run_job_params.rbi +0 -35
  194. data/rbi/courier/models/inbound_bulk_message.rbi +0 -124
  195. data/rbi/courier/models/inbound_bulk_message_user.rbi +0 -88
  196. data/rbi/courier/resources/bulk.rbi +0 -102
  197. data/sig/courier/models/bulk_add_users_params.rbs +0 -28
  198. data/sig/courier/models/bulk_create_job_params.rbs +0 -24
  199. data/sig/courier/models/bulk_create_job_response.rbs +0 -13
  200. data/sig/courier/models/bulk_list_users_params.rbs +0 -28
  201. data/sig/courier/models/bulk_list_users_response.rbs +0 -65
  202. data/sig/courier/models/bulk_retrieve_job_params.rbs +0 -23
  203. data/sig/courier/models/bulk_retrieve_job_response.rbs +0 -66
  204. data/sig/courier/models/bulk_run_job_params.rbs +0 -23
  205. data/sig/courier/models/inbound_bulk_message.rbs +0 -58
  206. data/sig/courier/models/inbound_bulk_message_user.rbs +0 -42
  207. data/sig/courier/resources/bulk.rbs +0 -34
@@ -2,7 +2,11 @@
2
2
 
3
3
  module Courier
4
4
  module Resources
5
+ # Create, update, version, publish, and localize notification templates and their
6
+ # content.
5
7
  class Notifications
8
+ # Create, update, version, publish, and localize notification templates and their
9
+ # content.
6
10
  # @return [Courier::Resources::Notifications::Checks]
7
11
  attr_reader :checks
8
12
 
@@ -12,11 +16,15 @@ module Courier
12
16
  # Create a notification template. Requires all fields in the notification object.
13
17
  # Templates are created in draft state by default.
14
18
  #
15
- # @overload create(notification:, state: nil, request_options: {})
19
+ # @overload create(notification:, state: nil, idempotency_key: nil, x_idempotency_expiration: nil, request_options: {})
16
20
  #
17
- # @param notification [Courier::Models::NotificationTemplatePayload] Core template fields used in POST and PUT request bodies (nested under a `notifi
21
+ # @param notification [Courier::Models::NotificationTemplatePayload] Body param: Core template fields used in POST and PUT request bodies (nested und
22
+ #
23
+ # @param state [Symbol, Courier::Models::NotificationTemplateCreateRequest::State] Body param: Template state after creation. Case-insensitive input, normalized to
24
+ #
25
+ # @param idempotency_key [String] Header param: A unique key that makes this request idempotent. If Courier receiv
18
26
  #
19
- # @param state [Symbol, Courier::Models::NotificationTemplateCreateRequest::State] Template state after creation. Case-insensitive input, normalized to uppercase i
27
+ # @param x_idempotency_expiration [String] Header param: How long the idempotency key remains valid, as a Unix epoch timest
20
28
  #
21
29
  # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
22
30
  #
@@ -25,10 +33,13 @@ module Courier
25
33
  # @see Courier::Models::NotificationCreateParams
26
34
  def create(params)
27
35
  parsed, options = Courier::NotificationCreateParams.dump_request(params)
36
+ header_params =
37
+ {idempotency_key: "idempotency-key", x_idempotency_expiration: "x-idempotency-expiration"}
28
38
  @client.request(
29
39
  method: :post,
30
40
  path: "notifications",
31
- body: parsed,
41
+ headers: parsed.slice(*header_params.keys).transform_keys(header_params),
42
+ body: parsed.except(*header_params.keys),
32
43
  model: Courier::NotificationTemplateResponse,
33
44
  options: options
34
45
  )
@@ -63,7 +74,8 @@ module Courier
63
74
  )
64
75
  end
65
76
 
66
- # List notification templates in your workspace.
77
+ # Lists the workspace's notification templates. Each carries a name, tags, brand,
78
+ # routing, and its draft or published state.
67
79
  #
68
80
  # @overload list(cursor: nil, event_id: nil, notes: nil, request_options: {})
69
81
  #
@@ -90,7 +102,8 @@ module Courier
90
102
  )
91
103
  end
92
104
 
93
- # Archive a notification template.
105
+ # Archives a notification template, preventing new sends from referencing it. The
106
+ # template stays retrievable for its version history.
94
107
  #
95
108
  # @overload archive(id, request_options: {})
96
109
  #
@@ -110,12 +123,9 @@ module Courier
110
123
  )
111
124
  end
112
125
 
113
- # Duplicate a notification template. Creates a standalone copy within the same
114
- # workspace and environment, with " COPY" appended to the title. The copy clones
115
- # the source draft's tags, brand, subscription topic, routing strategy, channels,
116
- # and content, and is always created as a standalone template (it is not linked to
117
- # any journey or broadcast, even if the source was). Templates that are scoped to
118
- # a journey or a broadcast cannot be duplicated through this endpoint.
126
+ # Copies a notification template within the same workspace and environment,
127
+ # appending " COPY" to the title. The copy is standalone and independently
128
+ # editable.
119
129
  #
120
130
  # @overload duplicate(id, request_options: {})
121
131
  #
@@ -135,7 +145,8 @@ module Courier
135
145
  )
136
146
  end
137
147
 
138
- # List versions of a notification template.
148
+ # Returns a notification template's published versions, most recent first, for
149
+ # comparison or rollback. Paged.
139
150
  #
140
151
  # @overload list_versions(id, cursor: nil, limit: nil, request_options: {})
141
152
  #
@@ -162,14 +173,21 @@ module Courier
162
173
  )
163
174
  end
164
175
 
176
+ # Some parameter documentations has been truncated, see
177
+ # {Courier::Models::NotificationPublishParams} for more details.
178
+ #
165
179
  # Publish a notification template. Publishes the current draft by default. Pass a
166
180
  # version in the request body to publish a specific historical version.
167
181
  #
168
- # @overload publish(id, version: nil, request_options: {})
182
+ # @overload publish(id, version: nil, idempotency_key: nil, x_idempotency_expiration: nil, request_options: {})
169
183
  #
170
- # @param id [String] Template ID (nt\_ prefix).
184
+ # @param id [String] Path param: Template ID (nt\_ prefix).
185
+ #
186
+ # @param version [String] Body param: Historical version to publish (e.g. "v001"). Omit to publish the cur
171
187
  #
172
- # @param version [String] Historical version to publish (e.g. "v001"). Omit to publish the current draft.
188
+ # @param idempotency_key [String] Header param: A unique key that makes this request idempotent. If Courier receiv
189
+ #
190
+ # @param x_idempotency_expiration [String] Header param: How long the idempotency key remains valid, as a Unix epoch timest
173
191
  #
174
192
  # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
175
193
  #
@@ -178,18 +196,20 @@ module Courier
178
196
  # @see Courier::Models::NotificationPublishParams
179
197
  def publish(id, params = {})
180
198
  parsed, options = Courier::NotificationPublishParams.dump_request(params)
199
+ header_params =
200
+ {idempotency_key: "idempotency-key", x_idempotency_expiration: "x-idempotency-expiration"}
181
201
  @client.request(
182
202
  method: :post,
183
203
  path: ["notifications/%1$s/publish", id],
184
- body: parsed,
204
+ headers: parsed.slice(*header_params.keys).transform_keys(header_params),
205
+ body: parsed.except(*header_params.keys),
185
206
  model: NilClass,
186
207
  options: options
187
208
  )
188
209
  end
189
210
 
190
- # Replace the elemental content of a notification template. Overwrites all
191
- # elements in the template with the provided content. Only supported for V2
192
- # (elemental) templates.
211
+ # Replaces all Elemental content in a template, overwriting every existing
212
+ # element. Supported for V2 templates only, not V1 blocks and channels.
193
213
  #
194
214
  # @overload put_content(id, content:, state: nil, request_options: {})
195
215
  #
@@ -215,8 +235,8 @@ module Courier
215
235
  )
216
236
  end
217
237
 
218
- # Update a single element within a notification template. Only supported for V2
219
- # (elemental) templates.
238
+ # Replaces one Elemental element in a template, addressed by its element id.
239
+ # Supported for V2 templates only, not V1 blocks and channels.
220
240
  #
221
241
  # @overload put_element(element_id, id:, type:, channels: nil, data: nil, if_: nil, loop_: nil, ref: nil, state: nil, request_options: {})
222
242
  #
@@ -258,9 +278,8 @@ module Courier
258
278
  )
259
279
  end
260
280
 
261
- # Set locale-specific content overrides for a notification template. Each element
262
- # override must reference an existing element by ID. Only supported for V2
263
- # (elemental) templates.
281
+ # Sets locale-specific content overrides for a template. Each override must
282
+ # reference an element that already exists in the default content.
264
283
  #
265
284
  # @overload put_locale(locale_id, id:, elements:, state: nil, request_options: {})
266
285
  #
@@ -295,7 +314,8 @@ module Courier
295
314
  # Some parameter documentations has been truncated, see
296
315
  # {Courier::Models::NotificationReplaceParams} for more details.
297
316
  #
298
- # Replace a notification template. All fields are required.
317
+ # Replaces a notification template in full, so send every field rather than only
318
+ # the ones you want changed. Publish separately to make it live.
299
319
  #
300
320
  # @overload replace(id, notification:, state: nil, request_options: {})
301
321
  #
@@ -324,10 +344,8 @@ module Courier
324
344
  # Some parameter documentations has been truncated, see
325
345
  # {Courier::Models::NotificationRetrieveContentParams} for more details.
326
346
  #
327
- # Retrieve the content of a notification template. The response shape depends on
328
- # whether the template uses V1 (blocks/channels) or V2 (elemental) content. Use
329
- # the `version` query parameter to select draft, published, or a specific
330
- # historical version.
347
+ # Returns a template's content and checksum. V2 templates return Elemental
348
+ # elements, while V1 templates return blocks and channels instead.
331
349
  #
332
350
  # @overload retrieve_content(id, version: nil, request_options: {})
333
351
  #
@@ -3,11 +3,14 @@
3
3
  module Courier
4
4
  module Resources
5
5
  class Profiles
6
+ # Store the contact information Courier delivers to for each user — email, phone
7
+ # number, push tokens, and any custom data you send to.
6
8
  class Lists
7
9
  # Some parameter documentations has been truncated, see
8
10
  # {Courier::Models::Profiles::ListRetrieveParams} for more details.
9
11
  #
10
- # Returns the subscribed lists for a specified user.
12
+ # Returns the lists a user is subscribed to, with paging. Use it to check what a
13
+ # recipient will receive before sending to a list.
11
14
  #
12
15
  # @overload retrieve(user_id, cursor: nil, request_options: {})
13
16
  #
@@ -35,7 +38,8 @@ module Courier
35
38
  # Some parameter documentations has been truncated, see
36
39
  # {Courier::Models::Profiles::ListDeleteParams} for more details.
37
40
  #
38
- # Removes all list subscriptions for given user.
41
+ # Removes every list subscription for a user at once. Their profile and
42
+ # preferences are untouched, so this only affects list-targeted sends.
39
43
  #
40
44
  # @overload delete(user_id, request_options: {})
41
45
  #
@@ -58,14 +62,18 @@ module Courier
58
62
  # Some parameter documentations has been truncated, see
59
63
  # {Courier::Models::Profiles::ListSubscribeParams} for more details.
60
64
  #
61
- # Subscribes the given user to one or more lists. If the list does not exist, it
62
- # will be created.
65
+ # Subscribes a user to one or more lists, creating any list that does not yet
66
+ # exist. Optional preferences apply to each subscription.
63
67
  #
64
- # @overload subscribe(user_id, lists:, request_options: {})
68
+ # @overload subscribe(user_id, lists:, idempotency_key: nil, x_idempotency_expiration: nil, request_options: {})
65
69
  #
66
- # @param user_id [String] A unique identifier representing the user associated with the requested user pro
70
+ # @param user_id [String] Path param: A unique identifier representing the user associated with the reques
71
+ #
72
+ # @param lists [Array<Courier::Models::SubscribeToListsRequestItem>] Body param
73
+ #
74
+ # @param idempotency_key [String] Header param: A unique key that makes this request idempotent. If Courier receiv
67
75
  #
68
- # @param lists [Array<Courier::Models::SubscribeToListsRequestItem>]
76
+ # @param x_idempotency_expiration [String] Header param: How long the idempotency key remains valid, as a Unix epoch timest
69
77
  #
70
78
  # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
71
79
  #
@@ -74,10 +82,13 @@ module Courier
74
82
  # @see Courier::Models::Profiles::ListSubscribeParams
75
83
  def subscribe(user_id, params)
76
84
  parsed, options = Courier::Profiles::ListSubscribeParams.dump_request(params)
85
+ header_params =
86
+ {idempotency_key: "idempotency-key", x_idempotency_expiration: "x-idempotency-expiration"}
77
87
  @client.request(
78
88
  method: :post,
79
89
  path: ["profiles/%1$s/lists", user_id],
80
- body: parsed,
90
+ headers: parsed.slice(*header_params.keys).transform_keys(header_params),
91
+ body: parsed.except(*header_params.keys),
81
92
  model: Courier::Models::Profiles::ListSubscribeResponse,
82
93
  options: options
83
94
  )
@@ -2,21 +2,29 @@
2
2
 
3
3
  module Courier
4
4
  module Resources
5
+ # Store the contact information Courier delivers to for each user — email, phone
6
+ # number, push tokens, and any custom data you send to.
5
7
  class Profiles
8
+ # Store the contact information Courier delivers to for each user — email, phone
9
+ # number, push tokens, and any custom data you send to.
6
10
  # @return [Courier::Resources::Profiles::Lists]
7
11
  attr_reader :lists
8
12
 
9
13
  # Some parameter documentations has been truncated, see
10
14
  # {Courier::Models::ProfileCreateParams} for more details.
11
15
  #
12
- # Merge the supplied values with an existing profile or create a new profile if
13
- # one doesn't already exist.
16
+ # Merges the supplied values into a user's profile, creating it if absent and
17
+ # leaving any key you omit untouched. Prefer this for everyday writes.
14
18
  #
15
- # @overload create(user_id, profile:, request_options: {})
19
+ # @overload create(user_id, profile:, idempotency_key: nil, x_idempotency_expiration: nil, request_options: {})
16
20
  #
17
- # @param user_id [String] A unique identifier representing the user associated with the requested profile.
21
+ # @param user_id [String] Path param: A unique identifier representing the user associated with the reques
18
22
  #
19
- # @param profile [Hash{Symbol=>Object}]
23
+ # @param profile [Hash{Symbol=>Object}] Body param
24
+ #
25
+ # @param idempotency_key [String] Header param: A unique key that makes this request idempotent. If Courier receiv
26
+ #
27
+ # @param x_idempotency_expiration [String] Header param: How long the idempotency key remains valid, as a Unix epoch timest
20
28
  #
21
29
  # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
22
30
  #
@@ -25,10 +33,13 @@ module Courier
25
33
  # @see Courier::Models::ProfileCreateParams
26
34
  def create(user_id, params)
27
35
  parsed, options = Courier::ProfileCreateParams.dump_request(params)
36
+ header_params =
37
+ {idempotency_key: "idempotency-key", x_idempotency_expiration: "x-idempotency-expiration"}
28
38
  @client.request(
29
39
  method: :post,
30
40
  path: ["profiles/%1$s", user_id],
31
- body: parsed,
41
+ headers: parsed.slice(*header_params.keys).transform_keys(header_params),
42
+ body: parsed.except(*header_params.keys),
32
43
  model: Courier::Models::ProfileCreateResponse,
33
44
  options: options
34
45
  )
@@ -37,7 +48,8 @@ module Courier
37
48
  # Some parameter documentations has been truncated, see
38
49
  # {Courier::Models::ProfileRetrieveParams} for more details.
39
50
  #
40
- # Returns the specified user profile.
51
+ # Returns a user's stored profile and preferences, including the email address,
52
+ # phone number, and push tokens Courier can reach them on.
41
53
  #
42
54
  # @overload retrieve(user_id, request_options: {})
43
55
  #
@@ -60,7 +72,8 @@ module Courier
60
72
  # Some parameter documentations has been truncated, see
61
73
  # {Courier::Models::ProfileUpdateParams} for more details.
62
74
  #
63
- # Update a profile
75
+ # Applies a JSON Patch to a user profile, adding, removing, or replacing
76
+ # individual fields without sending the whole object.
64
77
  #
65
78
  # @overload update(user_id, patch:, request_options: {})
66
79
  #
@@ -87,7 +100,8 @@ module Courier
87
100
  # Some parameter documentations has been truncated, see
88
101
  # {Courier::Models::ProfileDeleteParams} for more details.
89
102
  #
90
- # Deletes the specified user profile.
103
+ # Deletes a user's profile and stored contact details. List subscriptions and
104
+ # preferences are separate resources, so remove those too if required.
91
105
  #
92
106
  # @overload delete(user_id, request_options: {})
93
107
  #
@@ -110,11 +124,8 @@ module Courier
110
124
  # Some parameter documentations has been truncated, see
111
125
  # {Courier::Models::ProfileReplaceParams} for more details.
112
126
  #
113
- # When using `PUT`, be sure to include all the key-value pairs required by the
114
- # recipient's profile. Any key-value pairs that exist in the profile but fail to
115
- # be included in the `PUT` request will be removed from the profile. Remember, a
116
- # `PUT` update is a full replacement of the data. For partial updates, use the
117
- # [Patch](https://www.courier.com/docs/reference/profiles/patch/) request.
127
+ # Overwrites a user profile in full, removing any key absent from the request
128
+ # body. Use the patch endpoint when changing a single field.
118
129
  #
119
130
  # @overload replace(user_id, profile:, request_options: {})
120
131
  #
@@ -3,14 +3,14 @@
3
3
  module Courier
4
4
  module Resources
5
5
  class Providers
6
+ # Configure the channel providers Courier delivers through, and browse the
7
+ # provider types it supports.
6
8
  class Catalog
7
9
  # Some parameter documentations has been truncated, see
8
10
  # {Courier::Models::Providers::CatalogListParams} for more details.
9
11
  #
10
- # Returns the catalog of available provider types with their display names,
11
- # descriptions, and configuration schema fields (snake_case, with `type` and
12
- # `required`). Providers with no configurable schema return only `provider`,
13
- # `name`, and `description`.
12
+ # Returns the provider types Courier supports, each with a display name,
13
+ # description, and the configuration fields it requires.
14
14
  #
15
15
  # @overload list(channel: nil, keys: nil, name: nil, request_options: {})
16
16
  #
@@ -2,25 +2,33 @@
2
2
 
3
3
  module Courier
4
4
  module Resources
5
+ # Configure the channel providers Courier delivers through, and browse the
6
+ # provider types it supports.
5
7
  class Providers
8
+ # Configure the channel providers Courier delivers through, and browse the
9
+ # provider types it supports.
6
10
  # @return [Courier::Resources::Providers::Catalog]
7
11
  attr_reader :catalog
8
12
 
9
13
  # Some parameter documentations has been truncated, see
10
14
  # {Courier::Models::ProviderCreateParams} for more details.
11
15
  #
12
- # Create a new provider configuration. The `provider` field must be a known
13
- # Courier provider key (see catalog).
16
+ # Configures a provider integration from a Courier provider key and its settings.
17
+ # Check the catalog endpoint for the schema each provider expects.
14
18
  #
15
- # @overload create(provider:, alias_: nil, settings: nil, title: nil, request_options: {})
19
+ # @overload create(provider:, alias_: nil, settings: nil, title: nil, idempotency_key: nil, x_idempotency_expiration: nil, request_options: {})
16
20
  #
17
- # @param provider [String] The provider key identifying the type (e.g. "sendgrid", "twilio"). Must be a kno
21
+ # @param provider [String] Body param: The provider key identifying the type (e.g. "sendgrid", "twilio"). M
18
22
  #
19
- # @param alias_ [String] Optional alias for this configuration.
23
+ # @param alias_ [String] Body param: Optional alias for this configuration.
20
24
  #
21
- # @param settings [Hash{Symbol=>Object}] Provider-specific settings (snake_case keys). Defaults to an empty object when o
25
+ # @param settings [Hash{Symbol=>Object}] Body param: Provider-specific settings (snake_case keys). Defaults to an empty o
22
26
  #
23
- # @param title [String] Optional display title. Omit to use "Default Configuration".
27
+ # @param title [String] Body param: Optional display title. Omit to use "Default Configuration".
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
24
32
  #
25
33
  # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
26
34
  #
@@ -29,16 +37,20 @@ module Courier
29
37
  # @see Courier::Models::ProviderCreateParams
30
38
  def create(params)
31
39
  parsed, options = Courier::ProviderCreateParams.dump_request(params)
40
+ header_params =
41
+ {idempotency_key: "idempotency-key", x_idempotency_expiration: "x-idempotency-expiration"}
32
42
  @client.request(
33
43
  method: :post,
34
44
  path: "providers",
35
- body: parsed,
45
+ headers: parsed.slice(*header_params.keys).transform_keys(header_params),
46
+ body: parsed.except(*header_params.keys),
36
47
  model: Courier::Provider,
37
48
  options: options
38
49
  )
39
50
  end
40
51
 
41
- # Fetch a single provider configuration by ID.
52
+ # Returns one configured provider by id, including its channel, provider key,
53
+ # alias, title, and current settings.
42
54
  #
43
55
  # @overload retrieve(id, request_options: {})
44
56
  #
@@ -61,11 +73,8 @@ module Courier
61
73
  # Some parameter documentations has been truncated, see
62
74
  # {Courier::Models::ProviderUpdateParams} for more details.
63
75
  #
64
- # Replace an existing provider configuration. The `provider` key is required and
65
- # determines which provider-specific settings schema is applied. All other fields
66
- # are optional — omitted fields are cleared from the stored configuration (this is
67
- # a full replacement, not a partial merge). Changing the provider type for an
68
- # existing configuration is not supported.
76
+ # Replaces a provider's configuration in full, clearing any field you omit rather
77
+ # than merging it. Send the complete settings object.
69
78
  #
70
79
  # @overload update(id, provider:, alias_: nil, settings: nil, title: nil, request_options: {})
71
80
  #
@@ -95,8 +104,8 @@ module Courier
95
104
  )
96
105
  end
97
106
 
98
- # List configured provider integrations for the current workspace. Supports
99
- # cursor-based pagination.
107
+ # Lists the provider integrations configured in the workspace, one entry per
108
+ # channel and provider key with its alias and settings.
100
109
  #
101
110
  # @overload list(cursor: nil, request_options: {})
102
111
  #
@@ -119,8 +128,8 @@ module Courier
119
128
  )
120
129
  end
121
130
 
122
- # Delete a provider configuration. Returns 409 if the provider is still referenced
123
- # by routing or notifications.
131
+ # Deletes a provider configuration, which fails while routing strategies or
132
+ # templates still reference it. Update those references first.
124
133
  #
125
134
  # @overload delete(id, request_options: {})
126
135
  #
@@ -2,8 +2,11 @@
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 Requests
6
- # Archive message
8
+ # Archives a send request by its request id. Use it to remove test sends or
9
+ # superseded requests from the message list without deleting them.
7
10
  #
8
11
  # @overload archive(request_id, request_options: {})
9
12
  #
@@ -2,23 +2,32 @@
2
2
 
3
3
  module Courier
4
4
  module Resources
5
+ # Define reusable channel routing and failover strategies, and see which templates
6
+ # use them.
5
7
  class RoutingStrategies
8
+ # Some parameter documentations has been truncated, see
9
+ # {Courier::Models::RoutingStrategyCreateParams} for more details.
10
+ #
6
11
  # Create a routing strategy. Requires a name and routing configuration at minimum.
7
12
  # Channels and providers default to empty if omitted.
8
13
  #
9
- # @overload create(name:, routing:, channels: nil, description: nil, providers: nil, tags: nil, request_options: {})
14
+ # @overload create(name:, routing:, channels: nil, description: nil, providers: nil, tags: nil, idempotency_key: nil, x_idempotency_expiration: nil, request_options: {})
10
15
  #
11
- # @param name [String] Human-readable name for the routing strategy.
16
+ # @param name [String] Body param: Human-readable name for the routing strategy.
12
17
  #
13
- # @param routing [Courier::Models::MessageRouting] Routing tree defining channel selection method and order.
18
+ # @param routing [Courier::Models::MessageRouting] Body param: Routing tree defining channel selection method and order.
14
19
  #
15
- # @param channels [Hash{Symbol=>Courier::Models::Channel}, nil] Per-channel delivery configuration. Defaults to empty if omitted.
20
+ # @param channels [Hash{Symbol=>Courier::Models::Channel}, nil] Body param: Per-channel delivery configuration. Defaults to empty if omitted.
16
21
  #
17
- # @param description [String, nil] Optional description of the routing strategy.
22
+ # @param description [String, nil] Body param: Optional description of the routing strategy.
18
23
  #
19
- # @param providers [Hash{Symbol=>Courier::Models::MessageProvidersType}, nil] Per-provider delivery configuration. Defaults to empty if omitted.
24
+ # @param providers [Hash{Symbol=>Courier::Models::MessageProvidersType}, nil] Body param: Per-provider delivery configuration. Defaults to empty if omitted.
20
25
  #
21
- # @param tags [Array<String>, nil] Optional tags for categorization.
26
+ # @param tags [Array<String>, nil] Body param: Optional tags for categorization.
27
+ #
28
+ # @param idempotency_key [String] Header param: A unique key that makes this request idempotent. If Courier receiv
29
+ #
30
+ # @param x_idempotency_expiration [String] Header param: How long the idempotency key remains valid, as a Unix epoch timest
22
31
  #
23
32
  # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
24
33
  #
@@ -27,17 +36,20 @@ module Courier
27
36
  # @see Courier::Models::RoutingStrategyCreateParams
28
37
  def create(params)
29
38
  parsed, options = Courier::RoutingStrategyCreateParams.dump_request(params)
39
+ header_params =
40
+ {idempotency_key: "idempotency-key", x_idempotency_expiration: "x-idempotency-expiration"}
30
41
  @client.request(
31
42
  method: :post,
32
43
  path: "routing-strategies",
33
- body: parsed,
44
+ headers: parsed.slice(*header_params.keys).transform_keys(header_params),
45
+ body: parsed.except(*header_params.keys),
34
46
  model: Courier::RoutingStrategyGetResponse,
35
47
  options: options
36
48
  )
37
49
  end
38
50
 
39
- # Retrieve a routing strategy by ID. Returns the full entity including routing
40
- # content and metadata.
51
+ # Returns one routing strategy by id with its name, tags, channels, and the
52
+ # routing rules that decide provider order and fallback.
41
53
  #
42
54
  # @overload retrieve(id, request_options: {})
43
55
  #
@@ -105,8 +117,8 @@ module Courier
105
117
  )
106
118
  end
107
119
 
108
- # List notification templates associated with a routing strategy. Includes
109
- # template metadata only, not full content.
120
+ # Returns the notification templates using a routing strategy, with paging. Check
121
+ # this before changing a strategy that templates depend on.
110
122
  #
111
123
  # @overload list_notifications(id, cursor: nil, limit: nil, request_options: {})
112
124
  #
@@ -2,15 +2,22 @@
2
2
 
3
3
  module Courier
4
4
  module Resources
5
+ # Send a message to one or more recipients — users, lists, audiences, or tenants —
6
+ # across every channel you have configured.
5
7
  class Send
6
8
  # Some parameter documentations has been truncated, see
7
9
  # {Courier::Models::SendMessageParams} for more details.
8
10
  #
9
- # Send a message to one or more recipients.
11
+ # Sends a message to one or more recipients and returns a requestId. Courier
12
+ # routes it to email, SMS, push, chat, or in-app based on your rules.
10
13
  #
11
- # @overload message(message:, request_options: {})
14
+ # @overload message(message:, idempotency_key: nil, x_idempotency_expiration: nil, request_options: {})
12
15
  #
13
- # @param message [Courier::Models::SendMessageParams::Message] The message property has the following primary top-level properties. They define
16
+ # @param message [Courier::Models::SendMessageParams::Message] Body param: The message property has the following primary top-level properties.
17
+ #
18
+ # @param idempotency_key [String] Header param: A unique key that makes this request idempotent. If Courier receiv
19
+ #
20
+ # @param x_idempotency_expiration [String] Header param: How long the idempotency key remains valid, as a Unix epoch timest
14
21
  #
15
22
  # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
16
23
  #
@@ -19,10 +26,13 @@ module Courier
19
26
  # @see Courier::Models::SendMessageParams
20
27
  def message(params)
21
28
  parsed, options = Courier::SendMessageParams.dump_request(params)
29
+ header_params =
30
+ {idempotency_key: "idempotency-key", x_idempotency_expiration: "x-idempotency-expiration"}
22
31
  @client.request(
23
32
  method: :post,
24
33
  path: "send",
25
- body: parsed,
34
+ headers: parsed.slice(*header_params.keys).transform_keys(header_params),
35
+ body: parsed.except(*header_params.keys),
26
36
  model: Courier::Models::SendMessageResponse,
27
37
  options: options
28
38
  )
@@ -4,11 +4,14 @@ module Courier
4
4
  module Resources
5
5
  class Tenants
6
6
  class Preferences
7
+ # Manage tenants — the organizations, teams, or accounts your users belong to —
8
+ # along with their users and default preferences.
7
9
  class Items
8
10
  # Some parameter documentations has been truncated, see
9
11
  # {Courier::Models::Tenants::Preferences::ItemUpdateParams} for more details.
10
12
  #
11
- # Create or Replace Default Preferences For Topic
13
+ # Sets a tenant's default opt-in status for one subscription topic, which applies
14
+ # to every member unless a user sets their own override.
12
15
  #
13
16
  # @overload update(topic_id, tenant_id:, status:, custom_routing: nil, has_custom_routing: nil, request_options: {})
14
17
  #
@@ -42,7 +45,8 @@ module Courier
42
45
  )
43
46
  end
44
47
 
45
- # Remove Default Preferences For Topic
48
+ # Removes a tenant's default preference for one subscription topic, addressed by
49
+ # tenant id and topic id.
46
50
  #
47
51
  # @overload delete(topic_id, tenant_id:, request_options: {})
48
52
  #
@@ -4,6 +4,8 @@ module Courier
4
4
  module Resources
5
5
  class Tenants
6
6
  class Preferences
7
+ # Manage tenants — the organizations, teams, or accounts your users belong to —
8
+ # along with their users and default preferences.
7
9
  # @return [Courier::Resources::Tenants::Preferences::Items]
8
10
  attr_reader :items
9
11
 
@@ -4,17 +4,14 @@ module Courier
4
4
  module Resources
5
5
  class Tenants
6
6
  class Templates
7
+ # Manage the templates and template versions scoped to a single tenant, including
8
+ # the ones authored in the embedded designer.
7
9
  class Versions
8
10
  # Some parameter documentations has been truncated, see
9
11
  # {Courier::Models::Tenants::Templates::VersionRetrieveParams} for more details.
10
12
  #
11
- # Fetches a specific version of a tenant template.
12
- #
13
- # Supports the following version formats:
14
- #
15
- # - `latest` - The most recent version of the template
16
- # - `published` - The currently published version
17
- # - `v{version}` - A specific version (e.g., "v1", "v2", "v1.0.0")
13
+ # Returns one version of a tenant template, addressed by version number or by
14
+ # latest, with its content and publish timestamp.
18
15
  #
19
16
  # @overload retrieve(version, tenant_id:, template_id:, request_options: {})
20
17
  #