Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.5.0"
".": "1.6.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 89
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/knock%2Fknock-5ce0d88003acccf6111cd40663ad7b4d468696fc439fca41d88087ab84b465c3.yml
openapi_spec_hash: ff864d7f3cad6a98a0e39fee0fb2b16a
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/knock%2Fknock-e5a7933b414d403d082b34db140fc5b8dca9a5ea3ae322f640b0f9f055c47288.yml
openapi_spec_hash: 3740dc4d5c1f5a0c9ee6de9e40931fd4
config_hash: 2ae8965d371a03bd30c6a56819c04cf2
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 1.6.0 (2025-06-06)

Full Changelog: [v1.5.0...v1.6.0](https://github.com/knocklabs/knock-ruby/compare/v1.5.0...v1.6.0)

### Features

* **api:** api update ([53aa9c9](https://github.com/knocklabs/knock-ruby/commit/53aa9c9ebd4a8e7be2fd5bdf08a4b749f6b9d116))


### Bug Fixes

* default content-type for text in multi-part formdata uploads should be text/plain ([de655f0](https://github.com/knocklabs/knock-ruby/commit/de655f0dd9194b4c30d7ad26e2da98f6cba51a0f))

## 1.5.0 (2025-06-04)

Full Changelog: [v1.4.0...v1.5.0](https://github.com/knocklabs/knock-ruby/compare/v1.4.0...v1.5.0)
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GIT
PATH
remote: .
specs:
knockapi (1.5.0)
knockapi (1.6.0)
connection_pool

GEM
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
<!-- x-release-please-start-version -->

```ruby
gem "knockapi", "~> 1.5.0"
gem "knockapi", "~> 1.6.0"
```

<!-- x-release-please-end -->
Expand Down
17 changes: 8 additions & 9 deletions lib/knockapi/internal/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ class << self
# @param closing [Array<Proc>]
# @param content_type [String, nil]
private def write_multipart_content(y, val:, closing:, content_type: nil)
content_type ||= "application/octet-stream"
content_line = "Content-Type: %s\r\n\r\n"

case val
in Knockapi::FilePart
Expand All @@ -508,24 +508,21 @@ class << self
content_type: val.content_type
)
in Pathname
y << "Content-Type: #{content_type}\r\n\r\n"
y << format(content_line, content_type || "application/octet-stream")
io = val.open(binmode: true)
closing << io.method(:close)
IO.copy_stream(io, y)
in IO
y << "Content-Type: #{content_type}\r\n\r\n"
y << format(content_line, content_type || "application/octet-stream")
IO.copy_stream(val, y)
in StringIO
y << "Content-Type: #{content_type}\r\n\r\n"
y << format(content_line, content_type || "application/octet-stream")
y << val.string
in String
y << "Content-Type: #{content_type}\r\n\r\n"
y << val.to_s
in -> { primitive?(_1) }
y << "Content-Type: text/plain\r\n\r\n"
y << format(content_line, content_type || "text/plain")
y << val.to_s
else
y << "Content-Type: application/json\r\n\r\n"
y << format(content_line, content_type || "application/json")
y << JSON.generate(val)
end
y << "\r\n"
Expand Down Expand Up @@ -563,6 +560,8 @@ class << self

# @api private
#
# https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#special-considerations-for-multipart-content
#
# @param body [Object]
#
# @return [Array(String, Enumerable<String>)]
Expand Down
49 changes: 46 additions & 3 deletions lib/knockapi/models/objects/bulk_set_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,56 @@ class BulkSetParams < Knockapi::Internal::Type::BaseModel
# @!attribute objects
# A list of objects.
#
# @return [Array<Knockapi::Models::InlineObjectRequest>]
required :objects, -> { Knockapi::Internal::Type::ArrayOf[Knockapi::InlineObjectRequest] }
# @return [Array<Knockapi::Models::Objects::BulkSetParams::Object>]
required :objects, -> { Knockapi::Internal::Type::ArrayOf[Knockapi::Objects::BulkSetParams::Object] }

# @!method initialize(objects:, request_options: {})
# @param objects [Array<Knockapi::Models::InlineObjectRequest>] A list of objects.
# @param objects [Array<Knockapi::Models::Objects::BulkSetParams::Object>] A list of objects.
#
# @param request_options [Knockapi::RequestOptions, Hash{Symbol=>Object}]

class Object < Knockapi::Internal::Type::BaseModel
# @!attribute id
# Unique identifier for the object.
#
# @return [String]
required :id, String

# @!attribute channel_data
# A request to set channel data for a type of channel inline.
#
# @return [Hash{Symbol=>Knockapi::Models::Recipients::PushChannelData, Knockapi::Models::Recipients::OneSignalChannelData, Knockapi::Models::Recipients::SlackChannelData, Knockapi::Models::Recipients::MsTeamsChannelData, Knockapi::Models::Recipients::DiscordChannelData}, nil]
optional :channel_data,
-> {
Knockapi::Internal::Type::HashOf[union: Knockapi::Recipients::InlineChannelDataRequestItem]
},
nil?: true

# @!attribute created_at
# Timestamp when the resource was created.
#
# @return [Time, nil]
optional :created_at, Time, nil?: true

# @!attribute preferences
# Inline set preferences for a recipient, where the key is the preference set id.
#
# @return [Hash{Symbol=>Knockapi::Models::Recipients::PreferenceSetRequest}, nil]
optional :preferences,
-> { Knockapi::Internal::Type::HashOf[Knockapi::Recipients::PreferenceSetRequest] },
nil?: true

# @!method initialize(id:, channel_data: nil, created_at: nil, preferences: nil)
# A custom [Object](/concepts/objects) entity which belongs to a collection.
#
# @param id [String] Unique identifier for the object.
#
# @param channel_data [Hash{Symbol=>Knockapi::Models::Recipients::PushChannelData, Knockapi::Models::Recipients::OneSignalChannelData, Knockapi::Models::Recipients::SlackChannelData, Knockapi::Models::Recipients::MsTeamsChannelData, Knockapi::Models::Recipients::DiscordChannelData}, nil] A request to set channel data for a type of channel inline.
#
# @param created_at [Time, nil] Timestamp when the resource was created.
#
# @param preferences [Hash{Symbol=>Knockapi::Models::Recipients::PreferenceSetRequest}, nil] Inline set preferences for a recipient, where the key is the preference set id.
end
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions lib/knockapi/models/schedule_list_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ class ScheduleListParams < Knockapi::Internal::Type::BaseModel
optional :page_size, Integer

# @!attribute recipients
# Filter by recipient IDs.
# Filter by recipient references.
#
# @return [Array<String>, nil]
optional :recipients, Knockapi::Internal::Type::ArrayOf[String]
# @return [Array<String, Knockapi::Models::RecipientReference::ObjectReference>, nil]
optional :recipients, -> { Knockapi::Internal::Type::ArrayOf[union: Knockapi::RecipientReference] }

# @!attribute tenant
# Filter by tenant ID.
Expand All @@ -52,7 +52,7 @@ class ScheduleListParams < Knockapi::Internal::Type::BaseModel
#
# @param page_size [Integer] The number of items per page.
#
# @param recipients [Array<String>] Filter by recipient IDs.
# @param recipients [Array<String, Knockapi::Models::RecipientReference::ObjectReference>] Filter by recipient references.
#
# @param tenant [String] Filter by tenant ID.
#
Expand Down
18 changes: 9 additions & 9 deletions lib/knockapi/models/schedule_repeat_rule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
module Knockapi
module Models
class ScheduleRepeatRule < Knockapi::Internal::Type::BaseModel
# @!attribute _typename
# The typename of the schema.
#
# @return [String]
required :_typename, String, api_name: :__typename

# @!attribute frequency
# The frequency of the schedule.
#
# @return [Symbol, Knockapi::Models::ScheduleRepeatRule::Frequency]
required :frequency, enum: -> { Knockapi::ScheduleRepeatRule::Frequency }

# @!attribute _typename
# The typename of the schema.
#
# @return [String, nil]
optional :_typename, String, api_name: :__typename

# @!attribute day_of_month
# The day of the month to repeat the schedule.
#
Expand Down Expand Up @@ -47,13 +47,13 @@ class ScheduleRepeatRule < Knockapi::Internal::Type::BaseModel
# @return [Integer, nil]
optional :minutes, Integer, nil?: true

# @!method initialize(_typename:, frequency:, day_of_month: nil, days: nil, hours: nil, interval: nil, minutes: nil)
# @!method initialize(frequency:, _typename: nil, day_of_month: nil, days: nil, hours: nil, interval: nil, minutes: nil)
# The repeat rule for the schedule.
#
# @param _typename [String] The typename of the schema.
#
# @param frequency [Symbol, Knockapi::Models::ScheduleRepeatRule::Frequency] The frequency of the schedule.
#
# @param _typename [String] The typename of the schema.
#
# @param day_of_month [Integer, nil] The day of the month to repeat the schedule.
#
# @param days [Array<Symbol, Knockapi::Models::ScheduleRepeatRule::Day>, nil] The days of the week to repeat the schedule.
Expand Down
12 changes: 1 addition & 11 deletions lib/knockapi/models/tenant_set_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,15 @@ class TenantSetParams < Knockapi::Internal::Type::BaseModel
},
nil?: true

# @!attribute preferences
# Inline set preferences for a recipient, where the key is the preference set id.
#
# @return [Hash{Symbol=>Knockapi::Models::Recipients::PreferenceSetRequest}, nil]
optional :preferences,
-> { Knockapi::Internal::Type::HashOf[Knockapi::Recipients::PreferenceSetRequest] },
nil?: true

# @!attribute settings
# The settings for the tenant. Includes branding and preference set.
#
# @return [Knockapi::Models::TenantSetParams::Settings, nil]
optional :settings, -> { Knockapi::TenantSetParams::Settings }

# @!method initialize(channel_data: nil, preferences: nil, settings: nil, request_options: {})
# @!method initialize(channel_data: nil, settings: nil, request_options: {})
# @param channel_data [Hash{Symbol=>Knockapi::Models::Recipients::PushChannelData, Knockapi::Models::Recipients::OneSignalChannelData, Knockapi::Models::Recipients::SlackChannelData, Knockapi::Models::Recipients::MsTeamsChannelData, Knockapi::Models::Recipients::DiscordChannelData}, nil] A request to set channel data for a type of channel inline.
#
# @param preferences [Hash{Symbol=>Knockapi::Models::Recipients::PreferenceSetRequest}, nil] Inline set preferences for a recipient, where the key is the preference set id.
#
# @param settings [Knockapi::Models::TenantSetParams::Settings] The settings for the tenant. Includes branding and preference set.
#
# @param request_options [Knockapi::RequestOptions, Hash{Symbol=>Object}]
Expand Down
8 changes: 4 additions & 4 deletions lib/knockapi/models/user_list_subscriptions_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ class UserListSubscriptionsParams < Knockapi::Internal::Type::BaseModel
-> { Knockapi::Internal::Type::ArrayOf[enum: Knockapi::UserListSubscriptionsParams::Include] }

# @!attribute objects
# Only returns subscriptions for the specified object GIDs.
# Only returns subscriptions for the specified object references.
#
# @return [Array<String>, nil]
optional :objects, Knockapi::Internal::Type::ArrayOf[String]
# @return [Array<String, Knockapi::Models::RecipientReference::ObjectReference>, nil]
optional :objects, -> { Knockapi::Internal::Type::ArrayOf[union: Knockapi::RecipientReference] }

# @!attribute page_size
# The number of items per page.
Expand All @@ -45,7 +45,7 @@ class UserListSubscriptionsParams < Knockapi::Internal::Type::BaseModel
#
# @param include [Array<Symbol, Knockapi::Models::UserListSubscriptionsParams::Include>] Associated resources to include in the response.
#
# @param objects [Array<String>] Only returns subscriptions for the specified object GIDs.
# @param objects [Array<String, Knockapi::Models::RecipientReference::ObjectReference>] Only returns subscriptions for the specified object references.
#
# @param page_size [Integer] The number of items per page.
#
Expand Down
2 changes: 1 addition & 1 deletion lib/knockapi/resources/objects/bulk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def add_subscriptions(collection, params)
#
# @param collection [String] The collection this object belongs to.
#
# @param objects [Array<Knockapi::Models::InlineObjectRequest>] A list of objects.
# @param objects [Array<Knockapi::Models::Objects::BulkSetParams::Object>] A list of objects.
#
# @param request_options [Knockapi::RequestOptions, Hash{Symbol=>Object}, nil]
#
Expand Down
2 changes: 1 addition & 1 deletion lib/knockapi/resources/schedules.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def update(params)
#
# @param page_size [Integer] The number of items per page.
#
# @param recipients [Array<String>] Filter by recipient IDs.
# @param recipients [Array<String, Knockapi::Models::RecipientReference::ObjectReference>] Filter by recipient references.
#
# @param tenant [String] Filter by tenant ID.
#
Expand Down
4 changes: 1 addition & 3 deletions lib/knockapi/resources/tenants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,12 @@ def get(id, params = {})
# Sets a tenant within an environment, performing an upsert operation. Any
# existing properties will be merged with the incoming properties.
#
# @overload set(id, channel_data: nil, preferences: nil, settings: nil, request_options: {})
# @overload set(id, channel_data: nil, settings: nil, request_options: {})
#
# @param id [String] The unique identifier for the tenant.
#
# @param channel_data [Hash{Symbol=>Knockapi::Models::Recipients::PushChannelData, Knockapi::Models::Recipients::OneSignalChannelData, Knockapi::Models::Recipients::SlackChannelData, Knockapi::Models::Recipients::MsTeamsChannelData, Knockapi::Models::Recipients::DiscordChannelData}, nil] A request to set channel data for a type of channel inline.
#
# @param preferences [Hash{Symbol=>Knockapi::Models::Recipients::PreferenceSetRequest}, nil] Inline set preferences for a recipient, where the key is the preference set id.
#
# @param settings [Knockapi::Models::TenantSetParams::Settings] The settings for the tenant. Includes branding and preference set.
#
# @param request_options [Knockapi::RequestOptions, Hash{Symbol=>Object}, nil]
Expand Down
2 changes: 1 addition & 1 deletion lib/knockapi/resources/users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def list_schedules(user_id, params = {})
#
# @param include [Array<Symbol, Knockapi::Models::UserListSubscriptionsParams::Include>] Associated resources to include in the response.
#
# @param objects [Array<String>] Only returns subscriptions for the specified object GIDs.
# @param objects [Array<String, Knockapi::Models::RecipientReference::ObjectReference>] Only returns subscriptions for the specified object references.
#
# @param page_size [Integer] The number of items per page.
#
Expand Down
2 changes: 1 addition & 1 deletion lib/knockapi/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Knockapi
VERSION = "1.5.0"
VERSION = "1.6.0"
end
2 changes: 2 additions & 0 deletions rbi/knockapi/internal/util.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,8 @@ module Knockapi
end

# @api private
#
# https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#special-considerations-for-multipart-content
sig do
params(body: T.anything).returns([String, T::Enumerable[String]])
end
Expand Down
Loading