Skip to content

Commit 8184e98

Browse files
refactor(auth): simplify proxy configuration in OpenAPI schema
1 parent fd445dd commit 8184e98

3 files changed

Lines changed: 77 additions & 12 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 100
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-13e82ae9e725e2c3ca19da7248a7a9c8696a0dfe088654cf26aea07c76d6567a.yml
3-
openapi_spec_hash: 6d4151a6066a8474bc56923299aec18a
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-eaf23b9711c16c82563be76641c9c89988288307278dcd630a36f4f186f85afa.yml
3+
openapi_spec_hash: 369570222f4f725e1de11285422837cc
44
config_hash: 82f0a04081a3ab7111d3a9c68cd3ff2b

src/resources/auth/connections.ts

Lines changed: 70 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,36 @@ export type ManagedAuthsOffsetPagination = OffsetPagination<ManagedAuth>;
146146
* Request to start a login flow
147147
*/
148148
export interface LoginRequest {
149+
/**
150+
* Proxy selection. Provide either id or name. The proxy must belong to the
151+
* caller's org.
152+
*/
153+
proxy?: LoginRequest.Proxy;
154+
149155
/**
150156
* If provided, saves credentials under this name upon successful login
151157
*/
152158
save_credential_as?: string;
153159
}
154160

161+
export namespace LoginRequest {
162+
/**
163+
* Proxy selection. Provide either id or name. The proxy must belong to the
164+
* caller's org.
165+
*/
166+
export interface Proxy {
167+
/**
168+
* Proxy ID
169+
*/
170+
id?: string;
171+
172+
/**
173+
* Proxy name
174+
*/
175+
name?: string;
176+
}
177+
}
178+
155179
/**
156180
* Response from starting a login flow
157181
*/
@@ -522,7 +546,8 @@ export interface ManagedAuthCreateRequest {
522546
login_url?: string;
523547

524548
/**
525-
* Optional proxy configuration
549+
* Proxy selection. Provide either id or name. The proxy must belong to the
550+
* caller's org.
526551
*/
527552
proxy?: ManagedAuthCreateRequest.Proxy;
528553
}
@@ -558,13 +583,19 @@ export namespace ManagedAuthCreateRequest {
558583
}
559584

560585
/**
561-
* Optional proxy configuration
586+
* Proxy selection. Provide either id or name. The proxy must belong to the
587+
* caller's org.
562588
*/
563589
export interface Proxy {
564590
/**
565-
* ID of the proxy to use
591+
* Proxy ID
566592
*/
567-
proxy_id?: string;
593+
id?: string;
594+
595+
/**
596+
* Proxy name
597+
*/
598+
name?: string;
568599
}
569600
}
570601

@@ -829,7 +860,8 @@ export interface ConnectionCreateParams {
829860
login_url?: string;
830861

831862
/**
832-
* Optional proxy configuration
863+
* Proxy selection. Provide either id or name. The proxy must belong to the
864+
* caller's org.
833865
*/
834866
proxy?: ConnectionCreateParams.Proxy;
835867
}
@@ -865,13 +897,19 @@ export namespace ConnectionCreateParams {
865897
}
866898

867899
/**
868-
* Optional proxy configuration
900+
* Proxy selection. Provide either id or name. The proxy must belong to the
901+
* caller's org.
869902
*/
870903
export interface Proxy {
871904
/**
872-
* ID of the proxy to use
905+
* Proxy ID
873906
*/
874-
proxy_id?: string;
907+
id?: string;
908+
909+
/**
910+
* Proxy name
911+
*/
912+
name?: string;
875913
}
876914
}
877915

@@ -888,12 +926,36 @@ export interface ConnectionListParams extends OffsetPaginationParams {
888926
}
889927

890928
export interface ConnectionLoginParams {
929+
/**
930+
* Proxy selection. Provide either id or name. The proxy must belong to the
931+
* caller's org.
932+
*/
933+
proxy?: ConnectionLoginParams.Proxy;
934+
891935
/**
892936
* If provided, saves credentials under this name upon successful login
893937
*/
894938
save_credential_as?: string;
895939
}
896940

941+
export namespace ConnectionLoginParams {
942+
/**
943+
* Proxy selection. Provide either id or name. The proxy must belong to the
944+
* caller's org.
945+
*/
946+
export interface Proxy {
947+
/**
948+
* Proxy ID
949+
*/
950+
id?: string;
951+
952+
/**
953+
* Proxy name
954+
*/
955+
name?: string;
956+
}
957+
}
958+
897959
export interface ConnectionSubmitParams {
898960
/**
899961
* Map of field name to value

tests/api-resources/auth/connections.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ describe('resource connections', () => {
3737
},
3838
health_check_interval: 3600,
3939
login_url: 'https://netflix.com/login',
40-
proxy: { proxy_id: 'proxy_id' },
40+
proxy: { id: 'id', name: 'name' },
4141
});
4242
});
4343

@@ -123,7 +123,10 @@ describe('resource connections', () => {
123123
await expect(
124124
client.auth.connections.login(
125125
'id',
126-
{ save_credential_as: 'my-netflix-login' },
126+
{
127+
proxy: { id: 'id', name: 'name' },
128+
save_credential_as: 'my-netflix-login',
129+
},
127130
{ path: '/_stainless_unknown_path' },
128131
),
129132
).rejects.toThrow(Kernel.NotFoundError);

0 commit comments

Comments
 (0)