knockapi 1.10.3 → 1.11.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 247db1a9c4387aa27502f288b58a3db837203123f8986c2a39cd11c53da8b62d
4
- data.tar.gz: 797f6bc3a516d4ad8be7dfdfc040a5805e61b251b85ed0fb7426e77593ce3859
3
+ metadata.gz: fb73648101e7d2bd451a7d998eb5ded40adcd662a9ca06e29ec4f2f1b4c479dc
4
+ data.tar.gz: 47715ed958cb260beff0d347ea7e8783a05181e1d34c4394656ba6ac50c3d33a
5
5
  SHA512:
6
- metadata.gz: 514637c1db0be816f3e9913bc3a9cc138eebee03aedba7628ffdc290c5ab4b241a4cc1ebf0ac856c875a5382f313c0e3b2d1f6d5dd9352b957384d195d4749a4
7
- data.tar.gz: 3e0acf187a631fa5a55f3e4401f54d204ac51f6d97a2f9ec7d6ed3d5e3082bf737f48724b5a3285437ecbf6cb829cf6f1a32cdbb746338976c9a6da8730b766b
6
+ metadata.gz: 94968e7c435833897b9d5c574f1f2f81556c937661eeaf1f6854802379fddc9bf4e4f70ebb3096fdc84656361b29e70540956ae6c30d355fdd533102c777f559
7
+ data.tar.gz: 708aaf055317502fea383da4f0e3350ac35bd08eb07734beffabf71439d46666c67b334eaa5d83afc75f79c83bae241aa949b8d8e8f086257406828f4e352cfa
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.11.0 (2025-08-15)
4
+
5
+ Full Changelog: [v1.10.3...v1.11.0](https://github.com/knocklabs/knock-ruby/compare/v1.10.3...v1.11.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** api update ([d0ce3fe](https://github.com/knocklabs/knock-ruby/commit/d0ce3fe4004f9f5b663d88f6eea02c1def7a26fa))
10
+
3
11
  ## 1.10.3 (2025-08-12)
4
12
 
5
13
  Full Changelog: [v1.10.2...v1.10.3](https://github.com/knocklabs/knock-ruby/compare/v1.10.2...v1.10.3)
data/README.md CHANGED
@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
17
17
  <!-- x-release-please-start-version -->
18
18
 
19
19
  ```ruby
20
- gem "knockapi", "~> 1.10.3"
20
+ gem "knockapi", "~> 1.11.0"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -225,25 +225,25 @@ knock.workflows.trigger("dinosaurs-loose", **params)
225
225
  Since this library does not depend on `sorbet-runtime`, it cannot provide [`T::Enum`](https://sorbet.org/docs/tenum) instances. Instead, we provide "tagged symbols" instead, which is always a primitive at runtime:
226
226
 
227
227
  ```ruby
228
- # :exclude
229
- puts(Knockapi::Users::FeedListItemsParams::Archived::EXCLUDE)
228
+ # :merge
229
+ puts(Knockapi::Recipients::PreferenceSetRequest::PersistenceStrategy::MERGE)
230
230
 
231
- # Revealed type: `T.all(Knockapi::Users::FeedListItemsParams::Archived, Symbol)`
232
- T.reveal_type(Knockapi::Users::FeedListItemsParams::Archived::EXCLUDE)
231
+ # Revealed type: `T.all(Knockapi::Recipients::PreferenceSetRequest::PersistenceStrategy, Symbol)`
232
+ T.reveal_type(Knockapi::Recipients::PreferenceSetRequest::PersistenceStrategy::MERGE)
233
233
  ```
234
234
 
235
235
  Enum parameters have a "relaxed" type, so you can either pass in enum constants or their literal value:
236
236
 
237
237
  ```ruby
238
238
  # Using the enum constants preserves the tagged type information:
239
- knock.users.feeds.list_items(
240
- archived: Knockapi::Users::FeedListItemsParams::Archived::EXCLUDE,
239
+ knock.users.set_preferences(
240
+ _persistence_strategy: Knockapi::Recipients::PreferenceSetRequest::PersistenceStrategy::MERGE,
241
241
  # …
242
242
  )
243
243
 
244
244
  # Literal values are also permissible:
245
- knock.users.feeds.list_items(
246
- archived: :exclude,
245
+ knock.users.set_preferences(
246
+ _persistence_strategy: :merge,
247
247
  # …
248
248
  )
249
249
  ```
@@ -4,6 +4,15 @@ module Knockapi
4
4
  module Models
5
5
  module Recipients
6
6
  class PreferenceSetRequest < Knockapi::Internal::Type::BaseModel
7
+ # @!attribute _persistence_strategy
8
+ # Controls how the preference set is persisted. 'replace' will completely replace
9
+ # the preference set, 'merge' will merge with existing preferences.
10
+ #
11
+ # @return [Symbol, Knockapi::Models::Recipients::PreferenceSetRequest::PersistenceStrategy, nil]
12
+ optional :_persistence_strategy,
13
+ enum: -> { Knockapi::Recipients::PreferenceSetRequest::PersistenceStrategy },
14
+ api_name: :__persistence_strategy__
15
+
7
16
  # @!attribute categories
8
17
  # An object where the key is the category and the values are the preference
9
18
  # settings for that category.
@@ -32,18 +41,34 @@ module Knockapi
32
41
  },
33
42
  nil?: true
34
43
 
35
- # @!method initialize(categories: nil, channel_types: nil, workflows: nil)
44
+ # @!method initialize(_persistence_strategy: nil, categories: nil, channel_types: nil, workflows: nil)
36
45
  # Some parameter documentations has been truncated, see
37
46
  # {Knockapi::Models::Recipients::PreferenceSetRequest} for more details.
38
47
  #
39
48
  # A request to set a preference set for a recipient.
40
49
  #
50
+ # @param _persistence_strategy [Symbol, Knockapi::Models::Recipients::PreferenceSetRequest::PersistenceStrategy] Controls how the preference set is persisted. 'replace' will completely replace
51
+ #
41
52
  # @param categories [Hash{Symbol=>Boolean, Knockapi::Models::Recipients::PreferenceSetRequest::Category::PreferenceSetWorkflowCategorySettingObject}, nil] An object where the key is the category and the values are the preference settin
42
53
  #
43
54
  # @param channel_types [Knockapi::Models::Recipients::PreferenceSetChannelTypes, nil] Channel type preferences.
44
55
  #
45
56
  # @param workflows [Hash{Symbol=>Boolean, Knockapi::Models::Recipients::PreferenceSetRequest::Workflow::PreferenceSetWorkflowCategorySettingObject}, nil] An object where the key is the workflow key and the values are the preference se
46
57
 
58
+ # Controls how the preference set is persisted. 'replace' will completely replace
59
+ # the preference set, 'merge' will merge with existing preferences.
60
+ #
61
+ # @see Knockapi::Models::Recipients::PreferenceSetRequest#_persistence_strategy
62
+ module PersistenceStrategy
63
+ extend Knockapi::Internal::Type::Enum
64
+
65
+ MERGE = :merge
66
+ REPLACE = :replace
67
+
68
+ # @!method self.values
69
+ # @return [Array<Symbol>]
70
+ end
71
+
47
72
  # Workflow or category preferences within a preference set
48
73
  module Category
49
74
  extend Knockapi::Internal::Type::Union
@@ -425,14 +425,16 @@ module Knockapi
425
425
  # Some parameter documentations has been truncated, see
426
426
  # {Knockapi::Models::ObjectSetPreferencesParams} for more details.
427
427
  #
428
- # Sets preferences within the given preference set. This is a destructive
429
- # operation and will replace any existing preferences with the preferences given.
430
- # If no object exists in the current environment for the given `:collection` and
431
- # `:object_id`, Knock will create the object as part of this request. The
432
- # preference set `:id` can be either `default` or a `tenant.id`. Learn more about
428
+ # Sets preferences within the given preference set. By default, this is a
429
+ # destructive operation and will replace any existing preferences with the
430
+ # preferences given. Use '\_\_persistence_strategy': 'merge' to merge with
431
+ # existing preferences instead. If no object exists in the current environment for
432
+ # the given `:collection` and `:object_id`, Knock will create the object as part
433
+ # of this request. The preference set `:id` can be either `default` or a
434
+ # `tenant.id`. Learn more about
433
435
  # [per-tenant preferences](/preferences/tenant-preferences).
434
436
  #
435
- # @overload set_preferences(collection, object_id_, id, categories: nil, channel_types: nil, workflows: nil, request_options: {})
437
+ # @overload set_preferences(collection, object_id_, id, _persistence_strategy: nil, categories: nil, channel_types: nil, workflows: nil, request_options: {})
436
438
  #
437
439
  # @param collection [String] The collection this object belongs to.
438
440
  #
@@ -440,6 +442,8 @@ module Knockapi
440
442
  #
441
443
  # @param id [String] Unique identifier for the preference set.
442
444
  #
445
+ # @param _persistence_strategy [Symbol, Knockapi::Models::Recipients::PreferenceSetRequest::PersistenceStrategy] Controls how the preference set is persisted. 'replace' will completely replace
446
+ #
443
447
  # @param categories [Hash{Symbol=>Boolean, Knockapi::Models::Recipients::PreferenceSetRequest::Category::PreferenceSetWorkflowCategorySettingObject}, nil] An object where the key is the category and the values are the preference settin
444
448
  #
445
449
  # @param channel_types [Knockapi::Models::Recipients::PreferenceSetChannelTypes, nil] Channel type preferences.
@@ -375,15 +375,19 @@ module Knockapi
375
375
  # Some parameter documentations has been truncated, see
376
376
  # {Knockapi::Models::UserSetPreferencesParams} for more details.
377
377
  #
378
- # Updates a complete preference set for a user. This is a destructive operation
379
- # that will replace the existing preference set for the user.
378
+ # Updates a complete preference set for a user. By default, this is a destructive
379
+ # operation and will replace any existing preferences with the preferences given.
380
+ # Use '**persistence_strategy**': 'merge' to merge with existing preferences
381
+ # instead.
380
382
  #
381
- # @overload set_preferences(user_id, id, categories: nil, channel_types: nil, workflows: nil, request_options: {})
383
+ # @overload set_preferences(user_id, id, _persistence_strategy: nil, categories: nil, channel_types: nil, workflows: nil, request_options: {})
382
384
  #
383
385
  # @param user_id [String] The unique identifier of the user.
384
386
  #
385
387
  # @param id [String] Unique identifier for the preference set.
386
388
  #
389
+ # @param _persistence_strategy [Symbol, Knockapi::Models::Recipients::PreferenceSetRequest::PersistenceStrategy] Controls how the preference set is persisted. 'replace' will completely replace
390
+ #
387
391
  # @param categories [Hash{Symbol=>Boolean, Knockapi::Models::Recipients::PreferenceSetRequest::Category::PreferenceSetWorkflowCategorySettingObject}, nil] An object where the key is the category and the values are the preference settin
388
392
  #
389
393
  # @param channel_types [Knockapi::Models::Recipients::PreferenceSetChannelTypes, nil] Channel type preferences.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Knockapi
4
- VERSION = "1.10.3"
4
+ VERSION = "1.11.0"
5
5
  end
@@ -12,6 +12,25 @@ module Knockapi
12
12
  )
13
13
  end
14
14
 
15
+ # Controls how the preference set is persisted. 'replace' will completely replace
16
+ # the preference set, 'merge' will merge with existing preferences.
17
+ sig do
18
+ returns(
19
+ T.nilable(
20
+ Knockapi::Recipients::PreferenceSetRequest::PersistenceStrategy::OrSymbol
21
+ )
22
+ )
23
+ end
24
+ attr_reader :_persistence_strategy
25
+
26
+ sig do
27
+ params(
28
+ _persistence_strategy:
29
+ Knockapi::Recipients::PreferenceSetRequest::PersistenceStrategy::OrSymbol
30
+ ).void
31
+ end
32
+ attr_writer :_persistence_strategy
33
+
15
34
  # An object where the key is the category and the values are the preference
16
35
  # settings for that category.
17
36
  sig do
@@ -63,6 +82,8 @@ module Knockapi
63
82
  # A request to set a preference set for a recipient.
64
83
  sig do
65
84
  params(
85
+ _persistence_strategy:
86
+ Knockapi::Recipients::PreferenceSetRequest::PersistenceStrategy::OrSymbol,
66
87
  categories:
67
88
  T.nilable(
68
89
  T::Hash[
@@ -90,6 +111,9 @@ module Knockapi
90
111
  ).returns(T.attached_class)
91
112
  end
92
113
  def self.new(
114
+ # Controls how the preference set is persisted. 'replace' will completely replace
115
+ # the preference set, 'merge' will merge with existing preferences.
116
+ _persistence_strategy: nil,
93
117
  # An object where the key is the category and the values are the preference
94
118
  # settings for that category.
95
119
  categories: nil,
@@ -104,6 +128,8 @@ module Knockapi
104
128
  sig do
105
129
  override.returns(
106
130
  {
131
+ _persistence_strategy:
132
+ Knockapi::Recipients::PreferenceSetRequest::PersistenceStrategy::OrSymbol,
107
133
  categories:
108
134
  T.nilable(
109
135
  T::Hash[
@@ -132,6 +158,42 @@ module Knockapi
132
158
  def to_hash
133
159
  end
134
160
 
161
+ # Controls how the preference set is persisted. 'replace' will completely replace
162
+ # the preference set, 'merge' will merge with existing preferences.
163
+ module PersistenceStrategy
164
+ extend Knockapi::Internal::Type::Enum
165
+
166
+ TaggedSymbol =
167
+ T.type_alias do
168
+ T.all(
169
+ Symbol,
170
+ Knockapi::Recipients::PreferenceSetRequest::PersistenceStrategy
171
+ )
172
+ end
173
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
174
+
175
+ MERGE =
176
+ T.let(
177
+ :merge,
178
+ Knockapi::Recipients::PreferenceSetRequest::PersistenceStrategy::TaggedSymbol
179
+ )
180
+ REPLACE =
181
+ T.let(
182
+ :replace,
183
+ Knockapi::Recipients::PreferenceSetRequest::PersistenceStrategy::TaggedSymbol
184
+ )
185
+
186
+ sig do
187
+ override.returns(
188
+ T::Array[
189
+ Knockapi::Recipients::PreferenceSetRequest::PersistenceStrategy::TaggedSymbol
190
+ ]
191
+ )
192
+ end
193
+ def self.values
194
+ end
195
+ end
196
+
135
197
  # Workflow or category preferences within a preference set
136
198
  module Category
137
199
  extend Knockapi::Internal::Type::Union
@@ -422,17 +422,21 @@ module Knockapi
422
422
  )
423
423
  end
424
424
 
425
- # Sets preferences within the given preference set. This is a destructive
426
- # operation and will replace any existing preferences with the preferences given.
427
- # If no object exists in the current environment for the given `:collection` and
428
- # `:object_id`, Knock will create the object as part of this request. The
429
- # preference set `:id` can be either `default` or a `tenant.id`. Learn more about
425
+ # Sets preferences within the given preference set. By default, this is a
426
+ # destructive operation and will replace any existing preferences with the
427
+ # preferences given. Use '\_\_persistence_strategy': 'merge' to merge with
428
+ # existing preferences instead. If no object exists in the current environment for
429
+ # the given `:collection` and `:object_id`, Knock will create the object as part
430
+ # of this request. The preference set `:id` can be either `default` or a
431
+ # `tenant.id`. Learn more about
430
432
  # [per-tenant preferences](/preferences/tenant-preferences).
431
433
  sig do
432
434
  params(
433
435
  collection: String,
434
436
  object_id_: String,
435
437
  id: String,
438
+ _persistence_strategy:
439
+ Knockapi::Recipients::PreferenceSetRequest::PersistenceStrategy::OrSymbol,
436
440
  categories:
437
441
  T.nilable(
438
442
  T::Hash[
@@ -465,6 +469,9 @@ module Knockapi
465
469
  object_id_,
466
470
  # Unique identifier for the preference set.
467
471
  id,
472
+ # Controls how the preference set is persisted. 'replace' will completely replace
473
+ # the preference set, 'merge' will merge with existing preferences.
474
+ _persistence_strategy: nil,
468
475
  # An object where the key is the category and the values are the preference
469
476
  # settings for that category.
470
477
  categories: nil,
@@ -362,12 +362,16 @@ module Knockapi
362
362
  )
363
363
  end
364
364
 
365
- # Updates a complete preference set for a user. This is a destructive operation
366
- # that will replace the existing preference set for the user.
365
+ # Updates a complete preference set for a user. By default, this is a destructive
366
+ # operation and will replace any existing preferences with the preferences given.
367
+ # Use '**persistence_strategy**': 'merge' to merge with existing preferences
368
+ # instead.
367
369
  sig do
368
370
  params(
369
371
  user_id: String,
370
372
  id: String,
373
+ _persistence_strategy:
374
+ Knockapi::Recipients::PreferenceSetRequest::PersistenceStrategy::OrSymbol,
371
375
  categories:
372
376
  T.nilable(
373
377
  T::Hash[
@@ -398,6 +402,9 @@ module Knockapi
398
402
  user_id,
399
403
  # Unique identifier for the preference set.
400
404
  id,
405
+ # Controls how the preference set is persisted. 'replace' will completely replace
406
+ # the preference set, 'merge' will merge with existing preferences.
407
+ _persistence_strategy: nil,
401
408
  # An object where the key is the category and the values are the preference
402
409
  # settings for that category.
403
410
  categories: nil,
@@ -3,12 +3,19 @@ module Knockapi
3
3
  module Recipients
4
4
  type preference_set_request =
5
5
  {
6
+ _persistence_strategy: Knockapi::Models::Recipients::PreferenceSetRequest::persistence_strategy,
6
7
  categories: ::Hash[Symbol, Knockapi::Models::Recipients::PreferenceSetRequest::category]?,
7
8
  channel_types: Knockapi::Recipients::PreferenceSetChannelTypes?,
8
9
  workflows: ::Hash[Symbol, Knockapi::Models::Recipients::PreferenceSetRequest::workflow]?
9
10
  }
10
11
 
11
12
  class PreferenceSetRequest < Knockapi::Internal::Type::BaseModel
13
+ attr_reader _persistence_strategy: Knockapi::Models::Recipients::PreferenceSetRequest::persistence_strategy?
14
+
15
+ def _persistence_strategy=: (
16
+ Knockapi::Models::Recipients::PreferenceSetRequest::persistence_strategy
17
+ ) -> Knockapi::Models::Recipients::PreferenceSetRequest::persistence_strategy
18
+
12
19
  attr_accessor categories: ::Hash[Symbol, Knockapi::Models::Recipients::PreferenceSetRequest::category]?
13
20
 
14
21
  attr_accessor channel_types: Knockapi::Recipients::PreferenceSetChannelTypes?
@@ -16,17 +23,30 @@ module Knockapi
16
23
  attr_accessor workflows: ::Hash[Symbol, Knockapi::Models::Recipients::PreferenceSetRequest::workflow]?
17
24
 
18
25
  def initialize: (
26
+ ?_persistence_strategy: Knockapi::Models::Recipients::PreferenceSetRequest::persistence_strategy,
19
27
  ?categories: ::Hash[Symbol, Knockapi::Models::Recipients::PreferenceSetRequest::category]?,
20
28
  ?channel_types: Knockapi::Recipients::PreferenceSetChannelTypes?,
21
29
  ?workflows: ::Hash[Symbol, Knockapi::Models::Recipients::PreferenceSetRequest::workflow]?
22
30
  ) -> void
23
31
 
24
32
  def to_hash: -> {
33
+ _persistence_strategy: Knockapi::Models::Recipients::PreferenceSetRequest::persistence_strategy,
25
34
  categories: ::Hash[Symbol, Knockapi::Models::Recipients::PreferenceSetRequest::category]?,
26
35
  channel_types: Knockapi::Recipients::PreferenceSetChannelTypes?,
27
36
  workflows: ::Hash[Symbol, Knockapi::Models::Recipients::PreferenceSetRequest::workflow]?
28
37
  }
29
38
 
39
+ type persistence_strategy = :merge | :replace
40
+
41
+ module PersistenceStrategy
42
+ extend Knockapi::Internal::Type::Enum
43
+
44
+ MERGE: :merge
45
+ REPLACE: :replace
46
+
47
+ def self?.values: -> ::Array[Knockapi::Models::Recipients::PreferenceSetRequest::persistence_strategy]
48
+ end
49
+
30
50
  type category =
31
51
  bool
32
52
  | Knockapi::Recipients::PreferenceSetRequest::Category::PreferenceSetWorkflowCategorySettingObject
@@ -125,6 +125,7 @@ module Knockapi
125
125
  String collection,
126
126
  String object_id_,
127
127
  String id,
128
+ ?_persistence_strategy: Knockapi::Models::Recipients::PreferenceSetRequest::persistence_strategy,
128
129
  ?categories: ::Hash[Symbol, Knockapi::Models::Recipients::PreferenceSetRequest::category]?,
129
130
  ?channel_types: Knockapi::Recipients::PreferenceSetChannelTypes?,
130
131
  ?workflows: ::Hash[Symbol, Knockapi::Models::Recipients::PreferenceSetRequest::workflow]?,
@@ -112,6 +112,7 @@ module Knockapi
112
112
  def set_preferences: (
113
113
  String user_id,
114
114
  String id,
115
+ ?_persistence_strategy: Knockapi::Models::Recipients::PreferenceSetRequest::persistence_strategy,
115
116
  ?categories: ::Hash[Symbol, Knockapi::Models::Recipients::PreferenceSetRequest::category]?,
116
117
  ?channel_types: Knockapi::Recipients::PreferenceSetChannelTypes?,
117
118
  ?workflows: ::Hash[Symbol, Knockapi::Models::Recipients::PreferenceSetRequest::workflow]?,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knockapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.3
4
+ version: 1.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Knock
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-08-13 00:00:00.000000000 Z
11
+ date: 2025-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool