Skip to content

Commit 3271474

Browse files
chore: modify sorbet initializers to better support auto-completion (#13)
1 parent e093ce4 commit 3271474

File tree

142 files changed

+725
-748
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

142 files changed

+725
-748
lines changed

rbi/lib/finch-api/base_client.rbi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ module FinchAPI
4545

4646
class << self
4747
sig { params(req: FinchAPI::BaseClient::RequestComponentsShape).void }
48-
def self.validate!(req)
48+
def validate!(req)
4949
end
5050

5151
sig do
5252
params(status: Integer, headers: T.any(T::Hash[String, String], Net::HTTPHeader)).returns(T::Boolean)
5353
end
54-
def self.should_retry?(status, headers:)
54+
def should_retry?(status, headers:)
5555
end
5656

5757
sig do
@@ -62,7 +62,7 @@ module FinchAPI
6262
)
6363
.returns(FinchAPI::BaseClient::RequestInputShape)
6464
end
65-
def self.follow_redirect(request, status:, response_headers:)
65+
def follow_redirect(request, status:, response_headers:)
6666
end
6767
end
6868

@@ -85,9 +85,9 @@ module FinchAPI
8585
T.nilable(T.any(String, Integer, T::Array[T.nilable(T.any(String, Integer))]))],
8686
idempotency_header: T.nilable(String)
8787
)
88-
.void
88+
.returns(T.attached_class)
8989
end
90-
def initialize(
90+
def self.new(
9191
base_url:,
9292
timeout: 0.0,
9393
max_retries: 0,

rbi/lib/finch-api/base_model.rbi

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,9 @@ module FinchAPI
279279
),
280280
spec: T::Hash[Symbol, T.anything]
281281
)
282-
.void
282+
.returns(T.attached_class)
283283
end
284-
def initialize(type_info, spec = {})
284+
def self.new(type_info, spec = {})
285285
end
286286
end
287287

@@ -335,9 +335,9 @@ module FinchAPI
335335
),
336336
spec: T::Hash[Symbol, T.anything]
337337
)
338-
.void
338+
.returns(T.attached_class)
339339
end
340-
def initialize(type_info, spec = {})
340+
def self.new(type_info, spec = {})
341341
end
342342
end
343343

@@ -479,8 +479,8 @@ module FinchAPI
479479
def deconstruct_keys(keys)
480480
end
481481

482-
sig { params(data: T.any(T::Hash[Symbol, T.anything], T.self_type)).void }
483-
def initialize(data = {})
482+
sig { params(data: T.any(T::Hash[Symbol, T.anything], T.self_type)).returns(T.attached_class) }
483+
def self.new(data = {})
484484
end
485485

486486
sig { returns(String) }

rbi/lib/finch-api/client.rbi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ module FinchAPI
8585
initial_retry_delay: Float,
8686
max_retry_delay: Float
8787
)
88-
.void
88+
.returns(T.attached_class)
8989
end
90-
def initialize(
90+
def self.new(
9191
base_url: nil,
9292
access_token: nil,
9393
client_id: ENV["FINCH_CLIENT_ID"],

rbi/lib/finch-api/errors.rbi

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ module FinchAPI
3232
response: NilClass,
3333
message: T.nilable(String)
3434
)
35-
.void
35+
.returns(T.attached_class)
3636
end
37-
def initialize(url:, status: nil, body: nil, request: nil, response: nil, message: nil)
37+
def self.new(url:, status: nil, body: nil, request: nil, response: nil, message: nil)
3838
end
3939
end
4040

@@ -56,9 +56,9 @@ module FinchAPI
5656
response: NilClass,
5757
message: T.nilable(String)
5858
)
59-
.void
59+
.returns(T.attached_class)
6060
end
61-
def initialize(url:, status: nil, body: nil, request: nil, response: nil, message: "Connection error.")
61+
def self.new(url:, status: nil, body: nil, request: nil, response: nil, message: "Connection error.")
6262
end
6363
end
6464

@@ -72,9 +72,9 @@ module FinchAPI
7272
response: NilClass,
7373
message: T.nilable(String)
7474
)
75-
.void
75+
.returns(T.attached_class)
7676
end
77-
def initialize(url:, status: nil, body: nil, request: nil, response: nil, message: "Request timed out.")
77+
def self.new(url:, status: nil, body: nil, request: nil, response: nil, message: "Request timed out.")
7878
end
7979
end
8080

@@ -106,9 +106,9 @@ module FinchAPI
106106
response: NilClass,
107107
message: T.nilable(String)
108108
)
109-
.void
109+
.returns(T.attached_class)
110110
end
111-
def initialize(url:, status:, body:, request:, response:, message: nil)
111+
def self.new(url:, status:, body:, request:, response:, message: nil)
112112
end
113113
end
114114

rbi/lib/finch-api/models/access_token_create_params.rbi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ module FinchAPI
4646
redirect_uri: String,
4747
request_options: T.any(FinchAPI::RequestOptions, T::Hash[Symbol, T.anything])
4848
)
49-
.void
49+
.returns(T.attached_class)
5050
end
51-
def initialize(code:, client_id: nil, client_secret: nil, redirect_uri: nil, request_options: {})
51+
def self.new(code:, client_id: nil, client_secret: nil, redirect_uri: nil, request_options: {})
5252
end
5353

5454
sig do

rbi/lib/finch-api/models/account_disconnect_params.rbi

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ module FinchAPI
66
extend FinchAPI::RequestParameters::Converter
77
include FinchAPI::RequestParameters
88

9-
sig { params(request_options: T.any(FinchAPI::RequestOptions, T::Hash[Symbol, T.anything])).void }
10-
def initialize(request_options: {})
9+
sig do
10+
params(request_options: T.any(FinchAPI::RequestOptions, T::Hash[Symbol, T.anything]))
11+
.returns(T.attached_class)
12+
end
13+
def self.new(request_options: {})
1114
end
1215

1316
sig { override.returns({request_options: FinchAPI::RequestOptions}) }

rbi/lib/finch-api/models/account_introspect_params.rbi

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ module FinchAPI
66
extend FinchAPI::RequestParameters::Converter
77
include FinchAPI::RequestParameters
88

9-
sig { params(request_options: T.any(FinchAPI::RequestOptions, T::Hash[Symbol, T.anything])).void }
10-
def initialize(request_options: {})
9+
sig do
10+
params(request_options: T.any(FinchAPI::RequestOptions, T::Hash[Symbol, T.anything]))
11+
.returns(T.attached_class)
12+
end
13+
def self.new(request_options: {})
1114
end
1215

1316
sig { override.returns({request_options: FinchAPI::RequestOptions}) }

0 commit comments

Comments
 (0)