Skip to content

Commit d1b769f

Browse files
feat(api): make client id, client secret optional again
1 parent a67b714 commit d1b769f

File tree

8 files changed

+56
-51
lines changed

8 files changed

+56
-51
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 46
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-edbdcdf654a3ab8c23745e1d115fc8b54908eb913571d70f1145a0b6a45cc811.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-bb50c0ae41ff5036adf72344d33057941f6de67c5fae811eba2e758bfa4ffd31.yml
33
openapi_spec_hash: 1b21e4bfc46daeef1613e410e5aa8f28
4-
config_hash: 5146b12344dae76238940989dac1e8a0
4+
config_hash: 6d3585c0032e08d723d077d660fc8448

lib/finch_api/models/access_token_create_params.rb

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,37 @@ class AccessTokenCreateParams < FinchAPI::Internal::Type::BaseModel
77
extend FinchAPI::Internal::Type::RequestParameters::Converter
88
include FinchAPI::Internal::Type::RequestParameters
99

10+
# @!attribute code
11+
# The authorization code received from the authorization server
12+
#
13+
# @return [String]
14+
required :code, String
15+
1016
# @!attribute client_id
1117
# The client ID for your application
1218
#
13-
# @return [String]
14-
required :client_id, String
19+
# @return [String, nil]
20+
optional :client_id, String
1521

1622
# @!attribute client_secret
1723
# The client secret for your application
1824
#
19-
# @return [String]
20-
required :client_secret, String
21-
22-
# @!attribute code
23-
# The authorization code received from the authorization server
24-
#
25-
# @return [String]
26-
required :code, String
25+
# @return [String, nil]
26+
optional :client_secret, String
2727

2828
# @!attribute redirect_uri
2929
# The redirect URI used in the authorization request (optional)
3030
#
3131
# @return [String, nil]
3232
optional :redirect_uri, String
3333

34-
# @!method initialize(client_id:, client_secret:, code:, redirect_uri: nil, request_options: {})
34+
# @!method initialize(code:, client_id: nil, client_secret: nil, redirect_uri: nil, request_options: {})
35+
# @param code [String] The authorization code received from the authorization server
36+
#
3537
# @param client_id [String] The client ID for your application
3638
#
3739
# @param client_secret [String] The client secret for your application
3840
#
39-
# @param code [String] The authorization code received from the authorization server
40-
#
4141
# @param redirect_uri [String] The redirect URI used in the authorization request (optional)
4242
#
4343
# @param request_options [FinchAPI::RequestOptions, Hash{Symbol=>Object}]

lib/finch_api/resources/access_tokens.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ module Resources
55
class AccessTokens
66
# Exchange the authorization code for an access token
77
#
8-
# @overload create(client_id:, client_secret:, code:, redirect_uri: nil, request_options: {})
8+
# @overload create(code:, client_id: nil, client_secret: nil, redirect_uri: nil, request_options: {})
9+
#
10+
# @param code [String] The authorization code received from the authorization server
911
#
1012
# @param client_id [String] The client ID for your application
1113
#
1214
# @param client_secret [String] The client secret for your application
1315
#
14-
# @param code [String] The authorization code received from the authorization server
15-
#
1616
# @param redirect_uri [String] The redirect URI used in the authorization request (optional)
1717
#
1818
# @param request_options [FinchAPI::RequestOptions, Hash{Symbol=>Object}, nil]

rbi/finch_api/models/access_token_create_params.rbi

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,23 @@ module FinchAPI
1111
T.any(FinchAPI::AccessTokenCreateParams, FinchAPI::Internal::AnyHash)
1212
end
1313

14-
# The client ID for your application
14+
# The authorization code received from the authorization server
1515
sig { returns(String) }
16-
attr_accessor :client_id
16+
attr_accessor :code
17+
18+
# The client ID for your application
19+
sig { returns(T.nilable(String)) }
20+
attr_reader :client_id
21+
22+
sig { params(client_id: String).void }
23+
attr_writer :client_id
1724

1825
# The client secret for your application
19-
sig { returns(String) }
20-
attr_accessor :client_secret
26+
sig { returns(T.nilable(String)) }
27+
attr_reader :client_secret
2128

22-
# The authorization code received from the authorization server
23-
sig { returns(String) }
24-
attr_accessor :code
29+
sig { params(client_secret: String).void }
30+
attr_writer :client_secret
2531

2632
# The redirect URI used in the authorization request (optional)
2733
sig { returns(T.nilable(String)) }
@@ -32,20 +38,20 @@ module FinchAPI
3238

3339
sig do
3440
params(
41+
code: String,
3542
client_id: String,
3643
client_secret: String,
37-
code: String,
3844
redirect_uri: String,
3945
request_options: FinchAPI::RequestOptions::OrHash
4046
).returns(T.attached_class)
4147
end
4248
def self.new(
43-
# The client ID for your application
44-
client_id:,
45-
# The client secret for your application
46-
client_secret:,
4749
# The authorization code received from the authorization server
4850
code:,
51+
# The client ID for your application
52+
client_id: nil,
53+
# The client secret for your application
54+
client_secret: nil,
4955
# The redirect URI used in the authorization request (optional)
5056
redirect_uri: nil,
5157
request_options: {}
@@ -55,9 +61,9 @@ module FinchAPI
5561
sig do
5662
override.returns(
5763
{
64+
code: String,
5865
client_id: String,
5966
client_secret: String,
60-
code: String,
6167
redirect_uri: String,
6268
request_options: FinchAPI::RequestOptions
6369
}

rbi/finch_api/resources/access_tokens.rbi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ module FinchAPI
66
# Exchange the authorization code for an access token
77
sig do
88
params(
9+
code: String,
910
client_id: String,
1011
client_secret: String,
11-
code: String,
1212
redirect_uri: String,
1313
request_options: FinchAPI::RequestOptions::OrHash
1414
).returns(FinchAPI::CreateAccessTokenResponse)
1515
end
1616
def create(
17-
# The client ID for your application
18-
client_id:,
19-
# The client secret for your application
20-
client_secret:,
2117
# The authorization code received from the authorization server
2218
code:,
19+
# The client ID for your application
20+
client_id: nil,
21+
# The client secret for your application
22+
client_secret: nil,
2323
# The redirect URI used in the authorization request (optional)
2424
redirect_uri: nil,
2525
request_options: {}

sig/finch_api/models/access_token_create_params.rbs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ module FinchAPI
22
module Models
33
type access_token_create_params =
44
{
5+
code: String,
56
client_id: String,
67
client_secret: String,
7-
code: String,
88
redirect_uri: String
99
}
1010
& FinchAPI::Internal::Type::request_parameters
@@ -13,28 +13,32 @@ module FinchAPI
1313
extend FinchAPI::Internal::Type::RequestParameters::Converter
1414
include FinchAPI::Internal::Type::RequestParameters
1515

16-
attr_accessor client_id: String
16+
attr_accessor code: String
1717

18-
attr_accessor client_secret: String
18+
attr_reader client_id: String?
1919

20-
attr_accessor code: String
20+
def client_id=: (String) -> String
21+
22+
attr_reader client_secret: String?
23+
24+
def client_secret=: (String) -> String
2125

2226
attr_reader redirect_uri: String?
2327

2428
def redirect_uri=: (String) -> String
2529

2630
def initialize: (
27-
client_id: String,
28-
client_secret: String,
2931
code: String,
32+
?client_id: String,
33+
?client_secret: String,
3034
?redirect_uri: String,
3135
?request_options: FinchAPI::request_opts
3236
) -> void
3337

3438
def to_hash: -> {
39+
code: String,
3540
client_id: String,
3641
client_secret: String,
37-
code: String,
3842
redirect_uri: String,
3943
request_options: FinchAPI::RequestOptions
4044
}

sig/finch_api/resources/access_tokens.rbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ module FinchAPI
22
module Resources
33
class AccessTokens
44
def create: (
5-
client_id: String,
6-
client_secret: String,
75
code: String,
6+
?client_id: String,
7+
?client_secret: String,
88
?redirect_uri: String,
99
?request_options: FinchAPI::request_opts
1010
) -> FinchAPI::CreateAccessTokenResponse

test/finch_api/resources/access_tokens_test.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@
44

55
class FinchAPI::Test::Resources::AccessTokensTest < FinchAPI::Test::ResourceTest
66
def test_create_required_params
7-
response =
8-
@finch.access_tokens.create(
9-
client_id: "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
10-
client_secret: "client_secret",
11-
code: "code"
12-
)
7+
response = @finch.access_tokens.create(code: "code")
138

149
assert_pattern do
1510
response => FinchAPI::CreateAccessTokenResponse

0 commit comments

Comments
 (0)