knockapi 1.10.3 → 1.11.1

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 (29) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/README.md +9 -9
  4. data/lib/knockapi/internal/transport/pooled_net_requester.rb +1 -9
  5. data/lib/knockapi/internal/type/base_model.rb +1 -8
  6. data/lib/knockapi/internal/util.rb +1 -1
  7. data/lib/knockapi/models/audience_remove_members_params.rb +1 -4
  8. data/lib/knockapi/models/channels/bulk_update_message_status_params.rb +1 -4
  9. data/lib/knockapi/models/object_list_messages_params.rb +1 -3
  10. data/lib/knockapi/models/object_list_subscriptions_params.rb +1 -3
  11. data/lib/knockapi/models/object_set_params.rb +2 -7
  12. data/lib/knockapi/models/objects/bulk_add_subscriptions_params.rb +1 -3
  13. data/lib/knockapi/models/recipients/discord_channel_data.rb +3 -9
  14. data/lib/knockapi/models/recipients/ms_teams_channel_data.rb +3 -9
  15. data/lib/knockapi/models/recipients/preference_set.rb +2 -6
  16. data/lib/knockapi/models/recipients/preference_set_request.rb +28 -7
  17. data/lib/knockapi/models/recipients/slack_channel_data.rb +1 -3
  18. data/lib/knockapi/models/user_list_messages_params.rb +2 -7
  19. data/lib/knockapi/resources/objects.rb +10 -6
  20. data/lib/knockapi/resources/users.rb +7 -3
  21. data/lib/knockapi/version.rb +1 -1
  22. data/rbi/knockapi/errors.rbi +2 -2
  23. data/rbi/knockapi/models/recipients/preference_set_request.rbi +62 -0
  24. data/rbi/knockapi/resources/objects.rbi +12 -5
  25. data/rbi/knockapi/resources/users.rbi +9 -2
  26. data/sig/knockapi/models/recipients/preference_set_request.rbs +20 -0
  27. data/sig/knockapi/resources/objects.rbs +1 -0
  28. data/sig/knockapi/resources/users.rbs +1 -0
  29. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 247db1a9c4387aa27502f288b58a3db837203123f8986c2a39cd11c53da8b62d
4
- data.tar.gz: 797f6bc3a516d4ad8be7dfdfc040a5805e61b251b85ed0fb7426e77593ce3859
3
+ metadata.gz: d12a329bbc605a270487388dd768fdaf32d6ea55a9beaecb84be75032db59e4a
4
+ data.tar.gz: 7c2208d2f1b89d5416d5a4e02e6c5257dfcde6ed07228d59cffb5bb054d1b9b0
5
5
  SHA512:
6
- metadata.gz: 514637c1db0be816f3e9913bc3a9cc138eebee03aedba7628ffdc290c5ab4b241a4cc1ebf0ac856c875a5382f313c0e3b2d1f6d5dd9352b957384d195d4749a4
7
- data.tar.gz: 3e0acf187a631fa5a55f3e4401f54d204ac51f6d97a2f9ec7d6ed3d5e3082bf737f48724b5a3285437ecbf6cb829cf6f1a32cdbb746338976c9a6da8730b766b
6
+ metadata.gz: 1a72efe89eace5b0d29ce990709293ce186536c8c530f6ec8545a51c4f2f449d6b17d32b2711b619f752191efd8246d1f1f006a3ae7e539948581928e8e68924
7
+ data.tar.gz: 0e538e699dd375eff82b2ee5e8addf6e05496fca38f54266f28ef6fed6054a656f8ca2fe0ff763f0031d6c56dc69d5e6a12226eef1a8902dea0c8b7f20cf538c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.11.1 (2025-08-19)
4
+
5
+ Full Changelog: [v1.11.0...v1.11.1](https://github.com/knocklabs/knock-ruby/compare/v1.11.0...v1.11.1)
6
+
7
+ ### Bug Fixes
8
+
9
+ * bump sorbet version and fix new type errors from the breaking change ([0194974](https://github.com/knocklabs/knock-ruby/commit/0194974b049c8c69ce3749f1bc8086b724a39272))
10
+
11
+ ## 1.11.0 (2025-08-15)
12
+
13
+ Full Changelog: [v1.10.3...v1.11.0](https://github.com/knocklabs/knock-ruby/compare/v1.10.3...v1.11.0)
14
+
15
+ ### Features
16
+
17
+ * **api:** api update ([d0ce3fe](https://github.com/knocklabs/knock-ruby/commit/d0ce3fe4004f9f5b663d88f6eea02c1def7a26fa))
18
+
3
19
  ## 1.10.3 (2025-08-12)
4
20
 
5
21
  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.1"
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
  ```
@@ -193,15 +193,7 @@ module Knockapi
193
193
  end
194
194
 
195
195
  define_sorbet_constant!(:Request) do
196
- T.type_alias do
197
- {
198
- method: Symbol,
199
- url: URI::Generic,
200
- headers: T::Hash[String, String],
201
- body: T.anything,
202
- deadline: Float
203
- }
204
- end
196
+ T.type_alias { {method: Symbol, url: URI::Generic, headers: T::Hash[String, String], body: T.anything, deadline: Float} }
205
197
  end
206
198
  end
207
199
  end
@@ -64,14 +64,7 @@ module Knockapi
64
64
  setter = :"#{name_sym}="
65
65
  api_name = info.fetch(:api_name, name_sym)
66
66
  nilable = info.fetch(:nil?, false)
67
- const = if required && !nilable
68
- info.fetch(
69
- :const,
70
- Knockapi::Internal::OMIT
71
- )
72
- else
73
- Knockapi::Internal::OMIT
74
- end
67
+ const = required && !nilable ? info.fetch(:const, Knockapi::Internal::OMIT) : Knockapi::Internal::OMIT
75
68
 
76
69
  [name_sym, setter].each { undef_method(_1) } if known_fields.key?(name_sym)
77
70
 
@@ -244,7 +244,7 @@ module Knockapi
244
244
  #
245
245
  # @return [String]
246
246
  def uri_origin(uri)
247
- "#{uri.scheme}://#{uri.host}#{uri.port == uri.default_port ? '' : ":#{uri.port}"}"
247
+ "#{uri.scheme}://#{uri.host}#{":#{uri.port}" unless uri.port == uri.default_port}"
248
248
  end
249
249
 
250
250
  # @api private
@@ -11,10 +11,7 @@ module Knockapi
11
11
  # A list of audience members to remove.
12
12
  #
13
13
  # @return [Array<Knockapi::Models::AudienceRemoveMembersParams::Member>]
14
- required :members,
15
- -> {
16
- Knockapi::Internal::Type::ArrayOf[Knockapi::AudienceRemoveMembersParams::Member]
17
- }
14
+ required :members, -> { Knockapi::Internal::Type::ArrayOf[Knockapi::AudienceRemoveMembersParams::Member] }
18
15
 
19
16
  # @!method initialize(members:, request_options: {})
20
17
  # @param members [Array<Knockapi::Models::AudienceRemoveMembersParams::Member>] A list of audience members to remove.
@@ -18,10 +18,7 @@ module Knockapi
18
18
  # Limits the results to messages with the given delivery status.
19
19
  #
20
20
  # @return [Symbol, Knockapi::Models::Channels::BulkUpdateMessageStatusParams::DeliveryStatus, nil]
21
- optional :delivery_status,
22
- enum: -> {
23
- Knockapi::Channels::BulkUpdateMessageStatusParams::DeliveryStatus
24
- }
21
+ optional :delivery_status, enum: -> { Knockapi::Channels::BulkUpdateMessageStatusParams::DeliveryStatus }
25
22
 
26
23
  # @!attribute engagement_status
27
24
  # Limits the results to messages with the given engagement status.
@@ -30,9 +30,7 @@ module Knockapi
30
30
  #
31
31
  # @return [Array<Symbol, Knockapi::Models::ObjectListMessagesParams::EngagementStatus>, nil]
32
32
  optional :engagement_status,
33
- -> {
34
- Knockapi::Internal::Type::ArrayOf[enum: Knockapi::ObjectListMessagesParams::EngagementStatus]
35
- }
33
+ -> { Knockapi::Internal::Type::ArrayOf[enum: Knockapi::ObjectListMessagesParams::EngagementStatus] }
36
34
 
37
35
  # @!attribute inserted_at
38
36
  #
@@ -24,9 +24,7 @@ module Knockapi
24
24
  #
25
25
  # @return [Array<Symbol, Knockapi::Models::ObjectListSubscriptionsParams::Include>, nil]
26
26
  optional :include,
27
- -> {
28
- Knockapi::Internal::Type::ArrayOf[enum: Knockapi::ObjectListSubscriptionsParams::Include]
29
- }
27
+ -> { Knockapi::Internal::Type::ArrayOf[enum: Knockapi::ObjectListSubscriptionsParams::Include] }
30
28
 
31
29
  # @!attribute mode
32
30
  # Mode of the request. `recipient` to list the objects that the provided object is
@@ -12,9 +12,7 @@ module Knockapi
12
12
  #
13
13
  # @return [Hash{Symbol=>Knockapi::Models::Recipients::PushChannelData, Knockapi::Models::Recipients::OneSignalChannelData, Knockapi::Models::Recipients::SlackChannelData, Knockapi::Models::Recipients::MsTeamsChannelData, Knockapi::Models::Recipients::DiscordChannelData}, nil]
14
14
  optional :channel_data,
15
- -> {
16
- Knockapi::Internal::Type::HashOf[union: Knockapi::Recipients::InlineChannelDataRequestItem]
17
- }
15
+ -> { Knockapi::Internal::Type::HashOf[union: Knockapi::Recipients::InlineChannelDataRequestItem] }
18
16
 
19
17
  # @!attribute locale
20
18
  # The locale of the object. Used for
@@ -29,10 +27,7 @@ module Knockapi
29
27
  # rather than replacing them.
30
28
  #
31
29
  # @return [Hash{Symbol=>Knockapi::Models::Recipients::PreferenceSetRequest}, nil]
32
- optional :preferences,
33
- -> {
34
- Knockapi::Internal::Type::HashOf[Knockapi::Recipients::PreferenceSetRequest]
35
- }
30
+ optional :preferences, -> { Knockapi::Internal::Type::HashOf[Knockapi::Recipients::PreferenceSetRequest] }
36
31
 
37
32
  # @!attribute timezone
38
33
  # The timezone of the object. Must be a
@@ -13,9 +13,7 @@ module Knockapi
13
13
  #
14
14
  # @return [Array<Knockapi::Models::Objects::BulkAddSubscriptionsParams::Subscription>]
15
15
  required :subscriptions,
16
- -> {
17
- Knockapi::Internal::Type::ArrayOf[Knockapi::Objects::BulkAddSubscriptionsParams::Subscription]
18
- }
16
+ -> { Knockapi::Internal::Type::ArrayOf[Knockapi::Objects::BulkAddSubscriptionsParams::Subscription] }
19
17
 
20
18
  # @!method initialize(subscriptions:, request_options: {})
21
19
  # @param subscriptions [Array<Knockapi::Models::Objects::BulkAddSubscriptionsParams::Subscription>] A list of subscriptions.
@@ -9,9 +9,7 @@ module Knockapi
9
9
  #
10
10
  # @return [Array<Knockapi::Models::Recipients::DiscordChannelData::Connection::DiscordChannelConnection, Knockapi::Models::Recipients::DiscordChannelData::Connection::DiscordIncomingWebhookConnection>]
11
11
  required :connections,
12
- -> {
13
- Knockapi::Internal::Type::ArrayOf[union: Knockapi::Recipients::DiscordChannelData::Connection]
14
- }
12
+ -> { Knockapi::Internal::Type::ArrayOf[union: Knockapi::Recipients::DiscordChannelData::Connection] }
15
13
 
16
14
  # @!method initialize(connections:)
17
15
  # Discord channel data.
@@ -27,9 +25,7 @@ module Knockapi
27
25
  variant -> { Knockapi::Recipients::DiscordChannelData::Connection::DiscordChannelConnection }
28
26
 
29
27
  # Discord incoming webhook connection.
30
- variant -> {
31
- Knockapi::Recipients::DiscordChannelData::Connection::DiscordIncomingWebhookConnection
32
- }
28
+ variant -> { Knockapi::Recipients::DiscordChannelData::Connection::DiscordIncomingWebhookConnection }
33
29
 
34
30
  class DiscordChannelConnection < Knockapi::Internal::Type::BaseModel
35
31
  # @!attribute channel_id
@@ -50,9 +46,7 @@ module Knockapi
50
46
  #
51
47
  # @return [Knockapi::Models::Recipients::DiscordChannelData::Connection::DiscordIncomingWebhookConnection::IncomingWebhook]
52
48
  required :incoming_webhook,
53
- -> {
54
- Knockapi::Recipients::DiscordChannelData::Connection::DiscordIncomingWebhookConnection::IncomingWebhook
55
- }
49
+ -> { Knockapi::Recipients::DiscordChannelData::Connection::DiscordIncomingWebhookConnection::IncomingWebhook }
56
50
 
57
51
  # @!method initialize(incoming_webhook:)
58
52
  # Discord incoming webhook connection.
@@ -9,9 +9,7 @@ module Knockapi
9
9
  #
10
10
  # @return [Array<Knockapi::Models::Recipients::MsTeamsChannelData::Connection::MsTeamsTokenConnection, Knockapi::Models::Recipients::MsTeamsChannelData::Connection::MsTeamsIncomingWebhookConnection>]
11
11
  required :connections,
12
- -> {
13
- Knockapi::Internal::Type::ArrayOf[union: Knockapi::Recipients::MsTeamsChannelData::Connection]
14
- }
12
+ -> { Knockapi::Internal::Type::ArrayOf[union: Knockapi::Recipients::MsTeamsChannelData::Connection] }
15
13
 
16
14
  # @!attribute ms_teams_tenant_id
17
15
  # Microsoft Teams tenant ID.
@@ -34,9 +32,7 @@ module Knockapi
34
32
  variant -> { Knockapi::Recipients::MsTeamsChannelData::Connection::MsTeamsTokenConnection }
35
33
 
36
34
  # Microsoft Teams incoming webhook connection.
37
- variant -> {
38
- Knockapi::Recipients::MsTeamsChannelData::Connection::MsTeamsIncomingWebhookConnection
39
- }
35
+ variant -> { Knockapi::Recipients::MsTeamsChannelData::Connection::MsTeamsIncomingWebhookConnection }
40
36
 
41
37
  class MsTeamsTokenConnection < Knockapi::Internal::Type::BaseModel
42
38
  # @!attribute ms_teams_channel_id
@@ -81,9 +77,7 @@ module Knockapi
81
77
  #
82
78
  # @return [Knockapi::Models::Recipients::MsTeamsChannelData::Connection::MsTeamsIncomingWebhookConnection::IncomingWebhook]
83
79
  required :incoming_webhook,
84
- -> {
85
- Knockapi::Recipients::MsTeamsChannelData::Connection::MsTeamsIncomingWebhookConnection::IncomingWebhook
86
- }
80
+ -> { Knockapi::Recipients::MsTeamsChannelData::Connection::MsTeamsIncomingWebhookConnection::IncomingWebhook }
87
81
 
88
82
  # @!method initialize(incoming_webhook:)
89
83
  # Microsoft Teams incoming webhook connection.
@@ -60,9 +60,7 @@ module Knockapi
60
60
  variant Knockapi::Internal::Type::Boolean
61
61
 
62
62
  # The settings object for a workflow or category, where you can specify channel types or conditions.
63
- variant -> {
64
- Knockapi::Recipients::PreferenceSet::Category::PreferenceSetWorkflowCategorySettingObject
65
- }
63
+ variant -> { Knockapi::Recipients::PreferenceSet::Category::PreferenceSetWorkflowCategorySettingObject }
66
64
 
67
65
  class PreferenceSetWorkflowCategorySettingObject < Knockapi::Internal::Type::BaseModel
68
66
  # @!attribute channel_types
@@ -97,9 +95,7 @@ module Knockapi
97
95
  variant Knockapi::Internal::Type::Boolean
98
96
 
99
97
  # The settings object for a workflow or category, where you can specify channel types or conditions.
100
- variant -> {
101
- Knockapi::Recipients::PreferenceSet::Workflow::PreferenceSetWorkflowCategorySettingObject
102
- }
98
+ variant -> { Knockapi::Recipients::PreferenceSet::Workflow::PreferenceSetWorkflowCategorySettingObject }
103
99
 
104
100
  class PreferenceSetWorkflowCategorySettingObject < Knockapi::Internal::Type::BaseModel
105
101
  # @!attribute channel_types
@@ -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
@@ -51,9 +76,7 @@ module Knockapi
51
76
  variant Knockapi::Internal::Type::Boolean
52
77
 
53
78
  # The settings object for a workflow or category, where you can specify channel types or conditions.
54
- variant -> {
55
- Knockapi::Recipients::PreferenceSetRequest::Category::PreferenceSetWorkflowCategorySettingObject
56
- }
79
+ variant -> { Knockapi::Recipients::PreferenceSetRequest::Category::PreferenceSetWorkflowCategorySettingObject }
57
80
 
58
81
  class PreferenceSetWorkflowCategorySettingObject < Knockapi::Internal::Type::BaseModel
59
82
  # @!attribute channel_types
@@ -88,9 +111,7 @@ module Knockapi
88
111
  variant Knockapi::Internal::Type::Boolean
89
112
 
90
113
  # The settings object for a workflow or category, where you can specify channel types or conditions.
91
- variant -> {
92
- Knockapi::Recipients::PreferenceSetRequest::Workflow::PreferenceSetWorkflowCategorySettingObject
93
- }
114
+ variant -> { Knockapi::Recipients::PreferenceSetRequest::Workflow::PreferenceSetWorkflowCategorySettingObject }
94
115
 
95
116
  class PreferenceSetWorkflowCategorySettingObject < Knockapi::Internal::Type::BaseModel
96
117
  # @!attribute channel_types
@@ -9,9 +9,7 @@ module Knockapi
9
9
  #
10
10
  # @return [Array<Knockapi::Models::Recipients::SlackChannelData::Connection::SlackTokenConnection, Knockapi::Models::Recipients::SlackChannelData::Connection::SlackIncomingWebhookConnection>]
11
11
  required :connections,
12
- -> {
13
- Knockapi::Internal::Type::ArrayOf[union: Knockapi::Recipients::SlackChannelData::Connection]
14
- }
12
+ -> { Knockapi::Internal::Type::ArrayOf[union: Knockapi::Recipients::SlackChannelData::Connection] }
15
13
 
16
14
  # @!attribute token
17
15
  # A Slack connection token.
@@ -30,9 +30,7 @@ module Knockapi
30
30
  #
31
31
  # @return [Array<Symbol, Knockapi::Models::UserListMessagesParams::EngagementStatus>, nil]
32
32
  optional :engagement_status,
33
- -> {
34
- Knockapi::Internal::Type::ArrayOf[enum: Knockapi::UserListMessagesParams::EngagementStatus]
35
- }
33
+ -> { Knockapi::Internal::Type::ArrayOf[enum: Knockapi::UserListMessagesParams::EngagementStatus] }
36
34
 
37
35
  # @!attribute inserted_at
38
36
  #
@@ -62,10 +60,7 @@ module Knockapi
62
60
  # Limits the results to messages with the given delivery status.
63
61
  #
64
62
  # @return [Array<Symbol, Knockapi::Models::UserListMessagesParams::Status>, nil]
65
- optional :status,
66
- -> {
67
- Knockapi::Internal::Type::ArrayOf[enum: Knockapi::UserListMessagesParams::Status]
68
- }
63
+ optional :status, -> { Knockapi::Internal::Type::ArrayOf[enum: Knockapi::UserListMessagesParams::Status] }
69
64
 
70
65
  # @!attribute tenant
71
66
  # Limits the results to items with the corresponding tenant.
@@ -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.1"
5
5
  end
@@ -59,10 +59,10 @@ module Knockapi
59
59
  end
60
60
 
61
61
  class APIConnectionError < Knockapi::Errors::APIError
62
- sig { void }
62
+ sig { returns(NilClass) }
63
63
  attr_accessor :status
64
64
 
65
- sig { void }
65
+ sig { returns(NilClass) }
66
66
  attr_accessor :body
67
67
 
68
68
  # @api private
@@ -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.1
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-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool