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
@@ -0,0 +1,290 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Resources
5
+ class Broadcasts
6
+ # Create a broadcast. Provisions a private notification template for the broadcast
7
+ # and returns the new broadcast in the draft state. Exactly one channel is
8
+ # required.
9
+ #
10
+ # @overload create(channel:, name:, request_options: {})
11
+ #
12
+ # @param channel [Symbol, Courier::Models::CreateBroadcastRequest::Channel] The single delivery channel for this broadcast.
13
+ #
14
+ # @param name [String] Human-readable name.
15
+ #
16
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
17
+ #
18
+ # @return [Courier::Models::Broadcast]
19
+ #
20
+ # @see Courier::Models::BroadcastCreateParams
21
+ def create(params)
22
+ parsed, options = Courier::BroadcastCreateParams.dump_request(params)
23
+ @client.request(
24
+ method: :post,
25
+ path: "broadcasts",
26
+ body: parsed,
27
+ model: Courier::Broadcast,
28
+ options: options
29
+ )
30
+ end
31
+
32
+ # Retrieve a broadcast by ID. Archived broadcasts return 404.
33
+ #
34
+ # @overload retrieve(broadcast_id, request_options: {})
35
+ #
36
+ # @param broadcast_id [String]
37
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
38
+ #
39
+ # @return [Courier::Models::Broadcast]
40
+ #
41
+ # @see Courier::Models::BroadcastRetrieveParams
42
+ def retrieve(broadcast_id, params = {})
43
+ @client.request(
44
+ method: :get,
45
+ path: ["broadcasts/%1$s", broadcast_id],
46
+ model: Courier::Broadcast,
47
+ options: params[:request_options]
48
+ )
49
+ end
50
+
51
+ # Update a broadcast's name. Content is edited via the broadcast's notification
52
+ # template, not this endpoint.
53
+ #
54
+ # @overload update(broadcast_id, name:, request_options: {})
55
+ #
56
+ # @param broadcast_id [String]
57
+ #
58
+ # @param name [String] New human-readable name.
59
+ #
60
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
61
+ #
62
+ # @return [Courier::Models::Broadcast]
63
+ #
64
+ # @see Courier::Models::BroadcastUpdateParams
65
+ def update(broadcast_id, params)
66
+ parsed, options = Courier::BroadcastUpdateParams.dump_request(params)
67
+ @client.request(
68
+ method: :put,
69
+ path: ["broadcasts/%1$s", broadcast_id],
70
+ body: parsed,
71
+ model: Courier::Broadcast,
72
+ options: options
73
+ )
74
+ end
75
+
76
+ # List broadcasts in your workspace. Cursor-paginated; returns broadcasts
77
+ # newest-first.
78
+ #
79
+ # @overload list(cursor: nil, limit: nil, request_options: {})
80
+ #
81
+ # @param cursor [String, nil] Opaque pagination cursor from a previous response. Omit for the first page.
82
+ #
83
+ # @param limit [Integer] Maximum number of results per page.
84
+ #
85
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
86
+ #
87
+ # @return [Courier::Models::BroadcastListResponse]
88
+ #
89
+ # @see Courier::Models::BroadcastListParams
90
+ def list(params = {})
91
+ parsed, options = Courier::BroadcastListParams.dump_request(params)
92
+ query = Courier::Internal::Util.encode_query_params(parsed)
93
+ @client.request(
94
+ method: :get,
95
+ path: "broadcasts",
96
+ query: query,
97
+ model: Courier::BroadcastListResponse,
98
+ options: options
99
+ )
100
+ end
101
+
102
+ # Archive a broadcast. This is a soft delete — the archived broadcast is returned
103
+ # and no longer appears in list results.
104
+ #
105
+ # @overload archive(broadcast_id, request_options: {})
106
+ #
107
+ # @param broadcast_id [String]
108
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
109
+ #
110
+ # @return [Courier::Models::Broadcast]
111
+ #
112
+ # @see Courier::Models::BroadcastArchiveParams
113
+ def archive(broadcast_id, params = {})
114
+ @client.request(
115
+ method: :delete,
116
+ path: ["broadcasts/%1$s", broadcast_id],
117
+ model: Courier::Broadcast,
118
+ options: params[:request_options]
119
+ )
120
+ end
121
+
122
+ # Cancel a broadcast's pending schedule, returning it to the draft state. Only
123
+ # valid for a scheduled broadcast.
124
+ #
125
+ # @overload cancel(broadcast_id, request_options: {})
126
+ #
127
+ # @param broadcast_id [String]
128
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
129
+ #
130
+ # @return [Courier::Models::Broadcast]
131
+ #
132
+ # @see Courier::Models::BroadcastCancelParams
133
+ def cancel(broadcast_id, params = {})
134
+ @client.request(
135
+ method: :post,
136
+ path: ["broadcasts/%1$s/cancel", broadcast_id],
137
+ model: Courier::Broadcast,
138
+ options: params[:request_options]
139
+ )
140
+ end
141
+
142
+ # Duplicate a broadcast (and its template) into a new draft named "{source name}
143
+ # (copy)".
144
+ #
145
+ # @overload duplicate(broadcast_id, request_options: {})
146
+ #
147
+ # @param broadcast_id [String]
148
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
149
+ #
150
+ # @return [Courier::Models::Broadcast]
151
+ #
152
+ # @see Courier::Models::BroadcastDuplicateParams
153
+ def duplicate(broadcast_id, params = {})
154
+ @client.request(
155
+ method: :post,
156
+ path: ["broadcasts/%1$s/duplicate", broadcast_id],
157
+ model: Courier::Broadcast,
158
+ options: params[:request_options]
159
+ )
160
+ end
161
+
162
+ # Author the broadcast's content by replacing the draft elemental content of its
163
+ # private notification template. The draft is published automatically when the
164
+ # broadcast is sent or scheduled.
165
+ #
166
+ # @overload put_content(broadcast_id, content:, state: nil, request_options: {})
167
+ #
168
+ # @param broadcast_id [String]
169
+ #
170
+ # @param content [Courier::Models::NotificationContentPutRequest::Content] Elemental content payload. The server defaults `version` when omitted.
171
+ #
172
+ # @param state [Symbol, Courier::Models::NotificationTemplateState] Template state. Defaults to `DRAFT`.
173
+ #
174
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
175
+ #
176
+ # @return [Courier::Models::NotificationContentMutationResponse]
177
+ #
178
+ # @see Courier::Models::BroadcastPutContentParams
179
+ def put_content(broadcast_id, params)
180
+ parsed, options = Courier::BroadcastPutContentParams.dump_request(params)
181
+ @client.request(
182
+ method: :put,
183
+ path: ["broadcasts/%1$s/content", broadcast_id],
184
+ body: parsed,
185
+ model: Courier::NotificationContentMutationResponse,
186
+ options: options
187
+ )
188
+ end
189
+
190
+ # Some parameter documentations has been truncated, see
191
+ # {Courier::Models::BroadcastRetrieveContentParams} for more details.
192
+ #
193
+ # Retrieve the broadcast's content — the elemental content of its private
194
+ # notification template. Defaults to the working draft, since broadcast content is
195
+ # authored as a draft until the broadcast is sent.
196
+ #
197
+ # @overload retrieve_content(broadcast_id, version: nil, request_options: {})
198
+ #
199
+ # @param broadcast_id [String]
200
+ #
201
+ # @param version [String] Accepts `draft`, `published`, or a version string (e.g. `v001`). Defaults to `dr
202
+ #
203
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
204
+ #
205
+ # @return [Courier::Models::NotificationContentGetResponse]
206
+ #
207
+ # @see Courier::Models::BroadcastRetrieveContentParams
208
+ def retrieve_content(broadcast_id, params = {})
209
+ parsed, options = Courier::BroadcastRetrieveContentParams.dump_request(params)
210
+ query = Courier::Internal::Util.encode_query_params(parsed)
211
+ @client.request(
212
+ method: :get,
213
+ path: ["broadcasts/%1$s/content", broadcast_id],
214
+ query: query,
215
+ model: Courier::NotificationContentGetResponse,
216
+ options: options
217
+ )
218
+ end
219
+
220
+ # Some parameter documentations has been truncated, see
221
+ # {Courier::Models::BroadcastScheduleParams} for more details.
222
+ #
223
+ # Schedule a broadcast for a future send to a list or audience. Publishes the
224
+ # broadcast template first. Not allowed once the broadcast is sending or sent. For
225
+ # an immediate send use POST /broadcasts/{broadcastId}/send.
226
+ #
227
+ # @overload schedule(broadcast_id, recipient_id:, recipient_type:, scheduled_to:, timezone: nil, request_options: {})
228
+ #
229
+ # @param broadcast_id [String]
230
+ #
231
+ # @param recipient_id [String] ID of the target list or audience.
232
+ #
233
+ # @param recipient_type [Symbol, Courier::Models::ScheduleBroadcastRequest::RecipientType] Whether the broadcast targets a list or an audience.
234
+ #
235
+ # @param scheduled_to [String] Wall-clock timestamp of the future send, no timezone offset (e.g. "2026-07-21T20
236
+ #
237
+ # @param timezone [String] IANA timezone for the scheduled send (e.g. America/New_York).
238
+ #
239
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
240
+ #
241
+ # @return [Courier::Models::Broadcast]
242
+ #
243
+ # @see Courier::Models::BroadcastScheduleParams
244
+ def schedule(broadcast_id, params)
245
+ parsed, options = Courier::BroadcastScheduleParams.dump_request(params)
246
+ @client.request(
247
+ method: :post,
248
+ path: ["broadcasts/%1$s/schedule", broadcast_id],
249
+ body: parsed,
250
+ model: Courier::Broadcast,
251
+ options: options
252
+ )
253
+ end
254
+
255
+ # Send a broadcast immediately to a list or audience. Publishes the broadcast
256
+ # template first. Not allowed once the broadcast is sending or sent.
257
+ #
258
+ # @overload send_(broadcast_id, recipient_id:, recipient_type:, request_options: {})
259
+ #
260
+ # @param broadcast_id [String]
261
+ #
262
+ # @param recipient_id [String] ID of the target list or audience.
263
+ #
264
+ # @param recipient_type [Symbol, Courier::Models::SendBroadcastRequest::RecipientType] Whether the broadcast targets a list or an audience.
265
+ #
266
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
267
+ #
268
+ # @return [Courier::Models::Broadcast]
269
+ #
270
+ # @see Courier::Models::BroadcastSendParams
271
+ def send_(broadcast_id, params)
272
+ parsed, options = Courier::BroadcastSendParams.dump_request(params)
273
+ @client.request(
274
+ method: :post,
275
+ path: ["broadcasts/%1$s/send", broadcast_id],
276
+ body: parsed,
277
+ model: Courier::Broadcast,
278
+ options: options
279
+ )
280
+ end
281
+
282
+ # @api private
283
+ #
284
+ # @param client [Courier::Client]
285
+ def initialize(client:)
286
+ @client = client
287
+ end
288
+ end
289
+ end
290
+ end
@@ -3,13 +3,14 @@
3
3
  module Courier
4
4
  module Resources
5
5
  class Digests
6
+ # Inspect what has accumulated in a digest schedule and release a digest ahead of
7
+ # its next scheduled delivery.
6
8
  class Schedules
7
9
  # Some parameter documentations has been truncated, see
8
10
  # {Courier::Models::Digests::ScheduleListInstancesParams} for more details.
9
11
  #
10
- # List the digest instances for a schedule. Each instance represents the events
11
- # accumulated for a single user against the schedule, and can be used to monitor
12
- # digest accumulation before the digest is released.
12
+ # Returns the digest instances for a schedule, one per user, with cursor paging.
13
+ # Use it to see what has accumulated before a digest releases.
13
14
  #
14
15
  # @overload list_instances(schedule_id, cursor: nil, limit: nil, request_options: {})
15
16
  #
@@ -3,6 +3,8 @@
3
3
  module Courier
4
4
  module Resources
5
5
  class Digests
6
+ # Inspect what has accumulated in a digest schedule and release a digest ahead of
7
+ # its next scheduled delivery.
6
8
  # @return [Courier::Resources::Digests::Schedules]
7
9
  attr_reader :schedules
8
10
 
@@ -2,11 +2,13 @@
2
2
 
3
3
  module Courier
4
4
  module Resources
5
+ # Record an inbound event that triggers the journeys and automations mapped to it.
5
6
  class Inbound
6
7
  # Some parameter documentations has been truncated, see
7
8
  # {Courier::Models::InboundTrackEventParams} for more details.
8
9
  #
9
- # Courier Track Event
10
+ # Records an inbound event that can trigger a journey. Requires an event name, a
11
+ # messageId you generate, a type, and a properties object.
10
12
  #
11
13
  # @overload track_event(event:, message_id:, properties:, type:, user_id: nil, request_options: {})
12
14
  #
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Resources
5
+ class Inbox
6
+ # Manage the messages in a user's in-app inbox.
7
+ class Messages
8
+ # Delete a user's inbox message. The message is removed from every inbox read (it
9
+ # stops appearing in the recipient's Inbox); it can be restored.
10
+ #
11
+ # @overload delete(message_id, request_options: {})
12
+ #
13
+ # @param message_id [String] The message ID of the inbox message to delete.
14
+ #
15
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
16
+ #
17
+ # @return [nil]
18
+ #
19
+ # @see Courier::Models::Inbox::MessageDeleteParams
20
+ def delete(message_id, params = {})
21
+ @client.request(
22
+ method: :delete,
23
+ path: ["inbox/messages/%1$s", message_id],
24
+ model: NilClass,
25
+ options: params[:request_options]
26
+ )
27
+ end
28
+
29
+ # Restore a previously deleted inbox message.
30
+ #
31
+ # @overload restore(message_id, request_options: {})
32
+ #
33
+ # @param message_id [String] The message ID of the inbox message to restore.
34
+ #
35
+ # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
36
+ #
37
+ # @return [nil]
38
+ #
39
+ # @see Courier::Models::Inbox::MessageRestoreParams
40
+ def restore(message_id, params = {})
41
+ @client.request(
42
+ method: :put,
43
+ path: ["inbox/messages/%1$s/restore", message_id],
44
+ model: NilClass,
45
+ options: params[:request_options]
46
+ )
47
+ end
48
+
49
+ # @api private
50
+ #
51
+ # @param client [Courier::Client]
52
+ def initialize(client:)
53
+ @client = client
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Courier
4
+ module Resources
5
+ class Inbox
6
+ # Manage the messages in a user's in-app inbox.
7
+ # @return [Courier::Resources::Inbox::Messages]
8
+ attr_reader :messages
9
+
10
+ # @api private
11
+ #
12
+ # @param client [Courier::Client]
13
+ def initialize(client:)
14
+ @client = client
15
+ @messages = Courier::Resources::Inbox::Messages.new(client: client)
16
+ end
17
+ end
18
+ end
19
+ end
@@ -3,21 +3,30 @@
3
3
  module Courier
4
4
  module Resources
5
5
  class Journeys
6
+ # Build, version, publish, invoke, and cancel multi-step notification workflows,
7
+ # along with the templates scoped to them.
6
8
  class Templates
9
+ # Some parameter documentations has been truncated, see
10
+ # {Courier::Models::Journeys::TemplateCreateParams} for more details.
11
+ #
7
12
  # Create a notification template scoped to this journey. Defaults to `DRAFT`
8
13
  # state; pass `state: "PUBLISHED"` to publish on create.
9
14
  #
10
- # @overload create(template_id, channel:, notification:, provider_key: nil, state: nil, request_options: {})
15
+ # @overload create(template_id, channel:, notification:, provider_key: nil, state: nil, idempotency_key: nil, x_idempotency_expiration: nil, request_options: {})
11
16
  #
12
- # @param template_id [String] Journey id
17
+ # @param template_id [String] Path param: Journey id
13
18
  #
14
- # @param channel [String]
19
+ # @param channel [String] Body param
15
20
  #
16
- # @param notification [Courier::Models::JourneyTemplateCreateRequest::Notification]
21
+ # @param notification [Courier::Models::JourneyTemplateCreateRequest::Notification] Body param
22
+ #
23
+ # @param provider_key [String] Body param
24
+ #
25
+ # @param state [String] Body param
17
26
  #
18
- # @param provider_key [String]
27
+ # @param idempotency_key [String] Header param: A unique key that makes this request idempotent. If Courier receiv
19
28
  #
20
- # @param state [String]
29
+ # @param x_idempotency_expiration [String] Header param: How long the idempotency key remains valid, as a Unix epoch timest
21
30
  #
22
31
  # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
23
32
  #
@@ -26,18 +35,20 @@ module Courier
26
35
  # @see Courier::Models::Journeys::TemplateCreateParams
27
36
  def create(template_id, params)
28
37
  parsed, options = Courier::Journeys::TemplateCreateParams.dump_request(params)
38
+ header_params =
39
+ {idempotency_key: "idempotency-key", x_idempotency_expiration: "x-idempotency-expiration"}
29
40
  @client.request(
30
41
  method: :post,
31
42
  path: ["journeys/%1$s/templates", template_id],
32
- body: parsed,
43
+ headers: parsed.slice(*header_params.keys).transform_keys(header_params),
44
+ body: parsed.except(*header_params.keys),
33
45
  model: Courier::JourneyTemplateGetResponse,
34
46
  options: options
35
47
  )
36
48
  end
37
49
 
38
- # Fetch a journey-scoped notification template by id. Pass `?version=draft`
39
- # (default `published`) to retrieve the working draft, or `?version=vN` for a
40
- # historical version.
50
+ # Returns a journey's own notification template with its name, brand, subscription
51
+ # topic, and content. Defaults to the published version.
41
52
  #
42
53
  # @overload retrieve(notification_id, template_id:, request_options: {})
43
54
  #
@@ -92,8 +103,8 @@ module Courier
92
103
  )
93
104
  end
94
105
 
95
- # Archive the journey-scoped notification template. Archived templates cannot be
96
- # sent.
106
+ # Archives one journey's notification template, preventing further sends. Detach
107
+ # any send node referencing it beforehand.
97
108
  #
98
109
  # @overload archive(notification_id, template_id:, request_options: {})
99
110
  #
@@ -120,8 +131,8 @@ module Courier
120
131
  )
121
132
  end
122
133
 
123
- # List published versions of the journey-scoped notification template, ordered
124
- # most recent first.
134
+ # Lists the published versions of a template that belongs to a journey, most
135
+ # recent first. Paged by cursor.
125
136
  #
126
137
  # @overload list_versions(notification_id, template_id:, request_options: {})
127
138
  #
@@ -148,11 +159,13 @@ module Courier
148
159
  )
149
160
  end
150
161
 
151
- # Publish the current draft of the journey-scoped notification template as a new
152
- # version. Optionally roll back to a prior version by passing
153
- # `{ "version": "vN" }`.
162
+ # Some parameter documentations has been truncated, see
163
+ # {Courier::Models::Journeys::TemplatePublishParams} for more details.
164
+ #
165
+ # Publishes a journey-scoped template's draft as a new version. Pass a version
166
+ # instead to roll back the template to an earlier publish.
154
167
  #
155
- # @overload publish(notification_id, template_id:, version: nil, request_options: {})
168
+ # @overload publish(notification_id, template_id:, version: nil, idempotency_key: nil, x_idempotency_expiration: nil, request_options: {})
156
169
  #
157
170
  # @param notification_id [String] Path param: Notification template id
158
171
  #
@@ -160,6 +173,10 @@ module Courier
160
173
  #
161
174
  # @param version [String] Body param
162
175
  #
176
+ # @param idempotency_key [String] Header param: A unique key that makes this request idempotent. If Courier receiv
177
+ #
178
+ # @param x_idempotency_expiration [String] Header param: How long the idempotency key remains valid, as a Unix epoch timest
179
+ #
163
180
  # @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
164
181
  #
165
182
  # @return [nil]
@@ -171,10 +188,13 @@ module Courier
171
188
  parsed.delete(:template_id) do
172
189
  raise ArgumentError.new("missing required path argument #{_1}")
173
190
  end
191
+ header_params =
192
+ {idempotency_key: "idempotency-key", x_idempotency_expiration: "x-idempotency-expiration"}
174
193
  @client.request(
175
194
  method: :post,
176
195
  path: ["journeys/%1$s/templates/%2$s/publish", template_id, notification_id],
177
- body: parsed,
196
+ headers: parsed.slice(*header_params.keys).transform_keys(header_params),
197
+ body: parsed.except(*header_params.keys),
178
198
  model: NilClass,
179
199
  options: options
180
200
  )
@@ -255,7 +275,8 @@ module Courier
255
275
  )
256
276
  end
257
277
 
258
- # Replace the journey-scoped notification template draft.
278
+ # Replaces the draft content of one journey's notification template. Publish it
279
+ # before send nodes referencing it render the change.
259
280
  #
260
281
  # @overload replace(notification_id, template_id:, notification:, state: nil, request_options: {})
261
282
  #
@@ -290,11 +311,8 @@ module Courier
290
311
  # Some parameter documentations has been truncated, see
291
312
  # {Courier::Models::Journeys::TemplateRetrieveContentParams} for more details.
292
313
  #
293
- # Retrieve the elemental content of a journey-scoped notification template. The
294
- # response contains the versioned elements along with their content checksums,
295
- # which can be used to detect changes between versions. Pass `?version=draft`
296
- # (default `published`) to retrieve the working draft, or `?version=vN` for a
297
- # historical version.
314
+ # Returns the Elemental elements and version of a journey-scoped template's
315
+ # content. Compare versions to see what changed between publishes.
298
316
  #
299
317
  # @overload retrieve_content(notification_id, template_id:, version: nil, request_options: {})
300
318
  #