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 .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 7
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openint%2Fopenint-603899f0fe4bb2708f918f1c736c2f244adce7936136aeeb3b45f727d209b4af.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openint%2Fopenint-a33b999e54f4c80e7d83d29703b3936b2a821474af967faa2737c4fb281281c4.yml
30 changes: 10 additions & 20 deletions src/openint/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,17 +492,12 @@ def get_current_user(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> GetCurrentUserResponse:
"""Get information about the current authenticated user"""
return cast(
GetCurrentUserResponse,
self.get(
"/viewer",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=cast(
Any, GetCurrentUserResponse
), # Union types cannot be passed in as arguments in the type system
return self.get(
"/viewer",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=GetCurrentUserResponse,
)

def list_connection_configs(
Expand Down Expand Up @@ -1183,17 +1178,12 @@ async def get_current_user(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> GetCurrentUserResponse:
"""Get information about the current authenticated user"""
return cast(
GetCurrentUserResponse,
await self.get(
"/viewer",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=cast(
Any, GetCurrentUserResponse
), # Union types cannot be passed in as arguments in the type system
return await self.get(
"/viewer",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=GetCurrentUserResponse,
)

def list_connection_configs(
Expand Down
40 changes: 4 additions & 36 deletions src/openint/types/get_current_user_response.py
Original file line number Diff line number Diff line change
@@ -1,43 +1,11 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Dict, Union, Optional
from typing_extensions import Literal, TypeAlias

from pydantic import Field as FieldInfo
from typing_extensions import Literal

from .._models import BaseModel

__all__ = ["GetCurrentUserResponse", "Role", "UnionMember1", "UnionMember2", "UnionMember3"]


class Role(BaseModel):
role: Literal["anon"]


class UnionMember1(BaseModel):
customer_id: str = FieldInfo(alias="customerId")

org_id: str = FieldInfo(alias="orgId")

role: Literal["customer"]


class UnionMember2(BaseModel):
role: Literal["user"]

user_id: str = FieldInfo(alias="userId")

extra: Optional[Dict[str, object]] = None

org_id: Optional[str] = FieldInfo(alias="orgId", default=None)


class UnionMember3(BaseModel):
org_id: str = FieldInfo(alias="orgId")

role: Literal["org"]

extra: Optional[Dict[str, object]] = None
__all__ = ["GetCurrentUserResponse"]


GetCurrentUserResponse: TypeAlias = Union[Role, UnionMember1, UnionMember2, UnionMember3, Role]
class GetCurrentUserResponse(BaseModel):
role: Literal["customer", "org", "anon"]