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 Users
6
+ # Register and manage the APNS and FCM device tokens Courier delivers push
7
+ # notifications to.
6
8
  class Tokens
7
- # Get single token available for a `:token`
9
+ # Returns one device token with its provider key, status and status reason, expiry
10
+ # date, and any properties stored alongside it.
8
11
  sig do
9
12
  params(
10
13
  token: String,
@@ -21,7 +24,8 @@ module Courier
21
24
  )
22
25
  end
23
26
 
24
- # Apply a JSON Patch (RFC 6902) to the specified token.
27
+ # Applies a JSON Patch to a device token, changing its status, expiry, or
28
+ # properties without re-registering it.
25
29
  sig do
26
30
  params(
27
31
  token: String,
@@ -41,7 +45,8 @@ module Courier
41
45
  )
42
46
  end
43
47
 
44
- # Gets all tokens available for a :user_id
48
+ # Returns every device token registered for a user, each with its provider key,
49
+ # status, and expiry date.
45
50
  sig do
46
51
  params(
47
52
  user_id: String,
@@ -55,7 +60,8 @@ module Courier
55
60
  )
56
61
  end
57
62
 
58
- # Delete User Token
63
+ # Deletes one device token for a user, addressed by the token value, so push sends
64
+ # no longer target that device.
59
65
  sig do
60
66
  params(
61
67
  token: String,
@@ -72,7 +78,8 @@ module Courier
72
78
  )
73
79
  end
74
80
 
75
- # Adds multiple tokens to a user and overwrites matching existing tokens.
81
+ # Registers several device tokens for a user in one call, overwriting any stored
82
+ # token with a matching value.
76
83
  sig do
77
84
  params(
78
85
  user_id: String,
@@ -86,7 +93,8 @@ module Courier
86
93
  )
87
94
  end
88
95
 
89
- # Adds a single token to a user and overwrites a matching existing token.
96
+ # Registers one device token for a user against a provider key, overwriting the
97
+ # token if it already exists. Push sends resolve tokens per user.
90
98
  sig do
91
99
  params(
92
100
  token: String,
@@ -3,12 +3,18 @@
3
3
  module Courier
4
4
  module Resources
5
5
  class Users
6
+ # Read and write a single user's notification preferences, per topic and per
7
+ # channel.
6
8
  sig { returns(Courier::Resources::Users::Preferences) }
7
9
  attr_reader :preferences
8
10
 
11
+ # Associate a user with one or more tenants, and read or remove those
12
+ # associations.
9
13
  sig { returns(Courier::Resources::Users::Tenants) }
10
14
  attr_reader :tenants
11
15
 
16
+ # Register and manage the APNS and FCM device tokens Courier delivers push
17
+ # notifications to.
12
18
  sig { returns(Courier::Resources::Users::Tokens) }
13
19
  attr_reader :tokens
14
20
 
@@ -3,10 +3,11 @@
3
3
  module Courier
4
4
  module Resources
5
5
  class WorkspacePreferences
6
+ # Manage the workspace catalog of subscription topics, the sections that group
7
+ # them, and publishing the preference page.
6
8
  class Topics
7
- # Create a subscription preference topic inside a workspace preference. Fails with
8
- # 404 if the workspace preference does not exist. The topic id is generated and
9
- # returned.
9
+ # Creates a subscription topic inside a workspace preference. The default status
10
+ # sets whether users start opted in, opted out, or required.
10
11
  sig do
11
12
  params(
12
13
  section_id: String,
@@ -24,34 +25,51 @@ module Courier
24
25
  routing_options:
25
26
  T.nilable(T::Array[Courier::ChannelClassification::OrSymbol]),
26
27
  topic_data: T.nilable(T::Hash[Symbol, T.anything]),
28
+ idempotency_key: String,
29
+ x_idempotency_expiration: String,
27
30
  request_options: Courier::RequestOptions::OrHash
28
31
  ).returns(Courier::WorkspacePreferenceTopicGetResponse)
29
32
  end
30
33
  def create(
31
- # Id of the workspace preference to create the topic in.
34
+ # Path param: Id of the workspace preference to create the topic in.
32
35
  section_id,
33
- # The default subscription status applied when a recipient has not set their own.
36
+ # Body param: The default subscription status applied when a recipient has not set
37
+ # their own.
34
38
  default_status:,
35
- # Human-readable name for the preference topic.
39
+ # Body param: Human-readable name for the preference topic.
36
40
  name:,
37
- # Preference controls a recipient may customize for this topic. Defaults to empty
38
- # if omitted.
41
+ # Body param: Preference controls a recipient may customize for this topic.
42
+ # Defaults to empty if omitted.
39
43
  allowed_preferences: nil,
40
- # Optional description shown under the topic on the hosted preferences page.
44
+ # Body param: Optional description shown under the topic on the hosted preferences
45
+ # page.
41
46
  description: nil,
42
- # Whether to include a list-unsubscribe header on emails for this topic.
47
+ # Body param: Whether to include a list-unsubscribe header on emails for this
48
+ # topic.
43
49
  include_unsubscribe_header: nil,
44
- # Default channels delivered for this topic. Defaults to empty if omitted.
50
+ # Body param: Default channels delivered for this topic. Defaults to empty if
51
+ # omitted.
45
52
  routing_options: nil,
46
- # Arbitrary metadata associated with the topic.
53
+ # Body param: Arbitrary metadata associated with the topic.
47
54
  topic_data: nil,
55
+ # Header param: A unique key that makes this request idempotent. If Courier
56
+ # receives another request with the same `Idempotency-Key`, it returns the stored
57
+ # response from the first request without performing the operation again
58
+ # (including the original status code and any error). Use it to safely retry
59
+ # `POST` requests after network failures without risking duplicate sends. The key
60
+ # is scoped to this endpoint.
61
+ idempotency_key: nil,
62
+ # Header param: How long the idempotency key remains valid, as a Unix epoch
63
+ # timestamp in seconds or an ISO 8601 date string. Only applies when
64
+ # `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
65
+ # maximum is 1 year.
66
+ x_idempotency_expiration: nil,
48
67
  request_options: {}
49
68
  )
50
69
  end
51
70
 
52
- # Retrieve a topic within a workspace preference. Returns 404 if the workspace
53
- # preference does not exist, the topic does not exist, or the topic belongs to a
54
- # different workspace preference.
71
+ # Returns one subscription topic with its default status, routing options, allowed
72
+ # preferences, and unsubscribe header setting.
55
73
  sig do
56
74
  params(
57
75
  topic_id: String,
@@ -68,7 +86,8 @@ module Courier
68
86
  )
69
87
  end
70
88
 
71
- # List the topics in a workspace preference.
89
+ # Returns the subscription topics inside a workspace preference, each with its
90
+ # default status and routing options.
72
91
  sig do
73
92
  params(
74
93
  section_id: String,
@@ -82,8 +101,8 @@ module Courier
82
101
  )
83
102
  end
84
103
 
85
- # Archive a topic and remove it from its workspace preference. Same 404 rules as
86
- # GET.
104
+ # Archives a subscription topic and removes it from its workspace preference,
105
+ # addressed by section id and topic id.
87
106
  sig do
88
107
  params(
89
108
  topic_id: String,
@@ -2,13 +2,16 @@
2
2
 
3
3
  module Courier
4
4
  module Resources
5
+ # Manage the workspace catalog of subscription topics, the sections that group
6
+ # them, and publishing the preference page.
5
7
  class WorkspacePreferences
8
+ # Manage the workspace catalog of subscription topics, the sections that group
9
+ # them, and publishing the preference page.
6
10
  sig { returns(Courier::Resources::WorkspacePreferences::Topics) }
7
11
  attr_reader :topics
8
12
 
9
- # Create a workspace preference. The workspace preference id is generated and
10
- # returned. Topics are created inside a workspace preference via POST
11
- # /preferences/sections/{section_id}/topics.
13
+ # Creates a workspace preference and returns its generated id. Add subscription
14
+ # topics to it afterwards with the topics endpoint.
12
15
  sig do
13
16
  params(
14
17
  name: String,
@@ -16,23 +19,41 @@ module Courier
16
19
  has_custom_routing: T.nilable(T::Boolean),
17
20
  routing_options:
18
21
  T.nilable(T::Array[Courier::ChannelClassification::OrSymbol]),
22
+ idempotency_key: String,
23
+ x_idempotency_expiration: String,
19
24
  request_options: Courier::RequestOptions::OrHash
20
25
  ).returns(Courier::WorkspacePreferenceGetResponse)
21
26
  end
22
27
  def create(
23
- # Human-readable name for the workspace preference.
28
+ # Body param: Human-readable name for the workspace preference.
24
29
  name:,
25
- # Optional description shown under the section on the hosted preferences page.
30
+ # Body param: Optional description shown under the section on the hosted
31
+ # preferences page.
26
32
  description: nil,
27
- # Whether the workspace preference defines custom routing for its topics.
33
+ # Body param: Whether the workspace preference defines custom routing for its
34
+ # topics.
28
35
  has_custom_routing: nil,
29
- # Default channels for the workspace preference. Defaults to empty if omitted.
36
+ # Body param: Default channels for the workspace preference. Defaults to empty if
37
+ # omitted.
30
38
  routing_options: nil,
39
+ # Header param: A unique key that makes this request idempotent. If Courier
40
+ # receives another request with the same `Idempotency-Key`, it returns the stored
41
+ # response from the first request without performing the operation again
42
+ # (including the original status code and any error). Use it to safely retry
43
+ # `POST` requests after network failures without risking duplicate sends. The key
44
+ # is scoped to this endpoint.
45
+ idempotency_key: nil,
46
+ # Header param: How long the idempotency key remains valid, as a Unix epoch
47
+ # timestamp in seconds or an ISO 8601 date string. Only applies when
48
+ # `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
49
+ # maximum is 1 year.
50
+ x_idempotency_expiration: nil,
31
51
  request_options: {}
32
52
  )
33
53
  end
34
54
 
35
- # Retrieve a workspace preference by id, including its topics.
55
+ # Returns one workspace preference by id, including its subscription topics,
56
+ # routing options, and custom routing flag.
36
57
  sig do
37
58
  params(
38
59
  section_id: String,
@@ -46,8 +67,8 @@ module Courier
46
67
  )
47
68
  end
48
69
 
49
- # List the workspace's preferences. Each workspace preference embeds its topics.
50
- # Scoped to the workspace of the API key.
70
+ # Returns the workspace's preferences, each embedding its subscription topics,
71
+ # routing options, and whether custom routing is allowed.
51
72
  sig do
52
73
  params(request_options: Courier::RequestOptions::OrHash).returns(
53
74
  Courier::WorkspacePreferenceListResponse
@@ -71,25 +92,38 @@ module Courier
71
92
  )
72
93
  end
73
94
 
74
- # Publish the workspace's preferences page. Takes a snapshot of every workspace
75
- # preference with its topics under a new published version, making the current
76
- # state visible on the hosted preferences page (non-draft).
95
+ # Publishes the workspace preference page, snapshotting every preference and
96
+ # topic, and returns the page id and a preview URL.
77
97
  sig do
78
98
  params(
79
99
  brand_id: T.nilable(String),
80
100
  description: T.nilable(String),
81
101
  heading: T.nilable(String),
102
+ idempotency_key: String,
103
+ x_idempotency_expiration: String,
82
104
  request_options: Courier::RequestOptions::OrHash
83
105
  ).returns(Courier::PublishPreferencesResponse)
84
106
  end
85
107
  def publish(
86
- # Brand for the hosted page - "default" (workspace default brand), "none" (no
87
- # brand), or a specific brand id. Defaults to "default".
108
+ # Body param: Brand for the hosted page - "default" (workspace default brand),
109
+ # "none" (no brand), or a specific brand id. Defaults to "default".
88
110
  brand_id: nil,
89
- # Description shown under the heading on the hosted preferences page.
111
+ # Body param: Description shown under the heading on the hosted preferences page.
90
112
  description: nil,
91
- # Heading shown at the top of the hosted preferences page.
113
+ # Body param: Heading shown at the top of the hosted preferences page.
92
114
  heading: nil,
115
+ # Header param: A unique key that makes this request idempotent. If Courier
116
+ # receives another request with the same `Idempotency-Key`, it returns the stored
117
+ # response from the first request without performing the operation again
118
+ # (including the original status code and any error). Use it to safely retry
119
+ # `POST` requests after network failures without risking duplicate sends. The key
120
+ # is scoped to this endpoint.
121
+ idempotency_key: nil,
122
+ # Header param: How long the idempotency key remains valid, as a Unix epoch
123
+ # timestamp in seconds or an ISO 8601 date string. Only applies when
124
+ # `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
125
+ # maximum is 1 year.
126
+ x_idempotency_expiration: nil,
93
127
  request_options: {}
94
128
  )
95
129
  end
@@ -24,6 +24,8 @@ module Courier
24
24
 
25
25
  attr_reader journeys: Courier::Resources::Journeys
26
26
 
27
+ attr_reader broadcasts: Courier::Resources::Broadcasts
28
+
27
29
  attr_reader brands: Courier::Resources::Brands
28
30
 
29
31
  attr_reader digests: Courier::Resources::Digests
@@ -32,6 +34,8 @@ module Courier
32
34
 
33
35
  attr_reader lists: Courier::Resources::Lists
34
36
 
37
+ attr_reader inbox: Courier::Resources::Inbox
38
+
35
39
  attr_reader messages: Courier::Resources::Messages
36
40
 
37
41
  attr_reader requests: Courier::Resources::Requests
@@ -8,7 +8,9 @@ module Courier
8
8
  data: ::Hash[Symbol, top]?,
9
9
  profile: ::Hash[Symbol, top]?,
10
10
  recipient: String?,
11
- template: String?
11
+ template: String?,
12
+ idempotency_key: String,
13
+ x_idempotency_expiration: String
12
14
  }
13
15
  & Courier::Internal::Type::request_parameters
14
16
 
@@ -28,6 +30,14 @@ module Courier
28
30
 
29
31
  attr_accessor template: String?
30
32
 
33
+ attr_reader idempotency_key: String?
34
+
35
+ def idempotency_key=: (String) -> String
36
+
37
+ attr_reader x_idempotency_expiration: String?
38
+
39
+ def x_idempotency_expiration=: (String) -> String
40
+
31
41
  def initialize: (
32
42
  automation: Courier::Automations::InvokeInvokeAdHocParams::Automation,
33
43
  ?brand: String?,
@@ -35,6 +45,8 @@ module Courier
35
45
  ?profile: ::Hash[Symbol, top]?,
36
46
  ?recipient: String?,
37
47
  ?template: String?,
48
+ ?idempotency_key: String,
49
+ ?x_idempotency_expiration: String,
38
50
  ?request_options: Courier::request_opts
39
51
  ) -> void
40
52
 
@@ -45,6 +57,8 @@ module Courier
45
57
  profile: ::Hash[Symbol, top]?,
46
58
  recipient: String?,
47
59
  template: String?,
60
+ idempotency_key: String,
61
+ x_idempotency_expiration: String,
48
62
  request_options: Courier::RequestOptions
49
63
  }
50
64
 
@@ -8,7 +8,9 @@ module Courier
8
8
  brand: String?,
9
9
  data: ::Hash[Symbol, top]?,
10
10
  profile: ::Hash[Symbol, top]?,
11
- template: String?
11
+ template: String?,
12
+ idempotency_key: String,
13
+ x_idempotency_expiration: String
12
14
  }
13
15
  & Courier::Internal::Type::request_parameters
14
16
 
@@ -28,6 +30,14 @@ module Courier
28
30
 
29
31
  attr_accessor template: String?
30
32
 
33
+ attr_reader idempotency_key: String?
34
+
35
+ def idempotency_key=: (String) -> String
36
+
37
+ attr_reader x_idempotency_expiration: String?
38
+
39
+ def x_idempotency_expiration=: (String) -> String
40
+
31
41
  def initialize: (
32
42
  template_id: String,
33
43
  recipient: String?,
@@ -35,6 +45,8 @@ module Courier
35
45
  ?data: ::Hash[Symbol, top]?,
36
46
  ?profile: ::Hash[Symbol, top]?,
37
47
  ?template: String?,
48
+ ?idempotency_key: String,
49
+ ?x_idempotency_expiration: String,
38
50
  ?request_options: Courier::request_opts
39
51
  ) -> void
40
52
 
@@ -45,6 +57,8 @@ module Courier
45
57
  data: ::Hash[Symbol, top]?,
46
58
  profile: ::Hash[Symbol, top]?,
47
59
  template: String?,
60
+ idempotency_key: String,
61
+ x_idempotency_expiration: String,
48
62
  request_options: Courier::RequestOptions
49
63
  }
50
64
  end
@@ -5,7 +5,9 @@ module Courier
5
5
  name: String,
6
6
  settings: Courier::BrandSettings,
7
7
  id: String?,
8
- snippets: Courier::BrandSnippets?
8
+ snippets: Courier::BrandSnippets?,
9
+ idempotency_key: String,
10
+ x_idempotency_expiration: String
9
11
  }
10
12
  & Courier::Internal::Type::request_parameters
11
13
 
@@ -21,11 +23,21 @@ module Courier
21
23
 
22
24
  attr_accessor snippets: Courier::BrandSnippets?
23
25
 
26
+ attr_reader idempotency_key: String?
27
+
28
+ def idempotency_key=: (String) -> String
29
+
30
+ attr_reader x_idempotency_expiration: String?
31
+
32
+ def x_idempotency_expiration=: (String) -> String
33
+
24
34
  def initialize: (
25
35
  name: String,
26
36
  settings: Courier::BrandSettings,
27
37
  ?id: String?,
28
38
  ?snippets: Courier::BrandSnippets?,
39
+ ?idempotency_key: String,
40
+ ?x_idempotency_expiration: String,
29
41
  ?request_options: Courier::request_opts
30
42
  ) -> void
31
43
 
@@ -34,6 +46,8 @@ module Courier
34
46
  settings: Courier::BrandSettings,
35
47
  id: String?,
36
48
  snippets: Courier::BrandSnippets?,
49
+ idempotency_key: String,
50
+ x_idempotency_expiration: String,
37
51
  request_options: Courier::RequestOptions
38
52
  }
39
53
  end
@@ -0,0 +1,98 @@
1
+ module Courier
2
+ module Models
3
+ type broadcast =
4
+ {
5
+ id: String,
6
+ channel: Courier::Models::Broadcast::channel,
7
+ created_at: String,
8
+ created_by: String,
9
+ name: String,
10
+ status: Courier::Models::Broadcast::status,
11
+ updated_at: String,
12
+ updated_by: String,
13
+ archived_at: String?,
14
+ archived_by: String?,
15
+ schedule: Courier::BroadcastSchedule?
16
+ }
17
+
18
+ class Broadcast < Courier::Internal::Type::BaseModel
19
+ attr_accessor id: String
20
+
21
+ attr_accessor channel: Courier::Models::Broadcast::channel
22
+
23
+ attr_accessor created_at: String
24
+
25
+ attr_accessor created_by: String
26
+
27
+ attr_accessor name: String
28
+
29
+ attr_accessor status: Courier::Models::Broadcast::status
30
+
31
+ attr_accessor updated_at: String
32
+
33
+ attr_accessor updated_by: String
34
+
35
+ attr_accessor archived_at: String?
36
+
37
+ attr_accessor archived_by: String?
38
+
39
+ attr_accessor schedule: Courier::BroadcastSchedule?
40
+
41
+ def initialize: (
42
+ id: String,
43
+ channel: Courier::Models::Broadcast::channel,
44
+ created_at: String,
45
+ created_by: String,
46
+ name: String,
47
+ status: Courier::Models::Broadcast::status,
48
+ updated_at: String,
49
+ updated_by: String,
50
+ ?archived_at: String?,
51
+ ?archived_by: String?,
52
+ ?schedule: Courier::BroadcastSchedule?
53
+ ) -> void
54
+
55
+ def to_hash: -> {
56
+ id: String,
57
+ channel: Courier::Models::Broadcast::channel,
58
+ created_at: String,
59
+ created_by: String,
60
+ name: String,
61
+ status: Courier::Models::Broadcast::status,
62
+ updated_at: String,
63
+ updated_by: String,
64
+ archived_at: String?,
65
+ archived_by: String?,
66
+ schedule: Courier::BroadcastSchedule?
67
+ }
68
+
69
+ type channel = :email | :sms | :push | :inbox | :slack | :msteams
70
+
71
+ module Channel
72
+ extend Courier::Internal::Type::Enum
73
+
74
+ EMAIL: :email
75
+ SMS: :sms
76
+ PUSH: :push
77
+ INBOX: :inbox
78
+ SLACK: :slack
79
+ MSTEAMS: :msteams
80
+
81
+ def self?.values: -> ::Array[Courier::Models::Broadcast::channel]
82
+ end
83
+
84
+ type status = :draft | :scheduled | :sending | :sent
85
+
86
+ module Status
87
+ extend Courier::Internal::Type::Enum
88
+
89
+ DRAFT: :draft
90
+ SCHEDULED: :scheduled
91
+ SENDING: :sending
92
+ SENT: :sent
93
+
94
+ def self?.values: -> ::Array[Courier::Models::Broadcast::status]
95
+ end
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,23 @@
1
+ module Courier
2
+ module Models
3
+ type broadcast_archive_params =
4
+ { broadcast_id: String } & Courier::Internal::Type::request_parameters
5
+
6
+ class BroadcastArchiveParams < Courier::Internal::Type::BaseModel
7
+ extend Courier::Internal::Type::RequestParameters::Converter
8
+ include Courier::Internal::Type::RequestParameters
9
+
10
+ attr_accessor broadcast_id: String
11
+
12
+ def initialize: (
13
+ broadcast_id: String,
14
+ ?request_options: Courier::request_opts
15
+ ) -> void
16
+
17
+ def to_hash: -> {
18
+ broadcast_id: String,
19
+ request_options: Courier::RequestOptions
20
+ }
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ module Courier
2
+ module Models
3
+ type broadcast_cancel_params =
4
+ { broadcast_id: String } & Courier::Internal::Type::request_parameters
5
+
6
+ class BroadcastCancelParams < Courier::Internal::Type::BaseModel
7
+ extend Courier::Internal::Type::RequestParameters::Converter
8
+ include Courier::Internal::Type::RequestParameters
9
+
10
+ attr_accessor broadcast_id: String
11
+
12
+ def initialize: (
13
+ broadcast_id: String,
14
+ ?request_options: Courier::request_opts
15
+ ) -> void
16
+
17
+ def to_hash: -> {
18
+ broadcast_id: String,
19
+ request_options: Courier::RequestOptions
20
+ }
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,15 @@
1
+ module Courier
2
+ module Models
3
+ type broadcast_create_params =
4
+ { } & Courier::Internal::Type::request_parameters
5
+
6
+ class BroadcastCreateParams < Courier::Models::CreateBroadcastRequest
7
+ extend Courier::Internal::Type::RequestParameters::Converter
8
+ include Courier::Internal::Type::RequestParameters
9
+
10
+ def initialize: (?request_options: Courier::request_opts) -> void
11
+
12
+ def to_hash: -> { request_options: Courier::RequestOptions }
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,23 @@
1
+ module Courier
2
+ module Models
3
+ type broadcast_duplicate_params =
4
+ { broadcast_id: String } & Courier::Internal::Type::request_parameters
5
+
6
+ class BroadcastDuplicateParams < Courier::Internal::Type::BaseModel
7
+ extend Courier::Internal::Type::RequestParameters::Converter
8
+ include Courier::Internal::Type::RequestParameters
9
+
10
+ attr_accessor broadcast_id: String
11
+
12
+ def initialize: (
13
+ broadcast_id: String,
14
+ ?request_options: Courier::request_opts
15
+ ) -> void
16
+
17
+ def to_hash: -> {
18
+ broadcast_id: String,
19
+ request_options: Courier::RequestOptions
20
+ }
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,30 @@
1
+ module Courier
2
+ module Models
3
+ type broadcast_list_params =
4
+ { cursor: String?, limit: Integer }
5
+ & Courier::Internal::Type::request_parameters
6
+
7
+ class BroadcastListParams < Courier::Internal::Type::BaseModel
8
+ extend Courier::Internal::Type::RequestParameters::Converter
9
+ include Courier::Internal::Type::RequestParameters
10
+
11
+ attr_accessor cursor: String?
12
+
13
+ attr_reader limit: Integer?
14
+
15
+ def limit=: (Integer) -> Integer
16
+
17
+ def initialize: (
18
+ ?cursor: String?,
19
+ ?limit: Integer,
20
+ ?request_options: Courier::request_opts
21
+ ) -> void
22
+
23
+ def to_hash: -> {
24
+ cursor: String?,
25
+ limit: Integer,
26
+ request_options: Courier::RequestOptions
27
+ }
28
+ end
29
+ end
30
+ end