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
@@ -81,10 +81,14 @@ module Courier
81
81
  )
82
82
  end
83
83
 
84
+ # The subscription status to set: OPTED_IN or OPTED_OUT. REQUIRED is a topic-level
85
+ # default, not a user choice; the API rejects opting a user out of a REQUIRED
86
+ # topic.
84
87
  sig { returns(Courier::PreferenceStatus::OrSymbol) }
85
88
  attr_accessor :status
86
89
 
87
- # The Channels a user has chosen to receive notifications through for this topic
90
+ # The channels to deliver this topic on when has_custom_routing is true. One or
91
+ # more of: direct_message, email, push, sms, webhook, inbox.
88
92
  sig do
89
93
  returns(
90
94
  T.nilable(T::Array[Courier::ChannelClassification::OrSymbol])
@@ -92,6 +96,8 @@ module Courier
92
96
  end
93
97
  attr_accessor :custom_routing
94
98
 
99
+ # Set to true to route this topic to the channels in custom_routing instead of the
100
+ # topic's default routing.
95
101
  sig { returns(T.nilable(T::Boolean)) }
96
102
  attr_accessor :has_custom_routing
97
103
 
@@ -104,9 +110,15 @@ module Courier
104
110
  ).returns(T.attached_class)
105
111
  end
106
112
  def self.new(
113
+ # The subscription status to set: OPTED_IN or OPTED_OUT. REQUIRED is a topic-level
114
+ # default, not a user choice; the API rejects opting a user out of a REQUIRED
115
+ # topic.
107
116
  status:,
108
- # The Channels a user has chosen to receive notifications through for this topic
117
+ # The channels to deliver this topic on when has_custom_routing is true. One or
118
+ # more of: direct_message, email, push, sms, webhook, inbox.
109
119
  custom_routing: nil,
120
+ # Set to true to route this topic to the channels in custom_routing instead of the
121
+ # topic's default routing.
110
122
  has_custom_routing: nil
111
123
  )
112
124
  end
@@ -9,19 +9,28 @@ module Courier
9
9
  T.any(Courier::Users::TopicPreference, Courier::Internal::AnyHash)
10
10
  end
11
11
 
12
+ # The topic's default status, returned on reads. It applies whenever the user has
13
+ # no override of their own (status equals this value).
12
14
  sig { returns(Courier::PreferenceStatus::TaggedSymbol) }
13
15
  attr_accessor :default_status
14
16
 
17
+ # The user's subscription status for this topic. OPTED_IN or OPTED_OUT reflect the
18
+ # user's own choice; REQUIRED is a topic-level default set in the preferences
19
+ # editor, not a user choice.
15
20
  sig { returns(Courier::PreferenceStatus::TaggedSymbol) }
16
21
  attr_accessor :status
17
22
 
23
+ # The unique identifier of the subscription topic this preference applies to.
18
24
  sig { returns(String) }
19
25
  attr_accessor :topic_id
20
26
 
27
+ # The display name of the subscription topic, returned on reads.
21
28
  sig { returns(String) }
22
29
  attr_accessor :topic_name
23
30
 
24
- # The Channels a user has chosen to receive notifications through for this topic
31
+ # The channels the user has chosen to receive this topic on, present only when
32
+ # has_custom_routing is true. One or more of: direct_message, email, push, sms,
33
+ # webhook, inbox.
25
34
  sig do
26
35
  returns(
27
36
  T.nilable(T::Array[Courier::ChannelClassification::TaggedSymbol])
@@ -29,6 +38,8 @@ module Courier
29
38
  end
30
39
  attr_accessor :custom_routing
31
40
 
41
+ # Whether the user has chosen specific delivery channels for this topic (listed in
42
+ # custom_routing) rather than the topic's default routing.
32
43
  sig { returns(T.nilable(T::Boolean)) }
33
44
  attr_accessor :has_custom_routing
34
45
 
@@ -44,12 +55,23 @@ module Courier
44
55
  ).returns(T.attached_class)
45
56
  end
46
57
  def self.new(
58
+ # The topic's default status, returned on reads. It applies whenever the user has
59
+ # no override of their own (status equals this value).
47
60
  default_status:,
61
+ # The user's subscription status for this topic. OPTED_IN or OPTED_OUT reflect the
62
+ # user's own choice; REQUIRED is a topic-level default set in the preferences
63
+ # editor, not a user choice.
48
64
  status:,
65
+ # The unique identifier of the subscription topic this preference applies to.
49
66
  topic_id:,
67
+ # The display name of the subscription topic, returned on reads.
50
68
  topic_name:,
51
- # The Channels a user has chosen to receive notifications through for this topic
69
+ # The channels the user has chosen to receive this topic on, present only when
70
+ # has_custom_routing is true. One or more of: direct_message, email, push, sms,
71
+ # webhook, inbox.
52
72
  custom_routing: nil,
73
+ # Whether the user has chosen specific delivery channels for this topic (listed in
74
+ # custom_routing) rather than the topic's default routing.
53
75
  has_custom_routing: nil
54
76
  )
55
77
  end
@@ -14,15 +14,41 @@ module Courier
14
14
  )
15
15
  end
16
16
 
17
+ sig { returns(T.nilable(String)) }
18
+ attr_reader :idempotency_key
19
+
20
+ sig { params(idempotency_key: String).void }
21
+ attr_writer :idempotency_key
22
+
23
+ sig { returns(T.nilable(String)) }
24
+ attr_reader :x_idempotency_expiration
25
+
26
+ sig { params(x_idempotency_expiration: String).void }
27
+ attr_writer :x_idempotency_expiration
28
+
17
29
  sig do
18
- params(request_options: Courier::RequestOptions::OrHash).returns(
19
- T.attached_class
20
- )
30
+ params(
31
+ idempotency_key: String,
32
+ x_idempotency_expiration: String,
33
+ request_options: Courier::RequestOptions::OrHash
34
+ ).returns(T.attached_class)
21
35
  end
22
- def self.new(request_options: {})
36
+ def self.new(
37
+ idempotency_key: nil,
38
+ x_idempotency_expiration: nil,
39
+ request_options: {}
40
+ )
23
41
  end
24
42
 
25
- sig { override.returns({ request_options: Courier::RequestOptions }) }
43
+ sig do
44
+ override.returns(
45
+ {
46
+ idempotency_key: String,
47
+ x_idempotency_expiration: String,
48
+ request_options: Courier::RequestOptions
49
+ }
50
+ )
51
+ end
26
52
  def to_hash
27
53
  end
28
54
  end
@@ -14,15 +14,41 @@ module Courier
14
14
  )
15
15
  end
16
16
 
17
+ sig { returns(T.nilable(String)) }
18
+ attr_reader :idempotency_key
19
+
20
+ sig { params(idempotency_key: String).void }
21
+ attr_writer :idempotency_key
22
+
23
+ sig { returns(T.nilable(String)) }
24
+ attr_reader :x_idempotency_expiration
25
+
26
+ sig { params(x_idempotency_expiration: String).void }
27
+ attr_writer :x_idempotency_expiration
28
+
17
29
  sig do
18
- params(request_options: Courier::RequestOptions::OrHash).returns(
19
- T.attached_class
20
- )
30
+ params(
31
+ idempotency_key: String,
32
+ x_idempotency_expiration: String,
33
+ request_options: Courier::RequestOptions::OrHash
34
+ ).returns(T.attached_class)
21
35
  end
22
- def self.new(request_options: {})
36
+ def self.new(
37
+ idempotency_key: nil,
38
+ x_idempotency_expiration: nil,
39
+ request_options: {}
40
+ )
23
41
  end
24
42
 
25
- sig { override.returns({ request_options: Courier::RequestOptions }) }
43
+ sig do
44
+ override.returns(
45
+ {
46
+ idempotency_key: String,
47
+ x_idempotency_expiration: String,
48
+ request_options: Courier::RequestOptions
49
+ }
50
+ )
51
+ end
26
52
  def to_hash
27
53
  end
28
54
  end
@@ -18,18 +18,42 @@ module Courier
18
18
  sig { returns(String) }
19
19
  attr_accessor :section_id
20
20
 
21
+ sig { returns(T.nilable(String)) }
22
+ attr_reader :idempotency_key
23
+
24
+ sig { params(idempotency_key: String).void }
25
+ attr_writer :idempotency_key
26
+
27
+ sig { returns(T.nilable(String)) }
28
+ attr_reader :x_idempotency_expiration
29
+
30
+ sig { params(x_idempotency_expiration: String).void }
31
+ attr_writer :x_idempotency_expiration
32
+
21
33
  sig do
22
34
  params(
23
35
  section_id: String,
36
+ idempotency_key: String,
37
+ x_idempotency_expiration: String,
24
38
  request_options: Courier::RequestOptions::OrHash
25
39
  ).returns(T.attached_class)
26
40
  end
27
- def self.new(section_id:, request_options: {})
41
+ def self.new(
42
+ section_id:,
43
+ idempotency_key: nil,
44
+ x_idempotency_expiration: nil,
45
+ request_options: {}
46
+ )
28
47
  end
29
48
 
30
49
  sig do
31
50
  override.returns(
32
- { section_id: String, request_options: Courier::RequestOptions }
51
+ {
52
+ section_id: String,
53
+ idempotency_key: String,
54
+ x_idempotency_expiration: String,
55
+ request_options: Courier::RequestOptions
56
+ }
33
57
  )
34
58
  end
35
59
  def to_hash
@@ -77,6 +77,35 @@ module Courier
77
77
 
78
78
  BrandUpdateParams = Courier::Models::BrandUpdateParams
79
79
 
80
+ Broadcast = Courier::Models::Broadcast
81
+
82
+ BroadcastArchiveParams = Courier::Models::BroadcastArchiveParams
83
+
84
+ BroadcastCancelParams = Courier::Models::BroadcastCancelParams
85
+
86
+ BroadcastCreateParams = Courier::Models::BroadcastCreateParams
87
+
88
+ BroadcastDuplicateParams = Courier::Models::BroadcastDuplicateParams
89
+
90
+ BroadcastListParams = Courier::Models::BroadcastListParams
91
+
92
+ BroadcastListResponse = Courier::Models::BroadcastListResponse
93
+
94
+ BroadcastPutContentParams = Courier::Models::BroadcastPutContentParams
95
+
96
+ BroadcastRetrieveContentParams =
97
+ Courier::Models::BroadcastRetrieveContentParams
98
+
99
+ BroadcastRetrieveParams = Courier::Models::BroadcastRetrieveParams
100
+
101
+ BroadcastSchedule = Courier::Models::BroadcastSchedule
102
+
103
+ BroadcastScheduleParams = Courier::Models::BroadcastScheduleParams
104
+
105
+ BroadcastSendParams = Courier::Models::BroadcastSendParams
106
+
107
+ BroadcastUpdateParams = Courier::Models::BroadcastUpdateParams
108
+
80
109
  CancelJourneyRequest = Courier::Models::CancelJourneyRequest
81
110
 
82
111
  CancelJourneyResponse = Courier::Models::CancelJourneyResponse
@@ -91,6 +120,8 @@ module Courier
91
120
 
92
121
  Check = Courier::Models::Check
93
122
 
123
+ CreateBroadcastRequest = Courier::Models::CreateBroadcastRequest
124
+
94
125
  CreateJourneyRequest = Courier::Models::CreateJourneyRequest
95
126
 
96
127
  DefaultPreferences = Courier::Models::DefaultPreferences
@@ -149,6 +180,8 @@ module Courier
149
180
 
150
181
  InboundTrackEventParams = Courier::Models::InboundTrackEventParams
151
182
 
183
+ Inbox = Courier::Models::Inbox
184
+
152
185
  Intercom = Courier::Models::Intercom
153
186
 
154
187
  IntercomRecipient = Courier::Models::IntercomRecipient
@@ -450,6 +483,10 @@ module Courier
450
483
 
451
484
  Rule = Courier::Models::Rule
452
485
 
486
+ ScheduleBroadcastRequest = Courier::Models::ScheduleBroadcastRequest
487
+
488
+ SendBroadcastRequest = Courier::Models::SendBroadcastRequest
489
+
453
490
  SendDirectMessage = Courier::Models::SendDirectMessage
454
491
 
455
492
  SendMessageParams = Courier::Models::SendMessageParams
@@ -512,6 +549,8 @@ module Courier
512
549
 
513
550
  TranslationUpdateParams = Courier::Models::TranslationUpdateParams
514
551
 
552
+ UpdateBroadcastRequest = Courier::Models::UpdateBroadcastRequest
553
+
515
554
  UserProfile = Courier::Models::UserProfile
516
555
 
517
556
  UserProfileFirebaseToken = Courier::Models::UserProfileFirebaseToken
@@ -2,8 +2,11 @@
2
2
 
3
3
  module Courier
4
4
  module Resources
5
+ # Define filter-based groups whose membership Courier recalculates as user
6
+ # profiles change.
5
7
  class Audiences
6
- # Returns the specified audience by id.
8
+ # Returns one audience with its name, description, and the filter and AND or OR
9
+ # operator that decide which users belong to it.
7
10
  sig do
8
11
  params(
9
12
  audience_id: String,
@@ -17,7 +20,8 @@ module Courier
17
20
  )
18
21
  end
19
22
 
20
- # Creates or updates audience.
23
+ # Creates or replaces an audience from a filter and an AND or OR operator.
24
+ # Membership recalculates automatically as profiles change.
21
25
  sig do
22
26
  params(
23
27
  audience_id: String,
@@ -46,7 +50,8 @@ module Courier
46
50
  )
47
51
  end
48
52
 
49
- # Get the audiences associated with the authorization token.
53
+ # Returns the audiences in the workspace with paging. Audiences are filter-based
54
+ # groups that recalculate as user profiles change.
50
55
  sig do
51
56
  params(
52
57
  cursor: T.nilable(String),
@@ -60,7 +65,8 @@ module Courier
60
65
  )
61
66
  end
62
67
 
63
- # Deletes the specified audience.
68
+ # Deletes an audience permanently, so update any caller sending to it by audience
69
+ # id first. Those sends fail once the audience is gone.
64
70
  sig do
65
71
  params(
66
72
  audience_id: String,
@@ -74,7 +80,8 @@ module Courier
74
80
  )
75
81
  end
76
82
 
77
- # Get list of members of an audience.
83
+ # Returns the users currently matching an audience filter, with paging. Membership
84
+ # is recalculated, so results shift as profiles change.
78
85
  sig do
79
86
  params(
80
87
  audience_id: String,
@@ -2,8 +2,10 @@
2
2
 
3
3
  module Courier
4
4
  module Resources
5
+ # Read the audit trail of configuration and access changes in your workspace.
5
6
  class AuditEvents
6
- # Fetch a specific audit event by ID.
7
+ # Returns one audit event by id, including the actor who performed it, the target
8
+ # they changed, the source, the event type, and a timestamp.
7
9
  sig do
8
10
  params(
9
11
  audit_event_id: String,
@@ -17,7 +19,8 @@ module Courier
17
19
  )
18
20
  end
19
21
 
20
- # Fetch the list of audit events
22
+ # Returns the workspace's audit event log with cursor paging. Each event records
23
+ # the actor, target, source, type, and timestamp of a change.
21
24
  sig do
22
25
  params(
23
26
  cursor: T.nilable(String),
@@ -2,8 +2,12 @@
2
2
 
3
3
  module Courier
4
4
  module Resources
5
+ # Issue scoped, short-lived JWTs so client-side SDKs — Inbox, Preferences, and the
6
+ # embedded designer — can call Courier as a single user. Server-side requests
7
+ # authenticate with your workspace API key instead.
5
8
  class Auth
6
- # Returns a new access token.
9
+ # Returns a JWT for authenticating client-side SDKs such as the Inbox. You supply
10
+ # the scope and an expires_in duration, both required.
7
11
  sig do
8
12
  params(
9
13
  expires_in: String,
@@ -3,11 +3,11 @@
3
3
  module Courier
4
4
  module Resources
5
5
  class Automations
6
+ # Invoke a stored automation template or an ad hoc automation defined in the
7
+ # request.
6
8
  class Invoke
7
- # Invoke an ad hoc automation run. This endpoint accepts a JSON payload with a
8
- # series of automation steps. For information about what steps are available,
9
- # checkout the ad hoc automation guide
10
- # [here](https://www.courier.com/docs/automations/steps/).
9
+ # Runs a series of automation steps supplied inline, without a saved template, and
10
+ # returns a runId.
11
11
  sig do
12
12
  params(
13
13
  automation:
@@ -17,21 +17,42 @@ module Courier
17
17
  profile: T.nilable(T::Hash[Symbol, T.anything]),
18
18
  recipient: T.nilable(String),
19
19
  template: T.nilable(String),
20
+ idempotency_key: String,
21
+ x_idempotency_expiration: String,
20
22
  request_options: Courier::RequestOptions::OrHash
21
23
  ).returns(Courier::AutomationInvokeResponse)
22
24
  end
23
25
  def invoke_ad_hoc(
26
+ # Body param
24
27
  automation:,
28
+ # Body param
25
29
  brand: nil,
30
+ # Body param
26
31
  data: nil,
32
+ # Body param
27
33
  profile: nil,
34
+ # Body param
28
35
  recipient: nil,
36
+ # Body param
29
37
  template: nil,
38
+ # Header param: A unique key that makes this request idempotent. If Courier
39
+ # receives another request with the same `Idempotency-Key`, it returns the stored
40
+ # response from the first request without performing the operation again
41
+ # (including the original status code and any error). Use it to safely retry
42
+ # `POST` requests after network failures without risking duplicate sends. The key
43
+ # is scoped to this endpoint.
44
+ idempotency_key: nil,
45
+ # Header param: How long the idempotency key remains valid, as a Unix epoch
46
+ # timestamp in seconds or an ISO 8601 date string. Only applies when
47
+ # `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
48
+ # maximum is 1 year.
49
+ x_idempotency_expiration: nil,
30
50
  request_options: {}
31
51
  )
32
52
  end
33
53
 
34
- # Invoke an automation run from an automation template.
54
+ # Starts an automation run from a saved template for one recipient, with optional
55
+ # data and profile, and returns a runId.
35
56
  sig do
36
57
  params(
37
58
  template_id: String,
@@ -40,18 +61,38 @@ module Courier
40
61
  data: T.nilable(T::Hash[Symbol, T.anything]),
41
62
  profile: T.nilable(T::Hash[Symbol, T.anything]),
42
63
  template: T.nilable(String),
64
+ idempotency_key: String,
65
+ x_idempotency_expiration: String,
43
66
  request_options: Courier::RequestOptions::OrHash
44
67
  ).returns(Courier::AutomationInvokeResponse)
45
68
  end
46
69
  def invoke_by_template(
47
- # A unique identifier representing the automation template to be invoked. This
48
- # could be the Automation Template ID or the Automation Template Alias.
70
+ # Path param: A unique identifier representing the automation template to be
71
+ # invoked. This could be the Automation Template ID or the Automation Template
72
+ # Alias.
49
73
  template_id,
74
+ # Body param
50
75
  recipient:,
76
+ # Body param
51
77
  brand: nil,
78
+ # Body param
52
79
  data: nil,
80
+ # Body param
53
81
  profile: nil,
82
+ # Body param
54
83
  template: nil,
84
+ # Header param: A unique key that makes this request idempotent. If Courier
85
+ # receives another request with the same `Idempotency-Key`, it returns the stored
86
+ # response from the first request without performing the operation again
87
+ # (including the original status code and any error). Use it to safely retry
88
+ # `POST` requests after network failures without risking duplicate sends. The key
89
+ # is scoped to this endpoint.
90
+ idempotency_key: nil,
91
+ # Header param: How long the idempotency key remains valid, as a Unix epoch
92
+ # timestamp in seconds or an ISO 8601 date string. Only applies when
93
+ # `Idempotency-Key` is provided. If omitted, the key is retained for 25 hours; the
94
+ # maximum is 1 year.
95
+ x_idempotency_expiration: nil,
55
96
  request_options: {}
56
97
  )
57
98
  end
@@ -2,11 +2,16 @@
2
2
 
3
3
  module Courier
4
4
  module Resources
5
+ # Invoke a stored automation template or an ad hoc automation defined in the
6
+ # request.
5
7
  class Automations
8
+ # Invoke a stored automation template or an ad hoc automation defined in the
9
+ # request.
6
10
  sig { returns(Courier::Resources::Automations::Invoke) }
7
11
  attr_reader :invoke
8
12
 
9
- # Get the list of automations.
13
+ # Lists the workspace's saved automation templates, each with its id and a cursor
14
+ # for paging to the next page of results.
10
15
  sig do
11
16
  params(
12
17
  cursor: String,
@@ -2,22 +2,49 @@
2
2
 
3
3
  module Courier
4
4
  module Resources
5
+ # Manage the logos, colors, and layout that give the templates you send a
6
+ # consistent look.
5
7
  class Brands
6
- # Create a new brand. Requires `name` and `settings` (with at least
7
- # `colors.primary` and `colors.secondary`).
8
+ # Creates a brand from a name and settings, including primary and secondary
9
+ # colors. Brands supply the logo, colors, and styling that templates render with.
8
10
  sig do
9
11
  params(
10
12
  name: String,
11
13
  settings: Courier::BrandSettings::OrHash,
12
14
  id: T.nilable(String),
13
15
  snippets: T.nilable(Courier::BrandSnippets::OrHash),
16
+ idempotency_key: String,
17
+ x_idempotency_expiration: String,
14
18
  request_options: Courier::RequestOptions::OrHash
15
19
  ).returns(Courier::Brand)
16
20
  end
17
- def create(name:, settings:, id: nil, snippets: nil, request_options: {})
21
+ def create(
22
+ # Body param
23
+ name:,
24
+ # Body param
25
+ settings:,
26
+ # Body param
27
+ id: nil,
28
+ # Body param
29
+ snippets: nil,
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,
42
+ request_options: {}
43
+ )
18
44
  end
19
45
 
20
- # Fetch a specific brand by brand ID.
46
+ # Returns one brand by id, including its colors, logo and styling settings,
47
+ # Handlebars snippets, and published version.
21
48
  sig do
22
49
  params(
23
50
  brand_id: String,
@@ -31,7 +58,8 @@ module Courier
31
58
  )
32
59
  end
33
60
 
34
- # Replace an existing brand with the supplied values.
61
+ # Replaces a brand with the values you supply, so send the complete settings and
62
+ # snippets rather than only the fields you want changed.
35
63
  sig do
36
64
  params(
37
65
  brand_id: String,
@@ -52,7 +80,8 @@ module Courier
52
80
  )
53
81
  end
54
82
 
55
- # Get the list of brands.
83
+ # Lists the workspace's brands. Every entry carries its name, styling settings,
84
+ # snippets, and published version.
56
85
  sig do
57
86
  params(
58
87
  cursor: T.nilable(String),
@@ -66,7 +95,8 @@ module Courier
66
95
  )
67
96
  end
68
97
 
69
- # Delete a brand by brand ID.
98
+ # Deletes a brand by id. Reassign any template or tenant that references it before
99
+ # deleting to keep their styling intact.
70
100
  sig do
71
101
  params(
72
102
  brand_id: String,