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.4.0"
".": "1.5.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-2c885f8f3762bcc577255242aa61b3ad890170497c865f664d8ab42c8872d97c.yml
openapi_spec_hash: e0f6dd3ae8329fa8b96d1ffdc937cbc9
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/knock%2Fknock-5ce0d88003acccf6111cd40663ad7b4d468696fc439fca41d88087ab84b465c3.yml
openapi_spec_hash: ff864d7f3cad6a98a0e39fee0fb2b16a
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.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)

### Features

* **api:** api update ([b4a8a6f](https://github.com/knocklabs/knock-ruby/commit/b4a8a6f6bd5451fb68be75c19b5b08b7629543cc))


### Bug Fixes

* `to_sorbet_type` should not return branded types ([2fe0597](https://github.com/knocklabs/knock-ruby/commit/2fe05973673d02ced0a04abc32f0ea079ff9313f))

## 1.4.0 (2025-05-29)

Full Changelog: [v1.3.0...v1.4.0](https://github.com/knocklabs/knock-ruby/compare/v1.3.0...v1.4.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.4.0)
knockapi (1.5.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.4.0"
gem "knockapi", "~> 1.5.0"
```

<!-- x-release-please-end -->
Expand Down
9 changes: 6 additions & 3 deletions lib/knockapi/internal/type/enum.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,14 @@ def coerce(value, state:)
#
# @return [Object]
def to_sorbet_type
case values
types = values.map { Knockapi::Internal::Util::SorbetRuntimeSupport.to_sorbet_type(_1) }.uniq
case types
in []
T.noreturn
in [value, *_]
T.all(Knockapi::Internal::Util::SorbetRuntimeSupport.to_sorbet_type(value), self)
in [type]
type
else
T.any(*types)
end
end

Expand Down
7 changes: 5 additions & 2 deletions lib/knockapi/internal/type/union.rb
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,14 @@ def dump(value, state:)
#
# @return [Object]
def to_sorbet_type
case (v = variants)
types = variants.map { Knockapi::Internal::Util::SorbetRuntimeSupport.to_sorbet_type(_1) }.uniq
case types
in []
T.noreturn
in [type]
type
else
T.any(*v.map { Knockapi::Internal::Util::SorbetRuntimeSupport.to_sorbet_type(_1) })
T.any(*types)
end
end

Expand Down
8 changes: 4 additions & 4 deletions lib/knockapi/models.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ module Knockapi
mod.constants.each do |name|
case mod.const_get(name)
in true | false
mod.define_sorbet_constant!(:TaggedBoolean) { T.type_alias { T.all(T::Boolean, mod) } }
mod.define_sorbet_constant!(:TaggedBoolean) { T.type_alias { T::Boolean } }
mod.define_sorbet_constant!(:OrBoolean) { T.type_alias { T::Boolean } }
in Integer
mod.define_sorbet_constant!(:TaggedInteger) { T.type_alias { T.all(Integer, mod) } }
mod.define_sorbet_constant!(:TaggedInteger) { T.type_alias { Integer } }
mod.define_sorbet_constant!(:OrInteger) { T.type_alias { Integer } }
in Float
mod.define_sorbet_constant!(:TaggedFloat) { T.type_alias { T.all(Float, mod) } }
mod.define_sorbet_constant!(:TaggedFloat) { T.type_alias { Float } }
mod.define_sorbet_constant!(:OrFloat) { T.type_alias { Float } }
in Symbol
mod.define_sorbet_constant!(:TaggedSymbol) { T.type_alias { T.all(Symbol, mod) } }
mod.define_sorbet_constant!(:TaggedSymbol) { T.type_alias { Symbol } }
mod.define_sorbet_constant!(:OrSymbol) { T.type_alias { T.any(Symbol, String) } }
else
end
Expand Down
28 changes: 19 additions & 9 deletions lib/knockapi/models/schedule_create_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,20 @@ class ScheduleCreateParams < Knockapi::Internal::Type::BaseModel
# @return [Array<String, Knockapi::Models::InlineIdentifyUserRequest, Knockapi::Models::InlineObjectRequest>]
required :recipients, -> { Knockapi::Internal::Type::ArrayOf[union: Knockapi::RecipientRequest] }

# @!attribute repeats
# The repeat rule for the schedule.
#
# @return [Array<Knockapi::Models::ScheduleRepeatRule>]
required :repeats, -> { Knockapi::Internal::Type::ArrayOf[Knockapi::ScheduleRepeatRule] }

# @!attribute workflow
# The key of the workflow.
#
# @return [String]
required :workflow, String

# @!attribute actor
# Specifies a recipient in a request. This can either be a user identifier
# (string), an inline user request (object), or an inline object request, which is
# determined by the presence of a `collection` property.
#
# @return [String, Knockapi::Models::InlineIdentifyUserRequest, Knockapi::Models::InlineObjectRequest, nil]
optional :actor, union: -> { Knockapi::RecipientRequest }, nil?: true

# @!attribute data
# An optional map of data to pass into the workflow execution. There is a 1024
# byte limit on the size of any single string value (with the exception of
Expand All @@ -40,6 +42,12 @@ class ScheduleCreateParams < Knockapi::Internal::Type::BaseModel
# @return [Time, nil]
optional :ending_at, Time, nil?: true

# @!attribute repeats
# The repeat rule for the schedule.
#
# @return [Array<Knockapi::Models::ScheduleRepeatRule>, nil]
optional :repeats, -> { Knockapi::Internal::Type::ArrayOf[Knockapi::ScheduleRepeatRule] }

# @!attribute scheduled_at
# The starting date and time for the schedule.
#
Expand All @@ -52,20 +60,22 @@ class ScheduleCreateParams < Knockapi::Internal::Type::BaseModel
# @return [String, Knockapi::Models::TenantRequest, nil]
optional :tenant, union: -> { Knockapi::InlineTenantRequest }, nil?: true

# @!method initialize(recipients:, repeats:, workflow:, data: nil, ending_at: nil, scheduled_at: nil, tenant: nil, request_options: {})
# @!method initialize(recipients:, workflow:, actor: nil, data: nil, ending_at: nil, repeats: nil, scheduled_at: nil, tenant: nil, request_options: {})
# Some parameter documentations has been truncated, see
# {Knockapi::Models::ScheduleCreateParams} for more details.
#
# @param recipients [Array<String, Knockapi::Models::InlineIdentifyUserRequest, Knockapi::Models::InlineObjectRequest>] The recipients to set the schedule for. Limited to 100 recipients per request.
#
# @param repeats [Array<Knockapi::Models::ScheduleRepeatRule>] The repeat rule for the schedule.
#
# @param workflow [String] The key of the workflow.
#
# @param actor [String, Knockapi::Models::InlineIdentifyUserRequest, Knockapi::Models::InlineObjectRequest, nil] Specifies a recipient in a request. This can either be a user identifier (string
#
# @param data [Hash{Symbol=>Object}, nil] An optional map of data to pass into the workflow execution. There is a 1024 byt
#
# @param ending_at [Time, nil] The ending date and time for the schedule.
#
# @param repeats [Array<Knockapi::Models::ScheduleRepeatRule>] The repeat rule for the schedule.
#
# @param scheduled_at [Time, nil] The starting date and time for the schedule.
#
# @param tenant [String, Knockapi::Models::TenantRequest, nil] An request to set a tenant inline.
Expand Down
8 changes: 5 additions & 3 deletions lib/knockapi/resources/schedules.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,20 @@ class Schedules
# [inline identifications](/managing-recipients/identifying-recipients#inline-identifying-recipients)
# for the `actor`, `recipient`, and `tenant` fields.
#
# @overload create(recipients:, repeats:, workflow:, data: nil, ending_at: nil, scheduled_at: nil, tenant: nil, request_options: {})
# @overload create(recipients:, workflow:, actor: nil, data: nil, ending_at: nil, repeats: nil, scheduled_at: nil, tenant: nil, request_options: {})
#
# @param recipients [Array<String, Knockapi::Models::InlineIdentifyUserRequest, Knockapi::Models::InlineObjectRequest>] The recipients to set the schedule for. Limited to 100 recipients per request.
#
# @param repeats [Array<Knockapi::Models::ScheduleRepeatRule>] The repeat rule for the schedule.
#
# @param workflow [String] The key of the workflow.
#
# @param actor [String, Knockapi::Models::InlineIdentifyUserRequest, Knockapi::Models::InlineObjectRequest, nil] Specifies a recipient in a request. This can either be a user identifier (string
#
# @param data [Hash{Symbol=>Object}, nil] An optional map of data to pass into the workflow execution. There is a 1024 byt
#
# @param ending_at [Time, nil] The ending date and time for the schedule.
#
# @param repeats [Array<Knockapi::Models::ScheduleRepeatRule>] The repeat rule for the schedule.
#
# @param scheduled_at [Time, nil] The starting date and time for the schedule.
#
# @param tenant [String, Knockapi::Models::TenantRequest, nil] An request to set a tenant inline.
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.4.0"
VERSION = "1.5.0"
end
57 changes: 49 additions & 8 deletions rbi/knockapi/models/schedule_create_params.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,26 @@ module Knockapi
end
attr_accessor :recipients

# The repeat rule for the schedule.
sig { returns(T::Array[Knockapi::ScheduleRepeatRule]) }
attr_accessor :repeats

# The key of the workflow.
sig { returns(String) }
attr_accessor :workflow

# Specifies a recipient in a request. This can either be a user identifier
# (string), an inline user request (object), or an inline object request, which is
# determined by the presence of a `collection` property.
sig do
returns(
T.nilable(
T.any(
String,
Knockapi::InlineIdentifyUserRequest,
Knockapi::InlineObjectRequest
)
)
)
end
attr_accessor :actor

# An optional map of data to pass into the workflow execution. There is a 1024
# byte limit on the size of any single string value (with the exception of
# [email attachments](/integrations/email/attachments)), and a 10MB limit on the
Expand All @@ -44,6 +56,15 @@ module Knockapi
sig { returns(T.nilable(Time)) }
attr_accessor :ending_at

# The repeat rule for the schedule.
sig { returns(T.nilable(T::Array[Knockapi::ScheduleRepeatRule])) }
attr_reader :repeats

sig do
params(repeats: T::Array[Knockapi::ScheduleRepeatRule::OrHash]).void
end
attr_writer :repeats

# The starting date and time for the schedule.
sig { returns(T.nilable(Time)) }
attr_accessor :scheduled_at
Expand All @@ -62,10 +83,18 @@ module Knockapi
Knockapi::InlineObjectRequest::OrHash
)
],
repeats: T::Array[Knockapi::ScheduleRepeatRule::OrHash],
workflow: String,
actor:
T.nilable(
T.any(
String,
Knockapi::InlineIdentifyUserRequest::OrHash,
Knockapi::InlineObjectRequest::OrHash
)
),
data: T.nilable(T::Hash[Symbol, T.anything]),
ending_at: T.nilable(Time),
repeats: T::Array[Knockapi::ScheduleRepeatRule::OrHash],
scheduled_at: T.nilable(Time),
tenant: T.nilable(T.any(String, Knockapi::TenantRequest::OrHash)),
request_options: Knockapi::RequestOptions::OrHash
Expand All @@ -74,17 +103,21 @@ module Knockapi
def self.new(
# The recipients to set the schedule for. Limited to 100 recipients per request.
recipients:,
# The repeat rule for the schedule.
repeats:,
# The key of the workflow.
workflow:,
# Specifies a recipient in a request. This can either be a user identifier
# (string), an inline user request (object), or an inline object request, which is
# determined by the presence of a `collection` property.
actor: nil,
# An optional map of data to pass into the workflow execution. There is a 1024
# byte limit on the size of any single string value (with the exception of
# [email attachments](/integrations/email/attachments)), and a 10MB limit on the
# size of the full `data` payload.
data: nil,
# The ending date and time for the schedule.
ending_at: nil,
# The repeat rule for the schedule.
repeats: nil,
# The starting date and time for the schedule.
scheduled_at: nil,
# An request to set a tenant inline.
Expand All @@ -104,10 +137,18 @@ module Knockapi
Knockapi::InlineObjectRequest
)
],
repeats: T::Array[Knockapi::ScheduleRepeatRule],
workflow: String,
actor:
T.nilable(
T.any(
String,
Knockapi::InlineIdentifyUserRequest,
Knockapi::InlineObjectRequest
)
),
data: T.nilable(T::Hash[Symbol, T.anything]),
ending_at: T.nilable(Time),
repeats: T::Array[Knockapi::ScheduleRepeatRule],
scheduled_at: T.nilable(Time),
tenant: T.nilable(T.any(String, Knockapi::TenantRequest)),
request_options: Knockapi::RequestOptions
Expand Down
18 changes: 15 additions & 3 deletions rbi/knockapi/resources/schedules.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,18 @@ module Knockapi
Knockapi::InlineObjectRequest::OrHash
)
],
repeats: T::Array[Knockapi::ScheduleRepeatRule::OrHash],
workflow: String,
actor:
T.nilable(
T.any(
String,
Knockapi::InlineIdentifyUserRequest::OrHash,
Knockapi::InlineObjectRequest::OrHash
)
),
data: T.nilable(T::Hash[Symbol, T.anything]),
ending_at: T.nilable(Time),
repeats: T::Array[Knockapi::ScheduleRepeatRule::OrHash],
scheduled_at: T.nilable(Time),
tenant: T.nilable(T.any(String, Knockapi::TenantRequest::OrHash)),
request_options: Knockapi::RequestOptions::OrHash
Expand All @@ -33,17 +41,21 @@ module Knockapi
def create(
# The recipients to set the schedule for. Limited to 100 recipients per request.
recipients:,
# The repeat rule for the schedule.
repeats:,
# The key of the workflow.
workflow:,
# Specifies a recipient in a request. This can either be a user identifier
# (string), an inline user request (object), or an inline object request, which is
# determined by the presence of a `collection` property.
actor: nil,
# An optional map of data to pass into the workflow execution. There is a 1024
# byte limit on the size of any single string value (with the exception of
# [email attachments](/integrations/email/attachments)), and a 10MB limit on the
# size of the full `data` payload.
data: nil,
# The ending date and time for the schedule.
ending_at: nil,
# The repeat rule for the schedule.
repeats: nil,
# The starting date and time for the schedule.
scheduled_at: nil,
# An request to set a tenant inline.
Expand Down
Loading