trycourier 4.9.0 → 4.10.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 +9 -0
- data/lib/courier/models/associated_notification_list_response.rb +24 -0
- data/lib/courier/models/element_with_checksums.rb +60 -0
- data/lib/courier/models/notification_content_get_response.rb +26 -0
- data/lib/courier/models/notification_content_mutation_response.rb +61 -0
- data/lib/courier/models/notification_content_put_request.rb +51 -0
- data/lib/courier/models/notification_element_put_request.rb +62 -0
- data/lib/courier/models/notification_get_content.rb +0 -1
- data/lib/courier/models/notification_locale_put_request.rb +39 -0
- data/lib/courier/models/notification_put_content_params.rb +20 -0
- data/lib/courier/models/notification_put_element_params.rb +26 -0
- data/lib/courier/models/notification_put_locale_params.rb +26 -0
- data/lib/courier/models/notification_retrieve_content_params.rb +14 -1
- data/lib/courier/models/notification_retrieve_content_response.rb +21 -0
- data/lib/courier/models/notification_template_state.rb +16 -0
- data/lib/courier/models/routing_strategy_list_notifications_params.rb +37 -0
- data/lib/courier/models.rb +24 -0
- data/lib/courier/resources/notifications.rb +124 -9
- data/lib/courier/resources/routing_strategies.rb +28 -0
- data/lib/courier/version.rb +1 -1
- data/lib/courier.rb +13 -2
- data/rbi/courier/models/associated_notification_list_response.rbi +45 -0
- data/rbi/courier/models/element_with_checksums.rbi +109 -0
- data/rbi/courier/models/notification_content_get_response.rbi +45 -0
- data/rbi/courier/models/notification_content_mutation_response.rbi +95 -0
- data/rbi/courier/models/notification_content_put_request.rbi +145 -0
- data/rbi/courier/models/notification_element_put_request.rbi +98 -0
- data/rbi/courier/models/notification_locale_put_request.rbi +79 -0
- data/rbi/courier/models/notification_put_content_params.rbi +38 -0
- data/rbi/courier/models/notification_put_element_params.rbi +46 -0
- data/rbi/courier/models/notification_put_locale_params.rbi +46 -0
- data/rbi/courier/models/notification_retrieve_content_params.rbi +21 -2
- data/rbi/courier/models/notification_retrieve_content_response.rbi +29 -0
- data/rbi/courier/models/notification_template_state.rbi +26 -0
- data/rbi/courier/models/routing_strategy_list_notifications_params.rbi +63 -0
- data/rbi/courier/models.rbi +28 -0
- data/rbi/courier/resources/notifications.rbi +103 -5
- data/rbi/courier/resources/routing_strategies.rbi +21 -0
- data/sig/courier/models/associated_notification_list_response.rbs +25 -0
- data/sig/courier/models/element_with_checksums.rbs +60 -0
- data/sig/courier/models/notification_content_get_response.rbs +22 -0
- data/sig/courier/models/notification_content_mutation_response.rbs +47 -0
- data/sig/courier/models/notification_content_put_request.rbs +50 -0
- data/sig/courier/models/notification_element_put_request.rbs +64 -0
- data/sig/courier/models/notification_locale_put_request.rbs +39 -0
- data/sig/courier/models/notification_put_content_params.rbs +22 -0
- data/sig/courier/models/notification_put_element_params.rbs +32 -0
- data/sig/courier/models/notification_put_locale_params.rbs +32 -0
- data/sig/courier/models/notification_retrieve_content_params.rbs +12 -2
- data/sig/courier/models/notification_retrieve_content_response.rbs +12 -0
- data/sig/courier/models/notification_template_state.rbs +14 -0
- data/sig/courier/models/routing_strategy_list_notifications_params.rbs +34 -0
- data/sig/courier/models.rbs +24 -0
- data/sig/courier/resources/notifications.rbs +30 -3
- data/sig/courier/resources/routing_strategies.rbs +7 -0
- metadata +41 -8
- data/lib/courier/models/notifications/draft_retrieve_content_params.rb +0 -22
- data/lib/courier/resources/notifications/draft.rb +0 -33
- data/rbi/courier/models/notifications/draft_retrieve_content_params.rbi +0 -40
- data/rbi/courier/resources/notifications/draft.rbi +0 -23
- data/sig/courier/models/notifications/draft_retrieve_content_params.rbs +0 -22
- data/sig/courier/resources/notifications/draft.rbs +0 -14
|
@@ -3,9 +3,6 @@
|
|
|
3
3
|
module Courier
|
|
4
4
|
module Resources
|
|
5
5
|
class Notifications
|
|
6
|
-
# @return [Courier::Resources::Notifications::Draft]
|
|
7
|
-
attr_reader :draft
|
|
8
|
-
|
|
9
6
|
# @return [Courier::Resources::Notifications::Checks]
|
|
10
7
|
attr_reader :checks
|
|
11
8
|
|
|
@@ -165,6 +162,111 @@ module Courier
|
|
|
165
162
|
)
|
|
166
163
|
end
|
|
167
164
|
|
|
165
|
+
# Replace the elemental content of a notification template. Overwrites all
|
|
166
|
+
# elements in the template with the provided content. Only supported for V2
|
|
167
|
+
# (elemental) templates.
|
|
168
|
+
#
|
|
169
|
+
# @overload put_content(id, content:, state: nil, request_options: {})
|
|
170
|
+
#
|
|
171
|
+
# @param id [String] Notification template ID (`nt_` prefix).
|
|
172
|
+
#
|
|
173
|
+
# @param content [Courier::Models::NotificationContentPutRequest::Content] Elemental content payload. The server defaults `version` when omitted.
|
|
174
|
+
#
|
|
175
|
+
# @param state [Symbol, Courier::Models::NotificationTemplateState] Template state. Defaults to `DRAFT`.
|
|
176
|
+
#
|
|
177
|
+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
178
|
+
#
|
|
179
|
+
# @return [Courier::Models::NotificationContentMutationResponse]
|
|
180
|
+
#
|
|
181
|
+
# @see Courier::Models::NotificationPutContentParams
|
|
182
|
+
def put_content(id, params)
|
|
183
|
+
parsed, options = Courier::NotificationPutContentParams.dump_request(params)
|
|
184
|
+
@client.request(
|
|
185
|
+
method: :put,
|
|
186
|
+
path: ["notifications/%1$s/content", id],
|
|
187
|
+
body: parsed,
|
|
188
|
+
model: Courier::NotificationContentMutationResponse,
|
|
189
|
+
options: options
|
|
190
|
+
)
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
# Update a single element within a notification template. Only supported for V2
|
|
194
|
+
# (elemental) templates.
|
|
195
|
+
#
|
|
196
|
+
# @overload put_element(element_id, id:, type:, channels: nil, data: nil, if_: nil, loop_: nil, ref: nil, state: nil, request_options: {})
|
|
197
|
+
#
|
|
198
|
+
# @param element_id [String] Path param: Element ID within the template.
|
|
199
|
+
#
|
|
200
|
+
# @param id [String] Path param: Notification template ID (`nt_` prefix).
|
|
201
|
+
#
|
|
202
|
+
# @param type [String] Body param: Element type (text, meta, action, image, etc.).
|
|
203
|
+
#
|
|
204
|
+
# @param channels [Array<String>] Body param
|
|
205
|
+
#
|
|
206
|
+
# @param data [Hash{Symbol=>Object}] Body param
|
|
207
|
+
#
|
|
208
|
+
# @param if_ [String] Body param
|
|
209
|
+
#
|
|
210
|
+
# @param loop_ [String] Body param
|
|
211
|
+
#
|
|
212
|
+
# @param ref [String] Body param
|
|
213
|
+
#
|
|
214
|
+
# @param state [Symbol, Courier::Models::NotificationTemplateState] Body param: Template state. Defaults to `DRAFT`.
|
|
215
|
+
#
|
|
216
|
+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
217
|
+
#
|
|
218
|
+
# @return [Courier::Models::NotificationContentMutationResponse]
|
|
219
|
+
#
|
|
220
|
+
# @see Courier::Models::NotificationPutElementParams
|
|
221
|
+
def put_element(element_id, params)
|
|
222
|
+
parsed, options = Courier::NotificationPutElementParams.dump_request(params)
|
|
223
|
+
id =
|
|
224
|
+
parsed.delete(:id) do
|
|
225
|
+
raise ArgumentError.new("missing required path argument #{_1}")
|
|
226
|
+
end
|
|
227
|
+
@client.request(
|
|
228
|
+
method: :put,
|
|
229
|
+
path: ["notifications/%1$s/elements/%2$s", id, element_id],
|
|
230
|
+
body: parsed,
|
|
231
|
+
model: Courier::NotificationContentMutationResponse,
|
|
232
|
+
options: options
|
|
233
|
+
)
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
# Set locale-specific content overrides for a notification template. Each element
|
|
237
|
+
# override must reference an existing element by ID. Only supported for V2
|
|
238
|
+
# (elemental) templates.
|
|
239
|
+
#
|
|
240
|
+
# @overload put_locale(locale_id, id:, elements:, state: nil, request_options: {})
|
|
241
|
+
#
|
|
242
|
+
# @param locale_id [String] Path param: Locale code (e.g., `es`, `fr`, `pt-BR`).
|
|
243
|
+
#
|
|
244
|
+
# @param id [String] Path param: Notification template ID (`nt_` prefix).
|
|
245
|
+
#
|
|
246
|
+
# @param elements [Array<Courier::Models::NotificationLocalePutRequest::Element>] Body param: Elements with locale-specific content overrides.
|
|
247
|
+
#
|
|
248
|
+
# @param state [Symbol, Courier::Models::NotificationTemplateState] Body param: Template state. Defaults to `DRAFT`.
|
|
249
|
+
#
|
|
250
|
+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
251
|
+
#
|
|
252
|
+
# @return [Courier::Models::NotificationContentMutationResponse]
|
|
253
|
+
#
|
|
254
|
+
# @see Courier::Models::NotificationPutLocaleParams
|
|
255
|
+
def put_locale(locale_id, params)
|
|
256
|
+
parsed, options = Courier::NotificationPutLocaleParams.dump_request(params)
|
|
257
|
+
id =
|
|
258
|
+
parsed.delete(:id) do
|
|
259
|
+
raise ArgumentError.new("missing required path argument #{_1}")
|
|
260
|
+
end
|
|
261
|
+
@client.request(
|
|
262
|
+
method: :put,
|
|
263
|
+
path: ["notifications/%1$s/locales/%2$s", id, locale_id],
|
|
264
|
+
body: parsed,
|
|
265
|
+
model: Courier::NotificationContentMutationResponse,
|
|
266
|
+
options: options
|
|
267
|
+
)
|
|
268
|
+
end
|
|
269
|
+
|
|
168
270
|
# Some parameter documentations has been truncated, see
|
|
169
271
|
# {Courier::Models::NotificationReplaceParams} for more details.
|
|
170
272
|
#
|
|
@@ -194,20 +296,34 @@ module Courier
|
|
|
194
296
|
)
|
|
195
297
|
end
|
|
196
298
|
|
|
197
|
-
#
|
|
299
|
+
# Some parameter documentations has been truncated, see
|
|
300
|
+
# {Courier::Models::NotificationRetrieveContentParams} for more details.
|
|
301
|
+
#
|
|
302
|
+
# Retrieve the content of a notification template. The response shape depends on
|
|
303
|
+
# whether the template uses V1 (blocks/channels) or V2 (elemental) content. Use
|
|
304
|
+
# the `version` query parameter to select draft, published, or a specific
|
|
305
|
+
# historical version.
|
|
306
|
+
#
|
|
307
|
+
# @overload retrieve_content(id, version: nil, request_options: {})
|
|
308
|
+
#
|
|
309
|
+
# @param id [String] Notification template ID (`nt_` prefix).
|
|
310
|
+
#
|
|
311
|
+
# @param version [String] Accepts `draft`, `published`, or a version string (e.g., `v001`). Defaults to `p
|
|
198
312
|
#
|
|
199
|
-
# @param id [String]
|
|
200
313
|
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
201
314
|
#
|
|
202
|
-
# @return [Courier::Models::NotificationGetContent]
|
|
315
|
+
# @return [Courier::Models::NotificationContentGetResponse, Courier::Models::NotificationGetContent]
|
|
203
316
|
#
|
|
204
317
|
# @see Courier::Models::NotificationRetrieveContentParams
|
|
205
318
|
def retrieve_content(id, params = {})
|
|
319
|
+
parsed, options = Courier::NotificationRetrieveContentParams.dump_request(params)
|
|
320
|
+
query = Courier::Internal::Util.encode_query_params(parsed)
|
|
206
321
|
@client.request(
|
|
207
322
|
method: :get,
|
|
208
323
|
path: ["notifications/%1$s/content", id],
|
|
209
|
-
|
|
210
|
-
|
|
324
|
+
query: query,
|
|
325
|
+
model: Courier::Models::NotificationRetrieveContentResponse,
|
|
326
|
+
options: options
|
|
211
327
|
)
|
|
212
328
|
end
|
|
213
329
|
|
|
@@ -216,7 +332,6 @@ module Courier
|
|
|
216
332
|
# @param client [Courier::Client]
|
|
217
333
|
def initialize(client:)
|
|
218
334
|
@client = client
|
|
219
|
-
@draft = Courier::Resources::Notifications::Draft.new(client: client)
|
|
220
335
|
@checks = Courier::Resources::Notifications::Checks.new(client: client)
|
|
221
336
|
end
|
|
222
337
|
end
|
|
@@ -105,6 +105,34 @@ module Courier
|
|
|
105
105
|
)
|
|
106
106
|
end
|
|
107
107
|
|
|
108
|
+
# List notification templates associated with a routing strategy. Includes
|
|
109
|
+
# template metadata only, not full content.
|
|
110
|
+
#
|
|
111
|
+
# @overload list_notifications(id, cursor: nil, limit: nil, request_options: {})
|
|
112
|
+
#
|
|
113
|
+
# @param id [String] Routing strategy ID (`rs_` prefix).
|
|
114
|
+
#
|
|
115
|
+
# @param cursor [String, nil] Opaque pagination cursor from a previous response. Omit for the first page.
|
|
116
|
+
#
|
|
117
|
+
# @param limit [Integer] Maximum number of results per page. Default 20, max 100.
|
|
118
|
+
#
|
|
119
|
+
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
120
|
+
#
|
|
121
|
+
# @return [Courier::Models::AssociatedNotificationListResponse]
|
|
122
|
+
#
|
|
123
|
+
# @see Courier::Models::RoutingStrategyListNotificationsParams
|
|
124
|
+
def list_notifications(id, params = {})
|
|
125
|
+
parsed, options = Courier::RoutingStrategyListNotificationsParams.dump_request(params)
|
|
126
|
+
query = Courier::Internal::Util.encode_query_params(parsed)
|
|
127
|
+
@client.request(
|
|
128
|
+
method: :get,
|
|
129
|
+
path: ["routing-strategies/%1$s/notifications", id],
|
|
130
|
+
query: query,
|
|
131
|
+
model: Courier::AssociatedNotificationListResponse,
|
|
132
|
+
options: options
|
|
133
|
+
)
|
|
134
|
+
end
|
|
135
|
+
|
|
108
136
|
# Replace a routing strategy. Full document replacement; the caller must send the
|
|
109
137
|
# complete desired state. Missing optional fields are cleared.
|
|
110
138
|
#
|
data/lib/courier/version.rb
CHANGED
data/lib/courier.rb
CHANGED
|
@@ -62,6 +62,9 @@ require_relative "courier/models/journeys_invoke_request"
|
|
|
62
62
|
require_relative "courier/models/message_details"
|
|
63
63
|
require_relative "courier/models/notification_template_create_request"
|
|
64
64
|
require_relative "courier/models/notification_template_publish_request"
|
|
65
|
+
require_relative "courier/models/notification_content_put_request"
|
|
66
|
+
require_relative "courier/models/notification_element_put_request"
|
|
67
|
+
require_relative "courier/models/notification_locale_put_request"
|
|
65
68
|
require_relative "courier/models/notification_template_update_request"
|
|
66
69
|
require_relative "courier/models/notification_template_payload"
|
|
67
70
|
require_relative "courier/models/routing_strategy_create_request"
|
|
@@ -73,6 +76,7 @@ require_relative "courier/models/users/user_token"
|
|
|
73
76
|
require_relative "courier/models/airship_profile"
|
|
74
77
|
require_relative "courier/models/airship_profile_audience"
|
|
75
78
|
require_relative "courier/models/alignment"
|
|
79
|
+
require_relative "courier/models/associated_notification_list_response"
|
|
76
80
|
require_relative "courier/models/audience"
|
|
77
81
|
require_relative "courier/models/audience_delete_params"
|
|
78
82
|
require_relative "courier/models/audience_filter"
|
|
@@ -137,6 +141,7 @@ require_relative "courier/models/elemental_meta_node_with_type"
|
|
|
137
141
|
require_relative "courier/models/elemental_node"
|
|
138
142
|
require_relative "courier/models/elemental_quote_node_with_type"
|
|
139
143
|
require_relative "courier/models/elemental_text_node_with_type"
|
|
144
|
+
require_relative "courier/models/element_with_checksums"
|
|
140
145
|
require_relative "courier/models/email_footer"
|
|
141
146
|
require_relative "courier/models/email_head"
|
|
142
147
|
require_relative "courier/models/email_header"
|
|
@@ -190,6 +195,8 @@ require_relative "courier/models/ms_teams_base_properties"
|
|
|
190
195
|
require_relative "courier/models/ms_teams_recipient"
|
|
191
196
|
require_relative "courier/models/multiple_tokens"
|
|
192
197
|
require_relative "courier/models/notification_archive_params"
|
|
198
|
+
require_relative "courier/models/notification_content_get_response"
|
|
199
|
+
require_relative "courier/models/notification_content_mutation_response"
|
|
193
200
|
require_relative "courier/models/notification_create_params"
|
|
194
201
|
require_relative "courier/models/notification_get_content"
|
|
195
202
|
require_relative "courier/models/notification_list_params"
|
|
@@ -197,17 +204,21 @@ require_relative "courier/models/notification_list_response"
|
|
|
197
204
|
require_relative "courier/models/notification_list_versions_params"
|
|
198
205
|
require_relative "courier/models/notification_preference_details"
|
|
199
206
|
require_relative "courier/models/notification_publish_params"
|
|
207
|
+
require_relative "courier/models/notification_put_content_params"
|
|
208
|
+
require_relative "courier/models/notification_put_element_params"
|
|
209
|
+
require_relative "courier/models/notification_put_locale_params"
|
|
200
210
|
require_relative "courier/models/notification_replace_params"
|
|
201
211
|
require_relative "courier/models/notification_retrieve_content_params"
|
|
212
|
+
require_relative "courier/models/notification_retrieve_content_response"
|
|
202
213
|
require_relative "courier/models/notification_retrieve_params"
|
|
203
214
|
require_relative "courier/models/notifications/check_delete_params"
|
|
204
215
|
require_relative "courier/models/notifications/check_list_params"
|
|
205
216
|
require_relative "courier/models/notifications/check_list_response"
|
|
206
217
|
require_relative "courier/models/notifications/check_update_params"
|
|
207
218
|
require_relative "courier/models/notifications/check_update_response"
|
|
208
|
-
require_relative "courier/models/notifications/draft_retrieve_content_params"
|
|
209
219
|
require_relative "courier/models/notification_template_get_response"
|
|
210
220
|
require_relative "courier/models/notification_template_mutation_response"
|
|
221
|
+
require_relative "courier/models/notification_template_state"
|
|
211
222
|
require_relative "courier/models/notification_template_summary"
|
|
212
223
|
require_relative "courier/models/notification_template_version_list_response"
|
|
213
224
|
require_relative "courier/models/pagerduty"
|
|
@@ -247,6 +258,7 @@ require_relative "courier/models/request_archive_params"
|
|
|
247
258
|
require_relative "courier/models/routing_strategy_archive_params"
|
|
248
259
|
require_relative "courier/models/routing_strategy_create_params"
|
|
249
260
|
require_relative "courier/models/routing_strategy_get_response"
|
|
261
|
+
require_relative "courier/models/routing_strategy_list_notifications_params"
|
|
250
262
|
require_relative "courier/models/routing_strategy_list_params"
|
|
251
263
|
require_relative "courier/models/routing_strategy_list_response"
|
|
252
264
|
require_relative "courier/models/routing_strategy_mutation_response"
|
|
@@ -343,7 +355,6 @@ require_relative "courier/resources/lists/subscriptions"
|
|
|
343
355
|
require_relative "courier/resources/messages"
|
|
344
356
|
require_relative "courier/resources/notifications"
|
|
345
357
|
require_relative "courier/resources/notifications/checks"
|
|
346
|
-
require_relative "courier/resources/notifications/draft"
|
|
347
358
|
require_relative "courier/resources/profiles"
|
|
348
359
|
require_relative "courier/resources/profiles/lists"
|
|
349
360
|
require_relative "courier/resources/providers"
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Courier
|
|
4
|
+
module Models
|
|
5
|
+
class AssociatedNotificationListResponse < Courier::Internal::Type::BaseModel
|
|
6
|
+
OrHash =
|
|
7
|
+
T.type_alias do
|
|
8
|
+
T.any(
|
|
9
|
+
Courier::AssociatedNotificationListResponse,
|
|
10
|
+
Courier::Internal::AnyHash
|
|
11
|
+
)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
sig { returns(Courier::Paging) }
|
|
15
|
+
attr_reader :paging
|
|
16
|
+
|
|
17
|
+
sig { params(paging: Courier::Paging::OrHash).void }
|
|
18
|
+
attr_writer :paging
|
|
19
|
+
|
|
20
|
+
sig { returns(T::Array[Courier::NotificationTemplateSummary]) }
|
|
21
|
+
attr_accessor :results
|
|
22
|
+
|
|
23
|
+
# Paginated list of notification templates associated with a routing strategy.
|
|
24
|
+
sig do
|
|
25
|
+
params(
|
|
26
|
+
paging: Courier::Paging::OrHash,
|
|
27
|
+
results: T::Array[Courier::NotificationTemplateSummary::OrHash]
|
|
28
|
+
).returns(T.attached_class)
|
|
29
|
+
end
|
|
30
|
+
def self.new(paging:, results:)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
sig do
|
|
34
|
+
override.returns(
|
|
35
|
+
{
|
|
36
|
+
paging: Courier::Paging,
|
|
37
|
+
results: T::Array[Courier::NotificationTemplateSummary]
|
|
38
|
+
}
|
|
39
|
+
)
|
|
40
|
+
end
|
|
41
|
+
def to_hash
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Courier
|
|
4
|
+
module Models
|
|
5
|
+
class ElementWithChecksums < Courier::Internal::Type::BaseModel
|
|
6
|
+
OrHash =
|
|
7
|
+
T.type_alias do
|
|
8
|
+
T.any(Courier::ElementWithChecksums, Courier::Internal::AnyHash)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# MD5 hash of translatable content.
|
|
12
|
+
sig { returns(String) }
|
|
13
|
+
attr_accessor :checksum
|
|
14
|
+
|
|
15
|
+
# Element type (text, meta, action, etc.).
|
|
16
|
+
sig { returns(String) }
|
|
17
|
+
attr_accessor :type
|
|
18
|
+
|
|
19
|
+
sig { returns(T.nilable(String)) }
|
|
20
|
+
attr_reader :id
|
|
21
|
+
|
|
22
|
+
sig { params(id: String).void }
|
|
23
|
+
attr_writer :id
|
|
24
|
+
|
|
25
|
+
# Nested child elements (for group-type elements).
|
|
26
|
+
sig { returns(T.nilable(T::Array[Courier::ElementWithChecksums])) }
|
|
27
|
+
attr_reader :elements
|
|
28
|
+
|
|
29
|
+
sig { params(elements: T::Array[Courier::ElementWithChecksums]).void }
|
|
30
|
+
attr_writer :elements
|
|
31
|
+
|
|
32
|
+
# Locale-specific content with checksums.
|
|
33
|
+
sig do
|
|
34
|
+
returns(
|
|
35
|
+
T.nilable(T::Hash[Symbol, Courier::ElementWithChecksums::Locale])
|
|
36
|
+
)
|
|
37
|
+
end
|
|
38
|
+
attr_reader :locales
|
|
39
|
+
|
|
40
|
+
sig do
|
|
41
|
+
params(
|
|
42
|
+
locales:
|
|
43
|
+
T::Hash[Symbol, Courier::ElementWithChecksums::Locale::OrHash]
|
|
44
|
+
).void
|
|
45
|
+
end
|
|
46
|
+
attr_writer :locales
|
|
47
|
+
|
|
48
|
+
# An element with its content checksum and optional nested elements and locale
|
|
49
|
+
# checksums.
|
|
50
|
+
sig do
|
|
51
|
+
params(
|
|
52
|
+
checksum: String,
|
|
53
|
+
type: String,
|
|
54
|
+
id: String,
|
|
55
|
+
elements: T::Array[Courier::ElementWithChecksums],
|
|
56
|
+
locales:
|
|
57
|
+
T::Hash[Symbol, Courier::ElementWithChecksums::Locale::OrHash]
|
|
58
|
+
).returns(T.attached_class)
|
|
59
|
+
end
|
|
60
|
+
def self.new(
|
|
61
|
+
# MD5 hash of translatable content.
|
|
62
|
+
checksum:,
|
|
63
|
+
# Element type (text, meta, action, etc.).
|
|
64
|
+
type:,
|
|
65
|
+
id: nil,
|
|
66
|
+
# Nested child elements (for group-type elements).
|
|
67
|
+
elements: nil,
|
|
68
|
+
# Locale-specific content with checksums.
|
|
69
|
+
locales: nil
|
|
70
|
+
)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
sig do
|
|
74
|
+
override.returns(
|
|
75
|
+
{
|
|
76
|
+
checksum: String,
|
|
77
|
+
type: String,
|
|
78
|
+
id: String,
|
|
79
|
+
elements: T::Array[Courier::ElementWithChecksums],
|
|
80
|
+
locales: T::Hash[Symbol, Courier::ElementWithChecksums::Locale]
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
end
|
|
84
|
+
def to_hash
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
class Locale < Courier::Internal::Type::BaseModel
|
|
88
|
+
OrHash =
|
|
89
|
+
T.type_alias do
|
|
90
|
+
T.any(
|
|
91
|
+
Courier::ElementWithChecksums::Locale,
|
|
92
|
+
Courier::Internal::AnyHash
|
|
93
|
+
)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
sig { returns(String) }
|
|
97
|
+
attr_accessor :checksum
|
|
98
|
+
|
|
99
|
+
sig { params(checksum: String).returns(T.attached_class) }
|
|
100
|
+
def self.new(checksum:)
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
sig { override.returns({ checksum: String }) }
|
|
104
|
+
def to_hash
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Courier
|
|
4
|
+
module Models
|
|
5
|
+
class NotificationContentGetResponse < Courier::Internal::Type::BaseModel
|
|
6
|
+
OrHash =
|
|
7
|
+
T.type_alias do
|
|
8
|
+
T.any(
|
|
9
|
+
Courier::NotificationContentGetResponse,
|
|
10
|
+
Courier::Internal::AnyHash
|
|
11
|
+
)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
sig { returns(T::Array[Courier::ElementWithChecksums]) }
|
|
15
|
+
attr_accessor :elements
|
|
16
|
+
|
|
17
|
+
# Content version identifier.
|
|
18
|
+
sig { returns(String) }
|
|
19
|
+
attr_accessor :version
|
|
20
|
+
|
|
21
|
+
# Elemental content response for V2 templates. Contains versioned elements with
|
|
22
|
+
# content checksums.
|
|
23
|
+
sig do
|
|
24
|
+
params(
|
|
25
|
+
elements: T::Array[Courier::ElementWithChecksums::OrHash],
|
|
26
|
+
version: String
|
|
27
|
+
).returns(T.attached_class)
|
|
28
|
+
end
|
|
29
|
+
def self.new(
|
|
30
|
+
elements:,
|
|
31
|
+
# Content version identifier.
|
|
32
|
+
version:
|
|
33
|
+
)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
sig do
|
|
37
|
+
override.returns(
|
|
38
|
+
{ elements: T::Array[Courier::ElementWithChecksums], version: String }
|
|
39
|
+
)
|
|
40
|
+
end
|
|
41
|
+
def to_hash
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Courier
|
|
4
|
+
module Models
|
|
5
|
+
class NotificationContentMutationResponse < Courier::Internal::Type::BaseModel
|
|
6
|
+
OrHash =
|
|
7
|
+
T.type_alias do
|
|
8
|
+
T.any(
|
|
9
|
+
Courier::NotificationContentMutationResponse,
|
|
10
|
+
Courier::Internal::AnyHash
|
|
11
|
+
)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# Template ID.
|
|
15
|
+
sig { returns(String) }
|
|
16
|
+
attr_accessor :id
|
|
17
|
+
|
|
18
|
+
sig do
|
|
19
|
+
returns(T::Array[Courier::NotificationContentMutationResponse::Element])
|
|
20
|
+
end
|
|
21
|
+
attr_accessor :elements
|
|
22
|
+
|
|
23
|
+
# Template state. Defaults to `DRAFT`.
|
|
24
|
+
sig { returns(Courier::NotificationTemplateState::TaggedSymbol) }
|
|
25
|
+
attr_accessor :state
|
|
26
|
+
|
|
27
|
+
# Content version identifier.
|
|
28
|
+
sig { returns(String) }
|
|
29
|
+
attr_accessor :version
|
|
30
|
+
|
|
31
|
+
# Shared mutation response for `PUT` content, `PUT` element, and `PUT` locale
|
|
32
|
+
# operations. Contains the template ID, content version, per-element checksums,
|
|
33
|
+
# and resulting state.
|
|
34
|
+
sig do
|
|
35
|
+
params(
|
|
36
|
+
id: String,
|
|
37
|
+
elements:
|
|
38
|
+
T::Array[
|
|
39
|
+
Courier::NotificationContentMutationResponse::Element::OrHash
|
|
40
|
+
],
|
|
41
|
+
state: Courier::NotificationTemplateState::OrSymbol,
|
|
42
|
+
version: String
|
|
43
|
+
).returns(T.attached_class)
|
|
44
|
+
end
|
|
45
|
+
def self.new(
|
|
46
|
+
# Template ID.
|
|
47
|
+
id:,
|
|
48
|
+
elements:,
|
|
49
|
+
# Template state. Defaults to `DRAFT`.
|
|
50
|
+
state:,
|
|
51
|
+
# Content version identifier.
|
|
52
|
+
version:
|
|
53
|
+
)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
sig do
|
|
57
|
+
override.returns(
|
|
58
|
+
{
|
|
59
|
+
id: String,
|
|
60
|
+
elements:
|
|
61
|
+
T::Array[Courier::NotificationContentMutationResponse::Element],
|
|
62
|
+
state: Courier::NotificationTemplateState::TaggedSymbol,
|
|
63
|
+
version: String
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
end
|
|
67
|
+
def to_hash
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
class Element < Courier::Internal::Type::BaseModel
|
|
71
|
+
OrHash =
|
|
72
|
+
T.type_alias do
|
|
73
|
+
T.any(
|
|
74
|
+
Courier::NotificationContentMutationResponse::Element,
|
|
75
|
+
Courier::Internal::AnyHash
|
|
76
|
+
)
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
sig { returns(String) }
|
|
80
|
+
attr_accessor :id
|
|
81
|
+
|
|
82
|
+
sig { returns(String) }
|
|
83
|
+
attr_accessor :checksum
|
|
84
|
+
|
|
85
|
+
sig { params(id: String, checksum: String).returns(T.attached_class) }
|
|
86
|
+
def self.new(id:, checksum:)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
sig { override.returns({ id: String, checksum: String }) }
|
|
90
|
+
def to_hash
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|