trycourier 4.21.0 → 4.23.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 (231) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +24 -0
  3. data/lib/courier/client.rb +43 -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/broadcast.rb +132 -0
  8. data/lib/courier/models/broadcast_archive_params.rb +20 -0
  9. data/lib/courier/models/broadcast_cancel_params.rb +20 -0
  10. data/lib/courier/models/broadcast_create_params.rb +14 -0
  11. data/lib/courier/models/broadcast_duplicate_params.rb +20 -0
  12. data/lib/courier/models/broadcast_list_params.rb +30 -0
  13. data/lib/courier/models/broadcast_list_response.rb +24 -0
  14. data/lib/courier/models/broadcast_put_content_params.rb +20 -0
  15. data/lib/courier/models/broadcast_retrieve_content_params.rb +33 -0
  16. data/lib/courier/models/broadcast_retrieve_params.rb +20 -0
  17. data/lib/courier/models/broadcast_schedule.rb +59 -0
  18. data/lib/courier/models/broadcast_schedule_params.rb +20 -0
  19. data/lib/courier/models/broadcast_send_params.rb +20 -0
  20. data/lib/courier/models/broadcast_update_params.rb +20 -0
  21. data/lib/courier/models/create_broadcast_request.rb +43 -0
  22. data/lib/courier/models/inbox/message_delete_params.rb +22 -0
  23. data/lib/courier/models/inbox/message_restore_params.rb +22 -0
  24. data/lib/courier/models/journey_cancel_params.rb +13 -1
  25. data/lib/courier/models/journey_create_params.rb +13 -1
  26. data/lib/courier/models/journey_invoke_params.rb +13 -1
  27. data/lib/courier/models/journey_publish_params.rb +13 -1
  28. data/lib/courier/models/journeys/template_create_params.rb +13 -1
  29. data/lib/courier/models/journeys/template_publish_params.rb +13 -1
  30. data/lib/courier/models/lists/subscription_add_params.rb +13 -1
  31. data/lib/courier/models/notification_create_params.rb +13 -1
  32. data/lib/courier/models/notification_publish_params.rb +13 -1
  33. data/lib/courier/models/profile_create_params.rb +13 -1
  34. data/lib/courier/models/profiles/list_subscribe_params.rb +13 -1
  35. data/lib/courier/models/provider_create_params.rb +15 -1
  36. data/lib/courier/models/routing_strategy_create_params.rb +13 -1
  37. data/lib/courier/models/schedule_broadcast_request.rb +59 -0
  38. data/lib/courier/models/send_broadcast_request.rb +39 -0
  39. data/lib/courier/models/send_message_params.rb +15 -1
  40. data/lib/courier/models/update_broadcast_request.rb +18 -0
  41. data/lib/courier/models/users/preference_bulk_update_params.rb +15 -1
  42. data/lib/courier/models/users/preference_update_or_create_topic_params.rb +14 -4
  43. data/lib/courier/models/users/topic_preference.rb +21 -7
  44. data/lib/courier/models/workspace_preference_create_params.rb +13 -1
  45. data/lib/courier/models/workspace_preference_publish_params.rb +13 -1
  46. data/lib/courier/models/workspace_preferences/topic_create_params.rb +13 -1
  47. data/lib/courier/models.rb +38 -0
  48. data/lib/courier/resources/audiences.rb +12 -5
  49. data/lib/courier/resources/audit_events.rb +5 -2
  50. data/lib/courier/resources/auth.rb +5 -1
  51. data/lib/courier/resources/automations/invoke.rb +47 -23
  52. data/lib/courier/resources/automations.rb +6 -1
  53. data/lib/courier/resources/brands.rb +38 -12
  54. data/lib/courier/resources/broadcasts.rb +290 -0
  55. data/lib/courier/resources/digests/schedules.rb +4 -3
  56. data/lib/courier/resources/digests.rb +2 -0
  57. data/lib/courier/resources/inbound.rb +3 -1
  58. data/lib/courier/resources/inbox/messages.rb +58 -0
  59. data/lib/courier/resources/inbox.rb +19 -0
  60. data/lib/courier/resources/journeys/templates.rb +43 -25
  61. data/lib/courier/resources/journeys.rb +73 -44
  62. data/lib/courier/resources/lists/subscriptions.rb +22 -8
  63. data/lib/courier/resources/lists.rb +14 -5
  64. data/lib/courier/resources/messages.rb +14 -14
  65. data/lib/courier/resources/notifications/checks.rb +8 -3
  66. data/lib/courier/resources/notifications.rb +48 -30
  67. data/lib/courier/resources/profiles/lists.rb +19 -8
  68. data/lib/courier/resources/profiles.rb +25 -14
  69. data/lib/courier/resources/providers/catalog.rb +4 -4
  70. data/lib/courier/resources/providers.rb +27 -18
  71. data/lib/courier/resources/requests.rb +4 -1
  72. data/lib/courier/resources/routing_strategies.rb +24 -12
  73. data/lib/courier/resources/send.rb +14 -4
  74. data/lib/courier/resources/tenants/preferences/items.rb +6 -2
  75. data/lib/courier/resources/tenants/preferences.rb +2 -0
  76. data/lib/courier/resources/tenants/templates/versions.rb +4 -7
  77. data/lib/courier/resources/tenants/templates.rb +14 -19
  78. data/lib/courier/resources/tenants.rb +14 -5
  79. data/lib/courier/resources/translations.rb +6 -2
  80. data/lib/courier/resources/users/preferences.rb +23 -42
  81. data/lib/courier/resources/users/tenants.rb +12 -10
  82. data/lib/courier/resources/users/tokens.rb +14 -6
  83. data/lib/courier/resources/users.rb +6 -0
  84. data/lib/courier/resources/workspace_preferences/topics.rb +27 -19
  85. data/lib/courier/resources/workspace_preferences.rb +40 -20
  86. data/lib/courier/version.rb +1 -1
  87. data/lib/courier.rb +24 -1
  88. data/rbi/courier/client.rbi +41 -0
  89. data/rbi/courier/models/automations/invoke_invoke_ad_hoc_params.rbi +18 -0
  90. data/rbi/courier/models/automations/invoke_invoke_by_template_params.rbi +18 -0
  91. data/rbi/courier/models/brand_create_params.rbi +18 -0
  92. data/rbi/courier/models/broadcast.rbi +164 -0
  93. data/rbi/courier/models/broadcast_archive_params.rbi +35 -0
  94. data/rbi/courier/models/broadcast_cancel_params.rbi +35 -0
  95. data/rbi/courier/models/broadcast_create_params.rbi +27 -0
  96. data/rbi/courier/models/broadcast_duplicate_params.rbi +35 -0
  97. data/rbi/courier/models/broadcast_list_params.rbi +54 -0
  98. data/rbi/courier/models/broadcast_list_response.rbi +39 -0
  99. data/rbi/courier/models/broadcast_put_content_params.rbi +35 -0
  100. data/rbi/courier/models/broadcast_retrieve_content_params.rbi +57 -0
  101. data/rbi/courier/models/broadcast_retrieve_params.rbi +35 -0
  102. data/rbi/courier/models/broadcast_schedule.rbi +92 -0
  103. data/rbi/courier/models/broadcast_schedule_params.rbi +35 -0
  104. data/rbi/courier/models/broadcast_send_params.rbi +35 -0
  105. data/rbi/courier/models/broadcast_update_params.rbi +35 -0
  106. data/rbi/courier/models/create_broadcast_request.rbi +81 -0
  107. data/rbi/courier/models/inbox/message_delete_params.rbi +40 -0
  108. data/rbi/courier/models/inbox/message_restore_params.rbi +40 -0
  109. data/rbi/courier/models/journey_cancel_params.rbi +31 -5
  110. data/rbi/courier/models/journey_create_params.rbi +31 -5
  111. data/rbi/courier/models/journey_invoke_params.rbi +26 -2
  112. data/rbi/courier/models/journey_publish_params.rbi +26 -2
  113. data/rbi/courier/models/journeys/template_create_params.rbi +26 -2
  114. data/rbi/courier/models/journeys/template_publish_params.rbi +23 -1
  115. data/rbi/courier/models/lists/subscription_add_params.rbi +23 -1
  116. data/rbi/courier/models/notification_create_params.rbi +31 -5
  117. data/rbi/courier/models/notification_publish_params.rbi +26 -2
  118. data/rbi/courier/models/profile_create_params.rbi +23 -1
  119. data/rbi/courier/models/profiles/list_subscribe_params.rbi +23 -1
  120. data/rbi/courier/models/provider_create_params.rbi +18 -0
  121. data/rbi/courier/models/routing_strategy_create_params.rbi +31 -5
  122. data/rbi/courier/models/schedule_broadcast_request.rbi +103 -0
  123. data/rbi/courier/models/send_broadcast_request.rbi +77 -0
  124. data/rbi/courier/models/send_message_params.rbi +18 -0
  125. data/rbi/courier/models/update_broadcast_request.rbi +28 -0
  126. data/rbi/courier/models/users/preference_bulk_update_params.rbi +18 -0
  127. data/rbi/courier/models/users/preference_update_or_create_topic_params.rbi +14 -2
  128. data/rbi/courier/models/users/topic_preference.rbi +24 -2
  129. data/rbi/courier/models/workspace_preference_create_params.rbi +31 -5
  130. data/rbi/courier/models/workspace_preference_publish_params.rbi +31 -5
  131. data/rbi/courier/models/workspace_preferences/topic_create_params.rbi +26 -2
  132. data/rbi/courier/models.rbi +39 -0
  133. data/rbi/courier/resources/audiences.rbi +12 -5
  134. data/rbi/courier/resources/audit_events.rbi +5 -2
  135. data/rbi/courier/resources/auth.rbi +5 -1
  136. data/rbi/courier/resources/automations/invoke.rbi +48 -7
  137. data/rbi/courier/resources/automations.rbi +6 -1
  138. data/rbi/courier/resources/brands.rbi +37 -7
  139. data/rbi/courier/resources/broadcasts.rbi +199 -0
  140. data/rbi/courier/resources/digests/schedules.rbi +4 -3
  141. data/rbi/courier/resources/digests.rbi +2 -0
  142. data/rbi/courier/resources/inbound.rbi +3 -1
  143. data/rbi/courier/resources/inbox/messages.rbi +44 -0
  144. data/rbi/courier/resources/inbox.rbi +16 -0
  145. data/rbi/courier/resources/journeys/templates.rbi +47 -17
  146. data/rbi/courier/resources/journeys.rbi +93 -39
  147. data/rbi/courier/resources/lists/subscriptions.rbi +24 -5
  148. data/rbi/courier/resources/lists.rbi +14 -5
  149. data/rbi/courier/resources/messages.rbi +14 -14
  150. data/rbi/courier/resources/notifications/checks.rbi +8 -3
  151. data/rbi/courier/resources/notifications.rbi +58 -28
  152. data/rbi/courier/resources/profiles/lists.rbi +25 -6
  153. data/rbi/courier/resources/profiles.rbi +31 -11
  154. data/rbi/courier/resources/providers/catalog.rbi +4 -4
  155. data/rbi/courier/resources/providers.rbi +35 -19
  156. data/rbi/courier/resources/requests.rbi +4 -1
  157. data/rbi/courier/resources/routing_strategies.rbi +26 -10
  158. data/rbi/courier/resources/send.rbi +20 -3
  159. data/rbi/courier/resources/tenants/preferences/items.rbi +6 -2
  160. data/rbi/courier/resources/tenants/preferences.rbi +2 -0
  161. data/rbi/courier/resources/tenants/templates/versions.rbi +4 -7
  162. data/rbi/courier/resources/tenants/templates.rbi +14 -19
  163. data/rbi/courier/resources/tenants.rbi +14 -5
  164. data/rbi/courier/resources/translations.rbi +6 -2
  165. data/rbi/courier/resources/users/preferences.rbi +28 -40
  166. data/rbi/courier/resources/users/tenants.rbi +12 -10
  167. data/rbi/courier/resources/users/tokens.rbi +14 -6
  168. data/rbi/courier/resources/users.rbi +6 -0
  169. data/rbi/courier/resources/workspace_preferences/topics.rbi +37 -18
  170. data/rbi/courier/resources/workspace_preferences.rbi +51 -17
  171. data/sig/courier/client.rbs +4 -0
  172. data/sig/courier/models/automations/invoke_invoke_ad_hoc_params.rbs +15 -1
  173. data/sig/courier/models/automations/invoke_invoke_by_template_params.rbs +15 -1
  174. data/sig/courier/models/brand_create_params.rbs +15 -1
  175. data/sig/courier/models/broadcast.rbs +98 -0
  176. data/sig/courier/models/broadcast_archive_params.rbs +23 -0
  177. data/sig/courier/models/broadcast_cancel_params.rbs +23 -0
  178. data/sig/courier/models/broadcast_create_params.rbs +15 -0
  179. data/sig/courier/models/broadcast_duplicate_params.rbs +23 -0
  180. data/sig/courier/models/broadcast_list_params.rbs +30 -0
  181. data/sig/courier/models/broadcast_list_response.rbs +22 -0
  182. data/sig/courier/models/broadcast_put_content_params.rbs +25 -0
  183. data/sig/courier/models/broadcast_retrieve_content_params.rbs +30 -0
  184. data/sig/courier/models/broadcast_retrieve_params.rbs +23 -0
  185. data/sig/courier/models/broadcast_schedule.rbs +46 -0
  186. data/sig/courier/models/broadcast_schedule_params.rbs +25 -0
  187. data/sig/courier/models/broadcast_send_params.rbs +25 -0
  188. data/sig/courier/models/broadcast_update_params.rbs +25 -0
  189. data/sig/courier/models/create_broadcast_request.rbs +40 -0
  190. data/sig/courier/models/inbox/message_delete_params.rbs +25 -0
  191. data/sig/courier/models/inbox/message_restore_params.rbs +25 -0
  192. data/sig/courier/models/journey_cancel_params.rbs +20 -3
  193. data/sig/courier/models/journey_create_params.rbs +20 -3
  194. data/sig/courier/models/journey_invoke_params.rbs +18 -1
  195. data/sig/courier/models/journey_publish_params.rbs +18 -1
  196. data/sig/courier/models/journeys/template_create_params.rbs +18 -1
  197. data/sig/courier/models/journeys/template_publish_params.rbs +18 -1
  198. data/sig/courier/models/lists/subscription_add_params.rbs +15 -1
  199. data/sig/courier/models/notification_create_params.rbs +20 -3
  200. data/sig/courier/models/notification_publish_params.rbs +18 -2
  201. data/sig/courier/models/profile_create_params.rbs +18 -1
  202. data/sig/courier/models/profiles/list_subscribe_params.rbs +15 -1
  203. data/sig/courier/models/provider_create_params.rbs +15 -1
  204. data/sig/courier/models/routing_strategy_create_params.rbs +20 -3
  205. data/sig/courier/models/schedule_broadcast_request.rbs +48 -0
  206. data/sig/courier/models/send_broadcast_request.rbs +36 -0
  207. data/sig/courier/models/send_message_params.rbs +17 -1
  208. data/sig/courier/models/update_broadcast_request.rbs +13 -0
  209. data/sig/courier/models/users/preference_bulk_update_params.rbs +15 -1
  210. data/sig/courier/models/workspace_preference_create_params.rbs +20 -3
  211. data/sig/courier/models/workspace_preference_publish_params.rbs +20 -3
  212. data/sig/courier/models/workspace_preferences/topic_create_params.rbs +18 -1
  213. data/sig/courier/models.rbs +38 -0
  214. data/sig/courier/resources/automations/invoke.rbs +4 -0
  215. data/sig/courier/resources/brands.rbs +2 -0
  216. data/sig/courier/resources/broadcasts.rbs +74 -0
  217. data/sig/courier/resources/inbox/messages.rbs +19 -0
  218. data/sig/courier/resources/inbox.rbs +9 -0
  219. data/sig/courier/resources/journeys/templates.rbs +4 -0
  220. data/sig/courier/resources/journeys.rbs +8 -0
  221. data/sig/courier/resources/lists/subscriptions.rbs +2 -0
  222. data/sig/courier/resources/notifications.rbs +4 -0
  223. data/sig/courier/resources/profiles/lists.rbs +2 -0
  224. data/sig/courier/resources/profiles.rbs +2 -0
  225. data/sig/courier/resources/providers.rbs +2 -0
  226. data/sig/courier/resources/routing_strategies.rbs +2 -0
  227. data/sig/courier/resources/send.rbs +2 -0
  228. data/sig/courier/resources/users/preferences.rbs +2 -0
  229. data/sig/courier/resources/workspace_preferences/topics.rbs +2 -0
  230. data/sig/courier/resources/workspace_preferences.rbs +4 -0
  231. metadata +71 -2
@@ -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
  sig do
9
12
  params(
10
13
  list_id: String,
@@ -27,13 +30,28 @@ module Courier
27
30
  params(
28
31
  list_id: String,
29
32
  recipients: T::Array[Courier::PutSubscriptionsRecipient::OrHash],
33
+ idempotency_key: String,
34
+ x_idempotency_expiration: String,
30
35
  request_options: Courier::RequestOptions::OrHash
31
36
  ).void
32
37
  end
33
38
  def add(
34
- # A unique identifier representing the list you wish to retrieve.
39
+ # Path param: A unique identifier representing the list you wish to retrieve.
35
40
  list_id,
41
+ # Body param
36
42
  recipients:,
43
+ # Header param: A unique key that makes this request idempotent. If Courier
44
+ # receives another request with the same `Idempotency-Key`, it returns the stored
45
+ # response from the first request without performing the operation again
46
+ # (including the original status code and any error). Use it to safely retry
47
+ # `POST` requests after network failures without risking duplicate sends. The key
48
+ # is scoped to this endpoint.
49
+ idempotency_key: nil,
50
+ # Header param: How long the idempotency key remains valid, as a Unix epoch
51
+ # timestamp in seconds or an ISO 8601 date string. Only applies when
52
+ # `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
53
+ # maximum is 1 year.
54
+ x_idempotency_expiration: nil,
37
55
  request_options: {}
38
56
  )
39
57
  end
@@ -55,8 +73,8 @@ module Courier
55
73
  )
56
74
  end
57
75
 
58
- # Subscribe a user to an existing list (note: if the List does not exist, it will
59
- # be automatically created).
76
+ # Subscribes one user to a list, creating the list if it does not yet exist.
77
+ # Optional preferences apply to this subscription only.
60
78
  sig do
61
79
  params(
62
80
  user_id: String,
@@ -77,7 +95,8 @@ module Courier
77
95
  )
78
96
  end
79
97
 
80
- # Delete a subscription to a list by list ID and user ID.
98
+ # Removes one user's subscription to a list, addressed by list id and user id. The
99
+ # user's profile and other subscriptions are separate resources.
81
100
  sig do
82
101
  params(
83
102
  user_id: String,
@@ -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
  sig { returns(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
  sig do
11
16
  params(
12
17
  list_id: String,
@@ -20,7 +25,8 @@ module Courier
20
25
  )
21
26
  end
22
27
 
23
- # Create or replace an existing list with the supplied values.
28
+ # Creates or replaces a list from a name and preferences. Subscribers are managed
29
+ # through the separate subscriptions endpoints.
24
30
  sig do
25
31
  params(
26
32
  list_id: String,
@@ -38,7 +44,8 @@ module Courier
38
44
  )
39
45
  end
40
46
 
41
- # Returns all of the lists, with the ability to filter based on a pattern.
47
+ # Returns the workspace's lists, filterable by a pattern to fetch a subset such as
48
+ # every regional list. Paged by cursor.
42
49
  sig do
43
50
  params(
44
51
  cursor: T.nilable(String),
@@ -58,7 +65,8 @@ module Courier
58
65
  )
59
66
  end
60
67
 
61
- # Delete a list by list ID.
68
+ # Deletes a list, halting sends that target it. A previously deleted list can be
69
+ # brought back with the companion restore endpoint.
62
70
  sig do
63
71
  params(
64
72
  list_id: String,
@@ -72,7 +80,8 @@ module Courier
72
80
  )
73
81
  end
74
82
 
75
- # Restore a previously deleted list.
83
+ # Restores a previously deleted list along with its subscribers, so a list removed
84
+ # by mistake can be brought back rather than rebuilt.
76
85
  sig do
77
86
  params(
78
87
  list_id: String,
@@ -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 Messages
6
- # Fetch the status of a message you've previously sent.
8
+ # Returns a sent message's status, recipient, event, and per-provider delivery
9
+ # detail, with timestamps for enqueued, sent, delivered, opened, and clicked.
7
10
  sig do
8
11
  params(
9
12
  message_id: String,
@@ -18,7 +21,8 @@ module Courier
18
21
  )
19
22
  end
20
23
 
21
- # Fetch the statuses of messages you've previously sent.
24
+ # Returns previously sent messages, most recent first, each carrying its status,
25
+ # recipient, channel, and provider. Paged by cursor.
22
26
  sig do
23
27
  params(
24
28
  archived: T.nilable(T::Boolean),
@@ -80,11 +84,8 @@ module Courier
80
84
  )
81
85
  end
82
86
 
83
- # Cancel a message that is currently in the process of being delivered. A
84
- # well-formatted API call to the cancel message API will return either `200`
85
- # status code for a successful cancellation or `409` status code for an
86
- # unsuccessful cancellation. Both cases will include the actual message record in
87
- # the response body (see details below).
87
+ # Cancels a message that is still in the delivery pipeline and returns the message
88
+ # record with its resulting canceled or failed status.
88
89
  sig do
89
90
  params(
90
91
  message_id: String,
@@ -98,7 +99,8 @@ module Courier
98
99
  )
99
100
  end
100
101
 
101
- # Get message content
102
+ # Returns the rendered content Courier delivered for a message, broken out per
103
+ # channel, to confirm what the recipient received.
102
104
  sig do
103
105
  params(
104
106
  message_id: String,
@@ -113,7 +115,8 @@ module Courier
113
115
  )
114
116
  end
115
117
 
116
- # Fetch the array of events of a message you've previously sent.
118
+ # Returns the ordered event history for a sent message, one entry per status
119
+ # transition with its timestamp.
117
120
  sig do
118
121
  params(
119
122
  message_id: String,
@@ -130,11 +133,8 @@ module Courier
130
133
  )
131
134
  end
132
135
 
133
- # Resend a previously sent message. The original send request is loaded from
134
- # storage and a brand-new send is enqueued for the same recipient and content,
135
- # producing a **new** `messageId` — the original message is not modified.
136
- # Throttled by a per-message rate limit; a repeat inside the limit window returns
137
- # `429 Too Many Requests`.
136
+ # Resends a previously sent message to the same recipient and content, returning a
137
+ # new messageId. The original send request is not modified.
138
138
  sig do
139
139
  params(
140
140
  message_id: String,
@@ -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
  sig do
9
12
  params(
10
13
  submission_id: String,
@@ -24,7 +27,8 @@ module Courier
24
27
  )
25
28
  end
26
29
 
27
- # Retrieve the submission checks for a notification template.
30
+ # Returns the approval checks recorded for a template submission, each with its
31
+ # pass or fail result.
28
32
  sig do
29
33
  params(
30
34
  submission_id: String,
@@ -41,7 +45,8 @@ module Courier
41
45
  )
42
46
  end
43
47
 
44
- # Cancel a submission for a notification template.
48
+ # Cancels a pending template submission, withdrawing it from the approval
49
+ # workflow. The template stays in draft and can be resubmitted later.
45
50
  sig do
46
51
  params(
47
52
  submission_id: String,
@@ -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
  sig { returns(Courier::Resources::Notifications::Checks) }
7
11
  attr_reader :checks
8
12
 
@@ -12,16 +16,30 @@ module Courier
12
16
  params(
13
17
  notification: Courier::NotificationTemplatePayload::OrHash,
14
18
  state: Courier::NotificationTemplateCreateRequest::State::OrSymbol,
19
+ idempotency_key: String,
20
+ x_idempotency_expiration: String,
15
21
  request_options: Courier::RequestOptions::OrHash
16
22
  ).returns(Courier::NotificationTemplateResponse)
17
23
  end
18
24
  def create(
19
- # Core template fields used in POST and PUT request bodies (nested under a
20
- # `notification` key) and returned at the top level in responses.
25
+ # Body param: Core template fields used in POST and PUT request bodies (nested
26
+ # under a `notification` key) and returned at the top level in responses.
21
27
  notification:,
22
- # Template state after creation. Case-insensitive input, normalized to uppercase
23
- # in the response. Defaults to "DRAFT".
28
+ # Body param: Template state after creation. Case-insensitive input, normalized to
29
+ # uppercase in the response. Defaults to "DRAFT".
24
30
  state: nil,
31
+ # Header param: A unique key that makes this request idempotent. If Courier
32
+ # receives another request with the same `Idempotency-Key`, it returns the stored
33
+ # response from the first request without performing the operation again
34
+ # (including the original status code and any error). Use it to safely retry
35
+ # `POST` requests after network failures without risking duplicate sends. The key
36
+ # is scoped to this endpoint.
37
+ idempotency_key: nil,
38
+ # Header param: How long the idempotency key remains valid, as a Unix epoch
39
+ # timestamp in seconds or an ISO 8601 date string. Only applies when
40
+ # `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
41
+ # maximum is 1 year.
42
+ x_idempotency_expiration: nil,
25
43
  request_options: {}
26
44
  )
27
45
  end
@@ -45,7 +63,8 @@ module Courier
45
63
  )
46
64
  end
47
65
 
48
- # List notification templates in your workspace.
66
+ # Lists the workspace's notification templates. Each carries a name, tags, brand,
67
+ # routing, and its draft or published state.
49
68
  sig do
50
69
  params(
51
70
  cursor: T.nilable(String),
@@ -65,7 +84,8 @@ module Courier
65
84
  )
66
85
  end
67
86
 
68
- # Archive a notification template.
87
+ # Archives a notification template, preventing new sends from referencing it. The
88
+ # template stays retrievable for its version history.
69
89
  sig do
70
90
  params(
71
91
  id: String,
@@ -79,12 +99,9 @@ module Courier
79
99
  )
80
100
  end
81
101
 
82
- # Duplicate a notification template. Creates a standalone copy within the same
83
- # workspace and environment, with " COPY" appended to the title. The copy clones
84
- # the source draft's tags, brand, subscription topic, routing strategy, channels,
85
- # and content, and is always created as a standalone template (it is not linked to
86
- # any journey or broadcast, even if the source was). Templates that are scoped to
87
- # a journey or a broadcast cannot be duplicated through this endpoint.
102
+ # Copies a notification template within the same workspace and environment,
103
+ # appending " COPY" to the title. The copy is standalone and independently
104
+ # editable.
88
105
  sig do
89
106
  params(
90
107
  id: String,
@@ -98,7 +115,8 @@ module Courier
98
115
  )
99
116
  end
100
117
 
101
- # List versions of a notification template.
118
+ # Returns a notification template's published versions, most recent first, for
119
+ # comparison or rollback. Paged.
102
120
  sig do
103
121
  params(
104
122
  id: String,
@@ -124,21 +142,35 @@ module Courier
124
142
  params(
125
143
  id: String,
126
144
  version: String,
145
+ idempotency_key: String,
146
+ x_idempotency_expiration: String,
127
147
  request_options: Courier::RequestOptions::OrHash
128
148
  ).void
129
149
  end
130
150
  def publish(
131
- # Template ID (nt\_ prefix).
151
+ # Path param: Template ID (nt\_ prefix).
132
152
  id,
133
- # Historical version to publish (e.g. "v001"). Omit to publish the current draft.
153
+ # Body param: Historical version to publish (e.g. "v001"). Omit to publish the
154
+ # current draft.
134
155
  version: nil,
156
+ # Header param: A unique key that makes this request idempotent. If Courier
157
+ # receives another request with the same `Idempotency-Key`, it returns the stored
158
+ # response from the first request without performing the operation again
159
+ # (including the original status code and any error). Use it to safely retry
160
+ # `POST` requests after network failures without risking duplicate sends. The key
161
+ # is scoped to this endpoint.
162
+ idempotency_key: nil,
163
+ # Header param: How long the idempotency key remains valid, as a Unix epoch
164
+ # timestamp in seconds or an ISO 8601 date string. Only applies when
165
+ # `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
166
+ # maximum is 1 year.
167
+ x_idempotency_expiration: nil,
135
168
  request_options: {}
136
169
  )
137
170
  end
138
171
 
139
- # Replace the elemental content of a notification template. Overwrites all
140
- # elements in the template with the provided content. Only supported for V2
141
- # (elemental) templates.
172
+ # Replaces all Elemental content in a template, overwriting every existing
173
+ # element. Supported for V2 templates only, not V1 blocks and channels.
142
174
  sig do
143
175
  params(
144
176
  id: String,
@@ -158,8 +190,8 @@ module Courier
158
190
  )
159
191
  end
160
192
 
161
- # Update a single element within a notification template. Only supported for V2
162
- # (elemental) templates.
193
+ # Replaces one Elemental element in a template, addressed by its element id.
194
+ # Supported for V2 templates only, not V1 blocks and channels.
163
195
  sig do
164
196
  params(
165
197
  element_id: String,
@@ -197,9 +229,8 @@ module Courier
197
229
  )
198
230
  end
199
231
 
200
- # Set locale-specific content overrides for a notification template. Each element
201
- # override must reference an existing element by ID. Only supported for V2
202
- # (elemental) templates.
232
+ # Sets locale-specific content overrides for a template. Each override must
233
+ # reference an element that already exists in the default content.
203
234
  sig do
204
235
  params(
205
236
  locale_id: String,
@@ -223,7 +254,8 @@ module Courier
223
254
  )
224
255
  end
225
256
 
226
- # Replace a notification template. All fields are required.
257
+ # Replaces a notification template in full, so send every field rather than only
258
+ # the ones you want changed. Publish separately to make it live.
227
259
  sig do
228
260
  params(
229
261
  id: String,
@@ -245,10 +277,8 @@ module Courier
245
277
  )
246
278
  end
247
279
 
248
- # Retrieve the content of a notification template. The response shape depends on
249
- # whether the template uses V1 (blocks/channels) or V2 (elemental) content. Use
250
- # the `version` query parameter to select draft, published, or a specific
251
- # historical version.
280
+ # Returns a template's content and checksum. V2 templates return Elemental
281
+ # elements, while V1 templates return blocks and channels instead.
252
282
  sig do
253
283
  params(
254
284
  id: String,
@@ -3,8 +3,11 @@
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
- # Returns the subscribed lists for a specified user.
9
+ # Returns the lists a user is subscribed to, with paging. Use it to check what a
10
+ # recipient will receive before sending to a list.
8
11
  sig do
9
12
  params(
10
13
  user_id: String,
@@ -22,7 +25,8 @@ module Courier
22
25
  )
23
26
  end
24
27
 
25
- # Removes all list subscriptions for given user.
28
+ # Removes every list subscription for a user at once. Their profile and
29
+ # preferences are untouched, so this only affects list-targeted sends.
26
30
  sig do
27
31
  params(
28
32
  user_id: String,
@@ -36,20 +40,35 @@ module Courier
36
40
  )
37
41
  end
38
42
 
39
- # Subscribes the given user to one or more lists. If the list does not exist, it
40
- # will be created.
43
+ # Subscribes a user to one or more lists, creating any list that does not yet
44
+ # exist. Optional preferences apply to each subscription.
41
45
  sig do
42
46
  params(
43
47
  user_id: String,
44
48
  lists: T::Array[Courier::SubscribeToListsRequestItem::OrHash],
49
+ idempotency_key: String,
50
+ x_idempotency_expiration: String,
45
51
  request_options: Courier::RequestOptions::OrHash
46
52
  ).returns(Courier::Models::Profiles::ListSubscribeResponse)
47
53
  end
48
54
  def subscribe(
49
- # A unique identifier representing the user associated with the requested user
50
- # profile.
55
+ # Path param: A unique identifier representing the user associated with the
56
+ # requested user profile.
51
57
  user_id,
58
+ # Body param
52
59
  lists:,
60
+ # Header param: A unique key that makes this request idempotent. If Courier
61
+ # receives another request with the same `Idempotency-Key`, it returns the stored
62
+ # response from the first request without performing the operation again
63
+ # (including the original status code and any error). Use it to safely retry
64
+ # `POST` requests after network failures without risking duplicate sends. The key
65
+ # is scoped to this endpoint.
66
+ idempotency_key: nil,
67
+ # Header param: How long the idempotency key remains valid, as a Unix epoch
68
+ # timestamp in seconds or an ISO 8601 date string. Only applies when
69
+ # `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
70
+ # maximum is 1 year.
71
+ x_idempotency_expiration: nil,
53
72
  request_options: {}
54
73
  )
55
74
  end
@@ -2,28 +2,49 @@
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
  sig { returns(Courier::Resources::Profiles::Lists) }
7
11
  attr_reader :lists
8
12
 
9
- # Merge the supplied values with an existing profile or create a new profile if
10
- # one doesn't already exist.
13
+ # Merges the supplied values into a user's profile, creating it if absent and
14
+ # leaving any key you omit untouched. Prefer this for everyday writes.
11
15
  sig do
12
16
  params(
13
17
  user_id: String,
14
18
  profile: T::Hash[Symbol, T.anything],
19
+ idempotency_key: String,
20
+ x_idempotency_expiration: String,
15
21
  request_options: Courier::RequestOptions::OrHash
16
22
  ).returns(Courier::Models::ProfileCreateResponse)
17
23
  end
18
24
  def create(
19
- # A unique identifier representing the user associated with the requested profile.
25
+ # Path param: A unique identifier representing the user associated with the
26
+ # requested profile.
20
27
  user_id,
28
+ # Body param
21
29
  profile:,
30
+ # Header param: A unique key that makes this request idempotent. If Courier
31
+ # receives another request with the same `Idempotency-Key`, it returns the stored
32
+ # response from the first request without performing the operation again
33
+ # (including the original status code and any error). Use it to safely retry
34
+ # `POST` requests after network failures without risking duplicate sends. The key
35
+ # is scoped to this endpoint.
36
+ idempotency_key: nil,
37
+ # Header param: How long the idempotency key remains valid, as a Unix epoch
38
+ # timestamp in seconds or an ISO 8601 date string. Only applies when
39
+ # `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
40
+ # maximum is 1 year.
41
+ x_idempotency_expiration: nil,
22
42
  request_options: {}
23
43
  )
24
44
  end
25
45
 
26
- # Returns the specified user profile.
46
+ # Returns a user's stored profile and preferences, including the email address,
47
+ # phone number, and push tokens Courier can reach them on.
27
48
  sig do
28
49
  params(
29
50
  user_id: String,
@@ -37,7 +58,8 @@ module Courier
37
58
  )
38
59
  end
39
60
 
40
- # Update a profile
61
+ # Applies a JSON Patch to a user profile, adding, removing, or replacing
62
+ # individual fields without sending the whole object.
41
63
  sig do
42
64
  params(
43
65
  user_id: String,
@@ -55,7 +77,8 @@ module Courier
55
77
  )
56
78
  end
57
79
 
58
- # Deletes the specified user profile.
80
+ # Deletes a user's profile and stored contact details. List subscriptions and
81
+ # preferences are separate resources, so remove those too if required.
59
82
  sig do
60
83
  params(
61
84
  user_id: String,
@@ -70,11 +93,8 @@ module Courier
70
93
  )
71
94
  end
72
95
 
73
- # When using `PUT`, be sure to include all the key-value pairs required by the
74
- # recipient's profile. Any key-value pairs that exist in the profile but fail to
75
- # be included in the `PUT` request will be removed from the profile. Remember, a
76
- # `PUT` update is a full replacement of the data. For partial updates, use the
77
- # [Patch](https://www.courier.com/docs/reference/profiles/patch/) request.
96
+ # Overwrites a user profile in full, removing any key absent from the request
97
+ # body. Use the patch endpoint when changing a single field.
78
98
  sig do
79
99
  params(
80
100
  user_id: String,
@@ -3,11 +3,11 @@
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
- # Returns the catalog of available provider types with their display names,
8
- # descriptions, and configuration schema fields (snake_case, with `type` and
9
- # `required`). Providers with no configurable schema return only `provider`,
10
- # `name`, and `description`.
9
+ # Returns the provider types Courier supports, each with a display name,
10
+ # description, and the configuration fields it requires.
11
11
  sig do
12
12
  params(
13
13
  channel: String,