knockapi 1.16.0 → 1.18.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 (80) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +36 -0
  3. data/README.md +1 -1
  4. data/lib/knockapi/internal/transport/pooled_net_requester.rb +30 -24
  5. data/lib/knockapi/internal/util.rb +5 -5
  6. data/lib/knockapi/models/identify_user_request.rb +2 -2
  7. data/lib/knockapi/models/inline_identify_user_request.rb +2 -2
  8. data/lib/knockapi/models/inline_object_request.rb +2 -2
  9. data/lib/knockapi/models/message.rb +94 -3
  10. data/lib/knockapi/models/messages/batch_archive_response.rb +1 -1
  11. data/lib/knockapi/models/messages/batch_mark_as_interacted_response.rb +1 -1
  12. data/lib/knockapi/models/messages/batch_mark_as_read_response.rb +1 -1
  13. data/lib/knockapi/models/messages/batch_mark_as_seen_response.rb +1 -1
  14. data/lib/knockapi/models/messages/batch_mark_as_unread_response.rb +1 -1
  15. data/lib/knockapi/models/messages/batch_mark_as_unseen_response.rb +1 -1
  16. data/lib/knockapi/models/messages/batch_unarchive_response.rb +1 -1
  17. data/lib/knockapi/models/object_set_params.rb +2 -2
  18. data/lib/knockapi/models/objects/bulk_set_params.rb +2 -2
  19. data/lib/knockapi/models/recipients/channel_data.rb +133 -11
  20. data/lib/knockapi/models/recipients/channel_data_request.rb +151 -9
  21. data/lib/knockapi/models/recipients/inline_channel_data_request.rb +149 -7
  22. data/lib/knockapi/models/recipients/preference_set.rb +130 -3
  23. data/lib/knockapi/models/recipients/preference_set_request.rb +136 -3
  24. data/lib/knockapi/models/tenant_request.rb +2 -2
  25. data/lib/knockapi/models/tenant_set_params.rb +2 -2
  26. data/lib/knockapi/models/users/guide_get_channel_response.rb +270 -34
  27. data/lib/knockapi/resources/messages/batch.rb +7 -7
  28. data/lib/knockapi/resources/objects.rb +7 -3
  29. data/lib/knockapi/resources/tenants.rb +1 -1
  30. data/lib/knockapi/resources/users.rb +7 -3
  31. data/lib/knockapi/version.rb +1 -1
  32. data/lib/knockapi.rb +0 -2
  33. data/rbi/knockapi/models/identify_user_request.rbi +15 -9
  34. data/rbi/knockapi/models/inline_identify_user_request.rbi +15 -9
  35. data/rbi/knockapi/models/inline_object_request.rbi +15 -9
  36. data/rbi/knockapi/models/message.rbi +123 -2
  37. data/rbi/knockapi/models/messages/batch_archive_response.rbi +1 -1
  38. data/rbi/knockapi/models/messages/batch_mark_as_interacted_response.rbi +1 -1
  39. data/rbi/knockapi/models/messages/batch_mark_as_read_response.rbi +1 -1
  40. data/rbi/knockapi/models/messages/batch_mark_as_seen_response.rbi +1 -1
  41. data/rbi/knockapi/models/messages/batch_mark_as_unread_response.rbi +1 -1
  42. data/rbi/knockapi/models/messages/batch_mark_as_unseen_response.rbi +1 -1
  43. data/rbi/knockapi/models/messages/batch_unarchive_response.rbi +1 -1
  44. data/rbi/knockapi/models/object_set_params.rbi +20 -12
  45. data/rbi/knockapi/models/objects/bulk_set_params.rbi +15 -9
  46. data/rbi/knockapi/models/recipients/channel_data.rbi +250 -12
  47. data/rbi/knockapi/models/recipients/channel_data_request.rbi +298 -14
  48. data/rbi/knockapi/models/recipients/inline_channel_data_request.rbi +281 -5
  49. data/rbi/knockapi/models/recipients/preference_set.rbi +279 -0
  50. data/rbi/knockapi/models/recipients/preference_set_request.rbi +299 -0
  51. data/rbi/knockapi/models/tenant_request.rbi +15 -9
  52. data/rbi/knockapi/models/tenant_set_params.rbi +15 -9
  53. data/rbi/knockapi/models/users/guide_get_channel_response.rbi +532 -70
  54. data/rbi/knockapi/resources/messages/batch.rbi +7 -7
  55. data/rbi/knockapi/resources/objects.rbi +26 -6
  56. data/rbi/knockapi/resources/tenants.rbi +5 -3
  57. data/rbi/knockapi/resources/users.rbi +26 -6
  58. data/sig/knockapi/models/message.rbs +79 -0
  59. data/sig/knockapi/models/messages/batch_archive_response.rbs +1 -1
  60. data/sig/knockapi/models/messages/batch_mark_as_interacted_response.rbs +1 -2
  61. data/sig/knockapi/models/messages/batch_mark_as_read_response.rbs +1 -1
  62. data/sig/knockapi/models/messages/batch_mark_as_seen_response.rbs +1 -1
  63. data/sig/knockapi/models/messages/batch_mark_as_unread_response.rbs +1 -1
  64. data/sig/knockapi/models/messages/batch_mark_as_unseen_response.rbs +1 -1
  65. data/sig/knockapi/models/messages/batch_unarchive_response.rbs +1 -1
  66. data/sig/knockapi/models/recipients/channel_data.rbs +97 -7
  67. data/sig/knockapi/models/recipients/channel_data_request.rbs +108 -5
  68. data/sig/knockapi/models/recipients/inline_channel_data_request.rbs +108 -5
  69. data/sig/knockapi/models/recipients/preference_set.rbs +87 -0
  70. data/sig/knockapi/models/recipients/preference_set_request.rbs +87 -0
  71. data/sig/knockapi/models/users/guide_get_channel_response.rbs +294 -31
  72. data/sig/knockapi/resources/objects.rbs +2 -0
  73. data/sig/knockapi/resources/users.rbs +2 -0
  74. metadata +2 -8
  75. data/lib/knockapi/models/recipients/one_signal_channel_data.rb +0 -20
  76. data/lib/knockapi/models/recipients/push_channel_data.rb +0 -20
  77. data/rbi/knockapi/models/recipients/one_signal_channel_data.rbi +0 -33
  78. data/rbi/knockapi/models/recipients/push_channel_data.rbi +0 -33
  79. data/sig/knockapi/models/recipients/one_signal_channel_data.rbs +0 -15
  80. data/sig/knockapi/models/recipients/push_channel_data.rbs +0 -15
@@ -10,20 +10,157 @@ module Knockapi
10
10
  Variants =
11
11
  T.type_alias do
12
12
  T.any(
13
- Knockapi::Recipients::PushChannelData,
14
- Knockapi::Recipients::OneSignalChannelData,
15
- Knockapi::Recipients::InlineChannelDataRequestItem::AwsSnsPushChannelData,
13
+ Knockapi::Recipients::InlineChannelDataRequestItem::PushChannelDataTokensOnly,
14
+ Knockapi::Recipients::InlineChannelDataRequestItem::PushChannelDataDevicesOnly,
15
+ Knockapi::Recipients::InlineChannelDataRequestItem::AwssnsPushChannelDataTargetArNsOnly,
16
+ Knockapi::Recipients::InlineChannelDataRequestItem::AwssnsPushChannelDataDevicesOnly,
17
+ Knockapi::Recipients::InlineChannelDataRequestItem::OneSignalChannelDataPlayerIDsOnly,
16
18
  Knockapi::Recipients::SlackChannelData,
17
19
  Knockapi::Recipients::MsTeamsChannelData,
18
20
  Knockapi::Recipients::DiscordChannelData
19
21
  )
20
22
  end
21
23
 
22
- class AwsSnsPushChannelData < Knockapi::Internal::Type::BaseModel
24
+ class PushChannelDataTokensOnly < Knockapi::Internal::Type::BaseModel
23
25
  OrHash =
24
26
  T.type_alias do
25
27
  T.any(
26
- Knockapi::Recipients::InlineChannelDataRequestItem::AwsSnsPushChannelData,
28
+ Knockapi::Recipients::InlineChannelDataRequestItem::PushChannelDataTokensOnly,
29
+ Knockapi::Internal::AnyHash
30
+ )
31
+ end
32
+
33
+ # A list of push channel tokens.
34
+ sig { returns(T::Array[String]) }
35
+ attr_accessor :tokens
36
+
37
+ # Push channel data.
38
+ sig { params(tokens: T::Array[String]).returns(T.attached_class) }
39
+ def self.new(
40
+ # A list of push channel tokens.
41
+ tokens:
42
+ )
43
+ end
44
+
45
+ sig { override.returns({ tokens: T::Array[String] }) }
46
+ def to_hash
47
+ end
48
+ end
49
+
50
+ class PushChannelDataDevicesOnly < Knockapi::Internal::Type::BaseModel
51
+ OrHash =
52
+ T.type_alias do
53
+ T.any(
54
+ Knockapi::Recipients::InlineChannelDataRequestItem::PushChannelDataDevicesOnly,
55
+ Knockapi::Internal::AnyHash
56
+ )
57
+ end
58
+
59
+ # A list of devices. Each device contains a token, and optionally a locale and
60
+ # timezone.
61
+ sig do
62
+ returns(
63
+ T::Array[
64
+ Knockapi::Recipients::InlineChannelDataRequestItem::PushChannelDataDevicesOnly::Device
65
+ ]
66
+ )
67
+ end
68
+ attr_accessor :devices
69
+
70
+ # Push channel data.
71
+ sig do
72
+ params(
73
+ devices:
74
+ T::Array[
75
+ Knockapi::Recipients::InlineChannelDataRequestItem::PushChannelDataDevicesOnly::Device::OrHash
76
+ ]
77
+ ).returns(T.attached_class)
78
+ end
79
+ def self.new(
80
+ # A list of devices. Each device contains a token, and optionally a locale and
81
+ # timezone.
82
+ devices:
83
+ )
84
+ end
85
+
86
+ sig do
87
+ override.returns(
88
+ {
89
+ devices:
90
+ T::Array[
91
+ Knockapi::Recipients::InlineChannelDataRequestItem::PushChannelDataDevicesOnly::Device
92
+ ]
93
+ }
94
+ )
95
+ end
96
+ def to_hash
97
+ end
98
+
99
+ class Device < Knockapi::Internal::Type::BaseModel
100
+ OrHash =
101
+ T.type_alias do
102
+ T.any(
103
+ Knockapi::Recipients::InlineChannelDataRequestItem::PushChannelDataDevicesOnly::Device,
104
+ Knockapi::Internal::AnyHash
105
+ )
106
+ end
107
+
108
+ # The device token to send the push notification to.
109
+ sig { returns(String) }
110
+ attr_accessor :token
111
+
112
+ # The locale of the object. Used for
113
+ # [message localization](/concepts/translations).
114
+ sig { returns(T.nilable(String)) }
115
+ attr_accessor :locale
116
+
117
+ # The timezone of the object. Must be a
118
+ # valid [tz database time zone string](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
119
+ # Used
120
+ # for [recurring schedules](/concepts/schedules#scheduling-workflows-with-recurring-schedules-for-recipients).
121
+ sig { returns(T.nilable(String)) }
122
+ attr_accessor :timezone
123
+
124
+ sig do
125
+ params(
126
+ token: String,
127
+ locale: T.nilable(String),
128
+ timezone: T.nilable(String)
129
+ ).returns(T.attached_class)
130
+ end
131
+ def self.new(
132
+ # The device token to send the push notification to.
133
+ token:,
134
+ # The locale of the object. Used for
135
+ # [message localization](/concepts/translations).
136
+ locale: nil,
137
+ # The timezone of the object. Must be a
138
+ # valid [tz database time zone string](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
139
+ # Used
140
+ # for [recurring schedules](/concepts/schedules#scheduling-workflows-with-recurring-schedules-for-recipients).
141
+ timezone: nil
142
+ )
143
+ end
144
+
145
+ sig do
146
+ override.returns(
147
+ {
148
+ token: String,
149
+ locale: T.nilable(String),
150
+ timezone: T.nilable(String)
151
+ }
152
+ )
153
+ end
154
+ def to_hash
155
+ end
156
+ end
157
+ end
158
+
159
+ class AwssnsPushChannelDataTargetArNsOnly < Knockapi::Internal::Type::BaseModel
160
+ OrHash =
161
+ T.type_alias do
162
+ T.any(
163
+ Knockapi::Recipients::InlineChannelDataRequestItem::AwssnsPushChannelDataTargetArNsOnly,
27
164
  Knockapi::Internal::AnyHash
28
165
  )
29
166
  end
@@ -49,6 +186,145 @@ module Knockapi
49
186
  end
50
187
  end
51
188
 
189
+ class AwssnsPushChannelDataDevicesOnly < Knockapi::Internal::Type::BaseModel
190
+ OrHash =
191
+ T.type_alias do
192
+ T.any(
193
+ Knockapi::Recipients::InlineChannelDataRequestItem::AwssnsPushChannelDataDevicesOnly,
194
+ Knockapi::Internal::AnyHash
195
+ )
196
+ end
197
+
198
+ # A list of devices. Each device contains a target_arn, and optionally a locale
199
+ # and timezone.
200
+ sig do
201
+ returns(
202
+ T::Array[
203
+ Knockapi::Recipients::InlineChannelDataRequestItem::AwssnsPushChannelDataDevicesOnly::Device
204
+ ]
205
+ )
206
+ end
207
+ attr_accessor :devices
208
+
209
+ # AWS SNS push channel data.
210
+ sig do
211
+ params(
212
+ devices:
213
+ T::Array[
214
+ Knockapi::Recipients::InlineChannelDataRequestItem::AwssnsPushChannelDataDevicesOnly::Device::OrHash
215
+ ]
216
+ ).returns(T.attached_class)
217
+ end
218
+ def self.new(
219
+ # A list of devices. Each device contains a target_arn, and optionally a locale
220
+ # and timezone.
221
+ devices:
222
+ )
223
+ end
224
+
225
+ sig do
226
+ override.returns(
227
+ {
228
+ devices:
229
+ T::Array[
230
+ Knockapi::Recipients::InlineChannelDataRequestItem::AwssnsPushChannelDataDevicesOnly::Device
231
+ ]
232
+ }
233
+ )
234
+ end
235
+ def to_hash
236
+ end
237
+
238
+ class Device < Knockapi::Internal::Type::BaseModel
239
+ OrHash =
240
+ T.type_alias do
241
+ T.any(
242
+ Knockapi::Recipients::InlineChannelDataRequestItem::AwssnsPushChannelDataDevicesOnly::Device,
243
+ Knockapi::Internal::AnyHash
244
+ )
245
+ end
246
+
247
+ # The ARN of a platform endpoint associated with a platform application and a
248
+ # device token. See
249
+ # [Setting up an Amazon SNS platform endpoint for mobile notifications](https://docs.aws.amazon.com/sns/latest/dg/mobile-platform-endpoint.html).
250
+ sig { returns(String) }
251
+ attr_accessor :target_arn
252
+
253
+ # The locale of the object. Used for
254
+ # [message localization](/concepts/translations).
255
+ sig { returns(T.nilable(String)) }
256
+ attr_accessor :locale
257
+
258
+ # The timezone of the object. Must be a
259
+ # valid [tz database time zone string](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
260
+ # Used
261
+ # for [recurring schedules](/concepts/schedules#scheduling-workflows-with-recurring-schedules-for-recipients).
262
+ sig { returns(T.nilable(String)) }
263
+ attr_accessor :timezone
264
+
265
+ sig do
266
+ params(
267
+ target_arn: String,
268
+ locale: T.nilable(String),
269
+ timezone: T.nilable(String)
270
+ ).returns(T.attached_class)
271
+ end
272
+ def self.new(
273
+ # The ARN of a platform endpoint associated with a platform application and a
274
+ # device token. See
275
+ # [Setting up an Amazon SNS platform endpoint for mobile notifications](https://docs.aws.amazon.com/sns/latest/dg/mobile-platform-endpoint.html).
276
+ target_arn:,
277
+ # The locale of the object. Used for
278
+ # [message localization](/concepts/translations).
279
+ locale: nil,
280
+ # The timezone of the object. Must be a
281
+ # valid [tz database time zone string](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
282
+ # Used
283
+ # for [recurring schedules](/concepts/schedules#scheduling-workflows-with-recurring-schedules-for-recipients).
284
+ timezone: nil
285
+ )
286
+ end
287
+
288
+ sig do
289
+ override.returns(
290
+ {
291
+ target_arn: String,
292
+ locale: T.nilable(String),
293
+ timezone: T.nilable(String)
294
+ }
295
+ )
296
+ end
297
+ def to_hash
298
+ end
299
+ end
300
+ end
301
+
302
+ class OneSignalChannelDataPlayerIDsOnly < Knockapi::Internal::Type::BaseModel
303
+ OrHash =
304
+ T.type_alias do
305
+ T.any(
306
+ Knockapi::Recipients::InlineChannelDataRequestItem::OneSignalChannelDataPlayerIDsOnly,
307
+ Knockapi::Internal::AnyHash
308
+ )
309
+ end
310
+
311
+ # A list of OneSignal player IDs.
312
+ sig { returns(T::Array[String]) }
313
+ attr_accessor :player_ids
314
+
315
+ # OneSignal channel data.
316
+ sig { params(player_ids: T::Array[String]).returns(T.attached_class) }
317
+ def self.new(
318
+ # A list of OneSignal player IDs.
319
+ player_ids:
320
+ )
321
+ end
322
+
323
+ sig { override.returns({ player_ids: T::Array[String] }) }
324
+ def to_hash
325
+ end
326
+ end
327
+
52
328
  sig do
53
329
  override.returns(
54
330
  T::Array[
@@ -44,6 +44,24 @@ module Knockapi
44
44
  end
45
45
  attr_writer :channel_types
46
46
 
47
+ # Channel preferences.
48
+ sig do
49
+ returns(
50
+ T.nilable(
51
+ T::Hash[
52
+ Symbol,
53
+ Knockapi::Recipients::PreferenceSet::Channel::Variants
54
+ ]
55
+ )
56
+ )
57
+ end
58
+ attr_accessor :channels
59
+
60
+ # Whether the recipient is subscribed to commercial communications. When false,
61
+ # the recipient will not receive commercial workflow notifications.
62
+ sig { returns(T.nilable(T::Boolean)) }
63
+ attr_accessor :commercial_subscribed
64
+
47
65
  # An object where the key is the workflow key and the values are the preference
48
66
  # settings for that workflow.
49
67
  sig do
@@ -77,6 +95,17 @@ module Knockapi
77
95
  T.nilable(
78
96
  Knockapi::Recipients::PreferenceSetChannelTypes::OrHash
79
97
  ),
98
+ channels:
99
+ T.nilable(
100
+ T::Hash[
101
+ Symbol,
102
+ T.any(
103
+ T::Boolean,
104
+ Knockapi::Recipients::PreferenceSet::Channel::PreferenceSetChannelSetting::OrHash
105
+ )
106
+ ]
107
+ ),
108
+ commercial_subscribed: T.nilable(T::Boolean),
80
109
  workflows:
81
110
  T.nilable(
82
111
  T::Hash[
@@ -97,6 +126,11 @@ module Knockapi
97
126
  categories: nil,
98
127
  # Channel type preferences.
99
128
  channel_types: nil,
129
+ # Channel preferences.
130
+ channels: nil,
131
+ # Whether the recipient is subscribed to commercial communications. When false,
132
+ # the recipient will not receive commercial workflow notifications.
133
+ commercial_subscribed: nil,
100
134
  # An object where the key is the workflow key and the values are the preference
101
135
  # settings for that workflow.
102
136
  workflows: nil
@@ -116,6 +150,14 @@ module Knockapi
116
150
  ),
117
151
  channel_types:
118
152
  T.nilable(Knockapi::Recipients::PreferenceSetChannelTypes),
153
+ channels:
154
+ T.nilable(
155
+ T::Hash[
156
+ Symbol,
157
+ Knockapi::Recipients::PreferenceSet::Channel::Variants
158
+ ]
159
+ ),
160
+ commercial_subscribed: T.nilable(T::Boolean),
119
161
  workflows:
120
162
  T.nilable(
121
163
  T::Hash[
@@ -168,6 +210,19 @@ module Knockapi
168
210
  end
169
211
  attr_writer :channel_types
170
212
 
213
+ # Channel preferences.
214
+ sig do
215
+ returns(
216
+ T.nilable(
217
+ T::Hash[
218
+ Symbol,
219
+ Knockapi::Recipients::PreferenceSet::Category::PreferenceSetWorkflowCategorySettingObject::Channel::Variants
220
+ ]
221
+ )
222
+ )
223
+ end
224
+ attr_accessor :channels
225
+
171
226
  # A list of conditions to apply to a channel type.
172
227
  sig { returns(T.nilable(T::Array[Knockapi::Condition])) }
173
228
  attr_accessor :conditions
@@ -180,12 +235,24 @@ module Knockapi
180
235
  T.nilable(
181
236
  Knockapi::Recipients::PreferenceSetChannelTypes::OrHash
182
237
  ),
238
+ channels:
239
+ T.nilable(
240
+ T::Hash[
241
+ Symbol,
242
+ T.any(
243
+ T::Boolean,
244
+ Knockapi::Recipients::PreferenceSet::Category::PreferenceSetWorkflowCategorySettingObject::Channel::PreferenceSetChannelSetting::OrHash
245
+ )
246
+ ]
247
+ ),
183
248
  conditions: T.nilable(T::Array[Knockapi::Condition::OrHash])
184
249
  ).returns(T.attached_class)
185
250
  end
186
251
  def self.new(
187
252
  # Channel type preferences.
188
253
  channel_types: nil,
254
+ # Channel preferences.
255
+ channels: nil,
189
256
  # A list of conditions to apply to a channel type.
190
257
  conditions: nil
191
258
  )
@@ -196,12 +263,78 @@ module Knockapi
196
263
  {
197
264
  channel_types:
198
265
  T.nilable(Knockapi::Recipients::PreferenceSetChannelTypes),
266
+ channels:
267
+ T.nilable(
268
+ T::Hash[
269
+ Symbol,
270
+ Knockapi::Recipients::PreferenceSet::Category::PreferenceSetWorkflowCategorySettingObject::Channel::Variants
271
+ ]
272
+ ),
199
273
  conditions: T.nilable(T::Array[Knockapi::Condition])
200
274
  }
201
275
  )
202
276
  end
203
277
  def to_hash
204
278
  end
279
+
280
+ # Whether the specific channel (by channel_id) is enabled for the preference set,
281
+ # or a settings object with conditions.
282
+ module Channel
283
+ extend Knockapi::Internal::Type::Union
284
+
285
+ Variants =
286
+ T.type_alias do
287
+ T.any(
288
+ T::Boolean,
289
+ Knockapi::Recipients::PreferenceSet::Category::PreferenceSetWorkflowCategorySettingObject::Channel::PreferenceSetChannelSetting
290
+ )
291
+ end
292
+
293
+ class PreferenceSetChannelSetting < Knockapi::Internal::Type::BaseModel
294
+ OrHash =
295
+ T.type_alias do
296
+ T.any(
297
+ Knockapi::Recipients::PreferenceSet::Category::PreferenceSetWorkflowCategorySettingObject::Channel::PreferenceSetChannelSetting,
298
+ Knockapi::Internal::AnyHash
299
+ )
300
+ end
301
+
302
+ # A list of conditions to apply to a specific channel.
303
+ sig { returns(T::Array[Knockapi::Condition]) }
304
+ attr_accessor :conditions
305
+
306
+ # A set of settings for a specific channel. Currently, this can only be a list of
307
+ # conditions to apply.
308
+ sig do
309
+ params(
310
+ conditions: T::Array[Knockapi::Condition::OrHash]
311
+ ).returns(T.attached_class)
312
+ end
313
+ def self.new(
314
+ # A list of conditions to apply to a specific channel.
315
+ conditions:
316
+ )
317
+ end
318
+
319
+ sig do
320
+ override.returns(
321
+ { conditions: T::Array[Knockapi::Condition] }
322
+ )
323
+ end
324
+ def to_hash
325
+ end
326
+ end
327
+
328
+ sig do
329
+ override.returns(
330
+ T::Array[
331
+ Knockapi::Recipients::PreferenceSet::Category::PreferenceSetWorkflowCategorySettingObject::Channel::Variants
332
+ ]
333
+ )
334
+ end
335
+ def self.variants
336
+ end
337
+ end
205
338
  end
206
339
 
207
340
  sig do
@@ -213,6 +346,61 @@ module Knockapi
213
346
  end
214
347
  end
215
348
 
349
+ # Whether the specific channel (by channel_id) is enabled for the preference set,
350
+ # or a settings object with conditions.
351
+ module Channel
352
+ extend Knockapi::Internal::Type::Union
353
+
354
+ Variants =
355
+ T.type_alias do
356
+ T.any(
357
+ T::Boolean,
358
+ Knockapi::Recipients::PreferenceSet::Channel::PreferenceSetChannelSetting
359
+ )
360
+ end
361
+
362
+ class PreferenceSetChannelSetting < Knockapi::Internal::Type::BaseModel
363
+ OrHash =
364
+ T.type_alias do
365
+ T.any(
366
+ Knockapi::Recipients::PreferenceSet::Channel::PreferenceSetChannelSetting,
367
+ Knockapi::Internal::AnyHash
368
+ )
369
+ end
370
+
371
+ # A list of conditions to apply to a specific channel.
372
+ sig { returns(T::Array[Knockapi::Condition]) }
373
+ attr_accessor :conditions
374
+
375
+ # A set of settings for a specific channel. Currently, this can only be a list of
376
+ # conditions to apply.
377
+ sig do
378
+ params(conditions: T::Array[Knockapi::Condition::OrHash]).returns(
379
+ T.attached_class
380
+ )
381
+ end
382
+ def self.new(
383
+ # A list of conditions to apply to a specific channel.
384
+ conditions:
385
+ )
386
+ end
387
+
388
+ sig do
389
+ override.returns({ conditions: T::Array[Knockapi::Condition] })
390
+ end
391
+ def to_hash
392
+ end
393
+ end
394
+
395
+ sig do
396
+ override.returns(
397
+ T::Array[Knockapi::Recipients::PreferenceSet::Channel::Variants]
398
+ )
399
+ end
400
+ def self.variants
401
+ end
402
+ end
403
+
216
404
  # Workflow or category preferences within a preference set
217
405
  module Workflow
218
406
  extend Knockapi::Internal::Type::Union
@@ -252,6 +440,19 @@ module Knockapi
252
440
  end
253
441
  attr_writer :channel_types
254
442
 
443
+ # Channel preferences.
444
+ sig do
445
+ returns(
446
+ T.nilable(
447
+ T::Hash[
448
+ Symbol,
449
+ Knockapi::Recipients::PreferenceSet::Workflow::PreferenceSetWorkflowCategorySettingObject::Channel::Variants
450
+ ]
451
+ )
452
+ )
453
+ end
454
+ attr_accessor :channels
455
+
255
456
  # A list of conditions to apply to a channel type.
256
457
  sig { returns(T.nilable(T::Array[Knockapi::Condition])) }
257
458
  attr_accessor :conditions
@@ -264,12 +465,24 @@ module Knockapi
264
465
  T.nilable(
265
466
  Knockapi::Recipients::PreferenceSetChannelTypes::OrHash
266
467
  ),
468
+ channels:
469
+ T.nilable(
470
+ T::Hash[
471
+ Symbol,
472
+ T.any(
473
+ T::Boolean,
474
+ Knockapi::Recipients::PreferenceSet::Workflow::PreferenceSetWorkflowCategorySettingObject::Channel::PreferenceSetChannelSetting::OrHash
475
+ )
476
+ ]
477
+ ),
267
478
  conditions: T.nilable(T::Array[Knockapi::Condition::OrHash])
268
479
  ).returns(T.attached_class)
269
480
  end
270
481
  def self.new(
271
482
  # Channel type preferences.
272
483
  channel_types: nil,
484
+ # Channel preferences.
485
+ channels: nil,
273
486
  # A list of conditions to apply to a channel type.
274
487
  conditions: nil
275
488
  )
@@ -280,12 +493,78 @@ module Knockapi
280
493
  {
281
494
  channel_types:
282
495
  T.nilable(Knockapi::Recipients::PreferenceSetChannelTypes),
496
+ channels:
497
+ T.nilable(
498
+ T::Hash[
499
+ Symbol,
500
+ Knockapi::Recipients::PreferenceSet::Workflow::PreferenceSetWorkflowCategorySettingObject::Channel::Variants
501
+ ]
502
+ ),
283
503
  conditions: T.nilable(T::Array[Knockapi::Condition])
284
504
  }
285
505
  )
286
506
  end
287
507
  def to_hash
288
508
  end
509
+
510
+ # Whether the specific channel (by channel_id) is enabled for the preference set,
511
+ # or a settings object with conditions.
512
+ module Channel
513
+ extend Knockapi::Internal::Type::Union
514
+
515
+ Variants =
516
+ T.type_alias do
517
+ T.any(
518
+ T::Boolean,
519
+ Knockapi::Recipients::PreferenceSet::Workflow::PreferenceSetWorkflowCategorySettingObject::Channel::PreferenceSetChannelSetting
520
+ )
521
+ end
522
+
523
+ class PreferenceSetChannelSetting < Knockapi::Internal::Type::BaseModel
524
+ OrHash =
525
+ T.type_alias do
526
+ T.any(
527
+ Knockapi::Recipients::PreferenceSet::Workflow::PreferenceSetWorkflowCategorySettingObject::Channel::PreferenceSetChannelSetting,
528
+ Knockapi::Internal::AnyHash
529
+ )
530
+ end
531
+
532
+ # A list of conditions to apply to a specific channel.
533
+ sig { returns(T::Array[Knockapi::Condition]) }
534
+ attr_accessor :conditions
535
+
536
+ # A set of settings for a specific channel. Currently, this can only be a list of
537
+ # conditions to apply.
538
+ sig do
539
+ params(
540
+ conditions: T::Array[Knockapi::Condition::OrHash]
541
+ ).returns(T.attached_class)
542
+ end
543
+ def self.new(
544
+ # A list of conditions to apply to a specific channel.
545
+ conditions:
546
+ )
547
+ end
548
+
549
+ sig do
550
+ override.returns(
551
+ { conditions: T::Array[Knockapi::Condition] }
552
+ )
553
+ end
554
+ def to_hash
555
+ end
556
+ end
557
+
558
+ sig do
559
+ override.returns(
560
+ T::Array[
561
+ Knockapi::Recipients::PreferenceSet::Workflow::PreferenceSetWorkflowCategorySettingObject::Channel::Variants
562
+ ]
563
+ )
564
+ end
565
+ def self.variants
566
+ end
567
+ end
289
568
  end
290
569
 
291
570
  sig do