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,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
  #
@@ -3,11 +3,16 @@
3
3
  module Courier
4
4
  module Resources
5
5
  class Tenants
6
+ # Manage the templates and template versions scoped to a single tenant, including
7
+ # the ones authored in the embedded designer.
6
8
  class Templates
9
+ # Manage the templates and template versions scoped to a single tenant, including
10
+ # the ones authored in the embedded designer.
7
11
  # @return [Courier::Resources::Tenants::Templates::Versions]
8
12
  attr_reader :versions
9
13
 
10
- # Get a Template in Tenant
14
+ # Returns a tenant's notification template with its content, version, and created,
15
+ # updated, and published timestamps.
11
16
  #
12
17
  # @overload retrieve(template_id, tenant_id:, request_options: {})
13
18
  #
@@ -34,7 +39,8 @@ module Courier
34
39
  )
35
40
  end
36
41
 
37
- # List Templates in Tenant
42
+ # Lists a tenant's notification templates, each carrying its version and published
43
+ # timestamp. Paged.
38
44
  #
39
45
  # @overload list(tenant_id, cursor: nil, limit: nil, request_options: {})
40
46
  #
@@ -61,12 +67,8 @@ module Courier
61
67
  )
62
68
  end
63
69
 
64
- # Deletes the tenant's notification template with the given `template_id`.
65
- #
66
- # Returns **204 No Content** with an empty body on success.
67
- #
68
- # Returns **404** if there is no template with this ID for the tenant, including a
69
- # second `DELETE` after a successful removal.
70
+ # Deletes a tenant's notification template by id. Sends for that tenant then use
71
+ # the workspace template registered under the same id.
70
72
  #
71
73
  # @overload delete(template_id, tenant_id:, request_options: {})
72
74
  #
@@ -96,10 +98,8 @@ module Courier
96
98
  # Some parameter documentations has been truncated, see
97
99
  # {Courier::Models::Tenants::TemplatePublishParams} for more details.
98
100
  #
99
- # Publishes a specific version of a notification template for a tenant.
100
- #
101
- # The template must already exist in the tenant's notification map. If no version
102
- # is specified, defaults to publishing the "latest" version.
101
+ # Publishes a version of a tenant's notification template, making it the content
102
+ # that tenant's sends render from until you publish another.
103
103
  #
104
104
  # @overload publish(template_id, tenant_id:, version: nil, request_options: {})
105
105
  #
@@ -132,13 +132,8 @@ module Courier
132
132
  # Some parameter documentations has been truncated, see
133
133
  # {Courier::Models::Tenants::TemplateReplaceParams} for more details.
134
134
  #
135
- # Creates or updates a notification template for a tenant.
136
- #
137
- # If the template already exists for the tenant, it will be updated (200).
138
- # Otherwise, a new template is created (201).
139
- #
140
- # Optionally publishes the template immediately if the `published` flag is set to
141
- # true.
135
+ # Creates or updates a notification template scoped to one tenant, letting a
136
+ # tenant override the content the workspace template would send.
142
137
  #
143
138
  # @overload replace(template_id, tenant_id:, template:, published: nil, request_options: {})
144
139
  #
@@ -2,14 +2,19 @@
2
2
 
3
3
  module Courier
4
4
  module Resources
5
+ # Manage tenants — the organizations, teams, or accounts your users belong to —
6
+ # along with their users and default preferences.
5
7
  class Tenants
6
8
  # @return [Courier::Resources::Tenants::Preferences]
7
9
  attr_reader :preferences
8
10
 
11
+ # Manage the templates and template versions scoped to a single tenant, including
12
+ # the ones authored in the embedded designer.
9
13
  # @return [Courier::Resources::Tenants::Templates]
10
14
  attr_reader :templates
11
15
 
12
- # Get a Tenant
16
+ # Returns one tenant with its name, parent tenant id, default preferences,
17
+ # properties, and the user profile applied to its members.
13
18
  #
14
19
  # @overload retrieve(tenant_id, request_options: {})
15
20
  #
@@ -32,7 +37,8 @@ module Courier
32
37
  # Some parameter documentations has been truncated, see
33
38
  # {Courier::Models::TenantUpdateParams} for more details.
34
39
  #
35
- # Create or Replace a Tenant
40
+ # Creates or replaces a tenant from a name, parent, brand, properties, and default
41
+ # preferences supplied in the request body.
36
42
  #
37
43
  # @overload update(tenant_id, name:, brand_id: nil, default_preferences: nil, parent_tenant_id: nil, properties: nil, user_profile: nil, request_options: {})
38
44
  #
@@ -69,7 +75,8 @@ module Courier
69
75
  # Some parameter documentations has been truncated, see
70
76
  # {Courier::Models::TenantListParams} for more details.
71
77
  #
72
- # Get a List of Tenants
78
+ # Lists the workspace's tenants, each carrying a name, parent tenant, properties,
79
+ # and default preferences. Paged.
73
80
  #
74
81
  # @overload list(cursor: nil, limit: nil, parent_tenant_id: nil, request_options: {})
75
82
  #
@@ -96,7 +103,8 @@ module Courier
96
103
  )
97
104
  end
98
105
 
99
- # Delete a Tenant
106
+ # Deletes a tenant. Its members' workspace-level profiles and preferences live
107
+ # outside the tenant and are managed separately.
100
108
  #
101
109
  # @overload delete(tenant_id, request_options: {})
102
110
  #
@@ -119,7 +127,8 @@ module Courier
119
127
  # Some parameter documentations has been truncated, see
120
128
  # {Courier::Models::TenantListUsersParams} for more details.
121
129
  #
122
- # Get Users in Tenant
130
+ # Returns the users belonging to a tenant with cursor paging. Use it to see who a
131
+ # tenant-scoped send will reach.
123
132
  #
124
133
  # @overload list_users(tenant_id, cursor: nil, limit: nil, request_options: {})
125
134
  #
@@ -2,11 +2,14 @@
2
2
 
3
3
  module Courier
4
4
  module Resources
5
+ # Store and retrieve the translation strings Courier uses to render localized
6
+ # template content.
5
7
  class Translations
6
8
  # Some parameter documentations has been truncated, see
7
9
  # {Courier::Models::TranslationRetrieveParams} for more details.
8
10
  #
9
- # Get translations by locale
11
+ # Returns the translation strings stored for one domain and locale, for use in
12
+ # localized notification content.
10
13
  #
11
14
  # @overload retrieve(locale, domain:, request_options: {})
12
15
  #
@@ -36,7 +39,8 @@ module Courier
36
39
  # Some parameter documentations has been truncated, see
37
40
  # {Courier::Models::TranslationUpdateParams} for more details.
38
41
  #
39
- # Update a translation
42
+ # Uploads the translation strings for one domain and locale. Courier uses them to
43
+ # render localized content for recipients in that locale.
40
44
  #
41
45
  # @overload update(locale, domain:, body:, request_options: {})
42
46
  #