Skip to content
Open
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
22 changes: 11 additions & 11 deletions src/openai/resources/admin/organization/users/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ def with_raw_response(self) -> UsersWithRawResponse:
@cached_property
def with_streaming_response(self) -> UsersWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
An alternative to `.with_raw_response` that hooks into the response stream.

For more information, see https://www.github.com/openai/openai-python#with_streaming_response
For more information, see https://www.github.com/openai/openai-python#accessing-raw-response-data-eg-headers
"""
return UsersWithStreamingResponse(self)

Expand Down Expand Up @@ -194,7 +194,7 @@ def list(
query=maybe_transform(
{
"after": after,
"emails": emails,
"emails": emails if not isinstance(emails, (list, tuple)) else ",".join(emails),
"limit": limit,
},
user_list_params.UserListParams,
Expand Down Expand Up @@ -260,9 +260,9 @@ def with_raw_response(self) -> AsyncUsersWithRawResponse:
@cached_property
def with_streaming_response(self) -> AsyncUsersWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
An alternative to `.with_raw_response` that hooks into the response stream.

For more information, see https://www.github.com/openai/openai-python#with_streaming_response
For more information, see https://www.github.com/openai/openai-python#accessing-raw-response-data-eg-headers
"""
return AsyncUsersWithStreamingResponse(self)

Expand Down Expand Up @@ -373,7 +373,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AsyncPaginator[OrganizationUser, AsyncConversationCursorPage[OrganizationUser]]:
) -> AsyncConversationCursorPage[OrganizationUser]:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep async list typed as a paginator

The async client's get_api_list still returns an AsyncPaginator, and callers materialize the first page by awaiting it or iterate it asynchronously. Annotating this method as an already-materialized AsyncConversationCursorPage makes exported types allow async_client.admin.organization.users.list() to be used without await, which will fail at runtime because the returned object is the paginator; the surrounding async list methods keep the AsyncPaginator[...] return type.

Useful? React with 👍 / 👎.

"""
Lists all of the users in the organization.

Expand Down Expand Up @@ -407,7 +407,7 @@ def list(
query=maybe_transform(
{
"after": after,
"emails": emails,
"emails": emails if not isinstance(emails, (list, tuple)) else ",".join(emails),
"limit": limit,
},
user_list_params.UserListParams,
Expand Down Expand Up @@ -481,16 +481,16 @@ class AsyncUsersWithRawResponse:
def __init__(self, users: AsyncUsers) -> None:
self._users = users

self.retrieve = _legacy_response.async_to_raw_response_wrapper(
self.retrieve = async_to_streamed_response_wrapper(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restore raw wrappers for async raw responses

For async with_raw_response calls such as await async_client.admin.organization.users.with_raw_response.retrieve(...), this now installs the streaming wrapper, which returns an AsyncResponseContextManager and sets the raw-response header to stream; that object is meant for async with and is not awaitable, so the documented raw-response path raises before returning a closed raw response. This affects every async method assigned in this block; use _legacy_response.async_to_raw_response_wrapper here as in the neighboring resources.

Useful? React with 👍 / 👎.

users.retrieve,
)
self.update = _legacy_response.async_to_raw_response_wrapper(
self.update = async_to_streamed_response_wrapper(
users.update,
)
self.list = _legacy_response.async_to_raw_response_wrapper(
self.list = async_to_streamed_response_wrapper(
users.list,
)
self.delete = _legacy_response.async_to_raw_response_wrapper(
self.delete = async_to_streamed_response_wrapper(
users.delete,
)

Expand Down