trycourier 4.22.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/courier/client.rb +4 -0
- data/lib/courier/models/broadcast.rb +132 -0
- data/lib/courier/models/broadcast_archive_params.rb +20 -0
- data/lib/courier/models/broadcast_cancel_params.rb +20 -0
- data/lib/courier/models/broadcast_create_params.rb +14 -0
- data/lib/courier/models/broadcast_duplicate_params.rb +20 -0
- data/lib/courier/models/broadcast_list_params.rb +30 -0
- data/lib/courier/models/broadcast_list_response.rb +24 -0
- data/lib/courier/models/broadcast_put_content_params.rb +20 -0
- data/lib/courier/models/broadcast_retrieve_content_params.rb +33 -0
- data/lib/courier/models/broadcast_retrieve_params.rb +20 -0
- data/lib/courier/models/broadcast_schedule.rb +59 -0
- data/lib/courier/models/broadcast_schedule_params.rb +20 -0
- data/lib/courier/models/broadcast_send_params.rb +20 -0
- data/lib/courier/models/broadcast_update_params.rb +20 -0
- data/lib/courier/models/create_broadcast_request.rb +43 -0
- data/lib/courier/models/schedule_broadcast_request.rb +59 -0
- data/lib/courier/models/send_broadcast_request.rb +39 -0
- data/lib/courier/models/update_broadcast_request.rb +18 -0
- data/lib/courier/models.rb +36 -0
- data/lib/courier/resources/broadcasts.rb +290 -0
- data/lib/courier/version.rb +1 -1
- data/lib/courier.rb +20 -1
- data/rbi/courier/client.rbi +3 -0
- data/rbi/courier/models/broadcast.rbi +164 -0
- data/rbi/courier/models/broadcast_archive_params.rbi +35 -0
- data/rbi/courier/models/broadcast_cancel_params.rbi +35 -0
- data/rbi/courier/models/broadcast_create_params.rbi +27 -0
- data/rbi/courier/models/broadcast_duplicate_params.rbi +35 -0
- data/rbi/courier/models/broadcast_list_params.rbi +54 -0
- data/rbi/courier/models/broadcast_list_response.rbi +39 -0
- data/rbi/courier/models/broadcast_put_content_params.rbi +35 -0
- data/rbi/courier/models/broadcast_retrieve_content_params.rbi +57 -0
- data/rbi/courier/models/broadcast_retrieve_params.rbi +35 -0
- data/rbi/courier/models/broadcast_schedule.rbi +92 -0
- data/rbi/courier/models/broadcast_schedule_params.rbi +35 -0
- data/rbi/courier/models/broadcast_send_params.rbi +35 -0
- data/rbi/courier/models/broadcast_update_params.rbi +35 -0
- data/rbi/courier/models/create_broadcast_request.rbi +81 -0
- data/rbi/courier/models/schedule_broadcast_request.rbi +103 -0
- data/rbi/courier/models/send_broadcast_request.rbi +77 -0
- data/rbi/courier/models/update_broadcast_request.rbi +28 -0
- data/rbi/courier/models.rbi +37 -0
- data/rbi/courier/resources/broadcasts.rbi +199 -0
- data/sig/courier/client.rbs +2 -0
- data/sig/courier/models/broadcast.rbs +98 -0
- data/sig/courier/models/broadcast_archive_params.rbs +23 -0
- data/sig/courier/models/broadcast_cancel_params.rbs +23 -0
- data/sig/courier/models/broadcast_create_params.rbs +15 -0
- data/sig/courier/models/broadcast_duplicate_params.rbs +23 -0
- data/sig/courier/models/broadcast_list_params.rbs +30 -0
- data/sig/courier/models/broadcast_list_response.rbs +22 -0
- data/sig/courier/models/broadcast_put_content_params.rbs +25 -0
- data/sig/courier/models/broadcast_retrieve_content_params.rbs +30 -0
- data/sig/courier/models/broadcast_retrieve_params.rbs +23 -0
- data/sig/courier/models/broadcast_schedule.rbs +46 -0
- data/sig/courier/models/broadcast_schedule_params.rbs +25 -0
- data/sig/courier/models/broadcast_send_params.rbs +25 -0
- data/sig/courier/models/broadcast_update_params.rbs +25 -0
- data/sig/courier/models/create_broadcast_request.rbs +40 -0
- data/sig/courier/models/schedule_broadcast_request.rbs +48 -0
- data/sig/courier/models/send_broadcast_request.rbs +36 -0
- data/sig/courier/models/update_broadcast_request.rbs +13 -0
- data/sig/courier/models.rbs +36 -0
- data/sig/courier/resources/broadcasts.rbs +74 -0
- metadata +58 -1
data/lib/courier/models.rb
CHANGED
|
@@ -113,6 +113,34 @@ module Courier
|
|
|
113
113
|
|
|
114
114
|
BrandUpdateParams = Courier::Models::BrandUpdateParams
|
|
115
115
|
|
|
116
|
+
Broadcast = Courier::Models::Broadcast
|
|
117
|
+
|
|
118
|
+
BroadcastArchiveParams = Courier::Models::BroadcastArchiveParams
|
|
119
|
+
|
|
120
|
+
BroadcastCancelParams = Courier::Models::BroadcastCancelParams
|
|
121
|
+
|
|
122
|
+
BroadcastCreateParams = Courier::Models::BroadcastCreateParams
|
|
123
|
+
|
|
124
|
+
BroadcastDuplicateParams = Courier::Models::BroadcastDuplicateParams
|
|
125
|
+
|
|
126
|
+
BroadcastListParams = Courier::Models::BroadcastListParams
|
|
127
|
+
|
|
128
|
+
BroadcastListResponse = Courier::Models::BroadcastListResponse
|
|
129
|
+
|
|
130
|
+
BroadcastPutContentParams = Courier::Models::BroadcastPutContentParams
|
|
131
|
+
|
|
132
|
+
BroadcastRetrieveContentParams = Courier::Models::BroadcastRetrieveContentParams
|
|
133
|
+
|
|
134
|
+
BroadcastRetrieveParams = Courier::Models::BroadcastRetrieveParams
|
|
135
|
+
|
|
136
|
+
BroadcastSchedule = Courier::Models::BroadcastSchedule
|
|
137
|
+
|
|
138
|
+
BroadcastScheduleParams = Courier::Models::BroadcastScheduleParams
|
|
139
|
+
|
|
140
|
+
BroadcastSendParams = Courier::Models::BroadcastSendParams
|
|
141
|
+
|
|
142
|
+
BroadcastUpdateParams = Courier::Models::BroadcastUpdateParams
|
|
143
|
+
|
|
116
144
|
CancelJourneyRequest = Courier::Models::CancelJourneyRequest
|
|
117
145
|
|
|
118
146
|
CancelJourneyResponse = Courier::Models::CancelJourneyResponse
|
|
@@ -127,6 +155,8 @@ module Courier
|
|
|
127
155
|
|
|
128
156
|
Check = Courier::Models::Check
|
|
129
157
|
|
|
158
|
+
CreateBroadcastRequest = Courier::Models::CreateBroadcastRequest
|
|
159
|
+
|
|
130
160
|
CreateJourneyRequest = Courier::Models::CreateJourneyRequest
|
|
131
161
|
|
|
132
162
|
DefaultPreferences = Courier::Models::DefaultPreferences
|
|
@@ -474,6 +504,10 @@ module Courier
|
|
|
474
504
|
|
|
475
505
|
Rule = Courier::Models::Rule
|
|
476
506
|
|
|
507
|
+
ScheduleBroadcastRequest = Courier::Models::ScheduleBroadcastRequest
|
|
508
|
+
|
|
509
|
+
SendBroadcastRequest = Courier::Models::SendBroadcastRequest
|
|
510
|
+
|
|
477
511
|
SendDirectMessage = Courier::Models::SendDirectMessage
|
|
478
512
|
|
|
479
513
|
SendMessageParams = Courier::Models::SendMessageParams
|
|
@@ -536,6 +570,8 @@ module Courier
|
|
|
536
570
|
|
|
537
571
|
TranslationUpdateParams = Courier::Models::TranslationUpdateParams
|
|
538
572
|
|
|
573
|
+
UpdateBroadcastRequest = Courier::Models::UpdateBroadcastRequest
|
|
574
|
+
|
|
539
575
|
UserProfile = Courier::Models::UserProfile
|
|
540
576
|
|
|
541
577
|
UserProfileFirebaseToken = Courier::Models::UserProfileFirebaseToken
|
|
@@ -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
|
data/lib/courier/version.rb
CHANGED
data/lib/courier.rb
CHANGED
|
@@ -54,6 +54,11 @@ require_relative "courier/internal/transport/pooled_net_requester"
|
|
|
54
54
|
require_relative "courier/client"
|
|
55
55
|
require_relative "courier/models/elemental_base_node"
|
|
56
56
|
require_relative "courier/models/brand_template"
|
|
57
|
+
require_relative "courier/models/create_broadcast_request"
|
|
58
|
+
require_relative "courier/models/notification_content_put_request"
|
|
59
|
+
require_relative "courier/models/schedule_broadcast_request"
|
|
60
|
+
require_relative "courier/models/send_broadcast_request"
|
|
61
|
+
require_relative "courier/models/update_broadcast_request"
|
|
57
62
|
require_relative "courier/models/base_check"
|
|
58
63
|
require_relative "courier/models/subscription_topic_new"
|
|
59
64
|
require_relative "courier/models/elemental_channel_node"
|
|
@@ -63,7 +68,6 @@ require_relative "courier/models/journeys_invoke_request"
|
|
|
63
68
|
require_relative "courier/models/journey_publish_request"
|
|
64
69
|
require_relative "courier/models/journey_template_create_request"
|
|
65
70
|
require_relative "courier/models/journey_template_publish_request"
|
|
66
|
-
require_relative "courier/models/notification_content_put_request"
|
|
67
71
|
require_relative "courier/models/notification_locale_put_request"
|
|
68
72
|
require_relative "courier/models/journey_template_replace_request"
|
|
69
73
|
require_relative "courier/models/message_details"
|
|
@@ -124,6 +128,20 @@ require_relative "courier/models/brand_settings_in_app"
|
|
|
124
128
|
require_relative "courier/models/brand_snippet"
|
|
125
129
|
require_relative "courier/models/brand_snippets"
|
|
126
130
|
require_relative "courier/models/brand_update_params"
|
|
131
|
+
require_relative "courier/models/broadcast"
|
|
132
|
+
require_relative "courier/models/broadcast_archive_params"
|
|
133
|
+
require_relative "courier/models/broadcast_cancel_params"
|
|
134
|
+
require_relative "courier/models/broadcast_create_params"
|
|
135
|
+
require_relative "courier/models/broadcast_duplicate_params"
|
|
136
|
+
require_relative "courier/models/broadcast_list_params"
|
|
137
|
+
require_relative "courier/models/broadcast_list_response"
|
|
138
|
+
require_relative "courier/models/broadcast_put_content_params"
|
|
139
|
+
require_relative "courier/models/broadcast_retrieve_content_params"
|
|
140
|
+
require_relative "courier/models/broadcast_retrieve_params"
|
|
141
|
+
require_relative "courier/models/broadcast_schedule"
|
|
142
|
+
require_relative "courier/models/broadcast_schedule_params"
|
|
143
|
+
require_relative "courier/models/broadcast_send_params"
|
|
144
|
+
require_relative "courier/models/broadcast_update_params"
|
|
127
145
|
require_relative "courier/models/cancel_journey_response"
|
|
128
146
|
require_relative "courier/models/channel"
|
|
129
147
|
require_relative "courier/models/channel_classification"
|
|
@@ -423,6 +441,7 @@ require_relative "courier/resources/auth"
|
|
|
423
441
|
require_relative "courier/resources/automations"
|
|
424
442
|
require_relative "courier/resources/automations/invoke"
|
|
425
443
|
require_relative "courier/resources/brands"
|
|
444
|
+
require_relative "courier/resources/broadcasts"
|
|
426
445
|
require_relative "courier/resources/digests"
|
|
427
446
|
require_relative "courier/resources/digests/schedules"
|
|
428
447
|
require_relative "courier/resources/inbound"
|
data/rbi/courier/client.rbi
CHANGED
|
@@ -48,6 +48,9 @@ module Courier
|
|
|
48
48
|
sig { returns(Courier::Resources::Journeys) }
|
|
49
49
|
attr_reader :journeys
|
|
50
50
|
|
|
51
|
+
sig { returns(Courier::Resources::Broadcasts) }
|
|
52
|
+
attr_reader :broadcasts
|
|
53
|
+
|
|
51
54
|
# Manage the logos, colors, and layout that give the templates you send a
|
|
52
55
|
# consistent look.
|
|
53
56
|
sig { returns(Courier::Resources::Brands) }
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Courier
|
|
4
|
+
module Models
|
|
5
|
+
class Broadcast < Courier::Internal::Type::BaseModel
|
|
6
|
+
OrHash =
|
|
7
|
+
T.type_alias { T.any(Courier::Broadcast, Courier::Internal::AnyHash) }
|
|
8
|
+
|
|
9
|
+
# The broadcast ID (bst\_ prefix).
|
|
10
|
+
sig { returns(String) }
|
|
11
|
+
attr_accessor :id
|
|
12
|
+
|
|
13
|
+
# The broadcast's delivery channel.
|
|
14
|
+
sig { returns(Courier::Broadcast::Channel::TaggedSymbol) }
|
|
15
|
+
attr_accessor :channel
|
|
16
|
+
|
|
17
|
+
# ISO 8601 timestamp when the broadcast was created.
|
|
18
|
+
sig { returns(String) }
|
|
19
|
+
attr_accessor :created_at
|
|
20
|
+
|
|
21
|
+
# Actor that created the broadcast.
|
|
22
|
+
sig { returns(String) }
|
|
23
|
+
attr_accessor :created_by
|
|
24
|
+
|
|
25
|
+
# Human-readable name.
|
|
26
|
+
sig { returns(String) }
|
|
27
|
+
attr_accessor :name
|
|
28
|
+
|
|
29
|
+
# Lifecycle status of the broadcast.
|
|
30
|
+
sig { returns(Courier::Broadcast::Status::TaggedSymbol) }
|
|
31
|
+
attr_accessor :status
|
|
32
|
+
|
|
33
|
+
# ISO 8601 timestamp of the last update.
|
|
34
|
+
sig { returns(String) }
|
|
35
|
+
attr_accessor :updated_at
|
|
36
|
+
|
|
37
|
+
# Actor that last updated the broadcast.
|
|
38
|
+
sig { returns(String) }
|
|
39
|
+
attr_accessor :updated_by
|
|
40
|
+
|
|
41
|
+
# ISO 8601 timestamp when the broadcast was archived, if archived.
|
|
42
|
+
sig { returns(T.nilable(String)) }
|
|
43
|
+
attr_accessor :archived_at
|
|
44
|
+
|
|
45
|
+
# Actor that archived the broadcast, if archived.
|
|
46
|
+
sig { returns(T.nilable(String)) }
|
|
47
|
+
attr_accessor :archived_by
|
|
48
|
+
|
|
49
|
+
# The delivery schedule and recipient targeting for a broadcast.
|
|
50
|
+
sig { returns(T.nilable(Courier::BroadcastSchedule)) }
|
|
51
|
+
attr_reader :schedule
|
|
52
|
+
|
|
53
|
+
sig do
|
|
54
|
+
params(schedule: T.nilable(Courier::BroadcastSchedule::OrHash)).void
|
|
55
|
+
end
|
|
56
|
+
attr_writer :schedule
|
|
57
|
+
|
|
58
|
+
# A broadcast — a single-channel message delivered to a known set of recipients (a
|
|
59
|
+
# list or audience).
|
|
60
|
+
sig do
|
|
61
|
+
params(
|
|
62
|
+
id: String,
|
|
63
|
+
channel: Courier::Broadcast::Channel::OrSymbol,
|
|
64
|
+
created_at: String,
|
|
65
|
+
created_by: String,
|
|
66
|
+
name: String,
|
|
67
|
+
status: Courier::Broadcast::Status::OrSymbol,
|
|
68
|
+
updated_at: String,
|
|
69
|
+
updated_by: String,
|
|
70
|
+
archived_at: T.nilable(String),
|
|
71
|
+
archived_by: T.nilable(String),
|
|
72
|
+
schedule: T.nilable(Courier::BroadcastSchedule::OrHash)
|
|
73
|
+
).returns(T.attached_class)
|
|
74
|
+
end
|
|
75
|
+
def self.new(
|
|
76
|
+
# The broadcast ID (bst\_ prefix).
|
|
77
|
+
id:,
|
|
78
|
+
# The broadcast's delivery channel.
|
|
79
|
+
channel:,
|
|
80
|
+
# ISO 8601 timestamp when the broadcast was created.
|
|
81
|
+
created_at:,
|
|
82
|
+
# Actor that created the broadcast.
|
|
83
|
+
created_by:,
|
|
84
|
+
# Human-readable name.
|
|
85
|
+
name:,
|
|
86
|
+
# Lifecycle status of the broadcast.
|
|
87
|
+
status:,
|
|
88
|
+
# ISO 8601 timestamp of the last update.
|
|
89
|
+
updated_at:,
|
|
90
|
+
# Actor that last updated the broadcast.
|
|
91
|
+
updated_by:,
|
|
92
|
+
# ISO 8601 timestamp when the broadcast was archived, if archived.
|
|
93
|
+
archived_at: nil,
|
|
94
|
+
# Actor that archived the broadcast, if archived.
|
|
95
|
+
archived_by: nil,
|
|
96
|
+
# The delivery schedule and recipient targeting for a broadcast.
|
|
97
|
+
schedule: nil
|
|
98
|
+
)
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
sig do
|
|
102
|
+
override.returns(
|
|
103
|
+
{
|
|
104
|
+
id: String,
|
|
105
|
+
channel: Courier::Broadcast::Channel::TaggedSymbol,
|
|
106
|
+
created_at: String,
|
|
107
|
+
created_by: String,
|
|
108
|
+
name: String,
|
|
109
|
+
status: Courier::Broadcast::Status::TaggedSymbol,
|
|
110
|
+
updated_at: String,
|
|
111
|
+
updated_by: String,
|
|
112
|
+
archived_at: T.nilable(String),
|
|
113
|
+
archived_by: T.nilable(String),
|
|
114
|
+
schedule: T.nilable(Courier::BroadcastSchedule)
|
|
115
|
+
}
|
|
116
|
+
)
|
|
117
|
+
end
|
|
118
|
+
def to_hash
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# The broadcast's delivery channel.
|
|
122
|
+
module Channel
|
|
123
|
+
extend Courier::Internal::Type::Enum
|
|
124
|
+
|
|
125
|
+
TaggedSymbol =
|
|
126
|
+
T.type_alias { T.all(Symbol, Courier::Broadcast::Channel) }
|
|
127
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
128
|
+
|
|
129
|
+
EMAIL = T.let(:email, Courier::Broadcast::Channel::TaggedSymbol)
|
|
130
|
+
SMS = T.let(:sms, Courier::Broadcast::Channel::TaggedSymbol)
|
|
131
|
+
PUSH = T.let(:push, Courier::Broadcast::Channel::TaggedSymbol)
|
|
132
|
+
INBOX = T.let(:inbox, Courier::Broadcast::Channel::TaggedSymbol)
|
|
133
|
+
SLACK = T.let(:slack, Courier::Broadcast::Channel::TaggedSymbol)
|
|
134
|
+
MSTEAMS = T.let(:msteams, Courier::Broadcast::Channel::TaggedSymbol)
|
|
135
|
+
|
|
136
|
+
sig do
|
|
137
|
+
override.returns(T::Array[Courier::Broadcast::Channel::TaggedSymbol])
|
|
138
|
+
end
|
|
139
|
+
def self.values
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# Lifecycle status of the broadcast.
|
|
144
|
+
module Status
|
|
145
|
+
extend Courier::Internal::Type::Enum
|
|
146
|
+
|
|
147
|
+
TaggedSymbol =
|
|
148
|
+
T.type_alias { T.all(Symbol, Courier::Broadcast::Status) }
|
|
149
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
150
|
+
|
|
151
|
+
DRAFT = T.let(:draft, Courier::Broadcast::Status::TaggedSymbol)
|
|
152
|
+
SCHEDULED = T.let(:scheduled, Courier::Broadcast::Status::TaggedSymbol)
|
|
153
|
+
SENDING = T.let(:sending, Courier::Broadcast::Status::TaggedSymbol)
|
|
154
|
+
SENT = T.let(:sent, Courier::Broadcast::Status::TaggedSymbol)
|
|
155
|
+
|
|
156
|
+
sig do
|
|
157
|
+
override.returns(T::Array[Courier::Broadcast::Status::TaggedSymbol])
|
|
158
|
+
end
|
|
159
|
+
def self.values
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Courier
|
|
4
|
+
module Models
|
|
5
|
+
class BroadcastArchiveParams < Courier::Internal::Type::BaseModel
|
|
6
|
+
extend Courier::Internal::Type::RequestParameters::Converter
|
|
7
|
+
include Courier::Internal::Type::RequestParameters
|
|
8
|
+
|
|
9
|
+
OrHash =
|
|
10
|
+
T.type_alias do
|
|
11
|
+
T.any(Courier::BroadcastArchiveParams, Courier::Internal::AnyHash)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
sig { returns(String) }
|
|
15
|
+
attr_accessor :broadcast_id
|
|
16
|
+
|
|
17
|
+
sig do
|
|
18
|
+
params(
|
|
19
|
+
broadcast_id: String,
|
|
20
|
+
request_options: Courier::RequestOptions::OrHash
|
|
21
|
+
).returns(T.attached_class)
|
|
22
|
+
end
|
|
23
|
+
def self.new(broadcast_id:, request_options: {})
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
sig do
|
|
27
|
+
override.returns(
|
|
28
|
+
{ broadcast_id: String, request_options: Courier::RequestOptions }
|
|
29
|
+
)
|
|
30
|
+
end
|
|
31
|
+
def to_hash
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Courier
|
|
4
|
+
module Models
|
|
5
|
+
class BroadcastCancelParams < Courier::Internal::Type::BaseModel
|
|
6
|
+
extend Courier::Internal::Type::RequestParameters::Converter
|
|
7
|
+
include Courier::Internal::Type::RequestParameters
|
|
8
|
+
|
|
9
|
+
OrHash =
|
|
10
|
+
T.type_alias do
|
|
11
|
+
T.any(Courier::BroadcastCancelParams, Courier::Internal::AnyHash)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
sig { returns(String) }
|
|
15
|
+
attr_accessor :broadcast_id
|
|
16
|
+
|
|
17
|
+
sig do
|
|
18
|
+
params(
|
|
19
|
+
broadcast_id: String,
|
|
20
|
+
request_options: Courier::RequestOptions::OrHash
|
|
21
|
+
).returns(T.attached_class)
|
|
22
|
+
end
|
|
23
|
+
def self.new(broadcast_id:, request_options: {})
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
sig do
|
|
27
|
+
override.returns(
|
|
28
|
+
{ broadcast_id: String, request_options: Courier::RequestOptions }
|
|
29
|
+
)
|
|
30
|
+
end
|
|
31
|
+
def to_hash
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Courier
|
|
4
|
+
module Models
|
|
5
|
+
class BroadcastCreateParams < Courier::Models::CreateBroadcastRequest
|
|
6
|
+
extend Courier::Internal::Type::RequestParameters::Converter
|
|
7
|
+
include Courier::Internal::Type::RequestParameters
|
|
8
|
+
|
|
9
|
+
OrHash =
|
|
10
|
+
T.type_alias do
|
|
11
|
+
T.any(Courier::BroadcastCreateParams, Courier::Internal::AnyHash)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
sig do
|
|
15
|
+
params(request_options: Courier::RequestOptions::OrHash).returns(
|
|
16
|
+
T.attached_class
|
|
17
|
+
)
|
|
18
|
+
end
|
|
19
|
+
def self.new(request_options: {})
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
sig { override.returns({ request_options: Courier::RequestOptions }) }
|
|
23
|
+
def to_hash
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|