diff --git a/.release-please-manifest.json b/.release-please-manifest.json index e6484623..c174a897 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.72.0" + ".": "1.73.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index f3cb8a90..e47a8959 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 71 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/structify%2Fstructify-1d9e75129793e68b316a1e185b6fbfa934ef5ac774d1e2453f6a86d8964eeb22.yml +configured_endpoints: 73 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/structify%2Fstructify-1fa3705789b949366122100cefcf80ddf27699f2b4698f691ab73b301fb05df9.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index 71c5a1a4..7bad9b73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## 1.73.0 (2025-01-16) + +Full Changelog: [v1.72.0...v1.73.0](https://github.com/StructifyAI/structify-python/compare/v1.72.0...v1.73.0) + +### Features + +* **api:** api update ([#759](https://github.com/StructifyAI/structify-python/issues/759)) ([e5feac3](https://github.com/StructifyAI/structify-python/commit/e5feac301e9cc097ba50fc81e5bc506446775ced)) +* **api:** api update ([#760](https://github.com/StructifyAI/structify-python/issues/760)) ([c898d59](https://github.com/StructifyAI/structify-python/commit/c898d59c0fd4f6cb4e15b1d08718dca313050db7)) +* **api:** api update ([#761](https://github.com/StructifyAI/structify-python/issues/761)) ([ec353f8](https://github.com/StructifyAI/structify-python/commit/ec353f8aa88a0c19ca59b0b267bdb1345832b619)) +* **api:** api update ([#762](https://github.com/StructifyAI/structify-python/issues/762)) ([703c4cc](https://github.com/StructifyAI/structify-python/commit/703c4cc2dee5692d29cd3d118042429d3130001b)) +* **api:** api update ([#763](https://github.com/StructifyAI/structify-python/issues/763)) ([48561eb](https://github.com/StructifyAI/structify-python/commit/48561eb1935db7cf64284714f3b988fa6eb43799)) +* **api:** api update ([#764](https://github.com/StructifyAI/structify-python/issues/764)) ([badd348](https://github.com/StructifyAI/structify-python/commit/badd348b406b3599a716de54eb0d0081f91d583c)) +* **api:** api update ([#765](https://github.com/StructifyAI/structify-python/issues/765)) ([de5617f](https://github.com/StructifyAI/structify-python/commit/de5617fc2322949a41923424cc641dc9333799c0)) + + +### Chores + +* **internal:** version bump ([#757](https://github.com/StructifyAI/structify-python/issues/757)) ([23bd217](https://github.com/StructifyAI/structify-python/commit/23bd2171c0bc0559221ac89424bfc19c23080357)) + ## 1.72.0 (2025-01-14) Full Changelog: [v1.71.0...v1.72.0](https://github.com/StructifyAI/structify-python/compare/v1.71.0...v1.72.0) diff --git a/api.md b/api.md index 06189ea5..0472fb49 100644 --- a/api.md +++ b/api.md @@ -43,13 +43,20 @@ Methods: Types: ```python -from structify.types.admin import User, UserListResponse +from structify.types.admin import ( + User, + UserListResponse, + UserGetCreditsResponse, + UserSetCreditsResponse, +) ``` Methods: - client.admin.users.create(\*\*params) -> TokenResponse - client.admin.users.list() -> UserListResponse +- client.admin.users.get_credits(\*\*params) -> UserGetCreditsResponse +- client.admin.users.set_credits(\*\*params) -> UserSetCreditsResponse ## TrainingDatasets diff --git a/pyproject.toml b/pyproject.toml index 4eda25cc..7d5297e7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "structifyai" -version = "1.72.0" +version = "1.73.0" description = "The official Python library for the structify API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/structify/_version.py b/src/structify/_version.py index b82bd3e0..4d6fe889 100644 --- a/src/structify/_version.py +++ b/src/structify/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "structify" -__version__ = "1.72.0" # x-release-please-version +__version__ = "1.73.0" # x-release-please-version diff --git a/src/structify/resources/admin/training_datasets.py b/src/structify/resources/admin/training_datasets.py index 94f566c4..1b88fb6f 100644 --- a/src/structify/resources/admin/training_datasets.py +++ b/src/structify/resources/admin/training_datasets.py @@ -462,7 +462,7 @@ def switch_dataset( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> None: """ - Removes a training datum from the specified dataset. + Switches a training datum to a new dataset. Args: extra_headers: Send extra headers @@ -1035,7 +1035,7 @@ async def switch_dataset( timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, ) -> None: """ - Removes a training datum from the specified dataset. + Switches a training datum to a new dataset. Args: extra_headers: Send extra headers diff --git a/src/structify/resources/admin/users.py b/src/structify/resources/admin/users.py index 1babfec3..954f81b7 100644 --- a/src/structify/resources/admin/users.py +++ b/src/structify/resources/admin/users.py @@ -20,10 +20,12 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...types.admin import user_create_params +from ...types.admin import user_create_params, user_get_credits_params, user_set_credits_params from ..._base_client import make_request_options from ...types.token_response import TokenResponse from ...types.admin.user_list_response import UserListResponse +from ...types.admin.user_get_credits_response import UserGetCreditsResponse +from ...types.admin.user_set_credits_response import UserSetCreditsResponse __all__ = ["UsersResource", "AsyncUsersResource"] @@ -53,8 +55,8 @@ def create( *, credit_count: Optional[int] | NotGiven = NOT_GIVEN, email: Optional[str] | NotGiven = NOT_GIVEN, - feature_flags: Optional[List[Literal["pdf_parsing", "labeler", "none"]]] | NotGiven = NOT_GIVEN, is_admin: bool | NotGiven = NOT_GIVEN, + permissions: Optional[List[Literal["pdf_parsing", "labeler", "debug", "none"]]] | NotGiven = NOT_GIVEN, test: bool | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -81,8 +83,8 @@ def create( { "credit_count": credit_count, "email": email, - "feature_flags": feature_flags, "is_admin": is_admin, + "permissions": permissions, "test": test, }, user_create_params.UserCreateParams, @@ -112,6 +114,85 @@ def list( cast_to=UserListResponse, ) + def get_credits( + self, + *, + user_email: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> UserGetCreditsResponse: + """ + get the credit balance of a user by email. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "text/plain", **(extra_headers or {})} + return self._get( + "/admin/users/get_credits", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform({"user_email": user_email}, user_get_credits_params.UserGetCreditsParams), + ), + cast_to=int, + ) + + def set_credits( + self, + *, + credit_count: int, + user_email: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> UserSetCreditsResponse: + """ + set the credit balance of a user, returing that new credit balance. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "text/plain", **(extra_headers or {})} + return self._post( + "/admin/users/set_credits", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "credit_count": credit_count, + "user_email": user_email, + }, + user_set_credits_params.UserSetCreditsParams, + ), + ), + cast_to=int, + ) + class AsyncUsersResource(AsyncAPIResource): @cached_property @@ -138,8 +219,8 @@ async def create( *, credit_count: Optional[int] | NotGiven = NOT_GIVEN, email: Optional[str] | NotGiven = NOT_GIVEN, - feature_flags: Optional[List[Literal["pdf_parsing", "labeler", "none"]]] | NotGiven = NOT_GIVEN, is_admin: bool | NotGiven = NOT_GIVEN, + permissions: Optional[List[Literal["pdf_parsing", "labeler", "debug", "none"]]] | NotGiven = NOT_GIVEN, test: bool | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -166,8 +247,8 @@ async def create( { "credit_count": credit_count, "email": email, - "feature_flags": feature_flags, "is_admin": is_admin, + "permissions": permissions, "test": test, }, user_create_params.UserCreateParams, @@ -197,6 +278,87 @@ async def list( cast_to=UserListResponse, ) + async def get_credits( + self, + *, + user_email: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> UserGetCreditsResponse: + """ + get the credit balance of a user by email. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "text/plain", **(extra_headers or {})} + return await self._get( + "/admin/users/get_credits", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + {"user_email": user_email}, user_get_credits_params.UserGetCreditsParams + ), + ), + cast_to=int, + ) + + async def set_credits( + self, + *, + credit_count: int, + user_email: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> UserSetCreditsResponse: + """ + set the credit balance of a user, returing that new credit balance. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + extra_headers = {"Accept": "text/plain", **(extra_headers or {})} + return await self._post( + "/admin/users/set_credits", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "credit_count": credit_count, + "user_email": user_email, + }, + user_set_credits_params.UserSetCreditsParams, + ), + ), + cast_to=int, + ) + class UsersResourceWithRawResponse: def __init__(self, users: UsersResource) -> None: @@ -208,6 +370,12 @@ def __init__(self, users: UsersResource) -> None: self.list = to_raw_response_wrapper( users.list, ) + self.get_credits = to_raw_response_wrapper( + users.get_credits, + ) + self.set_credits = to_raw_response_wrapper( + users.set_credits, + ) class AsyncUsersResourceWithRawResponse: @@ -220,6 +388,12 @@ def __init__(self, users: AsyncUsersResource) -> None: self.list = async_to_raw_response_wrapper( users.list, ) + self.get_credits = async_to_raw_response_wrapper( + users.get_credits, + ) + self.set_credits = async_to_raw_response_wrapper( + users.set_credits, + ) class UsersResourceWithStreamingResponse: @@ -232,6 +406,12 @@ def __init__(self, users: UsersResource) -> None: self.list = to_streamed_response_wrapper( users.list, ) + self.get_credits = to_streamed_response_wrapper( + users.get_credits, + ) + self.set_credits = to_streamed_response_wrapper( + users.set_credits, + ) class AsyncUsersResourceWithStreamingResponse: @@ -244,3 +424,9 @@ def __init__(self, users: AsyncUsersResource) -> None: self.list = async_to_streamed_response_wrapper( users.list, ) + self.get_credits = async_to_streamed_response_wrapper( + users.get_credits, + ) + self.set_credits = async_to_streamed_response_wrapper( + users.set_credits, + ) diff --git a/src/structify/types/admin/__init__.py b/src/structify/types/admin/__init__.py index 698254bc..77ac3b98 100644 --- a/src/structify/types/admin/__init__.py +++ b/src/structify/types/admin/__init__.py @@ -8,7 +8,11 @@ from .user_create_params import UserCreateParams as UserCreateParams from .user_list_response import UserListResponse as UserListResponse from .training_datum_response import TrainingDatumResponse as TrainingDatumResponse +from .user_get_credits_params import UserGetCreditsParams as UserGetCreditsParams +from .user_set_credits_params import UserSetCreditsParams as UserSetCreditsParams from .human_llm_get_jobs_params import HumanLlmGetJobsParams as HumanLlmGetJobsParams +from .user_get_credits_response import UserGetCreditsResponse as UserGetCreditsResponse +from .user_set_credits_response import UserSetCreditsResponse as UserSetCreditsResponse from .human_llm_finish_job_params import HumanLlmFinishJobParams as HumanLlmFinishJobParams from .human_llm_get_jobs_response import HumanLlmGetJobsResponse as HumanLlmGetJobsResponse from .training_dataset_add_params import TrainingDatasetAddParams as TrainingDatasetAddParams diff --git a/src/structify/types/admin/step_choices.py b/src/structify/types/admin/step_choices.py index a373d20b..b415d902 100644 --- a/src/structify/types/admin/step_choices.py +++ b/src/structify/types/admin/step_choices.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import Dict, List from ..._models import BaseModel from ..knowledge_graph import KnowledgeGraph @@ -12,7 +12,9 @@ class StepOption(BaseModel): id: str - description: str + action_name: str + + metadata: Dict[str, str] class StepChoices(BaseModel): diff --git a/src/structify/types/admin/user.py b/src/structify/types/admin/user.py index 99266750..3cdd063d 100644 --- a/src/structify/types/admin/user.py +++ b/src/structify/types/admin/user.py @@ -11,6 +11,6 @@ class User(BaseModel): email: str - feature_flags: Optional[List[Literal["pdf_parsing", "labeler", "none"]]] = None + permissions: Optional[List[Literal["pdf_parsing", "labeler", "debug", "none"]]] = None user_type: Optional[Literal["Admin", "Public", "EndUser"]] = None diff --git a/src/structify/types/admin/user_create_params.py b/src/structify/types/admin/user_create_params.py index 8dcb1d05..aa26e28e 100644 --- a/src/structify/types/admin/user_create_params.py +++ b/src/structify/types/admin/user_create_params.py @@ -13,8 +13,8 @@ class UserCreateParams(TypedDict, total=False): email: Optional[str] - feature_flags: Optional[List[Literal["pdf_parsing", "labeler", "none"]]] - is_admin: bool + permissions: Optional[List[Literal["pdf_parsing", "labeler", "debug", "none"]]] + test: bool diff --git a/src/structify/types/admin/user_get_credits_params.py b/src/structify/types/admin/user_get_credits_params.py new file mode 100644 index 00000000..154c8f11 --- /dev/null +++ b/src/structify/types/admin/user_get_credits_params.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["UserGetCreditsParams"] + + +class UserGetCreditsParams(TypedDict, total=False): + user_email: Required[str] diff --git a/src/structify/types/admin/user_get_credits_response.py b/src/structify/types/admin/user_get_credits_response.py new file mode 100644 index 00000000..ec97bc6b --- /dev/null +++ b/src/structify/types/admin/user_get_credits_response.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import TypeAlias + +__all__ = ["UserGetCreditsResponse"] + +UserGetCreditsResponse: TypeAlias = int diff --git a/src/structify/types/admin/user_set_credits_params.py b/src/structify/types/admin/user_set_credits_params.py new file mode 100644 index 00000000..45e3f91e --- /dev/null +++ b/src/structify/types/admin/user_set_credits_params.py @@ -0,0 +1,13 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["UserSetCreditsParams"] + + +class UserSetCreditsParams(TypedDict, total=False): + credit_count: Required[int] + + user_email: Required[str] diff --git a/src/structify/types/admin/user_set_credits_response.py b/src/structify/types/admin/user_set_credits_response.py new file mode 100644 index 00000000..f859d706 --- /dev/null +++ b/src/structify/types/admin/user_set_credits_response.py @@ -0,0 +1,7 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing_extensions import TypeAlias + +__all__ = ["UserSetCreditsResponse"] + +UserSetCreditsResponse: TypeAlias = int diff --git a/src/structify/types/structure_run_async_params.py b/src/structify/types/structure_run_async_params.py index e732e895..64eace27 100644 --- a/src/structify/types/structure_run_async_params.py +++ b/src/structify/types/structure_run_async_params.py @@ -311,8 +311,12 @@ class StructureInputBasicBasicTextDocument(TypedDict, total=False): class StructureInputBasicBasicWebSearchWebSearch(TypedDict, total=False): + description: Optional[str] + starting_website: str + title: Optional[str] + class StructureInputBasicBasicWebSearch(TypedDict, total=False): web_search: Required[Annotated[StructureInputBasicBasicWebSearchWebSearch, PropertyInfo(alias="WebSearch")]] diff --git a/src/structify/types/token_response.py b/src/structify/types/token_response.py index 9d68385b..48fe555f 100644 --- a/src/structify/types/token_response.py +++ b/src/structify/types/token_response.py @@ -1,5 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from typing import List +from typing_extensions import Literal from .._models import BaseModel @@ -8,3 +10,5 @@ class TokenResponse(BaseModel): token: str + + permissions: List[Literal["pdf_parsing", "labeler", "debug", "none"]] diff --git a/src/structify/types/user_info.py b/src/structify/types/user_info.py index 2bb88342..b3258afb 100644 --- a/src/structify/types/user_info.py +++ b/src/structify/types/user_info.py @@ -1,5 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from typing import List +from typing_extensions import Literal from .._models import BaseModel @@ -13,4 +15,6 @@ class UserInfo(BaseModel): is_admin: bool + permissions: List[Literal["pdf_parsing", "labeler", "debug", "none"]] + username: str diff --git a/tests/api_resources/admin/test_users.py b/tests/api_resources/admin/test_users.py index 68b3eb33..4852f334 100644 --- a/tests/api_resources/admin/test_users.py +++ b/tests/api_resources/admin/test_users.py @@ -10,7 +10,11 @@ from structify import Structify, AsyncStructify from tests.utils import assert_matches_type from structify.types import TokenResponse -from structify.types.admin import UserListResponse +from structify.types.admin import ( + UserListResponse, + UserGetCreditsResponse, + UserSetCreditsResponse, +) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -28,8 +32,8 @@ def test_method_create_with_all_params(self, client: Structify) -> None: user = client.admin.users.create( credit_count=0, email="email", - feature_flags=["pdf_parsing"], is_admin=True, + permissions=["pdf_parsing"], test=True, ) assert_matches_type(TokenResponse, user, path=["response"]) @@ -79,6 +83,71 @@ def test_streaming_response_list(self, client: Structify) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_get_credits(self, client: Structify) -> None: + user = client.admin.users.get_credits( + user_email="user_email", + ) + assert_matches_type(UserGetCreditsResponse, user, path=["response"]) + + @parametrize + def test_raw_response_get_credits(self, client: Structify) -> None: + response = client.admin.users.with_raw_response.get_credits( + user_email="user_email", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user = response.parse() + assert_matches_type(UserGetCreditsResponse, user, path=["response"]) + + @parametrize + def test_streaming_response_get_credits(self, client: Structify) -> None: + with client.admin.users.with_streaming_response.get_credits( + user_email="user_email", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user = response.parse() + assert_matches_type(UserGetCreditsResponse, user, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_set_credits(self, client: Structify) -> None: + user = client.admin.users.set_credits( + credit_count=0, + user_email="user_email", + ) + assert_matches_type(UserSetCreditsResponse, user, path=["response"]) + + @parametrize + def test_raw_response_set_credits(self, client: Structify) -> None: + response = client.admin.users.with_raw_response.set_credits( + credit_count=0, + user_email="user_email", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user = response.parse() + assert_matches_type(UserSetCreditsResponse, user, path=["response"]) + + @parametrize + def test_streaming_response_set_credits(self, client: Structify) -> None: + with client.admin.users.with_streaming_response.set_credits( + credit_count=0, + user_email="user_email", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user = response.parse() + assert_matches_type(UserSetCreditsResponse, user, path=["response"]) + + assert cast(Any, response.is_closed) is True + class TestAsyncUsers: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @@ -93,8 +162,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncStructify) user = await async_client.admin.users.create( credit_count=0, email="email", - feature_flags=["pdf_parsing"], is_admin=True, + permissions=["pdf_parsing"], test=True, ) assert_matches_type(TokenResponse, user, path=["response"]) @@ -143,3 +212,68 @@ async def test_streaming_response_list(self, async_client: AsyncStructify) -> No assert_matches_type(UserListResponse, user, path=["response"]) assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_get_credits(self, async_client: AsyncStructify) -> None: + user = await async_client.admin.users.get_credits( + user_email="user_email", + ) + assert_matches_type(UserGetCreditsResponse, user, path=["response"]) + + @parametrize + async def test_raw_response_get_credits(self, async_client: AsyncStructify) -> None: + response = await async_client.admin.users.with_raw_response.get_credits( + user_email="user_email", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user = await response.parse() + assert_matches_type(UserGetCreditsResponse, user, path=["response"]) + + @parametrize + async def test_streaming_response_get_credits(self, async_client: AsyncStructify) -> None: + async with async_client.admin.users.with_streaming_response.get_credits( + user_email="user_email", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user = await response.parse() + assert_matches_type(UserGetCreditsResponse, user, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_set_credits(self, async_client: AsyncStructify) -> None: + user = await async_client.admin.users.set_credits( + credit_count=0, + user_email="user_email", + ) + assert_matches_type(UserSetCreditsResponse, user, path=["response"]) + + @parametrize + async def test_raw_response_set_credits(self, async_client: AsyncStructify) -> None: + response = await async_client.admin.users.with_raw_response.set_credits( + credit_count=0, + user_email="user_email", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + user = await response.parse() + assert_matches_type(UserSetCreditsResponse, user, path=["response"]) + + @parametrize + async def test_streaming_response_set_credits(self, async_client: AsyncStructify) -> None: + async with async_client.admin.users.with_streaming_response.set_credits( + credit_count=0, + user_email="user_email", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + user = await response.parse() + assert_matches_type(UserSetCreditsResponse, user, path=["response"]) + + assert cast(Any, response.is_closed) is True