diff --git a/.release-please-manifest.json b/.release-please-manifest.json index bc845f32..6a197bef 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.16.0" + ".": "1.17.0" } \ No newline at end of file diff --git a/.rubocop.yml b/.rubocop.yml index e067af35..e041239e 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -121,6 +121,10 @@ Metrics/BlockLength: Metrics/ClassLength: Enabled: false +Metrics/CollectionLiteralLength: + Exclude: + - "test/**/*" + Metrics/CyclomaticComplexity: Enabled: false diff --git a/.stats.yml b/.stats.yml index e0c39b94..e6d25fc0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 89 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/knock%2Fknock-fe051300804a0ee8b0212b288cec99c00918e570f4c4b8852f3f4a27afdddd1c.yml -openapi_spec_hash: d2f75f52ceb88b56e4fcf58bf876fe44 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/knock%2Fknock-7e017b74e4af156a7dc03b3ee24e8a9d7bbd8854c4f383b8caa9cac0d5fd3efa.yml +openapi_spec_hash: 40c32d8afabbb41391f8ed91519ff7f6 config_hash: 658c551418df454aa40794f8ac679c18 diff --git a/CHANGELOG.md b/CHANGELOG.md index 93e33371..48fe2334 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,26 @@ # Changelog +## 1.17.0 (2025-10-15) + +Full Changelog: [v1.16.0...v1.17.0](https://github.com/knocklabs/knock-ruby/compare/v1.16.0...v1.17.0) + +### Features + +* **api:** api update ([042c92a](https://github.com/knocklabs/knock-ruby/commit/042c92a80665539dfeda7c2b8de0acead59fcfb1)) +* **api:** api update ([0f7fc4a](https://github.com/knocklabs/knock-ruby/commit/0f7fc4a35357d5cf6cb8394f0df9b60598d15e63)) + + +### Bug Fixes + +* absolutely qualified uris should always override the default ([2bb6341](https://github.com/knocklabs/knock-ruby/commit/2bb63414bbf3b9d9b4b996cd75341a183a6aa792)) +* should not reuse buffers for `IO.copy_stream` interop ([6464681](https://github.com/knocklabs/knock-ruby/commit/64646819574a19a1eb4969dc4abbc1d718ed7f4f)) + + +### Chores + +* ignore linter error for tests having large collections ([20f8ea6](https://github.com/knocklabs/knock-ruby/commit/20f8ea6a8cae8b3463b48d48f4ad065df465cddb)) +* simplify model references ([c126d85](https://github.com/knocklabs/knock-ruby/commit/c126d85300aa1ffe211fbc8e1c25eff4ca25ab7e)) + ## 1.16.0 (2025-10-07) Full Changelog: [v1.15.0...v1.16.0](https://github.com/knocklabs/knock-ruby/compare/v1.15.0...v1.16.0) diff --git a/Gemfile.lock b/Gemfile.lock index f6f5b055..87ded01e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GIT PATH remote: . specs: - knockapi (1.16.0) + knockapi (1.17.0) connection_pool GEM diff --git a/README.md b/README.md index 91026dd6..13c0e0fe 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application ```ruby -gem "knockapi", "~> 1.16.0" +gem "knockapi", "~> 1.17.0" ``` diff --git a/lib/knockapi/internal/util.rb b/lib/knockapi/internal/util.rb index 42c71ee8..5600daed 100644 --- a/lib/knockapi/internal/util.rb +++ b/lib/knockapi/internal/util.rb @@ -346,8 +346,9 @@ def join_parsed_uri(lhs, rhs) base_path, base_query = lhs.fetch_values(:path, :query) slashed = base_path.end_with?("/") ? base_path : "#{base_path}/" - parsed_path, parsed_query = parse_uri(rhs.fetch(:path)).fetch_values(:path, :query) - override = URI::Generic.build(**rhs.slice(:scheme, :host, :port), path: parsed_path) + merged = {**parse_uri(rhs.fetch(:path)), **rhs.except(:path, :query)} + parsed_path, parsed_query = merged.fetch_values(:path, :query) + override = URI::Generic.build(**merged.slice(:scheme, :host, :port), path: parsed_path) joined = URI.join(URI::Generic.build(lhs.except(:path, :query)), slashed, override) query = deep_merge( @@ -473,10 +474,9 @@ class << self # @return [Enumerable] def writable_enum(&blk) Enumerator.new do |y| - buf = String.new y.define_singleton_method(:write) do - self << buf.replace(_1) - buf.bytesize + self << _1.dup + _1.bytesize end blk.call(y) diff --git a/lib/knockapi/models/message.rb b/lib/knockapi/models/message.rb index dbff57af..03c87f33 100644 --- a/lib/knockapi/models/message.rb +++ b/lib/knockapi/models/message.rb @@ -17,7 +17,9 @@ class Message < Knockapi::Internal::Type::BaseModel required :_typename, String, api_name: :__typename # @!attribute channel_id - # The ID for the channel the message was sent through. + # @deprecated + # + # Deprecated, use channel.id instead. # # @return [String] required :channel_id, String @@ -74,6 +76,12 @@ class Message < Knockapi::Internal::Type::BaseModel # @return [Time, nil] optional :archived_at, Time, nil?: true + # @!attribute channel + # A configured channel, which is a way to route messages to a provider. + # + # @return [Knockapi::Models::Message::Channel, nil] + optional :channel, -> { Knockapi::Message::Channel } + # @!attribute clicked_at # Timestamp when the message was clicked. # @@ -141,7 +149,7 @@ class Message < Knockapi::Internal::Type::BaseModel # @return [String, nil] optional :workflow, String, nil?: true - # @!method initialize(id:, _typename:, channel_id:, engagement_statuses:, inserted_at:, recipient:, source:, status:, updated_at:, actors: nil, archived_at: nil, clicked_at: nil, data: nil, interacted_at: nil, link_clicked_at: nil, metadata: nil, read_at: nil, scheduled_at: nil, seen_at: nil, tenant: nil, workflow: nil) + # @!method initialize(id:, _typename:, channel_id:, engagement_statuses:, inserted_at:, recipient:, source:, status:, updated_at:, actors: nil, archived_at: nil, channel: nil, clicked_at: nil, data: nil, interacted_at: nil, link_clicked_at: nil, metadata: nil, read_at: nil, scheduled_at: nil, seen_at: nil, tenant: nil, workflow: nil) # Some parameter documentations has been truncated, see # {Knockapi::Models::Message} for more details. # @@ -152,7 +160,7 @@ class Message < Knockapi::Internal::Type::BaseModel # # @param _typename [String] The typename of the schema. # - # @param channel_id [String] The ID for the channel the message was sent through. + # @param channel_id [String] Deprecated, use channel.id instead. # # @param engagement_statuses [Array] A list of engagement statuses. # @@ -170,6 +178,8 @@ class Message < Knockapi::Internal::Type::BaseModel # # @param archived_at [Time, nil] Timestamp when the message was archived. # + # @param channel [Knockapi::Models::Message::Channel] A configured channel, which is a way to route messages to a provider. + # # @param clicked_at [Time, nil] Timestamp when the message was clicked. # # @param data [Hash{Symbol=>Object}, nil] Data associated with the message’s workflow run. Includes the workflow trigger r @@ -289,6 +299,87 @@ module Status # @!method self.values # @return [Array] end + + # @see Knockapi::Models::Message#channel + class Channel < Knockapi::Internal::Type::BaseModel + # @!attribute id + # The unique identifier for the channel. + # + # @return [String] + required :id, String + + # @!attribute created_at + # The timestamp of when the channel was created. + # + # @return [Time] + required :created_at, Time + + # @!attribute provider + # The ID of the provider that this channel uses to deliver messages. + # + # @return [String] + required :provider, String + + # @!attribute type + # The type of channel, determining what kind of messages it can send. + # + # @return [Symbol, Knockapi::Models::Message::Channel::Type] + required :type, enum: -> { Knockapi::Message::Channel::Type } + + # @!attribute updated_at + # The timestamp of when the channel was last updated. + # + # @return [Time] + required :updated_at, Time + + # @!attribute key + # Unique identifier for the channel within a project (immutable once created). + # + # @return [String, nil] + optional :key, String, nil?: true + + # @!attribute name + # The human-readable name of the channel. + # + # @return [String, nil] + optional :name, String, nil?: true + + # @!method initialize(id:, created_at:, provider:, type:, updated_at:, key: nil, name: nil) + # A configured channel, which is a way to route messages to a provider. + # + # @param id [String] The unique identifier for the channel. + # + # @param created_at [Time] The timestamp of when the channel was created. + # + # @param provider [String] The ID of the provider that this channel uses to deliver messages. + # + # @param type [Symbol, Knockapi::Models::Message::Channel::Type] The type of channel, determining what kind of messages it can send. + # + # @param updated_at [Time] The timestamp of when the channel was last updated. + # + # @param key [String, nil] Unique identifier for the channel within a project (immutable once created). + # + # @param name [String, nil] The human-readable name of the channel. + + # The type of channel, determining what kind of messages it can send. + # + # @see Knockapi::Models::Message::Channel#type + module Type + extend Knockapi::Internal::Type::Enum + + EMAIL = :email + IN_APP = :in_app + IN_APP_FEED = :in_app_feed + IN_APP_GUIDE = :in_app_guide + SMS = :sms + PUSH = :push + CHAT = :chat + HTTP = :http + + # @!method self.values + # @return [Array] + end + end end end end diff --git a/lib/knockapi/models/messages/batch_archive_response.rb b/lib/knockapi/models/messages/batch_archive_response.rb index ee2f4c18..c5e8764f 100644 --- a/lib/knockapi/models/messages/batch_archive_response.rb +++ b/lib/knockapi/models/messages/batch_archive_response.rb @@ -4,7 +4,7 @@ module Knockapi module Models module Messages # @type [Knockapi::Internal::Type::Converter] - BatchArchiveResponse = Knockapi::Internal::Type::ArrayOf[-> { Knockapi::Models::Message }] + BatchArchiveResponse = Knockapi::Internal::Type::ArrayOf[-> { Knockapi::Message }] end end end diff --git a/lib/knockapi/models/messages/batch_mark_as_interacted_response.rb b/lib/knockapi/models/messages/batch_mark_as_interacted_response.rb index f8408215..ac31f6c7 100644 --- a/lib/knockapi/models/messages/batch_mark_as_interacted_response.rb +++ b/lib/knockapi/models/messages/batch_mark_as_interacted_response.rb @@ -4,7 +4,7 @@ module Knockapi module Models module Messages # @type [Knockapi::Internal::Type::Converter] - BatchMarkAsInteractedResponse = Knockapi::Internal::Type::ArrayOf[-> { Knockapi::Models::Message }] + BatchMarkAsInteractedResponse = Knockapi::Internal::Type::ArrayOf[-> { Knockapi::Message }] end end end diff --git a/lib/knockapi/models/messages/batch_mark_as_read_response.rb b/lib/knockapi/models/messages/batch_mark_as_read_response.rb index 4231c407..70534feb 100644 --- a/lib/knockapi/models/messages/batch_mark_as_read_response.rb +++ b/lib/knockapi/models/messages/batch_mark_as_read_response.rb @@ -4,7 +4,7 @@ module Knockapi module Models module Messages # @type [Knockapi::Internal::Type::Converter] - BatchMarkAsReadResponse = Knockapi::Internal::Type::ArrayOf[-> { Knockapi::Models::Message }] + BatchMarkAsReadResponse = Knockapi::Internal::Type::ArrayOf[-> { Knockapi::Message }] end end end diff --git a/lib/knockapi/models/messages/batch_mark_as_seen_response.rb b/lib/knockapi/models/messages/batch_mark_as_seen_response.rb index ab13c348..c075483e 100644 --- a/lib/knockapi/models/messages/batch_mark_as_seen_response.rb +++ b/lib/knockapi/models/messages/batch_mark_as_seen_response.rb @@ -4,7 +4,7 @@ module Knockapi module Models module Messages # @type [Knockapi::Internal::Type::Converter] - BatchMarkAsSeenResponse = Knockapi::Internal::Type::ArrayOf[-> { Knockapi::Models::Message }] + BatchMarkAsSeenResponse = Knockapi::Internal::Type::ArrayOf[-> { Knockapi::Message }] end end end diff --git a/lib/knockapi/models/messages/batch_mark_as_unread_response.rb b/lib/knockapi/models/messages/batch_mark_as_unread_response.rb index 886a7ae9..8d2fa073 100644 --- a/lib/knockapi/models/messages/batch_mark_as_unread_response.rb +++ b/lib/knockapi/models/messages/batch_mark_as_unread_response.rb @@ -4,7 +4,7 @@ module Knockapi module Models module Messages # @type [Knockapi::Internal::Type::Converter] - BatchMarkAsUnreadResponse = Knockapi::Internal::Type::ArrayOf[-> { Knockapi::Models::Message }] + BatchMarkAsUnreadResponse = Knockapi::Internal::Type::ArrayOf[-> { Knockapi::Message }] end end end diff --git a/lib/knockapi/models/messages/batch_mark_as_unseen_response.rb b/lib/knockapi/models/messages/batch_mark_as_unseen_response.rb index c35f4875..e5c7eb7d 100644 --- a/lib/knockapi/models/messages/batch_mark_as_unseen_response.rb +++ b/lib/knockapi/models/messages/batch_mark_as_unseen_response.rb @@ -4,7 +4,7 @@ module Knockapi module Models module Messages # @type [Knockapi::Internal::Type::Converter] - BatchMarkAsUnseenResponse = Knockapi::Internal::Type::ArrayOf[-> { Knockapi::Models::Message }] + BatchMarkAsUnseenResponse = Knockapi::Internal::Type::ArrayOf[-> { Knockapi::Message }] end end end diff --git a/lib/knockapi/models/messages/batch_unarchive_response.rb b/lib/knockapi/models/messages/batch_unarchive_response.rb index f234ea31..921adf7c 100644 --- a/lib/knockapi/models/messages/batch_unarchive_response.rb +++ b/lib/knockapi/models/messages/batch_unarchive_response.rb @@ -4,7 +4,7 @@ module Knockapi module Models module Messages # @type [Knockapi::Internal::Type::Converter] - BatchUnarchiveResponse = Knockapi::Internal::Type::ArrayOf[-> { Knockapi::Models::Message }] + BatchUnarchiveResponse = Knockapi::Internal::Type::ArrayOf[-> { Knockapi::Message }] end end end diff --git a/lib/knockapi/models/recipients/preference_set_request.rb b/lib/knockapi/models/recipients/preference_set_request.rb index b1f07451..4c66d528 100644 --- a/lib/knockapi/models/recipients/preference_set_request.rb +++ b/lib/knockapi/models/recipients/preference_set_request.rb @@ -30,6 +30,13 @@ class PreferenceSetRequest < Knockapi::Internal::Type::BaseModel # @return [Knockapi::Models::Recipients::PreferenceSetChannelTypes, nil] optional :channel_types, -> { Knockapi::Recipients::PreferenceSetChannelTypes }, nil?: true + # @!attribute commercial_subscribed + # Whether the recipient is subscribed to commercial communications. When false, + # the recipient will not receive commercial workflow notifications. + # + # @return [Boolean, nil] + optional :commercial_subscribed, Knockapi::Internal::Type::Boolean, nil?: true + # @!attribute workflows # An object where the key is the workflow key and the values are the preference # settings for that workflow. @@ -41,7 +48,7 @@ class PreferenceSetRequest < Knockapi::Internal::Type::BaseModel }, nil?: true - # @!method initialize(_persistence_strategy: nil, categories: nil, channel_types: nil, workflows: nil) + # @!method initialize(_persistence_strategy: nil, categories: nil, channel_types: nil, commercial_subscribed: nil, workflows: nil) # Some parameter documentations has been truncated, see # {Knockapi::Models::Recipients::PreferenceSetRequest} for more details. # @@ -53,6 +60,8 @@ class PreferenceSetRequest < Knockapi::Internal::Type::BaseModel # # @param channel_types [Knockapi::Models::Recipients::PreferenceSetChannelTypes, nil] Channel type preferences. # + # @param commercial_subscribed [Boolean, nil] Whether the recipient is subscribed to commercial communications. When false, th + # # @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 # Controls how the preference set is persisted. 'replace' will completely replace diff --git a/lib/knockapi/resources/messages/batch.rb b/lib/knockapi/resources/messages/batch.rb index 89bfded4..f667ab1e 100644 --- a/lib/knockapi/resources/messages/batch.rb +++ b/lib/knockapi/resources/messages/batch.rb @@ -22,7 +22,7 @@ def archive(params) method: :post, path: "v1/messages/batch/archived", body: parsed, - model: Knockapi::Internal::Type::ArrayOf[Knockapi::Models::Message], + model: Knockapi::Internal::Type::ArrayOf[Knockapi::Message], options: options ) end @@ -72,7 +72,7 @@ def mark_as_interacted(params) method: :post, path: "v1/messages/batch/interacted", body: parsed, - model: Knockapi::Internal::Type::ArrayOf[Knockapi::Models::Message], + model: Knockapi::Internal::Type::ArrayOf[Knockapi::Message], options: options ) end @@ -95,7 +95,7 @@ def mark_as_read(params) method: :post, path: "v1/messages/batch/read", body: parsed, - model: Knockapi::Internal::Type::ArrayOf[Knockapi::Models::Message], + model: Knockapi::Internal::Type::ArrayOf[Knockapi::Message], options: options ) end @@ -119,7 +119,7 @@ def mark_as_seen(params) method: :post, path: "v1/messages/batch/seen", body: parsed, - model: Knockapi::Internal::Type::ArrayOf[Knockapi::Models::Message], + model: Knockapi::Internal::Type::ArrayOf[Knockapi::Message], options: options ) end @@ -143,7 +143,7 @@ def mark_as_unread(params) method: :post, path: "v1/messages/batch/unread", body: parsed, - model: Knockapi::Internal::Type::ArrayOf[Knockapi::Models::Message], + model: Knockapi::Internal::Type::ArrayOf[Knockapi::Message], options: options ) end @@ -167,7 +167,7 @@ def mark_as_unseen(params) method: :post, path: "v1/messages/batch/unseen", body: parsed, - model: Knockapi::Internal::Type::ArrayOf[Knockapi::Models::Message], + model: Knockapi::Internal::Type::ArrayOf[Knockapi::Message], options: options ) end @@ -191,7 +191,7 @@ def unarchive(params) method: :post, path: "v1/messages/batch/unarchived", body: parsed, - model: Knockapi::Internal::Type::ArrayOf[Knockapi::Models::Message], + model: Knockapi::Internal::Type::ArrayOf[Knockapi::Message], options: options ) end diff --git a/lib/knockapi/resources/objects.rb b/lib/knockapi/resources/objects.rb index 88ad3310..dab4880f 100644 --- a/lib/knockapi/resources/objects.rb +++ b/lib/knockapi/resources/objects.rb @@ -434,7 +434,7 @@ def set_channel_data(collection, object_id_, channel_id, params) # `tenant.id`. Learn more about # [per-tenant preferences](/preferences/tenant-preferences). # - # @overload set_preferences(collection, object_id_, id, _persistence_strategy: nil, categories: nil, channel_types: nil, workflows: nil, request_options: {}) + # @overload set_preferences(collection, object_id_, id, _persistence_strategy: nil, categories: nil, channel_types: nil, commercial_subscribed: nil, workflows: nil, request_options: {}) # # @param collection [String] The collection this object belongs to. # @@ -448,6 +448,8 @@ def set_channel_data(collection, object_id_, channel_id, params) # # @param channel_types [Knockapi::Models::Recipients::PreferenceSetChannelTypes, nil] Channel type preferences. # + # @param commercial_subscribed [Boolean, nil] Whether the recipient is subscribed to commercial communications. When false, th + # # @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 # # @param request_options [Knockapi::RequestOptions, Hash{Symbol=>Object}, nil] diff --git a/lib/knockapi/resources/users.rb b/lib/knockapi/resources/users.rb index 1d01b5a6..17635af0 100644 --- a/lib/knockapi/resources/users.rb +++ b/lib/knockapi/resources/users.rb @@ -380,7 +380,7 @@ def set_channel_data(user_id, channel_id, params) # Use '**persistence_strategy**': 'merge' to merge with existing preferences # instead. # - # @overload set_preferences(user_id, id, _persistence_strategy: nil, categories: nil, channel_types: nil, workflows: nil, request_options: {}) + # @overload set_preferences(user_id, id, _persistence_strategy: nil, categories: nil, channel_types: nil, commercial_subscribed: nil, workflows: nil, request_options: {}) # # @param user_id [String] The unique identifier of the user. # @@ -392,6 +392,8 @@ def set_channel_data(user_id, channel_id, params) # # @param channel_types [Knockapi::Models::Recipients::PreferenceSetChannelTypes, nil] Channel type preferences. # + # @param commercial_subscribed [Boolean, nil] Whether the recipient is subscribed to commercial communications. When false, th + # # @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 # # @param request_options [Knockapi::RequestOptions, Hash{Symbol=>Object}, nil] diff --git a/lib/knockapi/version.rb b/lib/knockapi/version.rb index 061ee241..750c4acb 100644 --- a/lib/knockapi/version.rb +++ b/lib/knockapi/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Knockapi - VERSION = "1.16.0" + VERSION = "1.17.0" end diff --git a/rbi/knockapi/models/message.rbi b/rbi/knockapi/models/message.rbi index 5e0a0bf6..f0b304b8 100644 --- a/rbi/knockapi/models/message.rbi +++ b/rbi/knockapi/models/message.rbi @@ -14,7 +14,7 @@ module Knockapi sig { returns(String) } attr_accessor :_typename - # The ID for the channel the message was sent through. + # Deprecated, use channel.id instead. sig { returns(String) } attr_accessor :channel_id @@ -73,6 +73,13 @@ module Knockapi sig { returns(T.nilable(Time)) } attr_accessor :archived_at + # A configured channel, which is a way to route messages to a provider. + sig { returns(T.nilable(Knockapi::Message::Channel)) } + attr_reader :channel + + sig { params(channel: Knockapi::Message::Channel::OrHash).void } + attr_writer :channel + # Timestamp when the message was clicked. sig { returns(T.nilable(Time)) } attr_accessor :clicked_at @@ -144,6 +151,7 @@ module Knockapi ) ], archived_at: T.nilable(Time), + channel: Knockapi::Message::Channel::OrHash, clicked_at: T.nilable(Time), data: T.nilable(T::Hash[Symbol, T.anything]), interacted_at: T.nilable(Time), @@ -161,7 +169,7 @@ module Knockapi id:, # The typename of the schema. _typename:, - # The ID for the channel the message was sent through. + # Deprecated, use channel.id instead. channel_id:, # A list of engagement statuses. engagement_statuses:, @@ -182,6 +190,8 @@ module Knockapi actors: nil, # Timestamp when the message was archived. archived_at: nil, + # A configured channel, which is a way to route messages to a provider. + channel: nil, # Timestamp when the message was clicked. clicked_at: nil, # Data associated with the message’s workflow run. Includes the workflow trigger @@ -225,6 +235,7 @@ module Knockapi updated_at: Time, actors: T::Array[Knockapi::RecipientReference::Variants], archived_at: T.nilable(Time), + channel: Knockapi::Message::Channel, clicked_at: T.nilable(Time), data: T.nilable(T::Hash[Symbol, T.anything]), interacted_at: T.nilable(Time), @@ -393,6 +404,116 @@ module Knockapi def self.values end end + + class Channel < Knockapi::Internal::Type::BaseModel + OrHash = + T.type_alias do + T.any(Knockapi::Message::Channel, Knockapi::Internal::AnyHash) + end + + # The unique identifier for the channel. + sig { returns(String) } + attr_accessor :id + + # The timestamp of when the channel was created. + sig { returns(Time) } + attr_accessor :created_at + + # The ID of the provider that this channel uses to deliver messages. + sig { returns(String) } + attr_accessor :provider + + # The type of channel, determining what kind of messages it can send. + sig { returns(Knockapi::Message::Channel::Type::TaggedSymbol) } + attr_accessor :type + + # The timestamp of when the channel was last updated. + sig { returns(Time) } + attr_accessor :updated_at + + # Unique identifier for the channel within a project (immutable once created). + sig { returns(T.nilable(String)) } + attr_accessor :key + + # The human-readable name of the channel. + sig { returns(T.nilable(String)) } + attr_accessor :name + + # A configured channel, which is a way to route messages to a provider. + sig do + params( + id: String, + created_at: Time, + provider: String, + type: Knockapi::Message::Channel::Type::OrSymbol, + updated_at: Time, + key: T.nilable(String), + name: T.nilable(String) + ).returns(T.attached_class) + end + def self.new( + # The unique identifier for the channel. + id:, + # The timestamp of when the channel was created. + created_at:, + # The ID of the provider that this channel uses to deliver messages. + provider:, + # The type of channel, determining what kind of messages it can send. + type:, + # The timestamp of when the channel was last updated. + updated_at:, + # Unique identifier for the channel within a project (immutable once created). + key: nil, + # The human-readable name of the channel. + name: nil + ) + end + + sig do + override.returns( + { + id: String, + created_at: Time, + provider: String, + type: Knockapi::Message::Channel::Type::TaggedSymbol, + updated_at: Time, + key: T.nilable(String), + name: T.nilable(String) + } + ) + end + def to_hash + end + + # The type of channel, determining what kind of messages it can send. + module Type + extend Knockapi::Internal::Type::Enum + + TaggedSymbol = + T.type_alias { T.all(Symbol, Knockapi::Message::Channel::Type) } + OrSymbol = T.type_alias { T.any(Symbol, String) } + + EMAIL = T.let(:email, Knockapi::Message::Channel::Type::TaggedSymbol) + IN_APP = + T.let(:in_app, Knockapi::Message::Channel::Type::TaggedSymbol) + IN_APP_FEED = + T.let(:in_app_feed, Knockapi::Message::Channel::Type::TaggedSymbol) + IN_APP_GUIDE = + T.let(:in_app_guide, Knockapi::Message::Channel::Type::TaggedSymbol) + SMS = T.let(:sms, Knockapi::Message::Channel::Type::TaggedSymbol) + PUSH = T.let(:push, Knockapi::Message::Channel::Type::TaggedSymbol) + CHAT = T.let(:chat, Knockapi::Message::Channel::Type::TaggedSymbol) + HTTP = T.let(:http, Knockapi::Message::Channel::Type::TaggedSymbol) + + sig do + override.returns( + T::Array[Knockapi::Message::Channel::Type::TaggedSymbol] + ) + end + def self.values + end + end + end end end end diff --git a/rbi/knockapi/models/messages/batch_archive_response.rbi b/rbi/knockapi/models/messages/batch_archive_response.rbi index 091a0ce3..b0956cc7 100644 --- a/rbi/knockapi/models/messages/batch_archive_response.rbi +++ b/rbi/knockapi/models/messages/batch_archive_response.rbi @@ -5,7 +5,7 @@ module Knockapi module Messages BatchArchiveResponse = T.let( - Knockapi::Internal::Type::ArrayOf[Knockapi::Models::Message], + Knockapi::Internal::Type::ArrayOf[Knockapi::Message], Knockapi::Internal::Type::Converter ) end diff --git a/rbi/knockapi/models/messages/batch_mark_as_interacted_response.rbi b/rbi/knockapi/models/messages/batch_mark_as_interacted_response.rbi index 677451be..8bfa535c 100644 --- a/rbi/knockapi/models/messages/batch_mark_as_interacted_response.rbi +++ b/rbi/knockapi/models/messages/batch_mark_as_interacted_response.rbi @@ -5,7 +5,7 @@ module Knockapi module Messages BatchMarkAsInteractedResponse = T.let( - Knockapi::Internal::Type::ArrayOf[Knockapi::Models::Message], + Knockapi::Internal::Type::ArrayOf[Knockapi::Message], Knockapi::Internal::Type::Converter ) end diff --git a/rbi/knockapi/models/messages/batch_mark_as_read_response.rbi b/rbi/knockapi/models/messages/batch_mark_as_read_response.rbi index 127872cc..08e4aea6 100644 --- a/rbi/knockapi/models/messages/batch_mark_as_read_response.rbi +++ b/rbi/knockapi/models/messages/batch_mark_as_read_response.rbi @@ -5,7 +5,7 @@ module Knockapi module Messages BatchMarkAsReadResponse = T.let( - Knockapi::Internal::Type::ArrayOf[Knockapi::Models::Message], + Knockapi::Internal::Type::ArrayOf[Knockapi::Message], Knockapi::Internal::Type::Converter ) end diff --git a/rbi/knockapi/models/messages/batch_mark_as_seen_response.rbi b/rbi/knockapi/models/messages/batch_mark_as_seen_response.rbi index 1952911a..12b735c0 100644 --- a/rbi/knockapi/models/messages/batch_mark_as_seen_response.rbi +++ b/rbi/knockapi/models/messages/batch_mark_as_seen_response.rbi @@ -5,7 +5,7 @@ module Knockapi module Messages BatchMarkAsSeenResponse = T.let( - Knockapi::Internal::Type::ArrayOf[Knockapi::Models::Message], + Knockapi::Internal::Type::ArrayOf[Knockapi::Message], Knockapi::Internal::Type::Converter ) end diff --git a/rbi/knockapi/models/messages/batch_mark_as_unread_response.rbi b/rbi/knockapi/models/messages/batch_mark_as_unread_response.rbi index 2084f143..2f21953c 100644 --- a/rbi/knockapi/models/messages/batch_mark_as_unread_response.rbi +++ b/rbi/knockapi/models/messages/batch_mark_as_unread_response.rbi @@ -5,7 +5,7 @@ module Knockapi module Messages BatchMarkAsUnreadResponse = T.let( - Knockapi::Internal::Type::ArrayOf[Knockapi::Models::Message], + Knockapi::Internal::Type::ArrayOf[Knockapi::Message], Knockapi::Internal::Type::Converter ) end diff --git a/rbi/knockapi/models/messages/batch_mark_as_unseen_response.rbi b/rbi/knockapi/models/messages/batch_mark_as_unseen_response.rbi index 5a09caca..d2860fc5 100644 --- a/rbi/knockapi/models/messages/batch_mark_as_unseen_response.rbi +++ b/rbi/knockapi/models/messages/batch_mark_as_unseen_response.rbi @@ -5,7 +5,7 @@ module Knockapi module Messages BatchMarkAsUnseenResponse = T.let( - Knockapi::Internal::Type::ArrayOf[Knockapi::Models::Message], + Knockapi::Internal::Type::ArrayOf[Knockapi::Message], Knockapi::Internal::Type::Converter ) end diff --git a/rbi/knockapi/models/messages/batch_unarchive_response.rbi b/rbi/knockapi/models/messages/batch_unarchive_response.rbi index 1f01a4ff..af864800 100644 --- a/rbi/knockapi/models/messages/batch_unarchive_response.rbi +++ b/rbi/knockapi/models/messages/batch_unarchive_response.rbi @@ -5,7 +5,7 @@ module Knockapi module Messages BatchUnarchiveResponse = T.let( - Knockapi::Internal::Type::ArrayOf[Knockapi::Models::Message], + Knockapi::Internal::Type::ArrayOf[Knockapi::Message], Knockapi::Internal::Type::Converter ) end diff --git a/rbi/knockapi/models/recipients/preference_set_request.rbi b/rbi/knockapi/models/recipients/preference_set_request.rbi index a41d84bc..3fef350e 100644 --- a/rbi/knockapi/models/recipients/preference_set_request.rbi +++ b/rbi/knockapi/models/recipients/preference_set_request.rbi @@ -62,6 +62,11 @@ module Knockapi end attr_writer :channel_types + # Whether the recipient is subscribed to commercial communications. When false, + # the recipient will not receive commercial workflow notifications. + sig { returns(T.nilable(T::Boolean)) } + attr_accessor :commercial_subscribed + # An object where the key is the workflow key and the values are the preference # settings for that workflow. sig do @@ -98,6 +103,7 @@ module Knockapi T.nilable( Knockapi::Recipients::PreferenceSetChannelTypes::OrHash ), + commercial_subscribed: T.nilable(T::Boolean), workflows: T.nilable( T::Hash[ @@ -119,6 +125,9 @@ module Knockapi categories: nil, # Channel type preferences. channel_types: nil, + # Whether the recipient is subscribed to commercial communications. When false, + # the recipient will not receive commercial workflow notifications. + commercial_subscribed: nil, # An object where the key is the workflow key and the values are the preference # settings for that workflow. workflows: nil @@ -142,6 +151,7 @@ module Knockapi ), channel_types: T.nilable(Knockapi::Recipients::PreferenceSetChannelTypes), + commercial_subscribed: T.nilable(T::Boolean), workflows: T.nilable( T::Hash[ diff --git a/rbi/knockapi/resources/messages/batch.rbi b/rbi/knockapi/resources/messages/batch.rbi index 65ef38a8..7900e0d8 100644 --- a/rbi/knockapi/resources/messages/batch.rbi +++ b/rbi/knockapi/resources/messages/batch.rbi @@ -10,7 +10,7 @@ module Knockapi params( message_ids: T::Array[String], request_options: Knockapi::RequestOptions::OrHash - ).returns(T::Array[Knockapi::Models::Message]) + ).returns(T::Array[Knockapi::Message]) end def archive( # The message IDs to update the status of. @@ -45,7 +45,7 @@ module Knockapi message_ids: T::Array[String], metadata: T.nilable(T::Hash[Symbol, T.anything]), request_options: Knockapi::RequestOptions::OrHash - ).returns(T::Array[Knockapi::Models::Message]) + ).returns(T::Array[Knockapi::Message]) end def mark_as_interacted( # The message IDs to batch mark as interacted with. @@ -62,7 +62,7 @@ module Knockapi params( message_ids: T::Array[String], request_options: Knockapi::RequestOptions::OrHash - ).returns(T::Array[Knockapi::Models::Message]) + ).returns(T::Array[Knockapi::Message]) end def mark_as_read( # The message IDs to update the status of. @@ -78,7 +78,7 @@ module Knockapi params( message_ids: T::Array[String], request_options: Knockapi::RequestOptions::OrHash - ).returns(T::Array[Knockapi::Models::Message]) + ).returns(T::Array[Knockapi::Message]) end def mark_as_seen( # The message IDs to update the status of. @@ -94,7 +94,7 @@ module Knockapi params( message_ids: T::Array[String], request_options: Knockapi::RequestOptions::OrHash - ).returns(T::Array[Knockapi::Models::Message]) + ).returns(T::Array[Knockapi::Message]) end def mark_as_unread( # The message IDs to update the status of. @@ -110,7 +110,7 @@ module Knockapi params( message_ids: T::Array[String], request_options: Knockapi::RequestOptions::OrHash - ).returns(T::Array[Knockapi::Models::Message]) + ).returns(T::Array[Knockapi::Message]) end def mark_as_unseen( # The message IDs to update the status of. @@ -126,7 +126,7 @@ module Knockapi params( message_ids: T::Array[String], request_options: Knockapi::RequestOptions::OrHash - ).returns(T::Array[Knockapi::Models::Message]) + ).returns(T::Array[Knockapi::Message]) end def unarchive( # The message IDs to update the status of. diff --git a/rbi/knockapi/resources/objects.rbi b/rbi/knockapi/resources/objects.rbi index 1ceb8788..151085c0 100644 --- a/rbi/knockapi/resources/objects.rbi +++ b/rbi/knockapi/resources/objects.rbi @@ -451,6 +451,7 @@ module Knockapi ), channel_types: T.nilable(Knockapi::Recipients::PreferenceSetChannelTypes::OrHash), + commercial_subscribed: T.nilable(T::Boolean), workflows: T.nilable( T::Hash[ @@ -479,6 +480,9 @@ module Knockapi categories: nil, # Channel type preferences. channel_types: nil, + # Whether the recipient is subscribed to commercial communications. When false, + # the recipient will not receive commercial workflow notifications. + commercial_subscribed: nil, # An object where the key is the workflow key and the values are the preference # settings for that workflow. workflows: nil, diff --git a/rbi/knockapi/resources/users.rbi b/rbi/knockapi/resources/users.rbi index 8cb6ad55..964a1a0e 100644 --- a/rbi/knockapi/resources/users.rbi +++ b/rbi/knockapi/resources/users.rbi @@ -386,6 +386,7 @@ module Knockapi ), channel_types: T.nilable(Knockapi::Recipients::PreferenceSetChannelTypes::OrHash), + commercial_subscribed: T.nilable(T::Boolean), workflows: T.nilable( T::Hash[ @@ -412,6 +413,9 @@ module Knockapi categories: nil, # Channel type preferences. channel_types: nil, + # Whether the recipient is subscribed to commercial communications. When false, + # the recipient will not receive commercial workflow notifications. + commercial_subscribed: nil, # An object where the key is the workflow key and the values are the preference # settings for that workflow. workflows: nil, diff --git a/sig/knockapi/models/message.rbs b/sig/knockapi/models/message.rbs index abcfee1d..2f05d053 100644 --- a/sig/knockapi/models/message.rbs +++ b/sig/knockapi/models/message.rbs @@ -13,6 +13,7 @@ module Knockapi updated_at: Time, actors: ::Array[Knockapi::Models::recipient_reference], archived_at: Time?, + channel: Knockapi::Message::Channel, clicked_at: Time?, data: ::Hash[Symbol, top]?, interacted_at: Time?, @@ -52,6 +53,10 @@ module Knockapi attr_accessor archived_at: Time? + attr_reader channel: Knockapi::Message::Channel? + + def channel=: (Knockapi::Message::Channel) -> Knockapi::Message::Channel + attr_accessor clicked_at: Time? attr_accessor data: ::Hash[Symbol, top]? @@ -84,6 +89,7 @@ module Knockapi updated_at: Time, ?actors: ::Array[Knockapi::Models::recipient_reference], ?archived_at: Time?, + ?channel: Knockapi::Message::Channel, ?clicked_at: Time?, ?data: ::Hash[Symbol, top]?, ?interacted_at: Time?, @@ -108,6 +114,7 @@ module Knockapi updated_at: Time, actors: ::Array[Knockapi::Models::recipient_reference], archived_at: Time?, + channel: Knockapi::Message::Channel, clicked_at: Time?, data: ::Hash[Symbol, top]?, interacted_at: Time?, @@ -215,6 +222,78 @@ module Knockapi def self?.values: -> ::Array[Knockapi::Models::Message::status] end + + type channel = + { + id: String, + created_at: Time, + provider: String, + type: Knockapi::Models::Message::Channel::type_, + updated_at: Time, + key: String?, + name: String? + } + + class Channel < Knockapi::Internal::Type::BaseModel + attr_accessor id: String + + attr_accessor created_at: Time + + attr_accessor provider: String + + attr_accessor type: Knockapi::Models::Message::Channel::type_ + + attr_accessor updated_at: Time + + attr_accessor key: String? + + attr_accessor name: String? + + def initialize: ( + id: String, + created_at: Time, + provider: String, + type: Knockapi::Models::Message::Channel::type_, + updated_at: Time, + ?key: String?, + ?name: String? + ) -> void + + def to_hash: -> { + id: String, + created_at: Time, + provider: String, + type: Knockapi::Models::Message::Channel::type_, + updated_at: Time, + key: String?, + name: String? + } + + type type_ = + :email + | :in_app + | :in_app_feed + | :in_app_guide + | :sms + | :push + | :chat + | :http + + module Type + extend Knockapi::Internal::Type::Enum + + EMAIL: :email + IN_APP: :in_app + IN_APP_FEED: :in_app_feed + IN_APP_GUIDE: :in_app_guide + SMS: :sms + PUSH: :push + CHAT: :chat + HTTP: :http + + def self?.values: -> ::Array[Knockapi::Models::Message::Channel::type_] + end + end end end end diff --git a/sig/knockapi/models/messages/batch_archive_response.rbs b/sig/knockapi/models/messages/batch_archive_response.rbs index 5837000d..df1c4ee2 100644 --- a/sig/knockapi/models/messages/batch_archive_response.rbs +++ b/sig/knockapi/models/messages/batch_archive_response.rbs @@ -1,7 +1,7 @@ module Knockapi module Models module Messages - type batch_archive_response = ::Array[Knockapi::Models::Message] + type batch_archive_response = ::Array[Knockapi::Message] BatchArchiveResponse: Knockapi::Internal::Type::Converter end diff --git a/sig/knockapi/models/messages/batch_mark_as_interacted_response.rbs b/sig/knockapi/models/messages/batch_mark_as_interacted_response.rbs index de88d392..926d940b 100644 --- a/sig/knockapi/models/messages/batch_mark_as_interacted_response.rbs +++ b/sig/knockapi/models/messages/batch_mark_as_interacted_response.rbs @@ -1,8 +1,7 @@ module Knockapi module Models module Messages - type batch_mark_as_interacted_response = - ::Array[Knockapi::Models::Message] + type batch_mark_as_interacted_response = ::Array[Knockapi::Message] BatchMarkAsInteractedResponse: Knockapi::Internal::Type::Converter end diff --git a/sig/knockapi/models/messages/batch_mark_as_read_response.rbs b/sig/knockapi/models/messages/batch_mark_as_read_response.rbs index 63b32905..59ee9fb0 100644 --- a/sig/knockapi/models/messages/batch_mark_as_read_response.rbs +++ b/sig/knockapi/models/messages/batch_mark_as_read_response.rbs @@ -1,7 +1,7 @@ module Knockapi module Models module Messages - type batch_mark_as_read_response = ::Array[Knockapi::Models::Message] + type batch_mark_as_read_response = ::Array[Knockapi::Message] BatchMarkAsReadResponse: Knockapi::Internal::Type::Converter end diff --git a/sig/knockapi/models/messages/batch_mark_as_seen_response.rbs b/sig/knockapi/models/messages/batch_mark_as_seen_response.rbs index 74e8ee6d..bf1c067b 100644 --- a/sig/knockapi/models/messages/batch_mark_as_seen_response.rbs +++ b/sig/knockapi/models/messages/batch_mark_as_seen_response.rbs @@ -1,7 +1,7 @@ module Knockapi module Models module Messages - type batch_mark_as_seen_response = ::Array[Knockapi::Models::Message] + type batch_mark_as_seen_response = ::Array[Knockapi::Message] BatchMarkAsSeenResponse: Knockapi::Internal::Type::Converter end diff --git a/sig/knockapi/models/messages/batch_mark_as_unread_response.rbs b/sig/knockapi/models/messages/batch_mark_as_unread_response.rbs index 42e04337..b879ac42 100644 --- a/sig/knockapi/models/messages/batch_mark_as_unread_response.rbs +++ b/sig/knockapi/models/messages/batch_mark_as_unread_response.rbs @@ -1,7 +1,7 @@ module Knockapi module Models module Messages - type batch_mark_as_unread_response = ::Array[Knockapi::Models::Message] + type batch_mark_as_unread_response = ::Array[Knockapi::Message] BatchMarkAsUnreadResponse: Knockapi::Internal::Type::Converter end diff --git a/sig/knockapi/models/messages/batch_mark_as_unseen_response.rbs b/sig/knockapi/models/messages/batch_mark_as_unseen_response.rbs index a968cc8c..6fd17355 100644 --- a/sig/knockapi/models/messages/batch_mark_as_unseen_response.rbs +++ b/sig/knockapi/models/messages/batch_mark_as_unseen_response.rbs @@ -1,7 +1,7 @@ module Knockapi module Models module Messages - type batch_mark_as_unseen_response = ::Array[Knockapi::Models::Message] + type batch_mark_as_unseen_response = ::Array[Knockapi::Message] BatchMarkAsUnseenResponse: Knockapi::Internal::Type::Converter end diff --git a/sig/knockapi/models/messages/batch_unarchive_response.rbs b/sig/knockapi/models/messages/batch_unarchive_response.rbs index 19860008..a60df0a3 100644 --- a/sig/knockapi/models/messages/batch_unarchive_response.rbs +++ b/sig/knockapi/models/messages/batch_unarchive_response.rbs @@ -1,7 +1,7 @@ module Knockapi module Models module Messages - type batch_unarchive_response = ::Array[Knockapi::Models::Message] + type batch_unarchive_response = ::Array[Knockapi::Message] BatchUnarchiveResponse: Knockapi::Internal::Type::Converter end diff --git a/sig/knockapi/models/recipients/preference_set_request.rbs b/sig/knockapi/models/recipients/preference_set_request.rbs index 96c1fe96..c93ec71c 100644 --- a/sig/knockapi/models/recipients/preference_set_request.rbs +++ b/sig/knockapi/models/recipients/preference_set_request.rbs @@ -6,6 +6,7 @@ module Knockapi _persistence_strategy: Knockapi::Models::Recipients::PreferenceSetRequest::persistence_strategy, categories: ::Hash[Symbol, Knockapi::Models::Recipients::PreferenceSetRequest::category]?, channel_types: Knockapi::Recipients::PreferenceSetChannelTypes?, + commercial_subscribed: bool?, workflows: ::Hash[Symbol, Knockapi::Models::Recipients::PreferenceSetRequest::workflow]? } @@ -20,12 +21,15 @@ module Knockapi attr_accessor channel_types: Knockapi::Recipients::PreferenceSetChannelTypes? + attr_accessor commercial_subscribed: bool? + attr_accessor workflows: ::Hash[Symbol, Knockapi::Models::Recipients::PreferenceSetRequest::workflow]? def initialize: ( ?_persistence_strategy: Knockapi::Models::Recipients::PreferenceSetRequest::persistence_strategy, ?categories: ::Hash[Symbol, Knockapi::Models::Recipients::PreferenceSetRequest::category]?, ?channel_types: Knockapi::Recipients::PreferenceSetChannelTypes?, + ?commercial_subscribed: bool?, ?workflows: ::Hash[Symbol, Knockapi::Models::Recipients::PreferenceSetRequest::workflow]? ) -> void @@ -33,6 +37,7 @@ module Knockapi _persistence_strategy: Knockapi::Models::Recipients::PreferenceSetRequest::persistence_strategy, categories: ::Hash[Symbol, Knockapi::Models::Recipients::PreferenceSetRequest::category]?, channel_types: Knockapi::Recipients::PreferenceSetChannelTypes?, + commercial_subscribed: bool?, workflows: ::Hash[Symbol, Knockapi::Models::Recipients::PreferenceSetRequest::workflow]? } diff --git a/sig/knockapi/resources/objects.rbs b/sig/knockapi/resources/objects.rbs index 44830550..dd2cb0ac 100644 --- a/sig/knockapi/resources/objects.rbs +++ b/sig/knockapi/resources/objects.rbs @@ -128,6 +128,7 @@ module Knockapi ?_persistence_strategy: Knockapi::Models::Recipients::PreferenceSetRequest::persistence_strategy, ?categories: ::Hash[Symbol, Knockapi::Models::Recipients::PreferenceSetRequest::category]?, ?channel_types: Knockapi::Recipients::PreferenceSetChannelTypes?, + ?commercial_subscribed: bool?, ?workflows: ::Hash[Symbol, Knockapi::Models::Recipients::PreferenceSetRequest::workflow]?, ?request_options: Knockapi::request_opts ) -> Knockapi::Recipients::PreferenceSet diff --git a/sig/knockapi/resources/users.rbs b/sig/knockapi/resources/users.rbs index 0e4f469e..1d1d6ed4 100644 --- a/sig/knockapi/resources/users.rbs +++ b/sig/knockapi/resources/users.rbs @@ -115,6 +115,7 @@ module Knockapi ?_persistence_strategy: Knockapi::Models::Recipients::PreferenceSetRequest::persistence_strategy, ?categories: ::Hash[Symbol, Knockapi::Models::Recipients::PreferenceSetRequest::category]?, ?channel_types: Knockapi::Recipients::PreferenceSetChannelTypes?, + ?commercial_subscribed: bool?, ?workflows: ::Hash[Symbol, Knockapi::Models::Recipients::PreferenceSetRequest::workflow]?, ?request_options: Knockapi::request_opts ) -> Knockapi::Recipients::PreferenceSet diff --git a/test/knockapi/internal/util_test.rb b/test/knockapi/internal/util_test.rb index fe798de5..602f77f8 100644 --- a/test/knockapi/internal/util_test.rb +++ b/test/knockapi/internal/util_test.rb @@ -124,6 +124,14 @@ def test_joining path: "/c", query: {"d" => ["e"]} } + ], + [ + "h://a.b/c?d=e", + "h://nope", + { + path: "h://a.b/c", + query: {"d" => ["e"]} + } ] ] diff --git a/test/knockapi/resources/messages/batch_test.rb b/test/knockapi/resources/messages/batch_test.rb index 35ca141a..8fc458fb 100644 --- a/test/knockapi/resources/messages/batch_test.rb +++ b/test/knockapi/resources/messages/batch_test.rb @@ -15,7 +15,7 @@ def test_archive_required_params ) assert_pattern do - response => ^(Knockapi::Internal::Type::ArrayOf[Knockapi::Models::Message]) + response => ^(Knockapi::Internal::Type::ArrayOf[Knockapi::Message]) end end @@ -35,7 +35,7 @@ def test_mark_as_interacted_required_params response = @knock.messages.batch.mark_as_interacted(message_ids: ["1jNaXzB2RZX3LY8wVQnfCKyPnv7"]) assert_pattern do - response => ^(Knockapi::Internal::Type::ArrayOf[Knockapi::Models::Message]) + response => ^(Knockapi::Internal::Type::ArrayOf[Knockapi::Message]) end end @@ -48,7 +48,7 @@ def test_mark_as_read_required_params ) assert_pattern do - response => ^(Knockapi::Internal::Type::ArrayOf[Knockapi::Models::Message]) + response => ^(Knockapi::Internal::Type::ArrayOf[Knockapi::Message]) end end @@ -61,7 +61,7 @@ def test_mark_as_seen_required_params ) assert_pattern do - response => ^(Knockapi::Internal::Type::ArrayOf[Knockapi::Models::Message]) + response => ^(Knockapi::Internal::Type::ArrayOf[Knockapi::Message]) end end @@ -74,7 +74,7 @@ def test_mark_as_unread_required_params ) assert_pattern do - response => ^(Knockapi::Internal::Type::ArrayOf[Knockapi::Models::Message]) + response => ^(Knockapi::Internal::Type::ArrayOf[Knockapi::Message]) end end @@ -87,7 +87,7 @@ def test_mark_as_unseen_required_params ) assert_pattern do - response => ^(Knockapi::Internal::Type::ArrayOf[Knockapi::Models::Message]) + response => ^(Knockapi::Internal::Type::ArrayOf[Knockapi::Message]) end end @@ -100,7 +100,7 @@ def test_unarchive_required_params ) assert_pattern do - response => ^(Knockapi::Internal::Type::ArrayOf[Knockapi::Models::Message]) + response => ^(Knockapi::Internal::Type::ArrayOf[Knockapi::Message]) end end end diff --git a/test/knockapi/resources/messages_test.rb b/test/knockapi/resources/messages_test.rb index e54c1381..8401225e 100644 --- a/test/knockapi/resources/messages_test.rb +++ b/test/knockapi/resources/messages_test.rb @@ -32,6 +32,7 @@ def test_list updated_at: Time, actors: ^(Knockapi::Internal::Type::ArrayOf[union: Knockapi::RecipientReference]) | nil, archived_at: Time | nil, + channel: Knockapi::Message::Channel | nil, clicked_at: Time | nil, data: ^(Knockapi::Internal::Type::HashOf[Knockapi::Internal::Type::Unknown]) | nil, interacted_at: Time | nil, @@ -68,6 +69,7 @@ def test_archive updated_at: Time, actors: ^(Knockapi::Internal::Type::ArrayOf[union: Knockapi::RecipientReference]) | nil, archived_at: Time | nil, + channel: Knockapi::Message::Channel | nil, clicked_at: Time | nil, data: ^(Knockapi::Internal::Type::HashOf[Knockapi::Internal::Type::Unknown]) | nil, interacted_at: Time | nil, @@ -104,6 +106,7 @@ def test_get updated_at: Time, actors: ^(Knockapi::Internal::Type::ArrayOf[union: Knockapi::RecipientReference]) | nil, archived_at: Time | nil, + channel: Knockapi::Message::Channel | nil, clicked_at: Time | nil, data: ^(Knockapi::Internal::Type::HashOf[Knockapi::Internal::Type::Unknown]) | nil, interacted_at: Time | nil, @@ -245,6 +248,7 @@ def test_mark_as_interacted updated_at: Time, actors: ^(Knockapi::Internal::Type::ArrayOf[union: Knockapi::RecipientReference]) | nil, archived_at: Time | nil, + channel: Knockapi::Message::Channel | nil, clicked_at: Time | nil, data: ^(Knockapi::Internal::Type::HashOf[Knockapi::Internal::Type::Unknown]) | nil, interacted_at: Time | nil, @@ -281,6 +285,7 @@ def test_mark_as_read updated_at: Time, actors: ^(Knockapi::Internal::Type::ArrayOf[union: Knockapi::RecipientReference]) | nil, archived_at: Time | nil, + channel: Knockapi::Message::Channel | nil, clicked_at: Time | nil, data: ^(Knockapi::Internal::Type::HashOf[Knockapi::Internal::Type::Unknown]) | nil, interacted_at: Time | nil, @@ -317,6 +322,7 @@ def test_mark_as_seen updated_at: Time, actors: ^(Knockapi::Internal::Type::ArrayOf[union: Knockapi::RecipientReference]) | nil, archived_at: Time | nil, + channel: Knockapi::Message::Channel | nil, clicked_at: Time | nil, data: ^(Knockapi::Internal::Type::HashOf[Knockapi::Internal::Type::Unknown]) | nil, interacted_at: Time | nil, @@ -353,6 +359,7 @@ def test_mark_as_unread updated_at: Time, actors: ^(Knockapi::Internal::Type::ArrayOf[union: Knockapi::RecipientReference]) | nil, archived_at: Time | nil, + channel: Knockapi::Message::Channel | nil, clicked_at: Time | nil, data: ^(Knockapi::Internal::Type::HashOf[Knockapi::Internal::Type::Unknown]) | nil, interacted_at: Time | nil, @@ -389,6 +396,7 @@ def test_mark_as_unseen updated_at: Time, actors: ^(Knockapi::Internal::Type::ArrayOf[union: Knockapi::RecipientReference]) | nil, archived_at: Time | nil, + channel: Knockapi::Message::Channel | nil, clicked_at: Time | nil, data: ^(Knockapi::Internal::Type::HashOf[Knockapi::Internal::Type::Unknown]) | nil, interacted_at: Time | nil, @@ -425,6 +433,7 @@ def test_unarchive updated_at: Time, actors: ^(Knockapi::Internal::Type::ArrayOf[union: Knockapi::RecipientReference]) | nil, archived_at: Time | nil, + channel: Knockapi::Message::Channel | nil, clicked_at: Time | nil, data: ^(Knockapi::Internal::Type::HashOf[Knockapi::Internal::Type::Unknown]) | nil, interacted_at: Time | nil, diff --git a/test/knockapi/resources/objects_test.rb b/test/knockapi/resources/objects_test.rb index d8560a9a..21f83923 100644 --- a/test/knockapi/resources/objects_test.rb +++ b/test/knockapi/resources/objects_test.rb @@ -150,6 +150,7 @@ def test_list_messages updated_at: Time, actors: ^(Knockapi::Internal::Type::ArrayOf[union: Knockapi::RecipientReference]) | nil, archived_at: Time | nil, + channel: Knockapi::Message::Channel | nil, clicked_at: Time | nil, data: ^(Knockapi::Internal::Type::HashOf[Knockapi::Internal::Type::Unknown]) | nil, interacted_at: Time | nil, diff --git a/test/knockapi/resources/users_test.rb b/test/knockapi/resources/users_test.rb index 26af2613..4408100d 100644 --- a/test/knockapi/resources/users_test.rb +++ b/test/knockapi/resources/users_test.rb @@ -159,6 +159,7 @@ def test_list_messages updated_at: Time, actors: ^(Knockapi::Internal::Type::ArrayOf[union: Knockapi::RecipientReference]) | nil, archived_at: Time | nil, + channel: Knockapi::Message::Channel | nil, clicked_at: Time | nil, data: ^(Knockapi::Internal::Type::HashOf[Knockapi::Internal::Type::Unknown]) | nil, interacted_at: Time | nil,