From 2bbc5732a644119be4d2a1c5a88fdb0f451ba27f Mon Sep 17 00:00:00 2001 From: Dima Date: Mon, 21 Sep 2026 09:56:03 +0100 Subject: [PATCH] fix: prevent schema names from shadowing endpoint imports Alias endpoint-owned Client, AuthenticatedClient, Response and HTTPStatus imports while preserving generated model names and public SDK types. Cover resolved annotations, request execution and response identities in functional tests, and update generated fixtures and release notes. --- ...int_import_collisions_with_schema_names.md | 7 + .../test_client_import_collision.py | 141 ++++++++++++++++++ .../api/default/get_weird_responses.py | 23 +-- .../api/default/misc_metadata_escapes.py | 27 ++-- .../api/default/non_string_example.py | 23 +-- .../api/default/property_escapes.py | 23 +-- .../api/printtag_escape/with_braces_path.py | 24 +-- .../enums/bool_enum_tests_bool_enum_post.py | 24 +-- .../api/enums/int_enum_tests_int_enum_post.py | 24 +-- .../api/tests/get_user_list.py | 28 ++-- .../api/tests/post_user_list.py | 28 ++-- .../api/bodies/json_like.py | 24 +-- .../api/bodies/optional_body.py | 24 +-- .../api/bodies/post_bodies_multiple.py | 24 +-- .../my_test_api_client/api/bodies/refs.py | 24 +-- .../api/config/content_type_override.py | 28 ++-- .../api/default/get_common_parameters.py | 24 +-- .../api/default/get_models_allof.py | 29 ++-- .../get_models_oneof_with_required_const.py | 29 ++-- .../api/default/post_common_parameters.py | 24 +-- .../post_types_unions_duplicate_types.py | 28 ++-- .../api/default/reserved_parameters.py | 24 +-- .../defaults/defaults_tests_defaults_post.py | 30 ++-- .../enums/bool_enum_tests_bool_enum_post.py | 24 +-- .../api/enums/int_enum_tests_int_enum_post.py | 24 +-- .../api/location/get_location_header_types.py | 24 +-- .../get_location_query_optionality.py | 24 +-- .../api/naming/hyphen_in_path.py | 23 +-- .../api/naming/mixed_case.py | 30 ++-- ...st_naming_property_conflict_with_import.py | 30 ++-- .../get_parameter_references_path_param.py | 24 +-- ...lete_common_parameters_overriding_param.py | 24 +-- .../get_common_parameters_overriding_param.py | 24 +-- .../get_same_name_multiple_locations_param.py | 24 +-- .../parameters/multiple_path_parameters.py | 23 +-- .../api/responses/default_status_code.py | 27 ++-- ..._responses_unions_simple_before_complex.py | 29 ++-- .../api/responses/reference_response.py | 27 ++-- .../api/responses/status_code_patterns.py | 29 ++-- .../api/responses/status_code_precedence.py | 27 ++-- .../api/responses/text_response.py | 27 ++-- .../api/tag1/get_tag_with_number.py | 23 +-- .../api/tag2/get_tag_with_number.py | 23 +-- .../api/tests/callback_test.py | 29 ++-- .../api/tests/description_with_backslash.py | 23 +-- .../api/tests/get_basic_list_of_booleans.py | 27 ++-- .../api/tests/get_basic_list_of_floats.py | 27 ++-- .../api/tests/get_basic_list_of_integers.py | 27 ++-- .../api/tests/get_basic_list_of_strings.py | 27 ++-- .../api/tests/get_user_list.py | 30 ++-- .../tests/json_body_tests_json_body_post.py | 29 ++-- .../no_response_tests_no_response_get.py | 23 +-- .../octet_stream_tests_octet_stream_get.py | 28 ++-- .../octet_stream_tests_octet_stream_post.py | 30 ++-- .../api/tests/post_form_data.py | 23 +-- .../api/tests/post_form_data_inline.py | 23 +-- .../api/tests/post_tests_json_body_string.py | 29 ++-- .../api/tests/test_inline_objects.py | 29 ++-- ..._with_cookie_auth_token_with_cookie_get.py | 23 +-- ...d_content_tests_unsupported_content_get.py | 23 +-- .../tests/upload_file_tests_upload_post.py | 29 ++-- .../my_test_api_client/api/true_/false_.py | 24 +-- .../api/const/post_const_path.py | 30 ++-- .../api/prefix_items/post_prefix_items.py | 27 ++-- .../api/body/post_body_multipart.py | 30 ++-- .../api/parameters/post_parameters_header.py | 29 ++-- .../templates/endpoint_macros.py.jinja | 4 +- .../templates/endpoint_module.py.jinja | 18 +-- 68 files changed, 1039 insertions(+), 796 deletions(-) create mode 100644 .changeset/fix_endpoint_import_collisions_with_schema_names.md create mode 100644 end_to_end_tests/functional_tests/generated_code_execution/test_client_import_collision.py diff --git a/.changeset/fix_endpoint_import_collisions_with_schema_names.md b/.changeset/fix_endpoint_import_collisions_with_schema_names.md new file mode 100644 index 000000000..6e59aa680 --- /dev/null +++ b/.changeset/fix_endpoint_import_collisions_with_schema_names.md @@ -0,0 +1,7 @@ +--- +default: patch +--- + +# Fixed generated endpoints breaking when a schema is named `Client`, `AuthenticatedClient`, `Response` or `HTTPStatus` + +Generated endpoint modules imported the SDK's `Client`, `AuthenticatedClient` and `Response` classes and the standard library's `HTTPStatus` under their bare names, so a model with one of those names shadowed them. Depending on the name this produced wrong type annotations, a failed response build, or a `Response.status_code` that held a model instance instead of an `HTTPStatus`. Endpoint modules now bind these generator-owned symbols under private aliases, leaving the public model names unchanged. diff --git a/end_to_end_tests/functional_tests/generated_code_execution/test_client_import_collision.py b/end_to_end_tests/functional_tests/generated_code_execution/test_client_import_collision.py new file mode 100644 index 000000000..8d1179871 --- /dev/null +++ b/end_to_end_tests/functional_tests/generated_code_execution/test_client_import_collision.py @@ -0,0 +1,141 @@ +import asyncio +import json +from collections.abc import Iterator +from http import HTTPStatus +from typing import get_type_hints + +import httpx +import pytest + +from end_to_end_tests.generated_client import GeneratedClientContext, generate_client_from_inline_spec + +ISSUE_SPEC = """ +openapi: "3.0.3" +info: + title: Minimal repro + version: "1.0" +paths: + /api/clients/{id}: + patch: + operationId: update_client + tags: + - client + parameters: + - name: id + in: path + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + type: object + properties: + name: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: "#/components/schemas/Client" +components: + schemas: + Client: + type: object + properties: + name: + type: string +""" + + +@pytest.fixture(params=["Client", "AuthenticatedClient", "Response", "HTTPStatus", "Customer"]) +def generated_client(request: pytest.FixtureRequest) -> Iterator[GeneratedClientContext]: + # Client is the original issue document; Customer is a non-collision control. + spec = ISSUE_SPEC.replace("Client", request.param) + with generate_client_from_inline_spec( + spec, base_module="minimal_repro_client", add_missing_sections=False + ) as generated: + yield generated + + +def test_endpoint_types_and_requests(generated_client: GeneratedClientContext) -> None: + endpoint = generated_client.import_module(".api.client.update_client") + transport = generated_client.import_module(".client") + model = get_type_hints(endpoint._parse_response)["return"] + models = generated_client.import_module(".models") + response_type = generated_client.import_symbol(".types", "Response") + body_type = generated_client.import_symbol(".models", "UpdateClientBody") + package = generated_client.import_module("") + + # Compare with public exports, independently of endpoint import aliases. + schema_model = next( + getattr(models, name) + for name in ("Client", "AuthenticatedClient", "Response", "HTTPStatus", "Customer") + if hasattr(models, name) + ) + assert model == schema_model | None + assert package.Client is transport.Client + assert package.AuthenticatedClient is transport.AuthenticatedClient + assert schema_model is not transport.Client + assert schema_model is not transport.AuthenticatedClient + assert schema_model is not response_type + + for function_name in ("_parse_response", "_build_response", "sync", "sync_detailed", "asyncio", "asyncio_detailed"): + hints = get_type_hints(getattr(endpoint, function_name)) + assert hints["client"] == transport.AuthenticatedClient | transport.Client + detailed = function_name == "_build_response" or function_name.endswith("_detailed") + assert hints["return"] == (response_type[schema_model] if detailed else schema_model | None) + + def handle_request(request: httpx.Request) -> httpx.Response: + assert request.method == "PATCH" + assert request.url.path == "/api/clients/one" + assert json.loads(request.content) == {"name": "Ada"} + return httpx.Response(200, json={"name": "Ada"}) + + def check_result(result, detailed: bool) -> None: + if detailed: + assert type(result) is response_type + assert result.status_code is HTTPStatus.OK + result = result.parsed + assert type(result) is schema_model + assert result.name == "Ada" + + with httpx.Client(base_url="https://example.test", transport=httpx.MockTransport(handle_request)) as http_client: + client = transport.Client(base_url="https://example.test").set_httpx_client(http_client) + for operation in (endpoint.sync, endpoint.sync_detailed): + check_result( + operation("one", client=client, body=body_type(name="Ada")), operation is endpoint.sync_detailed + ) + + async def call_async() -> None: + async with httpx.AsyncClient( + base_url="https://example.test", transport=httpx.MockTransport(handle_request) + ) as http_client: + client = transport.AuthenticatedClient( + base_url="https://example.test", token="token" + ).set_async_httpx_client(http_client) + for operation in (endpoint.asyncio, endpoint.asyncio_detailed): + check_result( + await operation("one", client=client, body=body_type(name="Ada")), + operation is endpoint.asyncio_detailed, + ) + + asyncio.run(call_async()) + + +def test_authenticated_endpoint_client_type() -> None: + spec = ( + ISSUE_SPEC.replace("Client", "AuthenticatedClient") + .replace("operationId: update_client", "operationId: update_client\n security: [{bearer: []}]") + .replace("components:", "components:\n securitySchemes:\n bearer:\n type: http\n scheme: bearer") + ) + with generate_client_from_inline_spec( + spec, base_module="minimal_repro_client", add_missing_sections=False + ) as generated: + endpoint = generated.import_module(".api.client.update_client") + transport = generated.import_symbol(".client", "AuthenticatedClient") + for function_name in ("sync", "sync_detailed", "asyncio", "asyncio_detailed"): + assert get_type_hints(getattr(endpoint, function_name))["client"] is transport diff --git a/end_to_end_tests/golden-records/escapes-client/escapes_client/api/default/get_weird_responses.py b/end_to_end_tests/golden-records/escapes-client/escapes_client/api/default/get_weird_responses.py index 81a43a14b..0f8f14e29 100644 --- a/end_to_end_tests/golden-records/escapes-client/escapes_client/api/default/get_weird_responses.py +++ b/end_to_end_tests/golden-records/escapes-client/escapes_client/api/default/get_weird_responses.py @@ -1,11 +1,12 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client -from ...types import Response +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client +from ...types import Response as _Response def _get_kwargs() -> dict[str, Any]: @@ -18,16 +19,16 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> Any | None: if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[Any]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -36,8 +37,8 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[Any]: + client: _AuthenticatedClient | _Client, +) -> _Response[Any]: """ Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -58,8 +59,8 @@ def sync_detailed( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[Any]: + client: _AuthenticatedClient | _Client, +) -> _Response[Any]: """ Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. diff --git a/end_to_end_tests/golden-records/escapes-client/escapes_client/api/default/misc_metadata_escapes.py b/end_to_end_tests/golden-records/escapes-client/escapes_client/api/default/misc_metadata_escapes.py index adabb42d1..749a66eab 100644 --- a/end_to_end_tests/golden-records/escapes-client/escapes_client/api/default/misc_metadata_escapes.py +++ b/end_to_end_tests/golden-records/escapes-client/escapes_client/api/default/misc_metadata_escapes.py @@ -1,12 +1,13 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any, cast import httpx from ... import errors -from ...client import AuthenticatedClient, Client +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client from ...models.misc_metadata_escapes_body import MiscMetadataEscapesBody -from ...types import Response +from ...types import Response as _Response def _get_kwargs( @@ -28,7 +29,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> str | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> str | None: if response.status_code == 200: response_200 = cast(str, response.json()) return response_200 @@ -39,9 +40,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[str]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[str]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -50,9 +51,9 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: MiscMetadataEscapesBody, -) -> Response[str]: +) -> _Response[str]: """ Args: body (MiscMetadataEscapesBody): @@ -78,7 +79,7 @@ def sync_detailed( def sync( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: MiscMetadataEscapesBody, ) -> str | None: """ @@ -101,9 +102,9 @@ def sync( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: MiscMetadataEscapesBody, -) -> Response[str]: +) -> _Response[str]: """ Args: body (MiscMetadataEscapesBody): @@ -127,7 +128,7 @@ async def asyncio_detailed( async def asyncio( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: MiscMetadataEscapesBody, ) -> str | None: """ diff --git a/end_to_end_tests/golden-records/escapes-client/escapes_client/api/default/non_string_example.py b/end_to_end_tests/golden-records/escapes-client/escapes_client/api/default/non_string_example.py index 7090834e2..ecbdf819f 100644 --- a/end_to_end_tests/golden-records/escapes-client/escapes_client/api/default/non_string_example.py +++ b/end_to_end_tests/golden-records/escapes-client/escapes_client/api/default/non_string_example.py @@ -1,12 +1,13 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client from ...models.non_string_example_body import NonStringExampleBody -from ...types import Response +from ...types import Response as _Response def _get_kwargs( @@ -28,7 +29,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None @@ -38,9 +39,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[Any]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -49,9 +50,9 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: NonStringExampleBody, -) -> Response[Any]: +) -> _Response[Any]: """ Args: body (NonStringExampleBody): @@ -77,9 +78,9 @@ def sync_detailed( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: NonStringExampleBody, -) -> Response[Any]: +) -> _Response[Any]: """ Args: body (NonStringExampleBody): diff --git a/end_to_end_tests/golden-records/escapes-client/escapes_client/api/default/property_escapes.py b/end_to_end_tests/golden-records/escapes-client/escapes_client/api/default/property_escapes.py index 8a62c1764..2f16aa3d9 100644 --- a/end_to_end_tests/golden-records/escapes-client/escapes_client/api/default/property_escapes.py +++ b/end_to_end_tests/golden-records/escapes-client/escapes_client/api/default/property_escapes.py @@ -1,12 +1,13 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client from ...models.property_escapes_model_title_printuh_oh import PropertyEscapesModelTitlePrintuhOh -from ...types import Response +from ...types import Response as _Response def _get_kwargs( @@ -28,7 +29,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None @@ -38,9 +39,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[Any]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -49,9 +50,9 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: PropertyEscapesModelTitlePrintuhOh, -) -> Response[Any]: +) -> _Response[Any]: """ Args: body (PropertyEscapesModelTitlePrintuhOh): @@ -77,9 +78,9 @@ def sync_detailed( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: PropertyEscapesModelTitlePrintuhOh, -) -> Response[Any]: +) -> _Response[Any]: """ Args: body (PropertyEscapesModelTitlePrintuhOh): diff --git a/end_to_end_tests/golden-records/escapes-client/escapes_client/api/printtag_escape/with_braces_path.py b/end_to_end_tests/golden-records/escapes-client/escapes_client/api/printtag_escape/with_braces_path.py index cbbbc3541..5c05c37c7 100644 --- a/end_to_end_tests/golden-records/escapes-client/escapes_client/api/printtag_escape/with_braces_path.py +++ b/end_to_end_tests/golden-records/escapes-client/escapes_client/api/printtag_escape/with_braces_path.py @@ -1,13 +1,15 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any from urllib.parse import quote import httpx from ... import errors -from ...client import AuthenticatedClient, Client +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client from ...models.with_braces_path_body import WithBracesPathBody -from ...types import UNSET, Response, Unset +from ...types import UNSET, Unset +from ...types import Response as _Response def _get_kwargs( @@ -40,7 +42,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None @@ -50,9 +52,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[Any]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -62,10 +64,10 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( param: str, *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: WithBracesPathBody, printescape_param_name: str | Unset = UNSET, -) -> Response[Any]: +) -> _Response[Any]: """Summary \"\"\" Attempting to escape docstring \"\"\" print('uh oh') @@ -99,10 +101,10 @@ def sync_detailed( async def asyncio_detailed( param: str, *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: WithBracesPathBody, printescape_param_name: str | Unset = UNSET, -) -> Response[Any]: +) -> _Response[Any]: """Summary \"\"\" Attempting to escape docstring \"\"\" print('uh oh') diff --git a/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/api/enums/bool_enum_tests_bool_enum_post.py b/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/api/enums/bool_enum_tests_bool_enum_post.py index 53b574ebd..b1c6eea45 100644 --- a/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/api/enums/bool_enum_tests_bool_enum_post.py +++ b/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/api/enums/bool_enum_tests_bool_enum_post.py @@ -1,11 +1,13 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client -from ...types import UNSET, Response +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client +from ...types import UNSET +from ...types import Response as _Response def _get_kwargs( @@ -28,7 +30,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None @@ -38,9 +40,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[Any]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -49,9 +51,9 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, bool_enum: bool, -) -> Response[Any]: +) -> _Response[Any]: """Bool Enum Args: @@ -78,9 +80,9 @@ def sync_detailed( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, bool_enum: bool, -) -> Response[Any]: +) -> _Response[Any]: """Bool Enum Args: diff --git a/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/api/enums/int_enum_tests_int_enum_post.py b/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/api/enums/int_enum_tests_int_enum_post.py index f936104b5..e1a5053ef 100644 --- a/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/api/enums/int_enum_tests_int_enum_post.py +++ b/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/api/enums/int_enum_tests_int_enum_post.py @@ -1,12 +1,14 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client from ...models.an_int_enum import AnIntEnum -from ...types import UNSET, Response +from ...types import UNSET +from ...types import Response as _Response def _get_kwargs( @@ -30,7 +32,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None @@ -40,9 +42,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[Any]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -51,9 +53,9 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, int_enum: AnIntEnum, -) -> Response[Any]: +) -> _Response[Any]: """Int Enum Args: @@ -80,9 +82,9 @@ def sync_detailed( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, int_enum: AnIntEnum, -) -> Response[Any]: +) -> _Response[Any]: """Int Enum Args: diff --git a/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/api/tests/get_user_list.py b/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/api/tests/get_user_list.py index 15b821528..e9aff264c 100644 --- a/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/api/tests/get_user_list.py +++ b/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/api/tests/get_user_list.py @@ -1,10 +1,11 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client from ...models.a_model import AModel from ...models.an_enum import AnEnum from ...models.an_enum_with_null import AnEnumWithNull @@ -12,7 +13,8 @@ from ...models.get_user_list_string_enum_header import ( GetUserListStringEnumHeader, ) -from ...types import UNSET, Response, Unset +from ...types import UNSET, Unset +from ...types import Response as _Response def _get_kwargs( @@ -66,7 +68,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> list[AModel] | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> list[AModel] | None: if response.status_code == 200: response_200 = [] _response_200 = response.json() @@ -83,9 +85,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[list[AModel]]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[list[AModel]]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -94,13 +96,13 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, an_enum_value: list[AnEnum], an_enum_value_with_null: list[AnEnumWithNull | None], an_enum_value_with_only_null: list[None], int_enum_header: GetUserListIntEnumHeader | Unset = UNSET, string_enum_header: GetUserListStringEnumHeader | Unset = UNSET, -) -> Response[list[AModel]]: +) -> _Response[list[AModel]]: """Get List Get a list of things @@ -137,7 +139,7 @@ def sync_detailed( def sync( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, an_enum_value: list[AnEnum], an_enum_value_with_null: list[AnEnumWithNull | None], an_enum_value_with_only_null: list[None], @@ -175,13 +177,13 @@ def sync( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, an_enum_value: list[AnEnum], an_enum_value_with_null: list[AnEnumWithNull | None], an_enum_value_with_only_null: list[None], int_enum_header: GetUserListIntEnumHeader | Unset = UNSET, string_enum_header: GetUserListStringEnumHeader | Unset = UNSET, -) -> Response[list[AModel]]: +) -> _Response[list[AModel]]: """Get List Get a list of things @@ -216,7 +218,7 @@ async def asyncio_detailed( async def asyncio( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, an_enum_value: list[AnEnum], an_enum_value_with_null: list[AnEnumWithNull | None], an_enum_value_with_only_null: list[None], diff --git a/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/api/tests/post_user_list.py b/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/api/tests/post_user_list.py index 911d81248..4fba90262 100644 --- a/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/api/tests/post_user_list.py +++ b/end_to_end_tests/golden-records/my-enum-api-client/my_enum_api_client/api/tests/post_user_list.py @@ -1,13 +1,15 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client from ...models.a_model import AModel from ...models.post_user_list_body import PostUserListBody -from ...types import UNSET, Response, Unset +from ...types import UNSET, Unset +from ...types import Response as _Response def _get_kwargs( @@ -30,7 +32,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> list[AModel] | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> list[AModel] | None: if response.status_code == 200: response_200 = [] _response_200 = response.json() @@ -47,9 +49,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[list[AModel]]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[list[AModel]]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -58,9 +60,9 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: PostUserListBody | Unset = UNSET, -) -> Response[list[AModel]]: +) -> _Response[list[AModel]]: """Post List Post a list of things @@ -89,7 +91,7 @@ def sync_detailed( def sync( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: PostUserListBody | Unset = UNSET, ) -> list[AModel] | None: """Post List @@ -115,9 +117,9 @@ def sync( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: PostUserListBody | Unset = UNSET, -) -> Response[list[AModel]]: +) -> _Response[list[AModel]]: """Post List Post a list of things @@ -144,7 +146,7 @@ async def asyncio_detailed( async def asyncio( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: PostUserListBody | Unset = UNSET, ) -> list[AModel] | None: """Post List diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/bodies/json_like.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/bodies/json_like.py index 1a4fc2fd9..1e7f60622 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/bodies/json_like.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/bodies/json_like.py @@ -1,12 +1,14 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client from ...models.json_like_body import JsonLikeBody -from ...types import UNSET, Response, Unset +from ...types import UNSET, Unset +from ...types import Response as _Response def _get_kwargs( @@ -29,7 +31,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None @@ -39,9 +41,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[Any]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -50,9 +52,9 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: JsonLikeBody | Unset = UNSET, -) -> Response[Any]: +) -> _Response[Any]: """A content type that works like json but isn't application/json Args: @@ -79,9 +81,9 @@ def sync_detailed( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: JsonLikeBody | Unset = UNSET, -) -> Response[Any]: +) -> _Response[Any]: """A content type that works like json but isn't application/json Args: diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/bodies/optional_body.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/bodies/optional_body.py index 8402cf086..4af871cf5 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/bodies/optional_body.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/bodies/optional_body.py @@ -1,12 +1,14 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client from ...models.optional_body_body import OptionalBodyBody -from ...types import UNSET, Response, Unset +from ...types import UNSET, Unset +from ...types import Response as _Response def _get_kwargs( @@ -29,7 +31,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None @@ -39,9 +41,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[Any]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -50,9 +52,9 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: OptionalBodyBody | Unset = UNSET, -) -> Response[Any]: +) -> _Response[Any]: """Test optional request body Args: @@ -79,9 +81,9 @@ def sync_detailed( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: OptionalBodyBody | Unset = UNSET, -) -> Response[Any]: +) -> _Response[Any]: """Test optional request body Args: diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/bodies/post_bodies_multiple.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/bodies/post_bodies_multiple.py index 9361e3f56..65aa62b34 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/bodies/post_bodies_multiple.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/bodies/post_bodies_multiple.py @@ -1,14 +1,16 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client from ...models.post_bodies_multiple_data_body import PostBodiesMultipleDataBody from ...models.post_bodies_multiple_files_body import PostBodiesMultipleFilesBody from ...models.post_bodies_multiple_json_body import PostBodiesMultipleJsonBody -from ...types import UNSET, File, Response, Unset +from ...types import UNSET, File, Unset +from ...types import Response as _Response def _get_kwargs( @@ -45,7 +47,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None @@ -55,9 +57,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[Any]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -66,9 +68,9 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: PostBodiesMultipleJsonBody | File | PostBodiesMultipleDataBody | PostBodiesMultipleFilesBody | Unset = UNSET, -) -> Response[Any]: +) -> _Response[Any]: """Test multiple bodies Args: @@ -98,9 +100,9 @@ def sync_detailed( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: PostBodiesMultipleJsonBody | File | PostBodiesMultipleDataBody | PostBodiesMultipleFilesBody | Unset = UNSET, -) -> Response[Any]: +) -> _Response[Any]: """Test multiple bodies Args: diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/bodies/refs.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/bodies/refs.py index 2e224bc8c..d3848c59d 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/bodies/refs.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/bodies/refs.py @@ -1,12 +1,14 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client from ...models.a_model import AModel -from ...types import UNSET, Response, Unset +from ...types import UNSET, Unset +from ...types import Response as _Response def _get_kwargs( @@ -29,7 +31,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None @@ -39,9 +41,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[Any]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -50,9 +52,9 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: AModel | Unset = UNSET, -) -> Response[Any]: +) -> _Response[Any]: """Test request body defined via ref Args: @@ -79,9 +81,9 @@ def sync_detailed( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: AModel | Unset = UNSET, -) -> Response[Any]: +) -> _Response[Any]: """Test request body defined via ref Args: diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/config/content_type_override.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/config/content_type_override.py index be06459be..5e4f3bce1 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/config/content_type_override.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/config/content_type_override.py @@ -1,11 +1,13 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any, cast import httpx from ... import errors -from ...client import AuthenticatedClient, Client -from ...types import UNSET, Response, Unset +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client +from ...types import UNSET, Unset +from ...types import Response as _Response def _get_kwargs( @@ -28,7 +30,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> str | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> str | None: if response.status_code == 200: response_200 = cast(str, response.json()) return response_200 @@ -39,9 +41,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[str]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[str]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -50,9 +52,9 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: str | Unset = UNSET, -) -> Response[str]: +) -> _Response[str]: """Content Type Override Args: @@ -79,7 +81,7 @@ def sync_detailed( def sync( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: str | Unset = UNSET, ) -> str | None: """Content Type Override @@ -103,9 +105,9 @@ def sync( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: str | Unset = UNSET, -) -> Response[str]: +) -> _Response[str]: """Content Type Override Args: @@ -130,7 +132,7 @@ async def asyncio_detailed( async def asyncio( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: str | Unset = UNSET, ) -> str | None: """Content Type Override diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/get_common_parameters.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/get_common_parameters.py index c82055686..7dfd82a7f 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/get_common_parameters.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/get_common_parameters.py @@ -1,11 +1,13 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client -from ...types import UNSET, Response, Unset +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client +from ...types import UNSET, Unset +from ...types import Response as _Response def _get_kwargs( @@ -28,7 +30,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None @@ -38,9 +40,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[Any]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -49,9 +51,9 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, common: str | Unset = UNSET, -) -> Response[Any]: +) -> _Response[Any]: """ Args: common (str | Unset): @@ -77,9 +79,9 @@ def sync_detailed( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, common: str | Unset = UNSET, -) -> Response[Any]: +) -> _Response[Any]: """ Args: common (str | Unset): diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/get_models_allof.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/get_models_allof.py index 3558ef1be..d10ec149f 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/get_models_allof.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/get_models_allof.py @@ -1,12 +1,13 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client from ...models.get_models_allof_response_200 import GetModelsAllofResponse200 -from ...types import Response +from ...types import Response as _Response def _get_kwargs() -> dict[str, Any]: @@ -20,7 +21,7 @@ def _get_kwargs() -> dict[str, Any]: def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: _AuthenticatedClient | _Client, response: httpx.Response ) -> GetModelsAllofResponse200 | None: if response.status_code == 200: response_200 = GetModelsAllofResponse200.from_dict(response.json()) @@ -34,10 +35,10 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[GetModelsAllofResponse200]: - return Response( - status_code=HTTPStatus(response.status_code), + *, client: _AuthenticatedClient | _Client, response: httpx.Response +) -> _Response[GetModelsAllofResponse200]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -46,8 +47,8 @@ def _build_response( def sync_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[GetModelsAllofResponse200]: + client: _AuthenticatedClient | _Client, +) -> _Response[GetModelsAllofResponse200]: """ Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -68,7 +69,7 @@ def sync_detailed( def sync( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, ) -> GetModelsAllofResponse200 | None: """ Raises: @@ -86,8 +87,8 @@ def sync( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[GetModelsAllofResponse200]: + client: _AuthenticatedClient | _Client, +) -> _Response[GetModelsAllofResponse200]: """ Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -106,7 +107,7 @@ async def asyncio_detailed( async def asyncio( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, ) -> GetModelsAllofResponse200 | None: """ Raises: diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/get_models_oneof_with_required_const.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/get_models_oneof_with_required_const.py index 73911b7cd..32cdf5e78 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/get_models_oneof_with_required_const.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/get_models_oneof_with_required_const.py @@ -1,17 +1,18 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client from ...models.get_models_oneof_with_required_const_response_200_type_0 import ( GetModelsOneofWithRequiredConstResponse200Type0, ) from ...models.get_models_oneof_with_required_const_response_200_type_1 import ( GetModelsOneofWithRequiredConstResponse200Type1, ) -from ...types import Response +from ...types import Response as _Response def _get_kwargs() -> dict[str, Any]: @@ -25,7 +26,7 @@ def _get_kwargs() -> dict[str, Any]: def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: _AuthenticatedClient | _Client, response: httpx.Response ) -> GetModelsOneofWithRequiredConstResponse200Type0 | GetModelsOneofWithRequiredConstResponse200Type1 | None: if response.status_code == 200: @@ -57,10 +58,10 @@ def _parse_response_200( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[GetModelsOneofWithRequiredConstResponse200Type0 | GetModelsOneofWithRequiredConstResponse200Type1]: - return Response( - status_code=HTTPStatus(response.status_code), + *, client: _AuthenticatedClient | _Client, response: httpx.Response +) -> _Response[GetModelsOneofWithRequiredConstResponse200Type0 | GetModelsOneofWithRequiredConstResponse200Type1]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -69,8 +70,8 @@ def _build_response( def sync_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[GetModelsOneofWithRequiredConstResponse200Type0 | GetModelsOneofWithRequiredConstResponse200Type1]: + client: _AuthenticatedClient | _Client, +) -> _Response[GetModelsOneofWithRequiredConstResponse200Type0 | GetModelsOneofWithRequiredConstResponse200Type1]: """ Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -91,7 +92,7 @@ def sync_detailed( def sync( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, ) -> GetModelsOneofWithRequiredConstResponse200Type0 | GetModelsOneofWithRequiredConstResponse200Type1 | None: """ Raises: @@ -109,8 +110,8 @@ def sync( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[GetModelsOneofWithRequiredConstResponse200Type0 | GetModelsOneofWithRequiredConstResponse200Type1]: + client: _AuthenticatedClient | _Client, +) -> _Response[GetModelsOneofWithRequiredConstResponse200Type0 | GetModelsOneofWithRequiredConstResponse200Type1]: """ Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -129,7 +130,7 @@ async def asyncio_detailed( async def asyncio( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, ) -> GetModelsOneofWithRequiredConstResponse200Type0 | GetModelsOneofWithRequiredConstResponse200Type1 | None: """ Raises: diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/post_common_parameters.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/post_common_parameters.py index 27509b93a..9f810c2c4 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/post_common_parameters.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/post_common_parameters.py @@ -1,11 +1,13 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client -from ...types import UNSET, Response, Unset +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client +from ...types import UNSET, Unset +from ...types import Response as _Response def _get_kwargs( @@ -28,7 +30,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None @@ -38,9 +40,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[Any]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -49,9 +51,9 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, common: str | Unset = UNSET, -) -> Response[Any]: +) -> _Response[Any]: """ Args: common (str | Unset): @@ -77,9 +79,9 @@ def sync_detailed( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, common: str | Unset = UNSET, -) -> Response[Any]: +) -> _Response[Any]: """ Args: common (str | Unset): diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/post_types_unions_duplicate_types.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/post_types_unions_duplicate_types.py index f6eabc4a7..35c632791 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/post_types_unions_duplicate_types.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/post_types_unions_duplicate_types.py @@ -1,12 +1,14 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client from ...models.a_model import AModel -from ...types import UNSET, Response, Unset +from ...types import UNSET, Unset +from ...types import Response as _Response def _get_kwargs( @@ -29,7 +31,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> AModel | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> AModel | None: if response.status_code == 200: def _parse_response_200(data: object) -> AModel: @@ -49,9 +51,9 @@ def _parse_response_200(data: object) -> AModel: return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[AModel]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[AModel]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -60,9 +62,9 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: AModel | Unset = UNSET, -) -> Response[AModel]: +) -> _Response[AModel]: """ Args: body (AModel | Unset): @@ -88,7 +90,7 @@ def sync_detailed( def sync( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: AModel | Unset = UNSET, ) -> AModel | None: """ @@ -111,9 +113,9 @@ def sync( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: AModel | Unset = UNSET, -) -> Response[AModel]: +) -> _Response[AModel]: """ Args: body (AModel | Unset): @@ -137,7 +139,7 @@ async def asyncio_detailed( async def asyncio( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: AModel | Unset = UNSET, ) -> AModel | None: """ diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/reserved_parameters.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/reserved_parameters.py index 687473903..9be8df8e5 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/reserved_parameters.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/default/reserved_parameters.py @@ -1,11 +1,13 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client -from ...types import UNSET, Response +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client +from ...types import UNSET +from ...types import Response as _Response def _get_kwargs( @@ -31,7 +33,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None @@ -41,9 +43,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[Any]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -52,10 +54,10 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, client_query: str, url_query: str, -) -> Response[Any]: +) -> _Response[Any]: """ Args: client_query (str): @@ -83,10 +85,10 @@ def sync_detailed( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, client_query: str, url_query: str, -) -> Response[Any]: +) -> _Response[Any]: """ Args: client_query (str): diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/defaults/defaults_tests_defaults_post.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/defaults/defaults_tests_defaults_post.py index 9990c8b5e..d7ee122ca 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/defaults/defaults_tests_defaults_post.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/defaults/defaults_tests_defaults_post.py @@ -1,15 +1,17 @@ import datetime -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client from ...models.an_enum import AnEnum from ...models.http_validation_error import HTTPValidationError from ...models.model_with_union_property import ModelWithUnionProperty -from ...types import UNSET, Response, Unset +from ...types import UNSET, Unset +from ...types import Response as _Response def _get_kwargs( @@ -87,7 +89,7 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: _AuthenticatedClient | _Client, response: httpx.Response ) -> Any | HTTPValidationError | None: if response.status_code == 200: response_200 = response.json() @@ -105,10 +107,10 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Any | HTTPValidationError]: - return Response( - status_code=HTTPStatus(response.status_code), + *, client: _AuthenticatedClient | _Client, response: httpx.Response +) -> _Response[Any | HTTPValidationError]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -117,7 +119,7 @@ def _build_response( def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, string_prop: str = "the default string", string_with_num: str = "1", date_prop: datetime.date = datetime.date.fromisoformat("1010-10-10"), @@ -131,7 +133,7 @@ def sync_detailed( enum_prop: AnEnum, model_prop: ModelWithUnionProperty, required_model_prop: ModelWithUnionProperty, -) -> Response[Any | HTTPValidationError]: +) -> _Response[Any | HTTPValidationError]: """Defaults Args: @@ -182,7 +184,7 @@ def sync_detailed( def sync( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, string_prop: str = "the default string", string_with_num: str = "1", date_prop: datetime.date = datetime.date.fromisoformat("1010-10-10"), @@ -242,7 +244,7 @@ def sync( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, string_prop: str = "the default string", string_with_num: str = "1", date_prop: datetime.date = datetime.date.fromisoformat("1010-10-10"), @@ -256,7 +258,7 @@ async def asyncio_detailed( enum_prop: AnEnum, model_prop: ModelWithUnionProperty, required_model_prop: ModelWithUnionProperty, -) -> Response[Any | HTTPValidationError]: +) -> _Response[Any | HTTPValidationError]: """Defaults Args: @@ -305,7 +307,7 @@ async def asyncio_detailed( async def asyncio( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, string_prop: str = "the default string", string_with_num: str = "1", date_prop: datetime.date = datetime.date.fromisoformat("1010-10-10"), diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/enums/bool_enum_tests_bool_enum_post.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/enums/bool_enum_tests_bool_enum_post.py index 53b574ebd..b1c6eea45 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/enums/bool_enum_tests_bool_enum_post.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/enums/bool_enum_tests_bool_enum_post.py @@ -1,11 +1,13 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client -from ...types import UNSET, Response +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client +from ...types import UNSET +from ...types import Response as _Response def _get_kwargs( @@ -28,7 +30,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None @@ -38,9 +40,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[Any]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -49,9 +51,9 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, bool_enum: bool, -) -> Response[Any]: +) -> _Response[Any]: """Bool Enum Args: @@ -78,9 +80,9 @@ def sync_detailed( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, bool_enum: bool, -) -> Response[Any]: +) -> _Response[Any]: """Bool Enum Args: diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/enums/int_enum_tests_int_enum_post.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/enums/int_enum_tests_int_enum_post.py index 264c5af9e..b0870e509 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/enums/int_enum_tests_int_enum_post.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/enums/int_enum_tests_int_enum_post.py @@ -1,12 +1,14 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client from ...models.an_int_enum import AnIntEnum -from ...types import UNSET, Response +from ...types import UNSET +from ...types import Response as _Response def _get_kwargs( @@ -30,7 +32,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None @@ -40,9 +42,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[Any]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -51,9 +53,9 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, int_enum: AnIntEnum, -) -> Response[Any]: +) -> _Response[Any]: """Int Enum Args: @@ -80,9 +82,9 @@ def sync_detailed( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, int_enum: AnIntEnum, -) -> Response[Any]: +) -> _Response[Any]: """Int Enum Args: diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/location/get_location_header_types.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/location/get_location_header_types.py index 20c2db527..3ec215a05 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/location/get_location_header_types.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/location/get_location_header_types.py @@ -1,13 +1,15 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client from ...models.get_location_header_types_int_enum_header import GetLocationHeaderTypesIntEnumHeader from ...models.get_location_header_types_string_enum_header import GetLocationHeaderTypesStringEnumHeader -from ...types import UNSET, Response, Unset +from ...types import UNSET, Unset +from ...types import Response as _Response def _get_kwargs( @@ -47,7 +49,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None @@ -57,9 +59,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[Any]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -68,14 +70,14 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, boolean_header: bool | Unset = UNSET, string_header: str | Unset = UNSET, number_header: float | Unset = UNSET, integer_header: int | Unset = UNSET, int_enum_header: GetLocationHeaderTypesIntEnumHeader | Unset = UNSET, string_enum_header: GetLocationHeaderTypesStringEnumHeader | Unset = UNSET, -) -> Response[Any]: +) -> _Response[Any]: """ Args: boolean_header (bool | Unset): @@ -111,14 +113,14 @@ def sync_detailed( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, boolean_header: bool | Unset = UNSET, string_header: str | Unset = UNSET, number_header: float | Unset = UNSET, integer_header: int | Unset = UNSET, int_enum_header: GetLocationHeaderTypesIntEnumHeader | Unset = UNSET, string_enum_header: GetLocationHeaderTypesStringEnumHeader | Unset = UNSET, -) -> Response[Any]: +) -> _Response[Any]: """ Args: boolean_header (bool | Unset): diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/location/get_location_query_optionality.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/location/get_location_query_optionality.py index 756e4a266..e9dc9f4c9 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/location/get_location_query_optionality.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/location/get_location_query_optionality.py @@ -1,12 +1,14 @@ import datetime -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client -from ...types import UNSET, Response, Unset +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client +from ...types import UNSET, Unset +from ...types import Response as _Response def _get_kwargs( @@ -54,7 +56,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None @@ -64,9 +66,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[Any]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -75,12 +77,12 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, not_null_required: datetime.datetime, null_required: datetime.datetime | None, null_not_required: datetime.datetime | None | Unset = UNSET, not_null_not_required: datetime.datetime | Unset = UNSET, -) -> Response[Any]: +) -> _Response[Any]: """ Args: not_null_required (datetime.datetime): @@ -112,12 +114,12 @@ def sync_detailed( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, not_null_required: datetime.datetime, null_required: datetime.datetime | None, null_not_required: datetime.datetime | None | Unset = UNSET, not_null_not_required: datetime.datetime | Unset = UNSET, -) -> Response[Any]: +) -> _Response[Any]: """ Args: not_null_required (datetime.datetime): diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/naming/hyphen_in_path.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/naming/hyphen_in_path.py index d30d3c1ae..101b0f2a3 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/naming/hyphen_in_path.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/naming/hyphen_in_path.py @@ -1,12 +1,13 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any from urllib.parse import quote import httpx from ... import errors -from ...client import AuthenticatedClient, Client -from ...types import Response +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client +from ...types import Response as _Response def _get_kwargs( @@ -23,7 +24,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None @@ -33,9 +34,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[Any]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -45,8 +46,8 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( hyphen_in_path: str, *, - client: AuthenticatedClient | Client, -) -> Response[Any]: + client: _AuthenticatedClient | _Client, +) -> _Response[Any]: """ Args: hyphen_in_path (str): @@ -73,8 +74,8 @@ def sync_detailed( async def asyncio_detailed( hyphen_in_path: str, *, - client: AuthenticatedClient | Client, -) -> Response[Any]: + client: _AuthenticatedClient | _Client, +) -> _Response[Any]: """ Args: hyphen_in_path (str): diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/naming/mixed_case.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/naming/mixed_case.py index 5945ad0de..96f898d04 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/naming/mixed_case.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/naming/mixed_case.py @@ -1,12 +1,14 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client from ...models.mixed_case_response_200 import MixedCaseResponse200 -from ...types import UNSET, Response +from ...types import UNSET +from ...types import Response as _Response def _get_kwargs( @@ -32,7 +34,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> MixedCaseResponse200 | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> MixedCaseResponse200 | None: if response.status_code == 200: response_200 = MixedCaseResponse200.from_dict(response.json()) @@ -45,10 +47,10 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[MixedCaseResponse200]: - return Response( - status_code=HTTPStatus(response.status_code), + *, client: _AuthenticatedClient | _Client, response: httpx.Response +) -> _Response[MixedCaseResponse200]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -57,10 +59,10 @@ def _build_response( def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, mixed_case: str, mixedCase: str, -) -> Response[MixedCaseResponse200]: +) -> _Response[MixedCaseResponse200]: """ Args: mixed_case (str): @@ -88,7 +90,7 @@ def sync_detailed( def sync( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, mixed_case: str, mixedCase: str, ) -> MixedCaseResponse200 | None: @@ -114,10 +116,10 @@ def sync( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, mixed_case: str, mixedCase: str, -) -> Response[MixedCaseResponse200]: +) -> _Response[MixedCaseResponse200]: """ Args: mixed_case (str): @@ -143,7 +145,7 @@ async def asyncio_detailed( async def asyncio( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, mixed_case: str, mixedCase: str, ) -> MixedCaseResponse200 | None: diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/naming/post_naming_property_conflict_with_import.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/naming/post_naming_property_conflict_with_import.py index 9e848f7af..975c8e510 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/naming/post_naming_property_conflict_with_import.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/naming/post_naming_property_conflict_with_import.py @@ -1,15 +1,17 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client from ...models.post_naming_property_conflict_with_import_body import PostNamingPropertyConflictWithImportBody from ...models.post_naming_property_conflict_with_import_response_200 import ( PostNamingPropertyConflictWithImportResponse200, ) -from ...types import UNSET, Response, Unset +from ...types import UNSET, Unset +from ...types import Response as _Response def _get_kwargs( @@ -33,7 +35,7 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: _AuthenticatedClient | _Client, response: httpx.Response ) -> PostNamingPropertyConflictWithImportResponse200 | None: if response.status_code == 200: response_200 = PostNamingPropertyConflictWithImportResponse200.from_dict(response.json()) @@ -47,10 +49,10 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[PostNamingPropertyConflictWithImportResponse200]: - return Response( - status_code=HTTPStatus(response.status_code), + *, client: _AuthenticatedClient | _Client, response: httpx.Response +) -> _Response[PostNamingPropertyConflictWithImportResponse200]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -59,9 +61,9 @@ def _build_response( def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: PostNamingPropertyConflictWithImportBody | Unset = UNSET, -) -> Response[PostNamingPropertyConflictWithImportResponse200]: +) -> _Response[PostNamingPropertyConflictWithImportResponse200]: """ Args: body (PostNamingPropertyConflictWithImportBody | Unset): @@ -87,7 +89,7 @@ def sync_detailed( def sync( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: PostNamingPropertyConflictWithImportBody | Unset = UNSET, ) -> PostNamingPropertyConflictWithImportResponse200 | None: """ @@ -110,9 +112,9 @@ def sync( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: PostNamingPropertyConflictWithImportBody | Unset = UNSET, -) -> Response[PostNamingPropertyConflictWithImportResponse200]: +) -> _Response[PostNamingPropertyConflictWithImportResponse200]: """ Args: body (PostNamingPropertyConflictWithImportBody | Unset): @@ -136,7 +138,7 @@ async def asyncio_detailed( async def asyncio( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: PostNamingPropertyConflictWithImportBody | Unset = UNSET, ) -> PostNamingPropertyConflictWithImportResponse200 | None: """ diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameter_references/get_parameter_references_path_param.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameter_references/get_parameter_references_path_param.py index 801929db9..48fe754f1 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameter_references/get_parameter_references_path_param.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameter_references/get_parameter_references_path_param.py @@ -1,12 +1,14 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any from urllib.parse import quote import httpx from ... import errors -from ...client import AuthenticatedClient, Client -from ...types import UNSET, Response, Unset +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client +from ...types import UNSET, Unset +from ...types import Response as _Response def _get_kwargs( @@ -46,7 +48,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None @@ -56,9 +58,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[Any]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -68,12 +70,12 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( path_param: str, *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, string_param: str | Unset = UNSET, integer_param: int | Unset = 0, header_param: None | str | Unset = UNSET, cookie_param: str | Unset = UNSET, -) -> Response[Any]: +) -> _Response[Any]: """Test different types of parameter references Args: @@ -109,12 +111,12 @@ def sync_detailed( async def asyncio_detailed( path_param: str, *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, string_param: str | Unset = UNSET, integer_param: int | Unset = 0, header_param: None | str | Unset = UNSET, cookie_param: str | Unset = UNSET, -) -> Response[Any]: +) -> _Response[Any]: """Test different types of parameter references Args: diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameters/delete_common_parameters_overriding_param.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameters/delete_common_parameters_overriding_param.py index 23c5b72da..fd676bf20 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameters/delete_common_parameters_overriding_param.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameters/delete_common_parameters_overriding_param.py @@ -1,12 +1,14 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any from urllib.parse import quote import httpx from ... import errors -from ...client import AuthenticatedClient, Client -from ...types import UNSET, Response, Unset +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client +from ...types import UNSET, Unset +from ...types import Response as _Response def _get_kwargs( @@ -32,7 +34,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None @@ -42,9 +44,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[Any]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -54,9 +56,9 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( param_path: str, *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, param_query: str | Unset = UNSET, -) -> Response[Any]: +) -> _Response[Any]: """ Args: param_path (str): @@ -85,9 +87,9 @@ def sync_detailed( async def asyncio_detailed( param_path: str, *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, param_query: str | Unset = UNSET, -) -> Response[Any]: +) -> _Response[Any]: """ Args: param_path (str): diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py index 3233fa605..6291bc98a 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameters/get_common_parameters_overriding_param.py @@ -1,12 +1,14 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any from urllib.parse import quote import httpx from ... import errors -from ...client import AuthenticatedClient, Client -from ...types import UNSET, Response +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client +from ...types import UNSET +from ...types import Response as _Response def _get_kwargs( @@ -32,7 +34,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None @@ -42,9 +44,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[Any]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -54,9 +56,9 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( param_path: str, *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, param_query: str = "overridden_in_GET", -) -> Response[Any]: +) -> _Response[Any]: """Test that if you have an overriding property from `PathItem` in `Operation`, it produces valid code Args: @@ -87,9 +89,9 @@ def sync_detailed( async def asyncio_detailed( param_path: str, *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, param_query: str = "overridden_in_GET", -) -> Response[Any]: +) -> _Response[Any]: """Test that if you have an overriding property from `PathItem` in `Operation`, it produces valid code Args: diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameters/get_same_name_multiple_locations_param.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameters/get_same_name_multiple_locations_param.py index dd11f68ca..5ad7c5343 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameters/get_same_name_multiple_locations_param.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameters/get_same_name_multiple_locations_param.py @@ -1,12 +1,14 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any from urllib.parse import quote import httpx from ... import errors -from ...client import AuthenticatedClient, Client -from ...types import UNSET, Response, Unset +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client +from ...types import UNSET, Unset +from ...types import Response as _Response def _get_kwargs( @@ -43,7 +45,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None @@ -53,9 +55,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[Any]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -65,11 +67,11 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( param_path: str, *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, param_query: str | Unset = UNSET, param_header: str | Unset = UNSET, param_cookie: str | Unset = UNSET, -) -> Response[Any]: +) -> _Response[Any]: """ Args: param_path (str): @@ -102,11 +104,11 @@ def sync_detailed( async def asyncio_detailed( param_path: str, *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, param_query: str | Unset = UNSET, param_header: str | Unset = UNSET, param_cookie: str | Unset = UNSET, -) -> Response[Any]: +) -> _Response[Any]: """ Args: param_path (str): diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameters/multiple_path_parameters.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameters/multiple_path_parameters.py index d683b856c..d91adb33e 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameters/multiple_path_parameters.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/parameters/multiple_path_parameters.py @@ -1,12 +1,13 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any from urllib.parse import quote import httpx from ... import errors -from ...client import AuthenticatedClient, Client -from ...types import Response +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client +from ...types import Response as _Response def _get_kwargs( @@ -29,7 +30,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None @@ -39,9 +40,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[Any]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -54,8 +55,8 @@ def sync_detailed( param1: str, param3: int, *, - client: AuthenticatedClient | Client, -) -> Response[Any]: + client: _AuthenticatedClient | _Client, +) -> _Response[Any]: """ Args: param4 (str): @@ -91,8 +92,8 @@ async def asyncio_detailed( param1: str, param3: int, *, - client: AuthenticatedClient | Client, -) -> Response[Any]: + client: _AuthenticatedClient | _Client, +) -> _Response[Any]: """ Args: param4 (str): diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/default_status_code.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/default_status_code.py index aa32c5393..4558d5b20 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/default_status_code.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/default_status_code.py @@ -1,10 +1,11 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx -from ...client import AuthenticatedClient, Client -from ...types import Response +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client +from ...types import Response as _Response def _get_kwargs() -> dict[str, Any]: @@ -17,14 +18,14 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> str: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> str: response_default = response.text return response_default -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[str]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[str]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -33,8 +34,8 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[str]: + client: _AuthenticatedClient | _Client, +) -> _Response[str]: """Default Status Code Only Raises: @@ -56,7 +57,7 @@ def sync_detailed( def sync( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, ) -> str | None: """Default Status Code Only @@ -75,8 +76,8 @@ def sync( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[str]: + client: _AuthenticatedClient | _Client, +) -> _Response[str]: """Default Status Code Only Raises: @@ -96,7 +97,7 @@ async def asyncio_detailed( async def asyncio( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, ) -> str | None: """Default Status Code Only diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/post_responses_unions_simple_before_complex.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/post_responses_unions_simple_before_complex.py index 022f30062..ebb459f5a 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/post_responses_unions_simple_before_complex.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/post_responses_unions_simple_before_complex.py @@ -1,14 +1,15 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client from ...models.post_responses_unions_simple_before_complex_response_200 import ( PostResponsesUnionsSimpleBeforeComplexResponse200, ) -from ...types import Response +from ...types import Response as _Response def _get_kwargs() -> dict[str, Any]: @@ -22,7 +23,7 @@ def _get_kwargs() -> dict[str, Any]: def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: _AuthenticatedClient | _Client, response: httpx.Response ) -> PostResponsesUnionsSimpleBeforeComplexResponse200 | None: if response.status_code == 200: response_200 = PostResponsesUnionsSimpleBeforeComplexResponse200.from_dict(response.json()) @@ -36,10 +37,10 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[PostResponsesUnionsSimpleBeforeComplexResponse200]: - return Response( - status_code=HTTPStatus(response.status_code), + *, client: _AuthenticatedClient | _Client, response: httpx.Response +) -> _Response[PostResponsesUnionsSimpleBeforeComplexResponse200]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -48,8 +49,8 @@ def _build_response( def sync_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[PostResponsesUnionsSimpleBeforeComplexResponse200]: + client: _AuthenticatedClient | _Client, +) -> _Response[PostResponsesUnionsSimpleBeforeComplexResponse200]: """Regression test for #603 Raises: @@ -71,7 +72,7 @@ def sync_detailed( def sync( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, ) -> PostResponsesUnionsSimpleBeforeComplexResponse200 | None: """Regression test for #603 @@ -90,8 +91,8 @@ def sync( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[PostResponsesUnionsSimpleBeforeComplexResponse200]: + client: _AuthenticatedClient | _Client, +) -> _Response[PostResponsesUnionsSimpleBeforeComplexResponse200]: """Regression test for #603 Raises: @@ -111,7 +112,7 @@ async def asyncio_detailed( async def asyncio( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, ) -> PostResponsesUnionsSimpleBeforeComplexResponse200 | None: """Regression test for #603 diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/reference_response.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/reference_response.py index 77429a73b..056ead208 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/reference_response.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/reference_response.py @@ -1,12 +1,13 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client from ...models.a_model import AModel -from ...types import Response +from ...types import Response as _Response def _get_kwargs() -> dict[str, Any]: @@ -19,7 +20,7 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> AModel | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> AModel | None: if response.status_code == 200: response_200 = AModel.from_dict(response.json()) @@ -31,9 +32,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[AModel]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[AModel]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -42,8 +43,8 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[AModel]: + client: _AuthenticatedClient | _Client, +) -> _Response[AModel]: """Endpoint using predefined response Raises: @@ -65,7 +66,7 @@ def sync_detailed( def sync( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, ) -> AModel | None: """Endpoint using predefined response @@ -84,8 +85,8 @@ def sync( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[AModel]: + client: _AuthenticatedClient | _Client, +) -> _Response[AModel]: """Endpoint using predefined response Raises: @@ -105,7 +106,7 @@ async def asyncio_detailed( async def asyncio( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, ) -> AModel | None: """Endpoint using predefined response diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/status_code_patterns.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/status_code_patterns.py index 796d3764f..1116153e7 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/status_code_patterns.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/status_code_patterns.py @@ -1,13 +1,14 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client from ...models.status_code_patterns_response_2xx import StatusCodePatternsResponse2XX from ...models.status_code_patterns_response_4xx import StatusCodePatternsResponse4XX -from ...types import Response +from ...types import Response as _Response def _get_kwargs() -> dict[str, Any]: @@ -21,7 +22,7 @@ def _get_kwargs() -> dict[str, Any]: def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: _AuthenticatedClient | _Client, response: httpx.Response ) -> StatusCodePatternsResponse2XX | StatusCodePatternsResponse4XX | None: if 200 <= response.status_code <= 299: response_2xx = StatusCodePatternsResponse2XX.from_dict(response.json()) @@ -40,10 +41,10 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[StatusCodePatternsResponse2XX | StatusCodePatternsResponse4XX]: - return Response( - status_code=HTTPStatus(response.status_code), + *, client: _AuthenticatedClient | _Client, response: httpx.Response +) -> _Response[StatusCodePatternsResponse2XX | StatusCodePatternsResponse4XX]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -52,8 +53,8 @@ def _build_response( def sync_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[StatusCodePatternsResponse2XX | StatusCodePatternsResponse4XX]: + client: _AuthenticatedClient | _Client, +) -> _Response[StatusCodePatternsResponse2XX | StatusCodePatternsResponse4XX]: """Status Code Patterns Raises: @@ -75,7 +76,7 @@ def sync_detailed( def sync( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, ) -> StatusCodePatternsResponse2XX | StatusCodePatternsResponse4XX | None: """Status Code Patterns @@ -94,8 +95,8 @@ def sync( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[StatusCodePatternsResponse2XX | StatusCodePatternsResponse4XX]: + client: _AuthenticatedClient | _Client, +) -> _Response[StatusCodePatternsResponse2XX | StatusCodePatternsResponse4XX]: """Status Code Patterns Raises: @@ -115,7 +116,7 @@ async def asyncio_detailed( async def asyncio( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, ) -> StatusCodePatternsResponse2XX | StatusCodePatternsResponse4XX | None: """Status Code Patterns diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/status_code_precedence.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/status_code_precedence.py index 11d832c87..53373af22 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/status_code_precedence.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/status_code_precedence.py @@ -1,10 +1,11 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx -from ...client import AuthenticatedClient, Client -from ...types import Response +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client +from ...types import Response as _Response def _get_kwargs() -> dict[str, Any]: @@ -17,7 +18,7 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> str: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> str: if response.status_code == 200: response_200 = response.text return response_200 @@ -34,9 +35,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return response_default -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[str]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[str]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -45,8 +46,8 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[str]: + client: _AuthenticatedClient | _Client, +) -> _Response[str]: """Status Codes Precedence Verify that specific status codes are always checked first, then ranges, then default @@ -70,7 +71,7 @@ def sync_detailed( def sync( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, ) -> str | None: """Status Codes Precedence @@ -91,8 +92,8 @@ def sync( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[str]: + client: _AuthenticatedClient | _Client, +) -> _Response[str]: """Status Codes Precedence Verify that specific status codes are always checked first, then ranges, then default @@ -114,7 +115,7 @@ async def asyncio_detailed( async def asyncio( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, ) -> str | None: """Status Codes Precedence diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/text_response.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/text_response.py index 0f56f8c77..45056ca48 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/text_response.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/responses/text_response.py @@ -1,11 +1,12 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client -from ...types import Response +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client +from ...types import Response as _Response def _get_kwargs() -> dict[str, Any]: @@ -18,7 +19,7 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> str | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> str | None: if response.status_code == 200: response_200 = response.text return response_200 @@ -29,9 +30,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[str]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[str]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -40,8 +41,8 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[str]: + client: _AuthenticatedClient | _Client, +) -> _Response[str]: """Text Response Raises: @@ -63,7 +64,7 @@ def sync_detailed( def sync( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, ) -> str | None: """Text Response @@ -82,8 +83,8 @@ def sync( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[str]: + client: _AuthenticatedClient | _Client, +) -> _Response[str]: """Text Response Raises: @@ -103,7 +104,7 @@ async def asyncio_detailed( async def asyncio( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, ) -> str | None: """Text Response diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tag1/get_tag_with_number.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tag1/get_tag_with_number.py index 3ee534c8f..3f8455b19 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tag1/get_tag_with_number.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tag1/get_tag_with_number.py @@ -1,11 +1,12 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client -from ...types import Response +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client +from ...types import Response as _Response def _get_kwargs() -> dict[str, Any]: @@ -18,7 +19,7 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None @@ -28,9 +29,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[Any]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -39,8 +40,8 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[Any]: + client: _AuthenticatedClient | _Client, +) -> _Response[Any]: """ Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -61,8 +62,8 @@ def sync_detailed( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[Any]: + client: _AuthenticatedClient | _Client, +) -> _Response[Any]: """ Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tag2/get_tag_with_number.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tag2/get_tag_with_number.py index 3ee534c8f..3f8455b19 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tag2/get_tag_with_number.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tag2/get_tag_with_number.py @@ -1,11 +1,12 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client -from ...types import Response +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client +from ...types import Response as _Response def _get_kwargs() -> dict[str, Any]: @@ -18,7 +19,7 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None @@ -28,9 +29,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[Any]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -39,8 +40,8 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[Any]: + client: _AuthenticatedClient | _Client, +) -> _Response[Any]: """ Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -61,8 +62,8 @@ def sync_detailed( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[Any]: + client: _AuthenticatedClient | _Client, +) -> _Response[Any]: """ Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/callback_test.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/callback_test.py index e806fe60c..ce437eea2 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/callback_test.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/callback_test.py @@ -1,13 +1,14 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client from ...models.a_model import AModel from ...models.http_validation_error import HTTPValidationError -from ...types import Response +from ...types import Response as _Response def _get_kwargs( @@ -30,7 +31,7 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: _AuthenticatedClient | _Client, response: httpx.Response ) -> Any | HTTPValidationError | None: if response.status_code == 200: response_200 = response.json() @@ -48,10 +49,10 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Any | HTTPValidationError]: - return Response( - status_code=HTTPStatus(response.status_code), + *, client: _AuthenticatedClient | _Client, response: httpx.Response +) -> _Response[Any | HTTPValidationError]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -60,9 +61,9 @@ def _build_response( def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: AModel, -) -> Response[Any | HTTPValidationError]: +) -> _Response[Any | HTTPValidationError]: """Path with callback Try sending a request related to a callback @@ -91,7 +92,7 @@ def sync_detailed( def sync( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: AModel, ) -> Any | HTTPValidationError | None: """Path with callback @@ -117,9 +118,9 @@ def sync( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: AModel, -) -> Response[Any | HTTPValidationError]: +) -> _Response[Any | HTTPValidationError]: """Path with callback Try sending a request related to a callback @@ -146,7 +147,7 @@ async def asyncio_detailed( async def asyncio( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: AModel, ) -> Any | HTTPValidationError | None: """Path with callback diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/description_with_backslash.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/description_with_backslash.py index f173767ed..6c3a2527e 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/description_with_backslash.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/description_with_backslash.py @@ -1,11 +1,12 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client -from ...types import Response +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client +from ...types import Response as _Response def _get_kwargs() -> dict[str, Any]: @@ -18,7 +19,7 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None @@ -28,9 +29,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[Any]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -39,8 +40,8 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[Any]: + client: _AuthenticatedClient | _Client, +) -> _Response[Any]: """ Test description with \\ Test description with \\ @@ -64,8 +65,8 @@ def sync_detailed( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[Any]: + client: _AuthenticatedClient | _Client, +) -> _Response[Any]: """ Test description with \\ Test description with \\ diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_basic_list_of_booleans.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_basic_list_of_booleans.py index 0a20d2f8f..9a96263f1 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_basic_list_of_booleans.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_basic_list_of_booleans.py @@ -1,11 +1,12 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any, cast import httpx from ... import errors -from ...client import AuthenticatedClient, Client -from ...types import Response +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client +from ...types import Response as _Response def _get_kwargs() -> dict[str, Any]: @@ -18,7 +19,7 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> list[bool] | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> list[bool] | None: if response.status_code == 200: response_200 = cast(list[bool], response.json()) @@ -30,9 +31,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[list[bool]]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[list[bool]]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -41,8 +42,8 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[list[bool]]: + client: _AuthenticatedClient | _Client, +) -> _Response[list[bool]]: """Get Basic List Of Booleans Get a list of booleans @@ -66,7 +67,7 @@ def sync_detailed( def sync( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, ) -> list[bool] | None: """Get Basic List Of Booleans @@ -87,8 +88,8 @@ def sync( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[list[bool]]: + client: _AuthenticatedClient | _Client, +) -> _Response[list[bool]]: """Get Basic List Of Booleans Get a list of booleans @@ -110,7 +111,7 @@ async def asyncio_detailed( async def asyncio( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, ) -> list[bool] | None: """Get Basic List Of Booleans diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_basic_list_of_floats.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_basic_list_of_floats.py index 0beb7b1dd..3f4d13071 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_basic_list_of_floats.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_basic_list_of_floats.py @@ -1,11 +1,12 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any, cast import httpx from ... import errors -from ...client import AuthenticatedClient, Client -from ...types import Response +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client +from ...types import Response as _Response def _get_kwargs() -> dict[str, Any]: @@ -18,7 +19,7 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> list[float] | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> list[float] | None: if response.status_code == 200: response_200 = cast(list[float], response.json()) @@ -30,9 +31,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[list[float]]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[list[float]]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -41,8 +42,8 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[list[float]]: + client: _AuthenticatedClient | _Client, +) -> _Response[list[float]]: """Get Basic List Of Floats Get a list of floats @@ -66,7 +67,7 @@ def sync_detailed( def sync( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, ) -> list[float] | None: """Get Basic List Of Floats @@ -87,8 +88,8 @@ def sync( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[list[float]]: + client: _AuthenticatedClient | _Client, +) -> _Response[list[float]]: """Get Basic List Of Floats Get a list of floats @@ -110,7 +111,7 @@ async def asyncio_detailed( async def asyncio( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, ) -> list[float] | None: """Get Basic List Of Floats diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_basic_list_of_integers.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_basic_list_of_integers.py index c0ca1e8c7..1c2eb6685 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_basic_list_of_integers.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_basic_list_of_integers.py @@ -1,11 +1,12 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any, cast import httpx from ... import errors -from ...client import AuthenticatedClient, Client -from ...types import Response +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client +from ...types import Response as _Response def _get_kwargs() -> dict[str, Any]: @@ -18,7 +19,7 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> list[int] | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> list[int] | None: if response.status_code == 200: response_200 = cast(list[int], response.json()) @@ -30,9 +31,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[list[int]]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[list[int]]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -41,8 +42,8 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[list[int]]: + client: _AuthenticatedClient | _Client, +) -> _Response[list[int]]: """Get Basic List Of Integers Get a list of integers @@ -66,7 +67,7 @@ def sync_detailed( def sync( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, ) -> list[int] | None: """Get Basic List Of Integers @@ -87,8 +88,8 @@ def sync( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[list[int]]: + client: _AuthenticatedClient | _Client, +) -> _Response[list[int]]: """Get Basic List Of Integers Get a list of integers @@ -110,7 +111,7 @@ async def asyncio_detailed( async def asyncio( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, ) -> list[int] | None: """Get Basic List Of Integers diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_basic_list_of_strings.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_basic_list_of_strings.py index 4cb0a1bef..85e49078c 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_basic_list_of_strings.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_basic_list_of_strings.py @@ -1,11 +1,12 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any, cast import httpx from ... import errors -from ...client import AuthenticatedClient, Client -from ...types import Response +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client +from ...types import Response as _Response def _get_kwargs() -> dict[str, Any]: @@ -18,7 +19,7 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> list[str] | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> list[str] | None: if response.status_code == 200: response_200 = cast(list[str], response.json()) @@ -30,9 +31,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[list[str]]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[list[str]]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -41,8 +42,8 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[list[str]]: + client: _AuthenticatedClient | _Client, +) -> _Response[list[str]]: """Get Basic List Of Strings Get a list of strings @@ -66,7 +67,7 @@ def sync_detailed( def sync( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, ) -> list[str] | None: """Get Basic List Of Strings @@ -87,8 +88,8 @@ def sync( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[list[str]]: + client: _AuthenticatedClient | _Client, +) -> _Response[list[str]]: """Get Basic List Of Strings Get a list of strings @@ -110,7 +111,7 @@ async def asyncio_detailed( async def asyncio( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, ) -> list[str] | None: """Get Basic List Of Strings diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_user_list.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_user_list.py index 5fcbd86e1..5b3f46396 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_user_list.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/get_user_list.py @@ -1,16 +1,18 @@ import datetime -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client from ...models.a_model import AModel from ...models.an_enum import AnEnum from ...models.an_enum_with_null import AnEnumWithNull from ...models.http_validation_error import HTTPValidationError -from ...types import UNSET, Response +from ...types import UNSET +from ...types import Response as _Response def _get_kwargs( @@ -65,7 +67,7 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: _AuthenticatedClient | _Client, response: httpx.Response ) -> HTTPValidationError | list[AModel] | None: if response.status_code == 200: response_200 = [] @@ -94,10 +96,10 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[HTTPValidationError | list[AModel]]: - return Response( - status_code=HTTPStatus(response.status_code), + *, client: _AuthenticatedClient | _Client, response: httpx.Response +) -> _Response[HTTPValidationError | list[AModel]]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -106,12 +108,12 @@ def _build_response( def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, an_enum_value: list[AnEnum], an_enum_value_with_null: list[AnEnumWithNull | None], an_enum_value_with_only_null: list[None], some_date: datetime.date | datetime.datetime, -) -> Response[HTTPValidationError | list[AModel]]: +) -> _Response[HTTPValidationError | list[AModel]]: """Get List Get a list of things @@ -146,7 +148,7 @@ def sync_detailed( def sync( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, an_enum_value: list[AnEnum], an_enum_value_with_null: list[AnEnumWithNull | None], an_enum_value_with_only_null: list[None], @@ -181,12 +183,12 @@ def sync( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, an_enum_value: list[AnEnum], an_enum_value_with_null: list[AnEnumWithNull | None], an_enum_value_with_only_null: list[None], some_date: datetime.date | datetime.datetime, -) -> Response[HTTPValidationError | list[AModel]]: +) -> _Response[HTTPValidationError | list[AModel]]: """Get List Get a list of things @@ -219,7 +221,7 @@ async def asyncio_detailed( async def asyncio( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, an_enum_value: list[AnEnum], an_enum_value_with_null: list[AnEnumWithNull | None], an_enum_value_with_only_null: list[None], diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/json_body_tests_json_body_post.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/json_body_tests_json_body_post.py index 5be950c77..f422a0f20 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/json_body_tests_json_body_post.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/json_body_tests_json_body_post.py @@ -1,13 +1,14 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client from ...models.a_model import AModel from ...models.http_validation_error import HTTPValidationError -from ...types import Response +from ...types import Response as _Response def _get_kwargs( @@ -30,7 +31,7 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: _AuthenticatedClient | _Client, response: httpx.Response ) -> Any | HTTPValidationError | None: if response.status_code == 200: response_200 = response.json() @@ -48,10 +49,10 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Any | HTTPValidationError]: - return Response( - status_code=HTTPStatus(response.status_code), + *, client: _AuthenticatedClient | _Client, response: httpx.Response +) -> _Response[Any | HTTPValidationError]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -60,9 +61,9 @@ def _build_response( def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: AModel, -) -> Response[Any | HTTPValidationError]: +) -> _Response[Any | HTTPValidationError]: """Json Body Try sending a JSON body @@ -91,7 +92,7 @@ def sync_detailed( def sync( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: AModel, ) -> Any | HTTPValidationError | None: """Json Body @@ -117,9 +118,9 @@ def sync( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: AModel, -) -> Response[Any | HTTPValidationError]: +) -> _Response[Any | HTTPValidationError]: """Json Body Try sending a JSON body @@ -146,7 +147,7 @@ async def asyncio_detailed( async def asyncio( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: AModel, ) -> Any | HTTPValidationError | None: """Json Body diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/no_response_tests_no_response_get.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/no_response_tests_no_response_get.py index 34c4b54c0..553105be4 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/no_response_tests_no_response_get.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/no_response_tests_no_response_get.py @@ -1,11 +1,12 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client -from ...types import Response +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client +from ...types import Response as _Response def _get_kwargs() -> dict[str, Any]: @@ -18,7 +19,7 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None @@ -28,9 +29,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[Any]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -39,8 +40,8 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[Any]: + client: _AuthenticatedClient | _Client, +) -> _Response[Any]: """No Response Raises: @@ -62,8 +63,8 @@ def sync_detailed( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[Any]: + client: _AuthenticatedClient | _Client, +) -> _Response[Any]: """No Response Raises: diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/octet_stream_tests_octet_stream_get.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/octet_stream_tests_octet_stream_get.py index c08c3caca..d5f41ee52 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/octet_stream_tests_octet_stream_get.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/octet_stream_tests_octet_stream_get.py @@ -1,12 +1,14 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from io import BytesIO from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client -from ...types import File, Response +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client +from ...types import File +from ...types import Response as _Response def _get_kwargs() -> dict[str, Any]: @@ -19,7 +21,7 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> File | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> File | None: if response.status_code == 200: response_200 = File(payload=BytesIO(response.content)) @@ -31,9 +33,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[File]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[File]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -42,8 +44,8 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[File]: + client: _AuthenticatedClient | _Client, +) -> _Response[File]: """Octet Stream Raises: @@ -65,7 +67,7 @@ def sync_detailed( def sync( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, ) -> File | None: """Octet Stream @@ -84,8 +86,8 @@ def sync( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[File]: + client: _AuthenticatedClient | _Client, +) -> _Response[File]: """Octet Stream Raises: @@ -105,7 +107,7 @@ async def asyncio_detailed( async def asyncio( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, ) -> File | None: """Octet Stream diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/octet_stream_tests_octet_stream_post.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/octet_stream_tests_octet_stream_post.py index 1dd936601..aee913d04 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/octet_stream_tests_octet_stream_post.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/octet_stream_tests_octet_stream_post.py @@ -1,13 +1,15 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client from ...models.http_validation_error import HTTPValidationError from ...models.octet_stream_tests_octet_stream_post_response_200 import OctetStreamTestsOctetStreamPostResponse200 -from ...types import UNSET, File, Response, Unset +from ...types import UNSET, File, Unset +from ...types import Response as _Response def _get_kwargs( @@ -30,7 +32,7 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: _AuthenticatedClient | _Client, response: httpx.Response ) -> HTTPValidationError | OctetStreamTestsOctetStreamPostResponse200 | None: if response.status_code == 200: response_200 = OctetStreamTestsOctetStreamPostResponse200.from_dict(response.json()) @@ -49,10 +51,10 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[HTTPValidationError | OctetStreamTestsOctetStreamPostResponse200]: - return Response( - status_code=HTTPStatus(response.status_code), + *, client: _AuthenticatedClient | _Client, response: httpx.Response +) -> _Response[HTTPValidationError | OctetStreamTestsOctetStreamPostResponse200]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -61,9 +63,9 @@ def _build_response( def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: File | Unset = UNSET, -) -> Response[HTTPValidationError | OctetStreamTestsOctetStreamPostResponse200]: +) -> _Response[HTTPValidationError | OctetStreamTestsOctetStreamPostResponse200]: """Binary (octet stream) request body Args: @@ -90,7 +92,7 @@ def sync_detailed( def sync( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: File | Unset = UNSET, ) -> HTTPValidationError | OctetStreamTestsOctetStreamPostResponse200 | None: """Binary (octet stream) request body @@ -114,9 +116,9 @@ def sync( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: File | Unset = UNSET, -) -> Response[HTTPValidationError | OctetStreamTestsOctetStreamPostResponse200]: +) -> _Response[HTTPValidationError | OctetStreamTestsOctetStreamPostResponse200]: """Binary (octet stream) request body Args: @@ -141,7 +143,7 @@ async def asyncio_detailed( async def asyncio( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: File | Unset = UNSET, ) -> HTTPValidationError | OctetStreamTestsOctetStreamPostResponse200 | None: """Binary (octet stream) request body diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/post_form_data.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/post_form_data.py index 5e1ba06ed..94d037184 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/post_form_data.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/post_form_data.py @@ -1,12 +1,13 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client from ...models.a_form_data import AFormData -from ...types import Response +from ...types import Response as _Response def _get_kwargs( @@ -27,7 +28,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None @@ -37,9 +38,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[Any]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -48,9 +49,9 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: AFormData, -) -> Response[Any]: +) -> _Response[Any]: """Post form data Post form data @@ -79,9 +80,9 @@ def sync_detailed( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: AFormData, -) -> Response[Any]: +) -> _Response[Any]: """Post form data Post form data diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/post_form_data_inline.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/post_form_data_inline.py index 168fd9c82..537245bbc 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/post_form_data_inline.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/post_form_data_inline.py @@ -1,12 +1,13 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client from ...models.post_form_data_inline_body import PostFormDataInlineBody -from ...types import Response +from ...types import Response as _Response def _get_kwargs( @@ -27,7 +28,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None @@ -37,9 +38,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[Any]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -48,9 +49,9 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: PostFormDataInlineBody, -) -> Response[Any]: +) -> _Response[Any]: """Post form data (inline schema) Post form data (inline schema) @@ -79,9 +80,9 @@ def sync_detailed( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: PostFormDataInlineBody, -) -> Response[Any]: +) -> _Response[Any]: """Post form data (inline schema) Post form data (inline schema) diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/post_tests_json_body_string.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/post_tests_json_body_string.py index 498d0572e..6bcf13731 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/post_tests_json_body_string.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/post_tests_json_body_string.py @@ -1,12 +1,13 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any, cast import httpx from ... import errors -from ...client import AuthenticatedClient, Client +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client from ...models.http_validation_error import HTTPValidationError -from ...types import Response +from ...types import Response as _Response def _get_kwargs( @@ -29,7 +30,7 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: _AuthenticatedClient | _Client, response: httpx.Response ) -> HTTPValidationError | str | None: if response.status_code == 200: response_200 = cast(str, response.json()) @@ -47,10 +48,10 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[HTTPValidationError | str]: - return Response( - status_code=HTTPStatus(response.status_code), + *, client: _AuthenticatedClient | _Client, response: httpx.Response +) -> _Response[HTTPValidationError | str]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -59,9 +60,9 @@ def _build_response( def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: str, -) -> Response[HTTPValidationError | str]: +) -> _Response[HTTPValidationError | str]: """Json Body Which is String Args: @@ -88,7 +89,7 @@ def sync_detailed( def sync( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: str, ) -> HTTPValidationError | str | None: """Json Body Which is String @@ -112,9 +113,9 @@ def sync( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: str, -) -> Response[HTTPValidationError | str]: +) -> _Response[HTTPValidationError | str]: """Json Body Which is String Args: @@ -139,7 +140,7 @@ async def asyncio_detailed( async def asyncio( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: str, ) -> HTTPValidationError | str | None: """Json Body Which is String diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/test_inline_objects.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/test_inline_objects.py index ea2e45c94..d69bb0340 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/test_inline_objects.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/test_inline_objects.py @@ -1,13 +1,14 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client from ...models.test_inline_objects_body import TestInlineObjectsBody from ...models.test_inline_objects_response_200 import TestInlineObjectsResponse200 -from ...types import Response +from ...types import Response as _Response def _get_kwargs( @@ -30,7 +31,7 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: _AuthenticatedClient | _Client, response: httpx.Response ) -> TestInlineObjectsResponse200 | None: if response.status_code == 200: response_200 = TestInlineObjectsResponse200.from_dict(response.json()) @@ -44,10 +45,10 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[TestInlineObjectsResponse200]: - return Response( - status_code=HTTPStatus(response.status_code), + *, client: _AuthenticatedClient | _Client, response: httpx.Response +) -> _Response[TestInlineObjectsResponse200]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -56,9 +57,9 @@ def _build_response( def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: TestInlineObjectsBody, -) -> Response[TestInlineObjectsResponse200]: +) -> _Response[TestInlineObjectsResponse200]: """Test Inline Objects Args: @@ -85,7 +86,7 @@ def sync_detailed( def sync( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: TestInlineObjectsBody, ) -> TestInlineObjectsResponse200 | None: """Test Inline Objects @@ -109,9 +110,9 @@ def sync( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: TestInlineObjectsBody, -) -> Response[TestInlineObjectsResponse200]: +) -> _Response[TestInlineObjectsResponse200]: """Test Inline Objects Args: @@ -136,7 +137,7 @@ async def asyncio_detailed( async def asyncio( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: TestInlineObjectsBody, ) -> TestInlineObjectsResponse200 | None: """Test Inline Objects diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/token_with_cookie_auth_token_with_cookie_get.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/token_with_cookie_auth_token_with_cookie_get.py index 9ad310a2a..5c7bb2edd 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/token_with_cookie_auth_token_with_cookie_get.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/token_with_cookie_auth_token_with_cookie_get.py @@ -1,11 +1,12 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client -from ...types import Response +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client +from ...types import Response as _Response def _get_kwargs( @@ -25,7 +26,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None @@ -38,9 +39,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[Any]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -49,9 +50,9 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, my_token: str, -) -> Response[Any]: +) -> _Response[Any]: """TOKEN_WITH_COOKIE Test optional cookie parameters @@ -80,9 +81,9 @@ def sync_detailed( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, my_token: str, -) -> Response[Any]: +) -> _Response[Any]: """TOKEN_WITH_COOKIE Test optional cookie parameters diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/unsupported_content_tests_unsupported_content_get.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/unsupported_content_tests_unsupported_content_get.py index 409f6147a..6e9d66ca7 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/unsupported_content_tests_unsupported_content_get.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/unsupported_content_tests_unsupported_content_get.py @@ -1,11 +1,12 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client -from ...types import Response +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client +from ...types import Response as _Response def _get_kwargs() -> dict[str, Any]: @@ -18,7 +19,7 @@ def _get_kwargs() -> dict[str, Any]: return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None @@ -28,9 +29,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[Any]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -39,8 +40,8 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[Any]: + client: _AuthenticatedClient | _Client, +) -> _Response[Any]: """Unsupported Content Raises: @@ -62,8 +63,8 @@ def sync_detailed( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, -) -> Response[Any]: + client: _AuthenticatedClient | _Client, +) -> _Response[Any]: """Unsupported Content Raises: diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/upload_file_tests_upload_post.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/upload_file_tests_upload_post.py index 6339d61f3..2f3d7b63c 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/upload_file_tests_upload_post.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/tests/upload_file_tests_upload_post.py @@ -1,13 +1,14 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client from ...models.body_upload_file_tests_upload_post import BodyUploadFileTestsUploadPost from ...models.http_validation_error import HTTPValidationError -from ...types import Response +from ...types import Response as _Response def _get_kwargs( @@ -30,7 +31,7 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: _AuthenticatedClient | _Client, response: httpx.Response ) -> Any | HTTPValidationError | None: if response.status_code == 200: response_200 = response.json() @@ -48,10 +49,10 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Any | HTTPValidationError]: - return Response( - status_code=HTTPStatus(response.status_code), + *, client: _AuthenticatedClient | _Client, response: httpx.Response +) -> _Response[Any | HTTPValidationError]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -60,9 +61,9 @@ def _build_response( def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: BodyUploadFileTestsUploadPost, -) -> Response[Any | HTTPValidationError]: +) -> _Response[Any | HTTPValidationError]: """Upload File Upload a file @@ -91,7 +92,7 @@ def sync_detailed( def sync( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: BodyUploadFileTestsUploadPost, ) -> Any | HTTPValidationError | None: """Upload File @@ -117,9 +118,9 @@ def sync( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: BodyUploadFileTestsUploadPost, -) -> Response[Any | HTTPValidationError]: +) -> _Response[Any | HTTPValidationError]: """Upload File Upload a file @@ -146,7 +147,7 @@ async def asyncio_detailed( async def asyncio( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: BodyUploadFileTestsUploadPost, ) -> Any | HTTPValidationError | None: """Upload File diff --git a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/true_/false_.py b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/true_/false_.py index d7713f03f..9006ad53b 100644 --- a/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/true_/false_.py +++ b/end_to_end_tests/golden-records/my-test-api-client/my_test_api_client/api/true_/false_.py @@ -1,11 +1,13 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client -from ...types import UNSET, Response +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client +from ...types import UNSET +from ...types import Response as _Response def _get_kwargs( @@ -28,7 +30,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> Any | None: if response.status_code == 200: return None @@ -38,9 +40,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[Any]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -49,9 +51,9 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, import_: str, -) -> Response[Any]: +) -> _Response[Any]: """ Args: import_ (str): @@ -77,9 +79,9 @@ def sync_detailed( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, import_: str, -) -> Response[Any]: +) -> _Response[Any]: """ Args: import_ (str): diff --git a/end_to_end_tests/golden-records/test-3-1-features-client/test_3_1_features_client/api/const/post_const_path.py b/end_to_end_tests/golden-records/test-3-1-features-client/test_3_1_features_client/api/const/post_const_path.py index bf3472121..228390238 100644 --- a/end_to_end_tests/golden-records/test-3-1-features-client/test_3_1_features_client/api/const/post_const_path.py +++ b/end_to_end_tests/golden-records/test-3-1-features-client/test_3_1_features_client/api/const/post_const_path.py @@ -1,13 +1,15 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any, Literal, cast from urllib.parse import quote import httpx from ... import errors -from ...client import AuthenticatedClient, Client +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client from ...models.post_const_path_body import PostConstPathBody -from ...types import UNSET, Response, Unset +from ...types import UNSET, Unset +from ...types import Response as _Response def _get_kwargs( @@ -44,7 +46,7 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: _AuthenticatedClient | _Client, response: httpx.Response ) -> Literal["Why have a fixed response? I dunno"] | None: if response.status_code == 200: response_200 = cast(Literal["Why have a fixed response? I dunno"], response.json()) @@ -61,10 +63,10 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Literal["Why have a fixed response? I dunno"]]: - return Response( - status_code=HTTPStatus(response.status_code), + *, client: _AuthenticatedClient | _Client, response: httpx.Response +) -> _Response[Literal["Why have a fixed response? I dunno"]]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -74,11 +76,11 @@ def _build_response( def sync_detailed( path: Literal["this goes in the path"], *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: PostConstPathBody, required_query: Literal["this always goes in the query"], optional_query: Literal["this sometimes goes in the query"] | Unset = UNSET, -) -> Response[Literal["Why have a fixed response? I dunno"]]: +) -> _Response[Literal["Why have a fixed response? I dunno"]]: """ Args: path (Literal['this goes in the path']): @@ -111,7 +113,7 @@ def sync_detailed( def sync( path: Literal["this goes in the path"], *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: PostConstPathBody, required_query: Literal["this always goes in the query"], optional_query: Literal["this sometimes goes in the query"] | Unset = UNSET, @@ -143,11 +145,11 @@ def sync( async def asyncio_detailed( path: Literal["this goes in the path"], *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: PostConstPathBody, required_query: Literal["this always goes in the query"], optional_query: Literal["this sometimes goes in the query"] | Unset = UNSET, -) -> Response[Literal["Why have a fixed response? I dunno"]]: +) -> _Response[Literal["Why have a fixed response? I dunno"]]: """ Args: path (Literal['this goes in the path']): @@ -178,7 +180,7 @@ async def asyncio_detailed( async def asyncio( path: Literal["this goes in the path"], *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: PostConstPathBody, required_query: Literal["this always goes in the query"], optional_query: Literal["this sometimes goes in the query"] | Unset = UNSET, diff --git a/end_to_end_tests/golden-records/test-3-1-features-client/test_3_1_features_client/api/prefix_items/post_prefix_items.py b/end_to_end_tests/golden-records/test-3-1-features-client/test_3_1_features_client/api/prefix_items/post_prefix_items.py index 5b114873e..769426f70 100644 --- a/end_to_end_tests/golden-records/test-3-1-features-client/test_3_1_features_client/api/prefix_items/post_prefix_items.py +++ b/end_to_end_tests/golden-records/test-3-1-features-client/test_3_1_features_client/api/prefix_items/post_prefix_items.py @@ -1,12 +1,13 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any, cast import httpx from ... import errors -from ...client import AuthenticatedClient, Client +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client from ...models.post_prefix_items_body import PostPrefixItemsBody -from ...types import Response +from ...types import Response as _Response def _get_kwargs( @@ -28,7 +29,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> str | None: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> str | None: if response.status_code == 200: response_200 = cast(str, response.json()) return response_200 @@ -39,9 +40,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[str]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[str]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -50,9 +51,9 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: PostPrefixItemsBody, -) -> Response[str]: +) -> _Response[str]: """ Args: body (PostPrefixItemsBody): @@ -78,7 +79,7 @@ def sync_detailed( def sync( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: PostPrefixItemsBody, ) -> str | None: """ @@ -101,9 +102,9 @@ def sync( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: PostPrefixItemsBody, -) -> Response[str]: +) -> _Response[str]: """ Args: body (PostPrefixItemsBody): @@ -127,7 +128,7 @@ async def asyncio_detailed( async def asyncio( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: PostPrefixItemsBody, ) -> str | None: """ diff --git a/integration-tests/integration_tests/api/body/post_body_multipart.py b/integration-tests/integration_tests/api/body/post_body_multipart.py index 7ceef67b6..21237a4d1 100644 --- a/integration-tests/integration_tests/api/body/post_body_multipart.py +++ b/integration-tests/integration_tests/api/body/post_body_multipart.py @@ -1,14 +1,16 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client from ...models.post_body_multipart_body import PostBodyMultipartBody from ...models.post_body_multipart_response_200 import PostBodyMultipartResponse200 from ...models.public_error import PublicError -from ...types import UNSET, Response, Unset +from ...types import UNSET, Unset +from ...types import Response as _Response def _get_kwargs( @@ -32,7 +34,7 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: _AuthenticatedClient | _Client, response: httpx.Response ) -> PostBodyMultipartResponse200 | PublicError | None: if response.status_code == 200: response_200 = PostBodyMultipartResponse200.from_dict(response.json()) @@ -51,10 +53,10 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[PostBodyMultipartResponse200 | PublicError]: - return Response( - status_code=HTTPStatus(response.status_code), + *, client: _AuthenticatedClient | _Client, response: httpx.Response +) -> _Response[PostBodyMultipartResponse200 | PublicError]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -63,9 +65,9 @@ def _build_response( def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: PostBodyMultipartBody | Unset = UNSET, -) -> Response[PostBodyMultipartResponse200 | PublicError]: +) -> _Response[PostBodyMultipartResponse200 | PublicError]: """ Args: body (PostBodyMultipartBody | Unset): @@ -91,7 +93,7 @@ def sync_detailed( def sync( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: PostBodyMultipartBody | Unset = UNSET, ) -> PostBodyMultipartResponse200 | PublicError | None: """ @@ -114,9 +116,9 @@ def sync( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: PostBodyMultipartBody | Unset = UNSET, -) -> Response[PostBodyMultipartResponse200 | PublicError]: +) -> _Response[PostBodyMultipartResponse200 | PublicError]: """ Args: body (PostBodyMultipartBody | Unset): @@ -140,7 +142,7 @@ async def asyncio_detailed( async def asyncio( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, body: PostBodyMultipartBody | Unset = UNSET, ) -> PostBodyMultipartResponse200 | PublicError | None: """ diff --git a/integration-tests/integration_tests/api/parameters/post_parameters_header.py b/integration-tests/integration_tests/api/parameters/post_parameters_header.py index 190b7efe0..3634b3893 100644 --- a/integration-tests/integration_tests/api/parameters/post_parameters_header.py +++ b/integration-tests/integration_tests/api/parameters/post_parameters_header.py @@ -1,13 +1,14 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any import httpx from ... import errors -from ...client import AuthenticatedClient, Client +from ...client import AuthenticatedClient as _AuthenticatedClient +from ...client import Client as _Client from ...models.post_parameters_header_response_200 import PostParametersHeaderResponse200 from ...models.public_error import PublicError -from ...types import Response +from ...types import Response as _Response def _get_kwargs( @@ -36,7 +37,7 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response + *, client: _AuthenticatedClient | _Client, response: httpx.Response ) -> PostParametersHeaderResponse200 | PublicError | None: if response.status_code == 200: response_200 = PostParametersHeaderResponse200.from_dict(response.json()) @@ -55,10 +56,10 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[PostParametersHeaderResponse200 | PublicError]: - return Response( - status_code=HTTPStatus(response.status_code), + *, client: _AuthenticatedClient | _Client, response: httpx.Response +) -> _Response[PostParametersHeaderResponse200 | PublicError]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -67,12 +68,12 @@ def _build_response( def sync_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, boolean_header: bool, string_header: str, number_header: float, integer_header: int, -) -> Response[PostParametersHeaderResponse200 | PublicError]: +) -> _Response[PostParametersHeaderResponse200 | PublicError]: """ Args: boolean_header (bool): @@ -104,7 +105,7 @@ def sync_detailed( def sync( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, boolean_header: bool, string_header: str, number_header: float, @@ -136,12 +137,12 @@ def sync( async def asyncio_detailed( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, boolean_header: bool, string_header: str, number_header: float, integer_header: int, -) -> Response[PostParametersHeaderResponse200 | PublicError]: +) -> _Response[PostParametersHeaderResponse200 | PublicError]: """ Args: boolean_header (bool): @@ -171,7 +172,7 @@ async def asyncio_detailed( async def asyncio( *, - client: AuthenticatedClient | Client, + client: _AuthenticatedClient | _Client, boolean_header: bool, string_header: str, number_header: float, diff --git a/openapi_python_client/templates/endpoint_macros.py.jinja b/openapi_python_client/templates/endpoint_macros.py.jinja index 493c3551c..5091592f8 100644 --- a/openapi_python_client/templates/endpoint_macros.py.jinja +++ b/openapi_python_client/templates/endpoint_macros.py.jinja @@ -113,9 +113,9 @@ if not isinstance({{property.python_name}}, Unset): {# Proper client based on whether or not the endpoint requires authentication #} {% if include_client %} {% if endpoint.requires_security %} -client: AuthenticatedClient, +client: _AuthenticatedClient, {% else %} -client: AuthenticatedClient | Client, +client: _AuthenticatedClient | _Client, {% endif %} {% endif %} {# Any allowed bodies #} diff --git a/openapi_python_client/templates/endpoint_module.py.jinja b/openapi_python_client/templates/endpoint_module.py.jinja index 97f30a2b8..a63b7cb71 100644 --- a/openapi_python_client/templates/endpoint_module.py.jinja +++ b/openapi_python_client/templates/endpoint_module.py.jinja @@ -1,11 +1,11 @@ -from http import HTTPStatus +from http import HTTPStatus as _HTTPStatus from typing import Any, cast from urllib.parse import quote import httpx -from ...client import AuthenticatedClient, Client -from ...types import Response, UNSET +from ...client import AuthenticatedClient as _AuthenticatedClient, Client as _Client +from ...types import Response as _Response, UNSET from ... import errors {% for relative in endpoint.relative_imports | sort %} @@ -78,7 +78,7 @@ def _get_kwargs( {% endif %} -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> {{return_type}}: +def _parse_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> {{return_type}}: {% for response in endpoint.responses.patterns %} {% set code_range = response.status_code.range %} {% if code_range[0] == code_range[1] %} @@ -98,9 +98,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res {% endif %} -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[{{ return_string | as_unembedded_code }}]: - return Response( - status_code=HTTPStatus(response.status_code), +def _build_response(*, client: _AuthenticatedClient | _Client, response: httpx.Response) -> _Response[{{ return_string | as_unembedded_code }}]: + return _Response( + status_code=_HTTPStatus(response.status_code), content=response.content, headers=response.headers, parsed=_parse_response(client=client, response=response), @@ -109,7 +109,7 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Res def sync_detailed( {{ arguments(endpoint) | indent(4) }} -) -> Response[{{ return_string | as_unembedded_code }}]: +) -> _Response[{{ return_string | as_unembedded_code }}]: {{ docstring(endpoint, return_string, is_detailed=true) | indent(4) }} kwargs = _get_kwargs( @@ -135,7 +135,7 @@ def sync( async def asyncio_detailed( {{ arguments(endpoint) | indent(4) }} -) -> Response[{{ return_string | as_unembedded_code }}]: +) -> _Response[{{ return_string | as_unembedded_code }}]: {{ docstring(endpoint, return_string, is_detailed=true) | indent(4) }} kwargs = _get_kwargs(