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 @@
{
".": "0.1.0-alpha.25"
".": "0.1.0-alpha.26"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 46
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-73c284d36c1ed2d9963fc733e421005fad76e559de8efe9baa6511a43dd72668.yml
openapi_spec_hash: 1e58c4445919b71c77e5c7f16bd6fa7d
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-e8b684dbd61d1724b5e516a573a952bb6906d63840e27ebda7731a2f71061aff.yml
openapi_spec_hash: 8baff9577d4e721d0494ff315da267ca
config_hash: 5146b12344dae76238940989dac1e8a0
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# Changelog

## 0.1.0-alpha.26 (2025-08-14)

Full Changelog: [v0.1.0-alpha.25...v0.1.0-alpha.26](https://github.com/Finch-API/finch-api-ruby/compare/v0.1.0-alpha.25...v0.1.0-alpha.26)

### Features

* **api:** api update ([80b711b](https://github.com/Finch-API/finch-api-ruby/commit/80b711bc0c917ce1f1f4daaac3301b5c8e5bd1e7))
* **api:** api update ([5b2d8f2](https://github.com/Finch-API/finch-api-ruby/commit/5b2d8f2d1c30039ca4d4c5acfa055b5c60acefb9))


### Bug Fixes

* **client:** prioritise bearer auth ([d8817a5](https://github.com/Finch-API/finch-api-ruby/commit/d8817a5e6c6f289dc1dd1a5a5ad35c43049d1f0e))


### Chores

* collect metadata from type DSL ([e919ec0](https://github.com/Finch-API/finch-api-ruby/commit/e919ec0b110aa3a5ba703bf9dd317b2ea4091a28))
* **internal:** update comment in script ([5969020](https://github.com/Finch-API/finch-api-ruby/commit/59690202144cf2295b6edc7542f10cd6932b0da2))
* update @stainless-api/prism-cli to v5.15.0 ([2953337](https://github.com/Finch-API/finch-api-ruby/commit/29533376815ef4be96be5fde8de45fcf3f48a232))

## 0.1.0-alpha.25 (2025-07-31)

Full Changelog: [v0.1.0-alpha.24...v0.1.0-alpha.25](https://github.com/Finch-API/finch-api-ruby/compare/v0.1.0-alpha.24...v0.1.0-alpha.25)
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:
finch-api (0.1.0.pre.alpha.23)
finch-api (0.1.0.pre.alpha.26)
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 "finch-api", "~> 0.1.0.pre.alpha.25"
gem "finch-api", "~> 0.1.0.pre.alpha.26"
```

<!-- x-release-please-end -->
Expand Down
4 changes: 3 additions & 1 deletion lib/finch_api/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ class Client < FinchAPI::Internal::Transport::BaseClient
#
# @return [Hash{String=>String}]
private def auth_headers
{**bearer_auth, **basic_auth}
return bearer_auth unless bearer_auth.empty?
return basic_auth unless basic_auth.empty?
{}
Comment on lines +61 to +63

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

end

# @api private
Expand Down
1 change: 1 addition & 0 deletions lib/finch_api/internal/type/array_of.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ def to_sorbet_type
# @option spec [Boolean] :"nil?"
def initialize(type_info, spec = {})
@item_type_fn = FinchAPI::Internal::Type::Converter.type_info(type_info || spec)
@meta = FinchAPI::Internal::Type::Converter.meta_info(type_info, spec)
@nilable = spec.fetch(:nil?, false)
end

Expand Down
4 changes: 3 additions & 1 deletion lib/finch_api/internal/type/base_model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def fields
#
# @option spec [Boolean] :"nil?"
private def add_field(name_sym, required:, type_info:, spec:)
meta = FinchAPI::Internal::Type::Converter.meta_info(type_info, spec)
type_fn, info =
case type_info
in Proc | FinchAPI::Internal::Type::Converter | Class
Expand Down Expand Up @@ -81,7 +82,8 @@ def fields
required: required,
nilable: nilable,
const: const,
type_fn: type_fn
type_fn: type_fn,
meta: meta
}

define_method(setter) do |value|
Expand Down
27 changes: 27 additions & 0 deletions lib/finch_api/internal/type/converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,33 @@ def type_info(spec)
end
end

# @api private
#
# @param type_info [Hash{Symbol=>Object}, Proc, FinchAPI::Internal::Type::Converter, Class] .
#
# @option type_info [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const
#
# @option type_info [Proc] :enum
#
# @option type_info [Proc] :union
#
# @option type_info [Boolean] :"nil?"
#
# @param spec [Hash{Symbol=>Object}, Proc, FinchAPI::Internal::Type::Converter, Class] .
#
# @option spec [NilClass, TrueClass, FalseClass, Integer, Float, Symbol] :const
#
# @option spec [Proc] :enum
#
# @option spec [Proc] :union
#
# @option spec [Boolean] :"nil?"
#
# @return [Hash{Symbol=>Object}]
def meta_info(type_info, spec)
[spec, type_info].grep(Hash).first.to_h.except(:const, :enum, :union, :nil?)
end

# @api private
#
# @param translate_names [Boolean]
Expand Down
1 change: 1 addition & 0 deletions lib/finch_api/internal/type/hash_of.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ def to_sorbet_type
# @option spec [Boolean] :"nil?"
def initialize(type_info, spec = {})
@item_type_fn = FinchAPI::Internal::Type::Converter.type_info(type_info || spec)
@meta = FinchAPI::Internal::Type::Converter.meta_info(type_info, spec)
@nilable = spec.fetch(:nil?, false)
end

Expand Down
16 changes: 9 additions & 7 deletions lib/finch_api/internal/type/union.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,20 @@ module Union
#
# All of the specified variant info for this union.
#
# @return [Array<Array(Symbol, Proc)>]
# @return [Array<Array(Symbol, Proc, Hash{Symbol=>Object})>]
private def known_variants = (@known_variants ||= [])

# @api private
#
# @return [Array<Array(Symbol, Object)>]
# @return [Array<Array(Symbol, Object, Hash{Symbol=>Object})>]
protected def derefed_variants
known_variants.map { |key, variant_fn| [key, variant_fn.call] }
known_variants.map { |key, variant_fn, meta| [key, variant_fn.call, meta] }
end

# All of the specified variants for this union.
#
# @return [Array<Object>]
def variants = derefed_variants.map(&:last)
def variants = derefed_variants.map { _2 }

# @api private
#
Expand All @@ -72,12 +72,13 @@ def variants = derefed_variants.map(&:last)
#
# @option spec [Boolean] :"nil?"
private def variant(key, spec = nil)
meta = FinchAPI::Internal::Type::Converter.meta_info(nil, spec)
variant_info =
case key
in Symbol
[key, FinchAPI::Internal::Type::Converter.type_info(spec)]
[key, FinchAPI::Internal::Type::Converter.type_info(spec), meta]
in Proc | FinchAPI::Internal::Type::Converter | Class | Hash
[nil, FinchAPI::Internal::Type::Converter.type_info(key)]
[nil, FinchAPI::Internal::Type::Converter.type_info(key), meta]
end

known_variants << variant_info
Expand All @@ -100,7 +101,8 @@ def variants = derefed_variants.map(&:last)
return nil if key == FinchAPI::Internal::OMIT

key = key.to_sym if key.is_a?(String)
known_variants.find { |k,| k == key }&.last&.call
_, found = known_variants.find { |k,| k == key }
found&.call
else
nil
end
Expand Down
4 changes: 2 additions & 2 deletions lib/finch_api/models/disconnect_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ module Models
# @see FinchAPI::Resources::Account#disconnect
class DisconnectResponse < FinchAPI::Internal::Type::BaseModel
# @!attribute status
# If the request is successful, Finch will return success (HTTP 200 status).
# If the request is successful, Finch will return "success" (HTTP 200 status).
#
# @return [String]
required :status, String

# @!method initialize(status:)
# @param status [String] If the request is successful, Finch will return success (HTTP 200 status).
# @param status [String] If the request is successful, Finch will return "success" (HTTP 200 status).
end
end
end
2 changes: 1 addition & 1 deletion lib/finch_api/models/jobs/automated_async_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class AutomatedAsyncJob < FinchAPI::Internal::Type::BaseModel
# @!attribute scheduled_at
# The datetime a job is scheduled to be run. For scheduled jobs, this datetime can
# be in the future if the job has not yet been enqueued. For ad-hoc jobs, this
# field will be null.
# field will be null.
#
# @return [Time, nil]
required :scheduled_at, Time, nil?: true
Expand Down
15 changes: 14 additions & 1 deletion lib/finch_api/models/jobs/automated_list_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ class AutomatedListParams < FinchAPI::Internal::Type::BaseModel
extend FinchAPI::Internal::Type::RequestParameters::Converter
include FinchAPI::Internal::Type::RequestParameters

# @!attribute entity_id
# The entity ID to use when authenticating with a multi-account token. Required
# when using a multi-account token to specify which entity's data to access.
# Example: `123e4567-e89b-12d3-a456-426614174000`
#
# @return [String, nil]
optional :entity_id, String

# @!attribute limit
# Number of items to return
#
Expand All @@ -20,7 +28,12 @@ class AutomatedListParams < FinchAPI::Internal::Type::BaseModel
# @return [Integer, nil]
optional :offset, Integer

# @!method initialize(limit: nil, offset: nil, request_options: {})
# @!method initialize(entity_id: nil, limit: nil, offset: nil, request_options: {})
# Some parameter documentations has been truncated, see
# {FinchAPI::Models::Jobs::AutomatedListParams} for more details.
#
# @param entity_id [String] The entity ID to use when authenticating with a multi-account token. Required wh
#
# @param limit [Integer] Number of items to return
#
# @param offset [Integer] Index to start from (defaults to 0)
Expand Down
15 changes: 14 additions & 1 deletion lib/finch_api/models/jobs/automated_retrieve_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,20 @@ class AutomatedRetrieveParams < FinchAPI::Internal::Type::BaseModel
extend FinchAPI::Internal::Type::RequestParameters::Converter
include FinchAPI::Internal::Type::RequestParameters

# @!method initialize(request_options: {})
# @!attribute entity_id
# The entity ID to use when authenticating with a multi-account token. Required
# when using a multi-account token to specify which entity's data to access.
# Example: `123e4567-e89b-12d3-a456-426614174000`
#
# @return [String, nil]
optional :entity_id, String

# @!method initialize(entity_id: nil, request_options: {})
# Some parameter documentations has been truncated, see
# {FinchAPI::Models::Jobs::AutomatedRetrieveParams} for more details.
#
# @param entity_id [String] The entity ID to use when authenticating with a multi-account token. Required wh
#
# @param request_options [FinchAPI::RequestOptions, Hash{Symbol=>Object}]
end
end
Expand Down
8 changes: 5 additions & 3 deletions lib/finch_api/models/jobs/manual_async_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ class ManualAsyncJob < FinchAPI::Internal::Type::BaseModel
# @!attribute body
# Specific information about the job, such as individual statuses for batch jobs.
#
# @return [Array<Object>, nil]
required :body, FinchAPI::Internal::Type::ArrayOf[FinchAPI::Internal::Type::Unknown], nil?: true
# @return [Array<Object, nil>, nil]
required :body,
FinchAPI::Internal::Type::ArrayOf[FinchAPI::Internal::Type::Unknown, nil?: true],
nil?: true

# @!attribute job_id
#
Expand All @@ -22,7 +24,7 @@ class ManualAsyncJob < FinchAPI::Internal::Type::BaseModel
required :status, enum: -> { FinchAPI::Jobs::ManualAsyncJob::Status }

# @!method initialize(body:, job_id:, status:)
# @param body [Array<Object>, nil] Specific information about the job, such as individual statuses for batch jobs.
# @param body [Array<Object, nil>, nil] Specific information about the job, such as individual statuses for batch jobs.
#
# @param job_id [String]
#
Expand Down
15 changes: 14 additions & 1 deletion lib/finch_api/models/jobs/manual_retrieve_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,20 @@ class ManualRetrieveParams < FinchAPI::Internal::Type::BaseModel
extend FinchAPI::Internal::Type::RequestParameters::Converter
include FinchAPI::Internal::Type::RequestParameters

# @!method initialize(request_options: {})
# @!attribute entity_id
# The entity ID to use when authenticating with a multi-account token. Required
# when using a multi-account token to specify which entity's data to access.
# Example: `123e4567-e89b-12d3-a456-426614174000`
#
# @return [String, nil]
optional :entity_id, String

# @!method initialize(entity_id: nil, request_options: {})
# Some parameter documentations has been truncated, see
# {FinchAPI::Models::Jobs::ManualRetrieveParams} for more details.
#
# @param entity_id [String] The entity ID to use when authenticating with a multi-account token. Required wh
#
# @param request_options [FinchAPI::RequestOptions, Hash{Symbol=>Object}]
end
end
Expand Down
20 changes: 10 additions & 10 deletions lib/finch_api/models/request_forwarding_forward_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ module Models
# @see FinchAPI::Resources::RequestForwarding#forward
class RequestForwardingForwardResponse < FinchAPI::Internal::Type::BaseModel
# @!attribute data
# A string representation of the HTTP response body of the forwarded requests
# response received from the underlying integrations API. This field may be null
# in the case where the upstream systems response is empty.
# A string representation of the HTTP response body of the forwarded request's
# response received from the underlying integration's API. This field may be null
# in the case where the upstream system's response is empty.
#
# @return [String, nil]
required :data, String, nil?: true

# @!attribute headers
# The HTTP headers of the forwarded requests response, exactly as received from
# the underlying integrations API.
# The HTTP headers of the forwarded request's response, exactly as received from
# the underlying integration's API.
#
# @return [Object, nil]
required :headers, FinchAPI::Internal::Type::Unknown, nil?: true
Expand All @@ -27,8 +27,8 @@ class RequestForwardingForwardResponse < FinchAPI::Internal::Type::BaseModel
required :request, -> { FinchAPI::Models::RequestForwardingForwardResponse::Request }

# @!attribute status_code
# The HTTP status code of the forwarded requests response, exactly received from
# the underlying integrations API. This value will be returned as an integer.
# The HTTP status code of the forwarded request's response, exactly received from
# the underlying integration's API. This value will be returned as an integer.
#
# @return [Integer]
required :status_code, Integer, api_name: :statusCode
Expand All @@ -37,13 +37,13 @@ class RequestForwardingForwardResponse < FinchAPI::Internal::Type::BaseModel
# Some parameter documentations has been truncated, see
# {FinchAPI::Models::RequestForwardingForwardResponse} for more details.
#
# @param data [String, nil] A string representation of the HTTP response body of the forwarded requests res
# @param data [String, nil] A string representation of the HTTP response body of the forwarded request's res
#
# @param headers [Object, nil] The HTTP headers of the forwarded requests response, exactly as received from t
# @param headers [Object, nil] The HTTP headers of the forwarded request's response, exactly as received from t
#
# @param request [FinchAPI::Models::RequestForwardingForwardResponse::Request] An object containing details of your original forwarded request, for your ease o
#
# @param status_code [Integer] The HTTP status code of the forwarded requests response, exactly received from
# @param status_code [Integer] The HTTP status code of the forwarded request's response, exactly received from

# @see FinchAPI::Models::RequestForwardingForwardResponse#request
class Request < FinchAPI::Internal::Type::BaseModel
Expand Down
Loading