Skip to content

Commit 375e0a4

Browse files
feat(api): manual updates (#20)
1 parent 2eb2588 commit 375e0a4

File tree

6 files changed

+165
-1
lines changed

6 files changed

+165
-1
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 6
1+
configured_endpoints: 7
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openint%2Fopenint-603899f0fe4bb2708f918f1c736c2f244adce7936136aeeb3b45f727d209b4af.yml

api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ from openint.types import (
88
CreateMagicLinkResponse,
99
CreateTokenResponse,
1010
GetConnectionResponse,
11+
GetCurrentUserResponse,
1112
ListConnectionConfigsResponse,
1213
ListConnectionsResponse,
1314
)
@@ -19,5 +20,6 @@ Methods:
1920
- <code title="post /customer/{customer_id}/magic-link">client.<a href="./src/openint/_client.py">create_magic_link</a>(customer_id, \*\*<a href="src/openint/types/client_create_magic_link_params.py">params</a>) -> <a href="./src/openint/types/create_magic_link_response.py">CreateMagicLinkResponse</a></code>
2021
- <code title="post /customer/{customer_id}/token">client.<a href="./src/openint/_client.py">create_token</a>(customer_id, \*\*<a href="src/openint/types/client_create_token_params.py">params</a>) -> <a href="./src/openint/types/create_token_response.py">CreateTokenResponse</a></code>
2122
- <code title="get /connection/{id}">client.<a href="./src/openint/_client.py">get_connection</a>(id, \*\*<a href="src/openint/types/client_get_connection_params.py">params</a>) -> <a href="./src/openint/types/get_connection_response.py">GetConnectionResponse</a></code>
23+
- <code title="get /viewer">client.<a href="./src/openint/_client.py">get_current_user</a>() -> <a href="./src/openint/types/get_current_user_response.py">GetCurrentUserResponse</a></code>
2224
- <code title="get /connector-config">client.<a href="./src/openint/_client.py">list_connection_configs</a>(\*\*<a href="src/openint/types/client_list_connection_configs_params.py">params</a>) -> <a href="./src/openint/types/list_connection_configs_response.py">SyncOffsetPagination[ListConnectionConfigsResponse]</a></code>
2325
- <code title="get /connection">client.<a href="./src/openint/_client.py">list_connections</a>(\*\*<a href="src/openint/types/client_list_connections_params.py">params</a>) -> <a href="./src/openint/types/list_connections_response.py">SyncOffsetPagination[ListConnectionsResponse]</a></code>

src/openint/_client.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
from .types.create_token_response import CreateTokenResponse
5656
from .types.get_connection_response import GetConnectionResponse
5757
from .types.check_connection_response import CheckConnectionResponse
58+
from .types.get_current_user_response import GetCurrentUserResponse
5859
from .types.list_connections_response import ListConnectionsResponse
5960
from .types.create_magic_link_response import CreateMagicLinkResponse
6061
from .types.list_connection_configs_response import ListConnectionConfigsResponse
@@ -480,6 +481,30 @@ def get_connection(
480481
),
481482
)
482483

484+
def get_current_user(
485+
self,
486+
*,
487+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
488+
# The extra values given here take precedence over values defined on the client or passed to this method.
489+
extra_headers: Headers | None = None,
490+
extra_query: Query | None = None,
491+
extra_body: Body | None = None,
492+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
493+
) -> GetCurrentUserResponse:
494+
"""Get information about the current authenticated user"""
495+
return cast(
496+
GetCurrentUserResponse,
497+
self.get(
498+
"/viewer",
499+
options=make_request_options(
500+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
501+
),
502+
cast_to=cast(
503+
Any, GetCurrentUserResponse
504+
), # Union types cannot be passed in as arguments in the type system
505+
),
506+
)
507+
483508
def list_connection_configs(
484509
self,
485510
*,
@@ -1147,6 +1172,30 @@ async def get_connection(
11471172
),
11481173
)
11491174

1175+
async def get_current_user(
1176+
self,
1177+
*,
1178+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1179+
# The extra values given here take precedence over values defined on the client or passed to this method.
1180+
extra_headers: Headers | None = None,
1181+
extra_query: Query | None = None,
1182+
extra_body: Body | None = None,
1183+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1184+
) -> GetCurrentUserResponse:
1185+
"""Get information about the current authenticated user"""
1186+
return cast(
1187+
GetCurrentUserResponse,
1188+
await self.get(
1189+
"/viewer",
1190+
options=make_request_options(
1191+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1192+
),
1193+
cast_to=cast(
1194+
Any, GetCurrentUserResponse
1195+
), # Union types cannot be passed in as arguments in the type system
1196+
),
1197+
)
1198+
11501199
def list_connection_configs(
11511200
self,
11521201
*,
@@ -1410,6 +1459,9 @@ def __init__(self, client: Openint) -> None:
14101459
self.get_connection = to_raw_response_wrapper(
14111460
client.get_connection,
14121461
)
1462+
self.get_current_user = to_raw_response_wrapper(
1463+
client.get_current_user,
1464+
)
14131465
self.list_connection_configs = to_raw_response_wrapper(
14141466
client.list_connection_configs,
14151467
)
@@ -1432,6 +1484,9 @@ def __init__(self, client: AsyncOpenint) -> None:
14321484
self.get_connection = async_to_raw_response_wrapper(
14331485
client.get_connection,
14341486
)
1487+
self.get_current_user = async_to_raw_response_wrapper(
1488+
client.get_current_user,
1489+
)
14351490
self.list_connection_configs = async_to_raw_response_wrapper(
14361491
client.list_connection_configs,
14371492
)
@@ -1454,6 +1509,9 @@ def __init__(self, client: Openint) -> None:
14541509
self.get_connection = to_streamed_response_wrapper(
14551510
client.get_connection,
14561511
)
1512+
self.get_current_user = to_streamed_response_wrapper(
1513+
client.get_current_user,
1514+
)
14571515
self.list_connection_configs = to_streamed_response_wrapper(
14581516
client.list_connection_configs,
14591517
)
@@ -1476,6 +1534,9 @@ def __init__(self, client: AsyncOpenint) -> None:
14761534
self.get_connection = async_to_streamed_response_wrapper(
14771535
client.get_connection,
14781536
)
1537+
self.get_current_user = async_to_streamed_response_wrapper(
1538+
client.get_current_user,
1539+
)
14791540
self.list_connection_configs = async_to_streamed_response_wrapper(
14801541
client.list_connection_configs,
14811542
)

src/openint/types/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from .create_token_response import CreateTokenResponse as CreateTokenResponse
66
from .get_connection_response import GetConnectionResponse as GetConnectionResponse
77
from .check_connection_response import CheckConnectionResponse as CheckConnectionResponse
8+
from .get_current_user_response import GetCurrentUserResponse as GetCurrentUserResponse
89
from .list_connections_response import ListConnectionsResponse as ListConnectionsResponse
910
from .client_create_token_params import ClientCreateTokenParams as ClientCreateTokenParams
1011
from .create_magic_link_response import CreateMagicLinkResponse as CreateMagicLinkResponse
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import Dict, Union, Optional
4+
from typing_extensions import Literal, TypeAlias
5+
6+
from pydantic import Field as FieldInfo
7+
8+
from .._models import BaseModel
9+
10+
__all__ = ["GetCurrentUserResponse", "Role", "UnionMember1", "UnionMember2", "UnionMember3"]
11+
12+
13+
class Role(BaseModel):
14+
role: Literal["anon"]
15+
16+
17+
class UnionMember1(BaseModel):
18+
customer_id: str = FieldInfo(alias="customerId")
19+
20+
org_id: str = FieldInfo(alias="orgId")
21+
22+
role: Literal["customer"]
23+
24+
25+
class UnionMember2(BaseModel):
26+
role: Literal["user"]
27+
28+
user_id: str = FieldInfo(alias="userId")
29+
30+
extra: Optional[Dict[str, object]] = None
31+
32+
org_id: Optional[str] = FieldInfo(alias="orgId", default=None)
33+
34+
35+
class UnionMember3(BaseModel):
36+
org_id: str = FieldInfo(alias="orgId")
37+
38+
role: Literal["org"]
39+
40+
extra: Optional[Dict[str, object]] = None
41+
42+
43+
GetCurrentUserResponse: TypeAlias = Union[Role, UnionMember1, UnionMember2, UnionMember3, Role]

tests/api_resources/test_client.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from openint.types import (
1313
CreateTokenResponse,
1414
GetConnectionResponse,
15+
GetCurrentUserResponse,
1516
CheckConnectionResponse,
1617
CreateMagicLinkResponse,
1718
ListConnectionsResponse,
@@ -227,6 +228,34 @@ def test_path_params_get_connection(self, client: Openint) -> None:
227228
id="",
228229
)
229230

231+
@pytest.mark.skip()
232+
@parametrize
233+
def test_method_get_current_user(self, client: Openint) -> None:
234+
client_ = client.get_current_user()
235+
assert_matches_type(GetCurrentUserResponse, client_, path=["response"])
236+
237+
@pytest.mark.skip()
238+
@parametrize
239+
def test_raw_response_get_current_user(self, client: Openint) -> None:
240+
response = client.with_raw_response.get_current_user()
241+
242+
assert response.is_closed is True
243+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
244+
client_ = response.parse()
245+
assert_matches_type(GetCurrentUserResponse, client_, path=["response"])
246+
247+
@pytest.mark.skip()
248+
@parametrize
249+
def test_streaming_response_get_current_user(self, client: Openint) -> None:
250+
with client.with_streaming_response.get_current_user() as response:
251+
assert not response.is_closed
252+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
253+
254+
client_ = response.parse()
255+
assert_matches_type(GetCurrentUserResponse, client_, path=["response"])
256+
257+
assert cast(Any, response.is_closed) is True
258+
230259
@pytest.mark.skip()
231260
@parametrize
232261
def test_method_list_connection_configs(self, client: Openint) -> None:
@@ -514,6 +543,34 @@ async def test_path_params_get_connection(self, async_client: AsyncOpenint) -> N
514543
id="",
515544
)
516545

546+
@pytest.mark.skip()
547+
@parametrize
548+
async def test_method_get_current_user(self, async_client: AsyncOpenint) -> None:
549+
client = await async_client.get_current_user()
550+
assert_matches_type(GetCurrentUserResponse, client, path=["response"])
551+
552+
@pytest.mark.skip()
553+
@parametrize
554+
async def test_raw_response_get_current_user(self, async_client: AsyncOpenint) -> None:
555+
response = await async_client.with_raw_response.get_current_user()
556+
557+
assert response.is_closed is True
558+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
559+
client = await response.parse()
560+
assert_matches_type(GetCurrentUserResponse, client, path=["response"])
561+
562+
@pytest.mark.skip()
563+
@parametrize
564+
async def test_streaming_response_get_current_user(self, async_client: AsyncOpenint) -> None:
565+
async with async_client.with_streaming_response.get_current_user() as response:
566+
assert not response.is_closed
567+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
568+
569+
client = await response.parse()
570+
assert_matches_type(GetCurrentUserResponse, client, path=["response"])
571+
572+
assert cast(Any, response.is_closed) is True
573+
517574
@pytest.mark.skip()
518575
@parametrize
519576
async def test_method_list_connection_configs(self, async_client: AsyncOpenint) -> None:

0 commit comments

Comments
 (0)