From b0851adc0d8b8d2a6613957465ce07630e0f6d78 Mon Sep 17 00:00:00 2001 From: Cary Huang Date: Fri, 13 Nov 2026 19:08:01 -0800 Subject: [PATCH 1/3] Move ce-cli to httpx2 and Authlib --- INSTALL.md | 2 +- README.md | 4 +- ce/auth/device_flow.py | 131 ++++++++++-------- ce/commands/version.py | 4 +- ce/iir/api/README.md | 10 +- .../api/iir_api/iir_api_create_challenges.py | 14 +- .../api/iir_api/iir_api_federation_fetch.py | 14 +- .../api/iir_api/iir_api_get_issuer_by_did.py | 14 +- .../api/iir_api/iir_api_get_issuers.py | 14 +- .../iir_api/iir_api_get_issuers_by_user.py | 14 +- .../iir_api_get_organization_iir_detail.py | 14 +- .../iir_api/iir_api_get_registry_resource.py | 14 +- .../api/iir_api/iir_api_is_user_a_member.py | 14 +- .../iir_api_is_user_a_member_of_org.py | 14 +- .../iir_api/iir_api_save_challenge_token.py | 14 +- .../api/iir_api/iir_api_submit_to_iir.py | 14 +- .../api/iir_api/iir_api_update_issuer.py | 14 +- .../iir_api/iir_api_validate_jwt_signature.py | 14 +- .../api/iir_api/iir_api_validate_key.py | 14 +- .../api/iir_api/iir_api_validate_web.py | 14 +- ce/iir/api/iir_client/client.py | 86 ++++++------ ce/iir/api/iir_client/types.py | 4 +- ce/iir/api/pyproject.toml | 4 +- ce/utils/errors.py | 2 +- ce/utils/http.py | 20 +-- pyproject.toml | 5 +- tests/test_auth.py | 80 ++++++----- 27 files changed, 291 insertions(+), 271 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 4f5f01b..6f932a0 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -2,7 +2,7 @@ ## Requirements -- Python 3.10 or later +- Python 3.11 or later - `pip` ## Install from a release diff --git a/README.md b/README.md index a9d4ac3..323ef9a 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ A command-line tool for managing Credential Engine platform resources. ## Requirements -- Python 3.10 or later +- Python 3.11 or later - `pip` ## Installation @@ -253,7 +253,7 @@ ce-cli/ │ ├── csv_processor.py # Bulk DID upload (bulk-sign + publish) │ └── did_ops.py # DID validation, challenges, JWT signing └── utils/ - ├── http.py # Authenticated httpx wrapper + APIError + ├── http.py # Authenticated httpx2 wrapper + APIError ├── output.py # table/json/yaml/tsv renderer + @output_option └── errors.py # @handle_api_errors decorator ``` diff --git a/ce/auth/device_flow.py b/ce/auth/device_flow.py index 9b0b84d..8f03e00 100644 --- a/ce/auth/device_flow.py +++ b/ce/auth/device_flow.py @@ -2,14 +2,18 @@ from __future__ import annotations -import base64 -import hashlib -import secrets import time from dataclasses import dataclass from typing import Any, Optional -import httpx +import httpx2 +from authlib.common.security import generate_token +from authlib.integrations.base_client.errors import OAuthError +from authlib.integrations.httpx_client import OAuth2Client +from authlib.oauth2.rfc6749.errors import OAuth2Error +from authlib.oauth2.rfc7636 import create_s256_code_challenge + +DEVICE_CODE_GRANT = "urn:ietf:params:oauth:grant-type:device_code" @dataclass @@ -57,10 +61,8 @@ class RefreshRejectedError(DeviceFlowError): def create_pkce_pair() -> tuple[str, str]: """Return a new PKCE code verifier and its S256 challenge (RFC 7636).""" - verifier = secrets.token_urlsafe(48) - digest = hashlib.sha256(verifier.encode("ascii")).digest() - challenge = base64.urlsafe_b64encode(digest).rstrip(b"=").decode("ascii") - return verifier, challenge + verifier = generate_token(64) + return verifier, create_s256_code_challenge(verifier) class KeycloakDeviceFlowClient: @@ -69,10 +71,19 @@ class KeycloakDeviceFlowClient: def __init__( self, env: "ce.config.context.Environment", - transport: Optional[httpx.BaseTransport] = None, + transport: Optional[httpx2.BaseTransport] = None, ) -> None: self._env = env - self._http = httpx.Client( + self._http = httpx2.Client( + timeout=30, + verify=env.ssl_verify, + transport=transport, + ) + # Token grants (the device code and the refresh) go through Authlib, which sends the + # form, reads the answer and decodes OAuth errors. ce-cli is a public client: no secret. + self._oauth = OAuth2Client( + client_id=env.client_id, + token_endpoint_auth_method="none", timeout=30, verify=env.ssl_verify, transport=transport, @@ -118,62 +129,62 @@ def poll_for_token( deadline = time.monotonic() + expires_in poll_interval = interval - data = { - "grant_type": "urn:ietf:params:oauth:grant-type:device_code", - "device_code": device_code, - "client_id": self._env.client_id, - } + extra: dict[str, str] = {} if self._device_pkce is not None: pkce_device_code, verifier = self._device_pkce if pkce_device_code != device_code: raise DeviceFlowError("Device code does not match the pending PKCE session.") - data["code_verifier"] = verifier + extra["code_verifier"] = verifier while time.monotonic() < deadline: time.sleep(poll_interval) - resp = self._post(self._env.token_url, data, "Token request") - body = self._json(resp, "Token request") - - if resp.is_success: - self._device_pkce = None - return self._parse_token_response(body) - - error = body.get("error", "unknown_error") - - if error == "authorization_pending": - if on_pending: - on_pending() - continue - if error == "slow_down": - poll_interval += 5 - if on_pending: - on_pending() - continue - if error == "access_denied": - raise AccessDeniedError("Authorization was denied by the user.") - if error in ("expired_token", "device_code_expired"): - raise TokenExpiredError("The device code has expired. Please try again.") - raise DeviceFlowError(f"Unexpected error from token endpoint: {error}") + + try: + body = self._oauth.fetch_token( + self._env.token_url, + grant_type=DEVICE_CODE_GRANT, + device_code=device_code, + **extra, + ) + except (OAuthError, OAuth2Error) as exc: + error = exc.error + if error == "authorization_pending": + if on_pending: + on_pending() + continue + if error == "slow_down": + poll_interval += 5 + if on_pending: + on_pending() + continue + if error == "access_denied": + raise AccessDeniedError("Authorization was denied by the user.") from exc + if error in ("expired_token", "device_code_expired"): + raise TokenExpiredError("The device code has expired. Please try again.") from exc + raise DeviceFlowError(f"Unexpected error from token endpoint: {error}") from exc + except httpx2.HTTPError as exc: + raise DeviceFlowError(f"Token request failed: {exc}") from exc + except ValueError as exc: + raise DeviceFlowError(f"Token request failed: the answer was not JSON ({exc}).") from exc + + self._device_pkce = None + return self._parse_token_response(body) raise TokenExpiredError("Timed out waiting for user authorization.") def refresh_access_token(self, refresh_token: str) -> TokenResponse: - resp = self._post( - self._env.token_url, - { - "grant_type": "refresh_token", - "refresh_token": refresh_token, - "client_id": self._env.client_id, - }, - "Token refresh", - ) - - if resp.status_code in (400, 401): - # invalid_grant: the refresh token expired or the session was ended. - raise RefreshRejectedError(f"Token refresh was refused: {self._error_detail(resp)}") + try: + body = self._oauth.refresh_token(self._env.token_url, refresh_token=refresh_token) + except (OAuthError, OAuth2Error) as exc: + # invalid_grant and the like: the refresh token expired or the session was ended. + raise RefreshRejectedError( + f"Token refresh was refused: {exc.description or exc.error}" + ) from exc + except httpx2.HTTPError as exc: + raise DeviceFlowError(f"Token refresh failed: {exc}") from exc + except ValueError as exc: + raise DeviceFlowError(f"Token refresh failed: the answer was not JSON ({exc}).") from exc - self._raise_for_status(resp) - body = self._json(resp, "Token refresh") tokens = self._parse_token_response(body) if tokens.refresh_token is None: tokens.refresh_token = refresh_token @@ -187,7 +198,7 @@ def get_userinfo(self, access_token: str) -> dict: userinfo_url, headers={"Authorization": f"Bearer {access_token}"}, ) - except httpx.HTTPError as exc: + except httpx2.HTTPError as exc: raise DeviceFlowError(f"Account request failed: {exc}") from exc self._raise_for_status(resp) return self._json(resp, "Account request") @@ -210,15 +221,15 @@ def revoke_token(self, token: str, token_type_hint: str = "refresh_token") -> No ) self._raise_for_status(resp) - def _post(self, url: str, data: dict[str, str], what: str) -> httpx.Response: + def _post(self, url: str, data: dict[str, str], what: str) -> httpx2.Response: """POST a form, turning a transport failure into a DeviceFlowError.""" try: return self._http.post(url, data=data) - except httpx.HTTPError as exc: + except httpx2.HTTPError as exc: raise DeviceFlowError(f"{what} failed: {exc}") from exc @staticmethod - def _json(resp: httpx.Response, what: str) -> dict[str, Any]: + def _json(resp: httpx2.Response, what: str) -> dict[str, Any]: """The response body as a JSON object, or a DeviceFlowError (a proxy's HTML error page, for example).""" try: body = resp.json() @@ -242,7 +253,7 @@ def _parse_token_response(body: dict[str, Any]) -> TokenResponse: ) @staticmethod - def _error_detail(resp: httpx.Response) -> str: + def _error_detail(resp: httpx2.Response) -> str: try: body = resp.json() except ValueError: @@ -252,7 +263,7 @@ def _error_detail(resp: httpx.Response) -> str: return resp.text @staticmethod - def _raise_for_status(resp: httpx.Response) -> None: + def _raise_for_status(resp: httpx2.Response) -> None: if resp.is_error: detail = KeycloakDeviceFlowClient._error_detail(resp) raise DeviceFlowError(f"HTTP {resp.status_code} from {resp.url}: {detail}") diff --git a/ce/commands/version.py b/ce/commands/version.py index 897fb7a..5c4d861 100644 --- a/ce/commands/version.py +++ b/ce/commands/version.py @@ -31,11 +31,11 @@ def version_command(check: bool) -> None: def _check_for_update() -> None: """Query PyPI for the latest published version of ce-cli.""" - import httpx + import httpx2 try: with console.status("[dim]Checking for updates…[/dim]"): - resp = httpx.get( + resp = httpx2.get( "https://pypi.org/pypi/ce-cli/json", timeout=5, follow_redirects=True, diff --git a/ce/iir/api/README.md b/ce/iir/api/README.md index 447a45f..7c9ab10 100644 --- a/ce/iir/api/README.md +++ b/ce/iir/api/README.md @@ -76,7 +76,7 @@ Things to know: ## Advanced customizations -There are more settings on the generated `Client` class which let you control more runtime behavior, check out the docstring on that class for more info. You can also customize the underlying `httpx.Client` or `httpx.AsyncClient` (depending on your use-case): +There are more settings on the generated `Client` class which let you control more runtime behavior, check out the docstring on that class for more info. You can also customize the underlying `httpx2.Client` or `httpx2.AsyncClient` (depending on your use-case): ```python from iir_client import Client @@ -93,20 +93,20 @@ client = Client( httpx_args={"event_hooks": {"request": [log_request], "response": [log_response]}}, ) -# Or get the underlying httpx client to modify directly with client.get_httpx_client() or client.get_async_httpx_client() +# Or get the underlying httpx2 client to modify directly with client.get_httpx_client() or client.get_async_httpx_client() ``` -You can even set the httpx client directly, but beware that this will override any existing settings (e.g., base_url): +You can even set the httpx2 client directly, but beware that this will override any existing settings (e.g., base_url): ```python -import httpx +import httpx2 from iir_client import Client client = Client( base_url="https://api.example.com", ) # Note that base_url needs to be re-set, as would any shared cookies, headers, etc. -client.set_httpx_client(httpx.Client(base_url="https://api.example.com", proxies="http://localhost:8030")) +client.set_httpx_client(httpx2.Client(base_url="https://api.example.com", proxies="http://localhost:8030")) ``` ## Building / publishing this package diff --git a/ce/iir/api/iir_client/api/iir_api/iir_api_create_challenges.py b/ce/iir/api/iir_client/api/iir_api/iir_api_create_challenges.py index b7ae0e4..c5bf06c 100644 --- a/ce/iir/api/iir_client/api/iir_api/iir_api_create_challenges.py +++ b/ce/iir/api/iir_client/api/iir_api/iir_api_create_challenges.py @@ -2,7 +2,7 @@ from typing import Any, cast from urllib.parse import quote -import httpx +import httpx2 from ...client import AuthenticatedClient, Client from ...types import Response, UNSET, Unset @@ -45,7 +45,7 @@ def _get_kwargs( return _kwargs -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response): +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response): if response.status_code == 200: response_200 = [] for item_data in response.json(): @@ -58,7 +58,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[IIRApiCreateChallengesResponse200]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[IIRApiCreateChallengesResponse200]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -80,7 +80,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[IIRApiCreateChallengesResponse200] @@ -111,7 +111,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: IIRApiCreateChallengesResponse200 @@ -137,7 +137,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[IIRApiCreateChallengesResponse200] @@ -168,7 +168,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: IIRApiCreateChallengesResponse200 diff --git a/ce/iir/api/iir_client/api/iir_api/iir_api_federation_fetch.py b/ce/iir/api/iir_client/api/iir_api/iir_api_federation_fetch.py index 817ed73..a1492e6 100644 --- a/ce/iir/api/iir_client/api/iir_api/iir_api_federation_fetch.py +++ b/ce/iir/api/iir_client/api/iir_api/iir_api_federation_fetch.py @@ -2,7 +2,7 @@ from typing import Any, cast from urllib.parse import quote -import httpx +import httpx2 from ...client import AuthenticatedClient, Client from ...types import Response, UNSET @@ -41,7 +41,7 @@ def _get_kwargs( -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> IIRApiFederationFetchResponse200 | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> IIRApiFederationFetchResponse200 | None: if response.status_code == 200: response_200 = IIRApiFederationFetchResponse200.from_dict(response.json()) @@ -55,7 +55,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[IIRApiFederationFetchResponse200]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[IIRApiFederationFetchResponse200]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -76,7 +76,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[IIRApiFederationFetchResponse200] @@ -106,7 +106,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: IIRApiFederationFetchResponse200 @@ -131,7 +131,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[IIRApiFederationFetchResponse200] @@ -161,7 +161,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: IIRApiFederationFetchResponse200 diff --git a/ce/iir/api/iir_client/api/iir_api/iir_api_get_issuer_by_did.py b/ce/iir/api/iir_client/api/iir_api/iir_api_get_issuer_by_did.py index fa8a96f..f84d3da 100644 --- a/ce/iir/api/iir_client/api/iir_api/iir_api_get_issuer_by_did.py +++ b/ce/iir/api/iir_client/api/iir_api/iir_api_get_issuer_by_did.py @@ -2,7 +2,7 @@ from typing import Any, cast from urllib.parse import quote -import httpx +import httpx2 from ...client import AuthenticatedClient, Client from ...types import Response, UNSET @@ -41,7 +41,7 @@ def _get_kwargs( -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> IIRApiGetIssuerByDidResponse200 | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> IIRApiGetIssuerByDidResponse200 | None: if response.status_code == 200: response_200 = IIRApiGetIssuerByDidResponse200.from_dict(response.json()) @@ -55,7 +55,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[IIRApiGetIssuerByDidResponse200]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[IIRApiGetIssuerByDidResponse200]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -76,7 +76,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[IIRApiGetIssuerByDidResponse200] @@ -106,7 +106,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: IIRApiGetIssuerByDidResponse200 @@ -131,7 +131,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[IIRApiGetIssuerByDidResponse200] @@ -161,7 +161,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: IIRApiGetIssuerByDidResponse200 diff --git a/ce/iir/api/iir_client/api/iir_api/iir_api_get_issuers.py b/ce/iir/api/iir_client/api/iir_api/iir_api_get_issuers.py index b24f024..7b4b597 100644 --- a/ce/iir/api/iir_client/api/iir_api/iir_api_get_issuers.py +++ b/ce/iir/api/iir_client/api/iir_api/iir_api_get_issuers.py @@ -2,7 +2,7 @@ from typing import Any, cast from urllib.parse import quote -import httpx +import httpx2 from ...client import AuthenticatedClient, Client from ...types import Response, UNSET @@ -51,7 +51,7 @@ def _get_kwargs( -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> IIRApiGetIssuersResponse200 | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> IIRApiGetIssuersResponse200 | None: if response.status_code == 200: response_200 = IIRApiGetIssuersResponse200.from_dict(response.json()) @@ -65,7 +65,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[IIRApiGetIssuersResponse200]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[IIRApiGetIssuersResponse200]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -92,7 +92,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[IIRApiGetIssuersResponse200] @@ -131,7 +131,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: IIRApiGetIssuersResponse200 @@ -165,7 +165,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[IIRApiGetIssuersResponse200] @@ -204,7 +204,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: IIRApiGetIssuersResponse200 diff --git a/ce/iir/api/iir_client/api/iir_api/iir_api_get_issuers_by_user.py b/ce/iir/api/iir_client/api/iir_api/iir_api_get_issuers_by_user.py index 8a880e3..ddfd3be 100644 --- a/ce/iir/api/iir_client/api/iir_api/iir_api_get_issuers_by_user.py +++ b/ce/iir/api/iir_client/api/iir_api/iir_api_get_issuers_by_user.py @@ -2,7 +2,7 @@ from typing import Any, cast from urllib.parse import quote -import httpx +import httpx2 from ...client import AuthenticatedClient, Client from ...types import Response, UNSET @@ -53,7 +53,7 @@ def _get_kwargs( -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> IIRApiGetIssuersByUserResponse200 | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> IIRApiGetIssuersByUserResponse200 | None: if response.status_code == 200: response_200 = IIRApiGetIssuersByUserResponse200.from_dict(response.json()) @@ -67,7 +67,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[IIRApiGetIssuersByUserResponse200]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[IIRApiGetIssuersByUserResponse200]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -96,7 +96,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[IIRApiGetIssuersByUserResponse200] @@ -138,7 +138,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: IIRApiGetIssuersByUserResponse200 @@ -175,7 +175,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[IIRApiGetIssuersByUserResponse200] @@ -217,7 +217,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: IIRApiGetIssuersByUserResponse200 diff --git a/ce/iir/api/iir_client/api/iir_api/iir_api_get_organization_iir_detail.py b/ce/iir/api/iir_client/api/iir_api/iir_api_get_organization_iir_detail.py index 62ec496..b1b7040 100644 --- a/ce/iir/api/iir_client/api/iir_api/iir_api_get_organization_iir_detail.py +++ b/ce/iir/api/iir_client/api/iir_api/iir_api_get_organization_iir_detail.py @@ -2,7 +2,7 @@ from typing import Any, cast from urllib.parse import quote -import httpx +import httpx2 from ...client import AuthenticatedClient, Client from ...types import Response, UNSET @@ -41,7 +41,7 @@ def _get_kwargs( -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> IIRApiGetOrganizationIIRDetailResponse200 | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> IIRApiGetOrganizationIIRDetailResponse200 | None: if response.status_code == 200: response_200 = IIRApiGetOrganizationIIRDetailResponse200.from_dict(response.json()) @@ -55,7 +55,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[IIRApiGetOrganizationIIRDetailResponse200]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[IIRApiGetOrganizationIIRDetailResponse200]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -76,7 +76,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[IIRApiGetOrganizationIIRDetailResponse200] @@ -106,7 +106,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: IIRApiGetOrganizationIIRDetailResponse200 @@ -131,7 +131,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[IIRApiGetOrganizationIIRDetailResponse200] @@ -161,7 +161,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: IIRApiGetOrganizationIIRDetailResponse200 diff --git a/ce/iir/api/iir_client/api/iir_api/iir_api_get_registry_resource.py b/ce/iir/api/iir_client/api/iir_api/iir_api_get_registry_resource.py index 29615e3..97b88a0 100644 --- a/ce/iir/api/iir_client/api/iir_api/iir_api_get_registry_resource.py +++ b/ce/iir/api/iir_client/api/iir_api/iir_api_get_registry_resource.py @@ -2,7 +2,7 @@ from typing import Any, cast from urllib.parse import quote -import httpx +import httpx2 from ...client import AuthenticatedClient, Client from ...types import Response, UNSET @@ -41,7 +41,7 @@ def _get_kwargs( -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> IIRApiGetRegistryResourceResponse200 | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> IIRApiGetRegistryResourceResponse200 | None: if response.status_code == 200: response_200 = IIRApiGetRegistryResourceResponse200.from_dict(response.json()) @@ -55,7 +55,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[IIRApiGetRegistryResourceResponse200]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[IIRApiGetRegistryResourceResponse200]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -76,7 +76,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[IIRApiGetRegistryResourceResponse200] @@ -106,7 +106,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: IIRApiGetRegistryResourceResponse200 @@ -131,7 +131,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[IIRApiGetRegistryResourceResponse200] @@ -161,7 +161,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: IIRApiGetRegistryResourceResponse200 diff --git a/ce/iir/api/iir_client/api/iir_api/iir_api_is_user_a_member.py b/ce/iir/api/iir_client/api/iir_api/iir_api_is_user_a_member.py index 9bfe7d1..b401650 100644 --- a/ce/iir/api/iir_client/api/iir_api/iir_api_is_user_a_member.py +++ b/ce/iir/api/iir_client/api/iir_api/iir_api_is_user_a_member.py @@ -2,7 +2,7 @@ from typing import Any, cast from urllib.parse import quote -import httpx +import httpx2 from ...client import AuthenticatedClient, Client from ...types import Response, UNSET @@ -46,7 +46,7 @@ def _get_kwargs( -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> IIRApiIsUserAMemberResponse200 | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> IIRApiIsUserAMemberResponse200 | None: if response.status_code == 200: response_200 = IIRApiIsUserAMemberResponse200.from_dict(response.json()) @@ -60,7 +60,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[IIRApiIsUserAMemberResponse200]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[IIRApiIsUserAMemberResponse200]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -85,7 +85,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[IIRApiIsUserAMemberResponse200] @@ -121,7 +121,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: IIRApiIsUserAMemberResponse200 @@ -152,7 +152,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[IIRApiIsUserAMemberResponse200] @@ -188,7 +188,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: IIRApiIsUserAMemberResponse200 diff --git a/ce/iir/api/iir_client/api/iir_api/iir_api_is_user_a_member_of_org.py b/ce/iir/api/iir_client/api/iir_api/iir_api_is_user_a_member_of_org.py index c3679b2..8992004 100644 --- a/ce/iir/api/iir_client/api/iir_api/iir_api_is_user_a_member_of_org.py +++ b/ce/iir/api/iir_client/api/iir_api/iir_api_is_user_a_member_of_org.py @@ -2,7 +2,7 @@ from typing import Any, cast from urllib.parse import quote -import httpx +import httpx2 from ...client import AuthenticatedClient, Client from ...types import Response, UNSET @@ -44,7 +44,7 @@ def _get_kwargs( -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> IIRApiIsUserAMemberOfOrgResponse200 | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> IIRApiIsUserAMemberOfOrgResponse200 | None: if response.status_code == 200: response_200 = IIRApiIsUserAMemberOfOrgResponse200.from_dict(response.json()) @@ -58,7 +58,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[IIRApiIsUserAMemberOfOrgResponse200]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[IIRApiIsUserAMemberOfOrgResponse200]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -81,7 +81,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[IIRApiIsUserAMemberOfOrgResponse200] @@ -114,7 +114,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: IIRApiIsUserAMemberOfOrgResponse200 @@ -142,7 +142,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[IIRApiIsUserAMemberOfOrgResponse200] @@ -175,7 +175,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: IIRApiIsUserAMemberOfOrgResponse200 diff --git a/ce/iir/api/iir_client/api/iir_api/iir_api_save_challenge_token.py b/ce/iir/api/iir_client/api/iir_api/iir_api_save_challenge_token.py index 7542beb..a676741 100644 --- a/ce/iir/api/iir_client/api/iir_api/iir_api_save_challenge_token.py +++ b/ce/iir/api/iir_client/api/iir_api/iir_api_save_challenge_token.py @@ -2,7 +2,7 @@ from typing import Any, cast from urllib.parse import quote -import httpx +import httpx2 from ...client import AuthenticatedClient, Client from ...types import Response, UNSET, Unset @@ -46,7 +46,7 @@ def _get_kwargs( -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> IIRApiSaveChallengeTokenResponse200 | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> IIRApiSaveChallengeTokenResponse200 | None: if response.status_code == 200: response_200 = IIRApiSaveChallengeTokenResponse200.from_dict(response.json()) @@ -60,7 +60,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[IIRApiSaveChallengeTokenResponse200]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[IIRApiSaveChallengeTokenResponse200]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -82,7 +82,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[IIRApiSaveChallengeTokenResponse200] @@ -113,7 +113,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: IIRApiSaveChallengeTokenResponse200 @@ -139,7 +139,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[IIRApiSaveChallengeTokenResponse200] @@ -170,7 +170,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: IIRApiSaveChallengeTokenResponse200 diff --git a/ce/iir/api/iir_client/api/iir_api/iir_api_submit_to_iir.py b/ce/iir/api/iir_client/api/iir_api/iir_api_submit_to_iir.py index a374faf..3e23911 100644 --- a/ce/iir/api/iir_client/api/iir_api/iir_api_submit_to_iir.py +++ b/ce/iir/api/iir_client/api/iir_api/iir_api_submit_to_iir.py @@ -2,7 +2,7 @@ from typing import Any, cast from urllib.parse import quote -import httpx +import httpx2 from ...client import AuthenticatedClient, Client from ...types import Response, UNSET, Unset @@ -46,7 +46,7 @@ def _get_kwargs( -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> IIRApiSubmitToIIRResponse200 | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> IIRApiSubmitToIIRResponse200 | None: if response.status_code == 200: response_200 = IIRApiSubmitToIIRResponse200.from_dict(response.json()) @@ -60,7 +60,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[IIRApiSubmitToIIRResponse200]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[IIRApiSubmitToIIRResponse200]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -82,7 +82,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[IIRApiSubmitToIIRResponse200] @@ -113,7 +113,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: IIRApiSubmitToIIRResponse200 @@ -139,7 +139,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[IIRApiSubmitToIIRResponse200] @@ -170,7 +170,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: IIRApiSubmitToIIRResponse200 diff --git a/ce/iir/api/iir_client/api/iir_api/iir_api_update_issuer.py b/ce/iir/api/iir_client/api/iir_api/iir_api_update_issuer.py index 0bbd8b9..80be825 100644 --- a/ce/iir/api/iir_client/api/iir_api/iir_api_update_issuer.py +++ b/ce/iir/api/iir_client/api/iir_api/iir_api_update_issuer.py @@ -2,7 +2,7 @@ from typing import Any, cast from urllib.parse import quote -import httpx +import httpx2 from ...client import AuthenticatedClient, Client from ...types import Response, UNSET @@ -46,7 +46,7 @@ def _get_kwargs( -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> IIRApiUpdateIssuerResponse200 | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> IIRApiUpdateIssuerResponse200 | None: if response.status_code == 200: response_200 = IIRApiUpdateIssuerResponse200.from_dict(response.json()) @@ -60,7 +60,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[IIRApiUpdateIssuerResponse200]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[IIRApiUpdateIssuerResponse200]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -82,7 +82,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[IIRApiUpdateIssuerResponse200] @@ -113,7 +113,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: IIRApiUpdateIssuerResponse200 @@ -139,7 +139,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[IIRApiUpdateIssuerResponse200] @@ -170,7 +170,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: IIRApiUpdateIssuerResponse200 diff --git a/ce/iir/api/iir_client/api/iir_api/iir_api_validate_jwt_signature.py b/ce/iir/api/iir_client/api/iir_api/iir_api_validate_jwt_signature.py index 7ab600f..04e48db 100644 --- a/ce/iir/api/iir_client/api/iir_api/iir_api_validate_jwt_signature.py +++ b/ce/iir/api/iir_client/api/iir_api/iir_api_validate_jwt_signature.py @@ -2,7 +2,7 @@ from typing import Any, cast from urllib.parse import quote -import httpx +import httpx2 from ...client import AuthenticatedClient, Client from ...types import Response, UNSET, Unset @@ -46,7 +46,7 @@ def _get_kwargs( -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> IIRApiValidateJwtSignatureResponse200 | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> IIRApiValidateJwtSignatureResponse200 | None: if response.status_code == 200: response_200 = IIRApiValidateJwtSignatureResponse200.from_dict(response.json()) @@ -60,7 +60,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[IIRApiValidateJwtSignatureResponse200]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[IIRApiValidateJwtSignatureResponse200]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -82,7 +82,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[IIRApiValidateJwtSignatureResponse200] @@ -113,7 +113,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: IIRApiValidateJwtSignatureResponse200 @@ -139,7 +139,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[IIRApiValidateJwtSignatureResponse200] @@ -170,7 +170,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: IIRApiValidateJwtSignatureResponse200 diff --git a/ce/iir/api/iir_client/api/iir_api/iir_api_validate_key.py b/ce/iir/api/iir_client/api/iir_api/iir_api_validate_key.py index b4a1e5b..6e14043 100644 --- a/ce/iir/api/iir_client/api/iir_api/iir_api_validate_key.py +++ b/ce/iir/api/iir_client/api/iir_api/iir_api_validate_key.py @@ -2,7 +2,7 @@ from typing import Any, cast from urllib.parse import quote -import httpx +import httpx2 from ...client import AuthenticatedClient, Client from ...types import Response, UNSET @@ -44,7 +44,7 @@ def _get_kwargs( -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> IIRApiValidateKeyResponse200 | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> IIRApiValidateKeyResponse200 | None: if response.status_code == 200: response_200 = IIRApiValidateKeyResponse200.from_dict(response.json()) @@ -58,7 +58,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[IIRApiValidateKeyResponse200]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[IIRApiValidateKeyResponse200]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -81,7 +81,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[IIRApiValidateKeyResponse200] @@ -114,7 +114,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: IIRApiValidateKeyResponse200 @@ -142,7 +142,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[IIRApiValidateKeyResponse200] @@ -175,7 +175,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: IIRApiValidateKeyResponse200 diff --git a/ce/iir/api/iir_client/api/iir_api/iir_api_validate_web.py b/ce/iir/api/iir_client/api/iir_api/iir_api_validate_web.py index 0573ff1..1cd1f10 100644 --- a/ce/iir/api/iir_client/api/iir_api/iir_api_validate_web.py +++ b/ce/iir/api/iir_client/api/iir_api/iir_api_validate_web.py @@ -2,7 +2,7 @@ from typing import Any, cast from urllib.parse import quote -import httpx +import httpx2 from ...client import AuthenticatedClient, Client from ...types import Response, UNSET @@ -41,7 +41,7 @@ def _get_kwargs( -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> IIRApiValidateWebResponse200 | None: +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> IIRApiValidateWebResponse200 | None: if response.status_code == 200: response_200 = IIRApiValidateWebResponse200.from_dict(response.json()) @@ -55,7 +55,7 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[IIRApiValidateWebResponse200]: +def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[IIRApiValidateWebResponse200]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -76,7 +76,7 @@ def sync_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[IIRApiValidateWebResponse200] @@ -106,7 +106,7 @@ def sync( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: IIRApiValidateWebResponse200 @@ -131,7 +131,7 @@ async def asyncio_detailed( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: Response[IIRApiValidateWebResponse200] @@ -161,7 +161,7 @@ async def asyncio( Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. + httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: IIRApiValidateWebResponse200 diff --git a/ce/iir/api/iir_client/client.py b/ce/iir/api/iir_client/client.py index 5eeb05a..963e055 100644 --- a/ce/iir/api/iir_client/client.py +++ b/ce/iir/api/iir_client/client.py @@ -2,7 +2,7 @@ from typing import Any from attrs import define, field, evolve -import httpx +import httpx2 @@ -12,7 +12,7 @@ class Client: """A class for keeping track of data related to the API - The following are accepted as keyword arguments and will be used to construct httpx Clients internally: + The following are accepted as keyword arguments and will be used to construct httpx2 Clients internally: ``base_url``: The base URL for the API, all requests are made to a relative path to this URL @@ -21,14 +21,14 @@ class Client: ``headers``: A dictionary of headers to be sent with every request ``timeout``: The maximum amount of a time a request can take. API functions will raise - httpx.TimeoutException if this is exceeded. + httpx2.TimeoutException if this is exceeded. ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production, but can be set to False for testing purposes. ``follow_redirects``: Whether or not to follow redirects. Default value is False. - ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor. + ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx2.Client`` and ``httpx2.AsyncClient`` constructor. Attributes: @@ -40,12 +40,12 @@ class Client: _base_url: str = field(alias="base_url") _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers") - _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout") + _timeout: httpx2.Timeout | None = field(default=None, kw_only=True, alias="timeout") _verify_ssl: str | bool | ssl.SSLContext = field(default=True, kw_only=True, alias="verify_ssl") _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects") _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") - _client: httpx.Client | None = field(default=None, init=False) - _async_client: httpx.AsyncClient | None = field(default=None, init=False) + _client: httpx2.Client | None = field(default=None, init=False) + _async_client: httpx2.AsyncClient | None = field(default=None, init=False) def with_headers(self, headers: dict[str, str]) -> "Client": """Get a new client matching this one with additional headers""" @@ -63,7 +63,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "Client": self._async_client.cookies.update(cookies) return evolve(self, cookies={**self._cookies, **cookies}) - def with_timeout(self, timeout: httpx.Timeout) -> "Client": + def with_timeout(self, timeout: httpx2.Timeout) -> "Client": """Get a new client matching this one with a new timeout configuration""" if self._client is not None: self._client.timeout = timeout @@ -71,18 +71,18 @@ def with_timeout(self, timeout: httpx.Timeout) -> "Client": self._async_client.timeout = timeout return evolve(self, timeout=timeout) - def set_httpx_client(self, client: httpx.Client) -> "Client": - """Manually set the underlying httpx.Client + def set_httpx_client(self, client: httpx2.Client) -> "Client": + """Manually set the underlying httpx2.Client **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ self._client = client return self - def get_httpx_client(self) -> httpx.Client: - """Get the underlying httpx.Client, constructing a new one if not previously set""" + def get_httpx_client(self) -> httpx2.Client: + """Get the underlying httpx2.Client, constructing a new one if not previously set""" if self._client is None: - self._client = httpx.Client( + self._client = httpx2.Client( base_url=self._base_url, cookies=self._cookies, headers=self._headers, @@ -94,26 +94,26 @@ def get_httpx_client(self) -> httpx.Client: return self._client def __enter__(self) -> "Client": - """Enter a context manager for self.client—you cannot enter twice (see httpx docs)""" + """Enter a context manager for self.client—you cannot enter twice (see httpx2 docs)""" self.get_httpx_client().__enter__() return self def __exit__(self, *args: Any, **kwargs: Any) -> None: - """Exit a context manager for internal httpx.Client (see httpx docs)""" + """Exit a context manager for internal httpx2.Client (see httpx2 docs)""" self.get_httpx_client().__exit__(*args, **kwargs) - def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client": - """Manually set the underlying httpx.AsyncClient + def set_async_httpx_client(self, async_client: httpx2.AsyncClient) -> "Client": + """Manually set the underlying httpx2.AsyncClient **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ self._async_client = async_client return self - def get_async_httpx_client(self) -> httpx.AsyncClient: - """Get the underlying httpx.AsyncClient, constructing a new one if not previously set""" + def get_async_httpx_client(self) -> httpx2.AsyncClient: + """Get the underlying httpx2.AsyncClient, constructing a new one if not previously set""" if self._async_client is None: - self._async_client = httpx.AsyncClient( + self._async_client = httpx2.AsyncClient( base_url=self._base_url, cookies=self._cookies, headers=self._headers, @@ -125,12 +125,12 @@ def get_async_httpx_client(self) -> httpx.AsyncClient: return self._async_client async def __aenter__(self) -> "Client": - """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)""" + """Enter a context manager for underlying httpx2.AsyncClient—you cannot enter twice (see httpx2 docs)""" await self.get_async_httpx_client().__aenter__() return self async def __aexit__(self, *args: Any, **kwargs: Any) -> None: - """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)""" + """Exit a context manager for underlying httpx2.AsyncClient (see httpx2 docs)""" await self.get_async_httpx_client().__aexit__(*args, **kwargs) @@ -138,7 +138,7 @@ async def __aexit__(self, *args: Any, **kwargs: Any) -> None: class AuthenticatedClient: """A Client which has been authenticated for use on secured endpoints - The following are accepted as keyword arguments and will be used to construct httpx Clients internally: + The following are accepted as keyword arguments and will be used to construct httpx2 Clients internally: ``base_url``: The base URL for the API, all requests are made to a relative path to this URL @@ -147,14 +147,14 @@ class AuthenticatedClient: ``headers``: A dictionary of headers to be sent with every request ``timeout``: The maximum amount of a time a request can take. API functions will raise - httpx.TimeoutException if this is exceeded. + httpx2.TimeoutException if this is exceeded. ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production, but can be set to False for testing purposes. ``follow_redirects``: Whether or not to follow redirects. Default value is False. - ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor. + ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx2.Client`` and ``httpx2.AsyncClient`` constructor. Attributes: @@ -170,12 +170,12 @@ class AuthenticatedClient: _base_url: str = field(alias="base_url") _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers") - _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout") + _timeout: httpx2.Timeout | None = field(default=None, kw_only=True, alias="timeout") _verify_ssl: str | bool | ssl.SSLContext = field(default=True, kw_only=True, alias="verify_ssl") _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects") _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") - _client: httpx.Client | None = field(default=None, init=False) - _async_client: httpx.AsyncClient | None = field(default=None, init=False) + _client: httpx2.Client | None = field(default=None, init=False) + _async_client: httpx2.AsyncClient | None = field(default=None, init=False) token: str prefix: str = "Bearer" @@ -197,7 +197,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient": self._async_client.cookies.update(cookies) return evolve(self, cookies={**self._cookies, **cookies}) - def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient": + def with_timeout(self, timeout: httpx2.Timeout) -> "AuthenticatedClient": """Get a new client matching this one with a new timeout configuration""" if self._client is not None: self._client.timeout = timeout @@ -205,19 +205,19 @@ def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient": self._async_client.timeout = timeout return evolve(self, timeout=timeout) - def set_httpx_client(self, client: httpx.Client) -> "AuthenticatedClient": - """Manually set the underlying httpx.Client + def set_httpx_client(self, client: httpx2.Client) -> "AuthenticatedClient": + """Manually set the underlying httpx2.Client **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ self._client = client return self - def get_httpx_client(self) -> httpx.Client: - """Get the underlying httpx.Client, constructing a new one if not previously set""" + def get_httpx_client(self) -> httpx2.Client: + """Get the underlying httpx2.Client, constructing a new one if not previously set""" if self._client is None: self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token - self._client = httpx.Client( + self._client = httpx2.Client( base_url=self._base_url, cookies=self._cookies, headers=self._headers, @@ -229,27 +229,27 @@ def get_httpx_client(self) -> httpx.Client: return self._client def __enter__(self) -> "AuthenticatedClient": - """Enter a context manager for self.client—you cannot enter twice (see httpx docs)""" + """Enter a context manager for self.client—you cannot enter twice (see httpx2 docs)""" self.get_httpx_client().__enter__() return self def __exit__(self, *args: Any, **kwargs: Any) -> None: - """Exit a context manager for internal httpx.Client (see httpx docs)""" + """Exit a context manager for internal httpx2.Client (see httpx2 docs)""" self.get_httpx_client().__exit__(*args, **kwargs) - def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "AuthenticatedClient": - """Manually set the underlying httpx.AsyncClient + def set_async_httpx_client(self, async_client: httpx2.AsyncClient) -> "AuthenticatedClient": + """Manually set the underlying httpx2.AsyncClient **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ self._async_client = async_client return self - def get_async_httpx_client(self) -> httpx.AsyncClient: - """Get the underlying httpx.AsyncClient, constructing a new one if not previously set""" + def get_async_httpx_client(self) -> httpx2.AsyncClient: + """Get the underlying httpx2.AsyncClient, constructing a new one if not previously set""" if self._async_client is None: self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token - self._async_client = httpx.AsyncClient( + self._async_client = httpx2.AsyncClient( base_url=self._base_url, cookies=self._cookies, headers=self._headers, @@ -261,11 +261,11 @@ def get_async_httpx_client(self) -> httpx.AsyncClient: return self._async_client async def __aenter__(self) -> "AuthenticatedClient": - """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)""" + """Enter a context manager for underlying httpx2.AsyncClient—you cannot enter twice (see httpx2 docs)""" await self.get_async_httpx_client().__aenter__() return self async def __aexit__(self, *args: Any, **kwargs: Any) -> None: - """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)""" + """Exit a context manager for underlying httpx2.AsyncClient (see httpx2 docs)""" await self.get_async_httpx_client().__aexit__(*args, **kwargs) diff --git a/ce/iir/api/iir_client/types.py b/ce/iir/api/iir_client/types.py index f74db0a..2047c19 100644 --- a/ce/iir/api/iir_client/types.py +++ b/ce/iir/api/iir_client/types.py @@ -14,7 +14,7 @@ def __bool__(self) -> Literal[False]: UNSET: Unset = Unset() -# The types that `httpx.Client(files=)` can accept, copied from that library. +# The types that `httpx2.Client(files=)` can accept, copied from that library. FileContent = IO[bytes] | bytes | str FileTypes = ( # (filename, file (or bytes), content_type) @@ -33,7 +33,7 @@ class File: mime_type: str | None = None def to_tuple(self) -> FileTypes: - """ Return a tuple representation that httpx will accept for multipart/form-data """ + """ Return a tuple representation that httpx2 will accept for multipart/form-data """ return self.file_name, self.payload, self.mime_type diff --git a/ce/iir/api/pyproject.toml b/ce/iir/api/pyproject.toml index f0b3a4b..0c2f1e1 100644 --- a/ce/iir/api/pyproject.toml +++ b/ce/iir/api/pyproject.toml @@ -10,8 +10,8 @@ packages = [ include = ["iir_client/py.typed"] [tool.poetry.dependencies] -python = "^3.10" -httpx = ">=0.23.0,<0.29.0" +python = "^3.11" +httpx2 = ">=2.16,<3" attrs = ">=22.2.0" python-dateutil = "^2.8.0" diff --git a/ce/utils/errors.py b/ce/utils/errors.py index a533e63..4297925 100644 --- a/ce/utils/errors.py +++ b/ce/utils/errors.py @@ -15,7 +15,7 @@ def handle_api_errors(f: Callable) -> Callable: - """Decorator: catch APIError / httpx errors and print a friendly message.""" + """Decorator: catch APIError / httpx2 errors and print a friendly message.""" @functools.wraps(f) def wrapper(*args, **kwargs): diff --git a/ce/utils/http.py b/ce/utils/http.py index 91f2fc1..f8256b2 100644 --- a/ce/utils/http.py +++ b/ce/utils/http.py @@ -4,7 +4,7 @@ from contextlib import contextmanager from typing import Any, Generator -import httpx +import httpx2 from ce.auth.token_manager import require_login from ce.utils.logging import get_logger @@ -20,10 +20,10 @@ def __init__(self, status_code: int, message: str) -> None: class CEHTTPClient: - """Thin wrapper around httpx.Client with auth, debug tracing, and error handling.""" + """Thin wrapper around httpx2.Client with auth, debug tracing, and error handling.""" def __init__(self, base_url: str, access_token: str, timeout: float = 30.0) -> None: - self._client = httpx.Client( + self._client = httpx2.Client( base_url=base_url, headers={ "Authorization": f"Bearer {access_token}", @@ -35,22 +35,22 @@ def __init__(self, base_url: str, access_token: str, timeout: float = 30.0) -> N ) self._base_url = base_url - def get(self, path: str, **kwargs: Any) -> httpx.Response: + def get(self, path: str, **kwargs: Any) -> httpx2.Response: return self._request("GET", path, **kwargs) - def post(self, path: str, **kwargs: Any) -> httpx.Response: + def post(self, path: str, **kwargs: Any) -> httpx2.Response: return self._request("POST", path, **kwargs) - def put(self, path: str, **kwargs: Any) -> httpx.Response: + def put(self, path: str, **kwargs: Any) -> httpx2.Response: return self._request("PUT", path, **kwargs) - def patch(self, path: str, **kwargs: Any) -> httpx.Response: + def patch(self, path: str, **kwargs: Any) -> httpx2.Response: return self._request("PATCH", path, **kwargs) - def delete(self, path: str, **kwargs: Any) -> httpx.Response: + def delete(self, path: str, **kwargs: Any) -> httpx2.Response: return self._request("DELETE", path, **kwargs) - def _request(self, method: str, path: str, **kwargs: Any) -> httpx.Response: + def _request(self, method: str, path: str, **kwargs: Any) -> httpx2.Response: url = f"{self._base_url}{path}" start = log.http_request(method, url) resp = self._client.request(method, path, **kwargs) @@ -59,7 +59,7 @@ def _request(self, method: str, path: str, **kwargs: Any) -> httpx.Response: return resp @staticmethod - def _raise_for_status(resp: httpx.Response) -> None: + def _raise_for_status(resp: httpx2.Response) -> None: if resp.is_success: return try: diff --git a/pyproject.toml b/pyproject.toml index bb08ebc..4d779b4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,10 +7,11 @@ name = "ce-cli" dynamic = ["version"] description = "Credential Engine CLI - Internal platform management tool" readme = "README.md" -requires-python = ">=3.10" +requires-python = ">=3.11" dependencies = [ "click>=8.1", - "httpx>=0.27,<0.29", + "Authlib>=1.9", + "httpx2>=2.16,<3", "keyring>=25", "rich>=13", "pydantic>=2", diff --git a/tests/test_auth.py b/tests/test_auth.py index 6e6b622..e2a866e 100644 --- a/tests/test_auth.py +++ b/tests/test_auth.py @@ -15,7 +15,7 @@ from urllib.parse import parse_qs import click -import httpx +import httpx2 import pytest from click.testing import CliRunner @@ -51,13 +51,13 @@ class FakeKeycloak: """Keycloak's device, token, revoke and userinfo endpoints in memory.""" def __init__(self) -> None: - self.requests: list[httpx.Request] = [] - self.token_answers: list[httpx.Response | Exception] = [httpx.Response(200, json=TOKEN_BODY)] - self.device_answer: httpx.Response | Exception = httpx.Response(200, json=DEVICE_BODY) - self.revoke_answer: httpx.Response | Exception = httpx.Response(200) + self.requests: list[httpx2.Request] = [] + self.token_answers: list[httpx2.Response | Exception] = [httpx2.Response(200, json=TOKEN_BODY)] + self.device_answer: httpx2.Response | Exception = httpx2.Response(200, json=DEVICE_BODY) + self.revoke_answer: httpx2.Response | Exception = httpx2.Response(200) self.userinfo: dict[str, Any] = {"name": "Pat Tester", "email": "pat@example.org", "sub": "user-1"} - def handler(self, request: httpx.Request) -> httpx.Response: + def handler(self, request: httpx2.Request) -> httpx2.Response: self.requests.append(request) path = request.url.path @@ -68,16 +68,16 @@ def handler(self, request: httpx.Request) -> httpx.Response: elif path.endswith("/revoke"): answer = self.revoke_answer elif path.endswith("/userinfo"): - answer = httpx.Response(200, json=self.userinfo) + answer = httpx2.Response(200, json=self.userinfo) else: - answer = httpx.Response(404) + answer = httpx2.Response(404) if isinstance(answer, Exception): raise answer return answer def client(self) -> KeycloakDeviceFlowClient: - return KeycloakDeviceFlowClient(DEV, transport=httpx.MockTransport(self.handler)) + return KeycloakDeviceFlowClient(DEV, transport=httpx2.MockTransport(self.handler)) def forms(self, suffix: str) -> list[dict[str, str]]: """The form fields of every request to an endpoint.""" @@ -88,21 +88,22 @@ def forms(self, suffix: str) -> list[dict[str, str]]: ] -def oauth_error(error: str, status: int = 400) -> httpx.Response: - return httpx.Response(status, json={"error": error, "error_description": f"{error} happened"}) +def oauth_error(error: str, status: int = 400) -> httpx2.Response: + return httpx2.Response(status, json={"error": error, "error_description": f"{error} happened"}) @pytest.fixture def keycloak(monkeypatch: pytest.MonkeyPatch) -> FakeKeycloak: """A fake Keycloak that every KeycloakDeviceFlowClient talks to; polling does not sleep.""" fake = FakeKeycloak() - real_client = httpx.Client + real_init = KeycloakDeviceFlowClient.__init__ - def client_with_fake_transport(**kwargs: Any) -> httpx.Client: - kwargs["transport"] = httpx.MockTransport(fake.handler) - return real_client(**kwargs) + def init_with_fake_transport(self: KeycloakDeviceFlowClient, env: Any, transport: Any = None) -> None: + real_init(self, env, transport=httpx2.MockTransport(fake.handler)) - monkeypatch.setattr("ce.auth.device_flow.httpx.Client", client_with_fake_transport) + # Authlib's OAuth2Client is itself an httpx2.Client, so the fake goes in through the constructor, not by + # replacing httpx2.Client. + monkeypatch.setattr(KeycloakDeviceFlowClient, "__init__", init_with_fake_transport) monkeypatch.setattr("ce.auth.device_flow.time.sleep", lambda _seconds: None) return fake @@ -174,7 +175,7 @@ def test_request_device_code_reports_an_http_error(keycloak: FakeKeycloak) -> No def test_request_device_code_wraps_a_transport_error(keycloak: FakeKeycloak) -> None: - keycloak.device_answer = httpx.ConnectError("connection refused") + keycloak.device_answer = httpx2.ConnectError("connection refused") with pytest.raises(DeviceFlowError, match="Device authorization request failed"): keycloak.client().request_device_code() @@ -189,7 +190,7 @@ def test_poll_returns_the_tokens_on_the_first_success(keycloak: FakeKeycloak) -> def test_poll_keeps_waiting_while_authorization_is_pending(keycloak: FakeKeycloak) -> None: - keycloak.token_answers = [oauth_error("authorization_pending"), httpx.Response(200, json=TOKEN_BODY)] + keycloak.token_answers = [oauth_error("authorization_pending"), httpx2.Response(200, json=TOKEN_BODY)] pending: list[int] = [] tokens = keycloak.client().poll_for_token( @@ -201,7 +202,7 @@ def test_poll_keeps_waiting_while_authorization_is_pending(keycloak: FakeKeycloa def test_poll_slows_down_when_asked(keycloak: FakeKeycloak, monkeypatch: pytest.MonkeyPatch) -> None: - keycloak.token_answers = [oauth_error("slow_down"), httpx.Response(200, json=TOKEN_BODY)] + keycloak.token_answers = [oauth_error("slow_down"), httpx2.Response(200, json=TOKEN_BODY)] waits: list[float] = [] monkeypatch.setattr("ce.auth.device_flow.time.sleep", waits.append) @@ -234,21 +235,28 @@ def test_poll_times_out(keycloak: FakeKeycloak) -> None: def test_poll_wraps_a_transport_error(keycloak: FakeKeycloak) -> None: - keycloak.token_answers = [httpx.ConnectError("connection refused")] + keycloak.token_answers = [httpx2.ConnectError("connection refused")] with pytest.raises(DeviceFlowError, match="Token request failed"): keycloak.client().poll_for_token("device-1", interval=0, expires_in=60) -def test_poll_wraps_an_answer_that_is_not_json(keycloak: FakeKeycloak) -> None: - keycloak.token_answers = [httpx.Response(502, text="Bad gateway")] +def test_poll_wraps_a_proxys_error_page(keycloak: FakeKeycloak) -> None: + keycloak.token_answers = [httpx2.Response(502, text="Bad gateway")] + + with pytest.raises(DeviceFlowError, match="Token request failed.*502"): + keycloak.client().poll_for_token("device-1", interval=0, expires_in=60) + + +def test_poll_wraps_an_ok_answer_that_is_not_json(keycloak: FakeKeycloak) -> None: + keycloak.token_answers = [httpx2.Response(200, text="Welcome")] with pytest.raises(DeviceFlowError, match="was not JSON"): keycloak.client().poll_for_token("device-1", interval=0, expires_in=60) def test_refresh_keeps_the_old_refresh_token_when_none_comes_back(keycloak: FakeKeycloak) -> None: - keycloak.token_answers = [httpx.Response(200, json={"access_token": "access-2", "expires_in": 300})] + keycloak.token_answers = [httpx2.Response(200, json={"access_token": "access-2", "expires_in": 300})] tokens = keycloak.client().refresh_access_token("refresh-0") @@ -263,10 +271,10 @@ def test_refresh_refused_by_keycloak_is_a_rejection(keycloak: FakeKeycloak) -> N @pytest.mark.parametrize( - "answer", [httpx.ConnectError("connection refused"), httpx.Response(503, text="unavailable")] + "answer", [httpx2.ConnectError("connection refused"), httpx2.Response(503, text="unavailable")] ) def test_refresh_that_could_not_be_tried_is_not_a_rejection( - keycloak: FakeKeycloak, answer: httpx.Response | Exception + keycloak: FakeKeycloak, answer: httpx2.Response | Exception ) -> None: keycloak.token_answers = [answer] @@ -287,8 +295,8 @@ def test_revoke_posts_the_token_to_the_revocation_endpoint(keycloak: FakeKeycloa } -@pytest.mark.parametrize("answer", [httpx.Response(400, json={"error": "invalid_request"}), httpx.ConnectError("down")]) -def test_revoke_reports_a_failure(keycloak: FakeKeycloak, answer: httpx.Response | Exception) -> None: +@pytest.mark.parametrize("answer", [httpx2.Response(400, json={"error": "invalid_request"}), httpx2.ConnectError("down")]) +def test_revoke_reports_a_failure(keycloak: FakeKeycloak, answer: httpx2.Response | Exception) -> None: keycloak.revoke_answer = answer with pytest.raises(DeviceFlowError): @@ -389,7 +397,7 @@ def test_a_renewal_that_could_not_reach_keycloak_keeps_the_saved_session( config_dir: Path, keycloak: FakeKeycloak ) -> None: settings.save_tokens(stored(expires_in=-10), "dev") - keycloak.token_answers = [httpx.ConnectError("connection refused")] + keycloak.token_answers = [httpx2.ConnectError("connection refused")] result = token_manager.resolve_access_token() @@ -417,13 +425,13 @@ def test_a_session_for_one_environment_does_not_count_for_another(config_dir: Pa [ (None, click.UsageError, "You are not logged in"), (oauth_error("invalid_grant"), click.UsageError, "Your session has expired"), - (httpx.ConnectError("connection refused"), click.ClickException, "You are still signed in"), + (httpx2.ConnectError("connection refused"), click.ClickException, "You are still signed in"), ], ) def test_require_login_says_why_there_is_no_token( config_dir: Path, keycloak: FakeKeycloak, - answer: httpx.Response | Exception | None, + answer: httpx2.Response | Exception | None, exception: type[click.ClickException], message: str, ) -> None: @@ -485,7 +493,7 @@ def test_login_to_another_environment_does_not_reuse_the_active_ones_session( def test_an_expired_session_permits_a_new_login(config_dir: Path, keycloak: FakeKeycloak) -> None: settings.save_tokens(stored(expires_in=-10), "dev") - keycloak.token_answers = [oauth_error("invalid_grant"), httpx.Response(200, json=TOKEN_BODY)] + keycloak.token_answers = [oauth_error("invalid_grant"), httpx2.Response(200, json=TOKEN_BODY)] result = run(login) @@ -495,7 +503,7 @@ def test_an_expired_session_permits_a_new_login(config_dir: Path, keycloak: Fake def test_login_shows_a_device_code_error(config_dir: Path, keycloak: FakeKeycloak) -> None: - keycloak.device_answer = httpx.ConnectError("connection refused") + keycloak.device_answer = httpx2.ConnectError("connection refused") result = run(login) @@ -504,13 +512,13 @@ def test_login_shows_a_device_code_error(config_dir: Path, keycloak: FakeKeycloa def test_login_shows_a_polling_error_instead_of_a_traceback(config_dir: Path, keycloak: FakeKeycloak) -> None: - keycloak.token_answers = [httpx.ConnectError("connection refused")] + keycloak.token_answers = [httpx2.ConnectError("connection refused")] result = run(login) assert result.exit_code == 1 assert "Token request failed" in result.output - assert not isinstance(result.exception, httpx.HTTPError) + assert not isinstance(result.exception, httpx2.HTTPError) assert settings.load_tokens("dev") is None @@ -528,7 +536,7 @@ def test_logout_revokes_the_refresh_token_and_clears_the_session(config_dir: Pat def test_logout_still_clears_the_session_when_revoking_fails(config_dir: Path, keycloak: FakeKeycloak) -> None: settings.save_tokens(stored(), "dev") - keycloak.revoke_answer = httpx.ConnectError("connection refused") + keycloak.revoke_answer = httpx2.ConnectError("connection refused") result = run(logout, "--yes") @@ -592,7 +600,7 @@ def test_whoami_says_when_the_session_has_expired(config_dir: Path, keycloak: Fa def test_whoami_exits_1_when_keycloak_cannot_be_reached(config_dir: Path, keycloak: FakeKeycloak) -> None: settings.save_tokens(stored(expires_in=-10), "dev") - keycloak.token_answers = [httpx.ConnectError("connection refused")] + keycloak.token_answers = [httpx2.ConnectError("connection refused")] result = run(account_show) From 5000e1a34c736ef8d95cadba41a8dcbcc785c1e6 Mon Sep 17 00:00:00 2001 From: Cary Huang Date: Fri, 13 Nov 2026 19:20:00 -0800 Subject: [PATCH 2/3] Regenerate the IIR client for httpx2 --- ce/iir/api/README.md | 13 +- ce/iir/api/iir_client/__init__.py | 2 +- ce/iir/api/iir_client/api/__init__.py | 2 +- ce/iir/api/iir_client/api/iir_api/__init__.py | 2 +- .../api/iir_api/iir_api_create_challenges.py | 117 +++++++-------- .../api/iir_api/iir_api_federation_fetch.py | 97 +++++-------- .../api/iir_api/iir_api_get_issuer_by_did.py | 97 +++++-------- .../api/iir_api/iir_api_get_issuers.py | 122 +++++++--------- .../iir_api/iir_api_get_issuers_by_user.py | 135 ++++++++---------- .../iir_api_get_organization_iir_detail.py | 97 +++++-------- .../iir_api/iir_api_get_registry_resource.py | 97 +++++-------- .../api/iir_api/iir_api_is_user_a_member.py | 118 +++++++-------- .../iir_api_is_user_a_member_of_org.py | 105 ++++++-------- .../iir_api/iir_api_save_challenge_token.py | 108 ++++++-------- .../api/iir_api/iir_api_submit_to_iir.py | 108 ++++++-------- .../api/iir_api/iir_api_update_issuer.py | 108 ++++++-------- .../iir_api/iir_api_validate_jwt_signature.py | 108 ++++++-------- .../api/iir_api/iir_api_validate_key.py | 105 ++++++-------- .../api/iir_api/iir_api_validate_web.py | 97 +++++-------- ce/iir/api/iir_client/client.py | 25 ++-- ce/iir/api/iir_client/errors.py | 4 +- ce/iir/api/iir_client/models/__init__.py | 62 ++++---- .../iir_client/models/cancellation_token.py | 43 ++---- .../models/create_challenges_request.py | 35 +---- ...pi_create_challenges_response_200_item.py} | 34 +---- .../iir_api_federation_fetch_response_200.py | 30 +--- .../iir_api_get_issuer_by_did_response_200.py | 30 +--- ...ir_api_get_issuers_by_user_response_200.py | 30 +--- .../iir_api_get_issuers_response_200.py | 30 +--- ...et_organization_iir_detail_response_200.py | 30 +--- ..._api_get_registry_resource_response_200.py | 30 +--- ...pi_is_user_a_member_of_org_response_200.py | 30 +--- .../iir_api_is_user_a_member_response_200.py | 30 +--- ...r_api_save_challenge_token_response_200.py | 30 +--- .../iir_api_submit_to_iir_response_200.py | 30 +--- .../iir_api_update_issuer_response_200.py | 30 +--- ...api_validate_jwt_signature_response_200.py | 30 +--- .../iir_api_validate_key_response_200.py | 30 +--- .../iir_api_validate_web_response_200.py | 30 +--- .../api/iir_client/models/pub_issuer_dto.py | 65 +++------ .../api/iir_client/models/safe_wait_handle.py | 31 +--- .../models/save_challenge_token_request.py | 40 ++---- .../iir_client/models/validate_jwt_request.py | 38 ++--- ce/iir/api/iir_client/models/wait_handle.py | 51 ++----- .../iir_client/models/wait_handle_handle.py | 26 +--- ce/iir/api/iir_client/types.py | 11 +- ce/iir/api/pyproject.toml | 3 +- ce/iir/openapi.json | 22 ++- ce/iir/prepare_openapi.py | 41 ++++++ generate.ps1 | 6 +- 50 files changed, 952 insertions(+), 1643 deletions(-) rename ce/iir/api/iir_client/models/{iir_api_create_challenges_response_200.py => iir_api_create_challenges_response_200_item.py} (69%) create mode 100644 ce/iir/prepare_openapi.py diff --git a/ce/iir/api/README.md b/ce/iir/api/README.md index 7c9ab10..70dd9c9 100644 --- a/ce/iir/api/README.md +++ b/ce/iir/api/README.md @@ -47,7 +47,7 @@ By default, when you're calling an HTTPS API it will attempt to verify that SSL ```python client = AuthenticatedClient( - base_url="https://internal_api.example.com", + base_url="https://internal_api.example.com", token="SuperSecretToken", verify_ssl="/path/to/certificate_bundle.pem", ) @@ -56,11 +56,7 @@ client = AuthenticatedClient( You can also disable certificate validation altogether, but beware that **this is a security risk**. ```python -client = AuthenticatedClient( - base_url="https://internal_api.example.com", - token="SuperSecretToken", - verify_ssl=False -) +client = AuthenticatedClient(base_url="https://internal_api.example.com", token="SuperSecretToken", verify_ssl=False) ``` Things to know: @@ -81,13 +77,16 @@ There are more settings on the generated `Client` class which let you control mo ```python from iir_client import Client + def log_request(request): print(f"Request event hook: {request.method} {request.url} - Waiting for response") + def log_response(response): request = response.request print(f"Response event hook: {request.method} {request.url} - Status {response.status_code}") + client = Client( base_url="https://api.example.com", httpx_args={"event_hooks": {"request": [log_request], "response": [log_response]}}, @@ -106,7 +105,7 @@ client = Client( base_url="https://api.example.com", ) # Note that base_url needs to be re-set, as would any shared cookies, headers, etc. -client.set_httpx_client(httpx2.Client(base_url="https://api.example.com", proxies="http://localhost:8030")) +client.set_httpx_client(httpx2.Client(base_url="https://api.example.com", proxy="http://localhost:8030")) ``` ## Building / publishing this package diff --git a/ce/iir/api/iir_client/__init__.py b/ce/iir/api/iir_client/__init__.py index a1ec1dd..6b4d41e 100644 --- a/ce/iir/api/iir_client/__init__.py +++ b/ce/iir/api/iir_client/__init__.py @@ -1,5 +1,5 @@ +"""A client library for accessing CTI Directory API""" -""" A client library for accessing CTI Directory API """ from .client import AuthenticatedClient, Client __all__ = ( diff --git a/ce/iir/api/iir_client/api/__init__.py b/ce/iir/api/iir_client/api/__init__.py index dc035f4..81f9fa2 100644 --- a/ce/iir/api/iir_client/api/__init__.py +++ b/ce/iir/api/iir_client/api/__init__.py @@ -1 +1 @@ -""" Contains methods for accessing the API """ +"""Contains methods for accessing the API""" diff --git a/ce/iir/api/iir_client/api/iir_api/__init__.py b/ce/iir/api/iir_client/api/iir_api/__init__.py index c9921b5..2d7c0b2 100644 --- a/ce/iir/api/iir_client/api/iir_api/__init__.py +++ b/ce/iir/api/iir_client/api/iir_api/__init__.py @@ -1 +1 @@ -""" Contains endpoint functions for accessing the API """ +"""Contains endpoint functions for accessing the API""" diff --git a/ce/iir/api/iir_client/api/iir_api/iir_api_create_challenges.py b/ce/iir/api/iir_client/api/iir_api/iir_api_create_challenges.py index c5bf06c..07e5d24 100644 --- a/ce/iir/api/iir_client/api/iir_api/iir_api_create_challenges.py +++ b/ce/iir/api/iir_client/api/iir_api/iir_api_create_challenges.py @@ -1,31 +1,21 @@ from http import HTTPStatus -from typing import Any, cast -from urllib.parse import quote +from typing import Any import httpx2 -from ...client import AuthenticatedClient, Client -from ...types import Response, UNSET, Unset from ... import errors - +from ...client import AuthenticatedClient, Client from ...models.create_challenges_request import CreateChallengesRequest -from ...models.iir_api_create_challenges_response_200 import IIRApiCreateChallengesResponse200 -from typing import cast - +from ...models.iir_api_create_challenges_response_200_item import IirApiCreateChallengesResponse200Item +from ...types import UNSET, Response def _get_kwargs( *, - body: CreateChallengesRequest | Unset = UNSET, - + body: CreateChallengesRequest | CreateChallengesRequest | Unset = UNSET, ) -> dict[str, Any]: headers: dict[str, Any] = {} - - - - - _kwargs: dict[str, Any] = { "method": "post", "url": "/iir-api/createChallenges", @@ -34,31 +24,37 @@ def _get_kwargs( if isinstance(body, CreateChallengesRequest): _kwargs["json"] = body.to_dict() - headers["Content-Type"] = "application/json" if isinstance(body, CreateChallengesRequest): _kwargs["data"] = body.to_dict() - headers["Content-Type"] = "application/x-www-form-urlencoded" _kwargs["headers"] = headers return _kwargs - -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response): + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx2.Response +) -> list[IirApiCreateChallengesResponse200Item] | None: if response.status_code == 200: response_200 = [] - for item_data in response.json(): - item = IIRApiCreateChallengesResponse200.from_dict(item_data) - response_200.append(item) + _response_200 = response.json() + for response_200_item_data in _response_200: + response_200_item = IirApiCreateChallengesResponse200Item.from_dict(response_200_item_data) + + response_200.append(response_200_item) + return response_200 if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) - return None + else: + return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[IIRApiCreateChallengesResponse200]: +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx2.Response +) -> Response[list[IirApiCreateChallengesResponse200Item]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -70,10 +66,9 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Re def sync_detailed( *, client: AuthenticatedClient | Client, - body: CreateChallengesRequest | CreateChallengesRequest | Unset = UNSET, - -) -> Response[IIRApiCreateChallengesResponse200]: - """ + body: CreateChallengesRequest | CreateChallengesRequest | Unset = UNSET, +) -> Response[list[IirApiCreateChallengesResponse200Item]]: + """ Args: body (CreateChallengesRequest): body (CreateChallengesRequest): @@ -83,13 +78,11 @@ def sync_detailed( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[IIRApiCreateChallengesResponse200] - """ - + Response[list[IirApiCreateChallengesResponse200Item]] + """ kwargs = _get_kwargs( body=body, - ) response = client.get_httpx_client().request( @@ -98,13 +91,13 @@ def sync_detailed( return _build_response(client=client, response=response) + def sync( *, client: AuthenticatedClient | Client, - body: CreateChallengesRequest | CreateChallengesRequest | Unset = UNSET, - -) -> IIRApiCreateChallengesResponse200 | None: - """ + body: CreateChallengesRequest | CreateChallengesRequest | Unset = UNSET, +) -> list[IirApiCreateChallengesResponse200Item] | None: + """ Args: body (CreateChallengesRequest): body (CreateChallengesRequest): @@ -114,23 +107,21 @@ def sync( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - IIRApiCreateChallengesResponse200 - """ - + list[IirApiCreateChallengesResponse200Item] + """ return sync_detailed( client=client, -body=body, - + body=body, ).parsed + async def asyncio_detailed( *, client: AuthenticatedClient | Client, - body: CreateChallengesRequest | CreateChallengesRequest | Unset = UNSET, - -) -> Response[IIRApiCreateChallengesResponse200]: - """ + body: CreateChallengesRequest | CreateChallengesRequest | Unset = UNSET, +) -> Response[list[IirApiCreateChallengesResponse200Item]]: + """ Args: body (CreateChallengesRequest): body (CreateChallengesRequest): @@ -140,28 +131,24 @@ async def asyncio_detailed( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[IIRApiCreateChallengesResponse200] - """ - + Response[list[IirApiCreateChallengesResponse200Item]] + """ kwargs = _get_kwargs( body=body, - ) - response = await client.get_async_httpx_client().request( - **kwargs - ) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) + async def asyncio( *, client: AuthenticatedClient | Client, - body: CreateChallengesRequest | CreateChallengesRequest | Unset = UNSET, - -) -> IIRApiCreateChallengesResponse200 | None: - """ + body: CreateChallengesRequest | CreateChallengesRequest | Unset = UNSET, +) -> list[IirApiCreateChallengesResponse200Item] | None: + """ Args: body (CreateChallengesRequest): body (CreateChallengesRequest): @@ -171,12 +158,12 @@ async def asyncio( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - IIRApiCreateChallengesResponse200 - """ - - - return (await asyncio_detailed( - client=client, -body=body, - - )).parsed + list[IirApiCreateChallengesResponse200Item] + """ + + return ( + await asyncio_detailed( + client=client, + body=body, + ) + ).parsed diff --git a/ce/iir/api/iir_client/api/iir_api/iir_api_federation_fetch.py b/ce/iir/api/iir_client/api/iir_api/iir_api_federation_fetch.py index a1492e6..ef501df 100644 --- a/ce/iir/api/iir_client/api/iir_api/iir_api_federation_fetch.py +++ b/ce/iir/api/iir_client/api/iir_api/iir_api_federation_fetch.py @@ -1,51 +1,39 @@ from http import HTTPStatus -from typing import Any, cast -from urllib.parse import quote +from typing import Any import httpx2 -from ...client import AuthenticatedClient, Client -from ...types import Response, UNSET from ... import errors - -from ...models.iir_api_federation_fetch_response_200 import IIRApiFederationFetchResponse200 -from typing import cast - +from ...client import AuthenticatedClient, Client +from ...models.iir_api_federation_fetch_response_200 import IirApiFederationFetchResponse200 +from ...types import UNSET, Response def _get_kwargs( *, sub: str, - ) -> dict[str, Any]: - - - params: dict[str, Any] = {} params["sub"] = sub - params = {k: v for k, v in params.items() if v is not UNSET and v is not None} - _kwargs: dict[str, Any] = { "method": "get", "url": "/iir-api/federationFetch", "params": params, } - return _kwargs - -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> IIRApiFederationFetchResponse200 | None: +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx2.Response +) -> IirApiFederationFetchResponse200 | None: if response.status_code == 200: - response_200 = IIRApiFederationFetchResponse200.from_dict(response.json()) - - + response_200 = IirApiFederationFetchResponse200.from_dict(response.json()) return response_200 @@ -55,7 +43,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Re return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[IIRApiFederationFetchResponse200]: +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx2.Response +) -> Response[IirApiFederationFetchResponse200]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -68,9 +58,8 @@ def sync_detailed( *, client: AuthenticatedClient | Client, sub: str, - -) -> Response[IIRApiFederationFetchResponse200]: - """ +) -> Response[IirApiFederationFetchResponse200]: + """ Args: sub (str): @@ -79,13 +68,11 @@ def sync_detailed( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[IIRApiFederationFetchResponse200] - """ - + Response[IirApiFederationFetchResponse200] + """ kwargs = _get_kwargs( sub=sub, - ) response = client.get_httpx_client().request( @@ -94,13 +81,13 @@ def sync_detailed( return _build_response(client=client, response=response) + def sync( *, client: AuthenticatedClient | Client, sub: str, - -) -> IIRApiFederationFetchResponse200 | None: - """ +) -> IirApiFederationFetchResponse200 | None: + """ Args: sub (str): @@ -109,23 +96,21 @@ def sync( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - IIRApiFederationFetchResponse200 - """ - + IirApiFederationFetchResponse200 + """ return sync_detailed( client=client, -sub=sub, - + sub=sub, ).parsed + async def asyncio_detailed( *, client: AuthenticatedClient | Client, sub: str, - -) -> Response[IIRApiFederationFetchResponse200]: - """ +) -> Response[IirApiFederationFetchResponse200]: + """ Args: sub (str): @@ -134,28 +119,24 @@ async def asyncio_detailed( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[IIRApiFederationFetchResponse200] - """ - + Response[IirApiFederationFetchResponse200] + """ kwargs = _get_kwargs( sub=sub, - ) - response = await client.get_async_httpx_client().request( - **kwargs - ) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) + async def asyncio( *, client: AuthenticatedClient | Client, sub: str, - -) -> IIRApiFederationFetchResponse200 | None: - """ +) -> IirApiFederationFetchResponse200 | None: + """ Args: sub (str): @@ -164,12 +145,12 @@ async def asyncio( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - IIRApiFederationFetchResponse200 - """ - - - return (await asyncio_detailed( - client=client, -sub=sub, - - )).parsed + IirApiFederationFetchResponse200 + """ + + return ( + await asyncio_detailed( + client=client, + sub=sub, + ) + ).parsed diff --git a/ce/iir/api/iir_client/api/iir_api/iir_api_get_issuer_by_did.py b/ce/iir/api/iir_client/api/iir_api/iir_api_get_issuer_by_did.py index f84d3da..9638f21 100644 --- a/ce/iir/api/iir_client/api/iir_api/iir_api_get_issuer_by_did.py +++ b/ce/iir/api/iir_client/api/iir_api/iir_api_get_issuer_by_did.py @@ -1,51 +1,39 @@ from http import HTTPStatus -from typing import Any, cast -from urllib.parse import quote +from typing import Any import httpx2 -from ...client import AuthenticatedClient, Client -from ...types import Response, UNSET from ... import errors - -from ...models.iir_api_get_issuer_by_did_response_200 import IIRApiGetIssuerByDidResponse200 -from typing import cast - +from ...client import AuthenticatedClient, Client +from ...models.iir_api_get_issuer_by_did_response_200 import IirApiGetIssuerByDidResponse200 +from ...types import UNSET, Response def _get_kwargs( *, did: str, - ) -> dict[str, Any]: - - - params: dict[str, Any] = {} params["did"] = did - params = {k: v for k, v in params.items() if v is not UNSET and v is not None} - _kwargs: dict[str, Any] = { "method": "get", "url": "/iir-api/issuerByDid", "params": params, } - return _kwargs - -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> IIRApiGetIssuerByDidResponse200 | None: +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx2.Response +) -> IirApiGetIssuerByDidResponse200 | None: if response.status_code == 200: - response_200 = IIRApiGetIssuerByDidResponse200.from_dict(response.json()) - - + response_200 = IirApiGetIssuerByDidResponse200.from_dict(response.json()) return response_200 @@ -55,7 +43,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Re return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[IIRApiGetIssuerByDidResponse200]: +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx2.Response +) -> Response[IirApiGetIssuerByDidResponse200]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -68,9 +58,8 @@ def sync_detailed( *, client: AuthenticatedClient | Client, did: str, - -) -> Response[IIRApiGetIssuerByDidResponse200]: - """ +) -> Response[IirApiGetIssuerByDidResponse200]: + """ Args: did (str): @@ -79,13 +68,11 @@ def sync_detailed( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[IIRApiGetIssuerByDidResponse200] - """ - + Response[IirApiGetIssuerByDidResponse200] + """ kwargs = _get_kwargs( did=did, - ) response = client.get_httpx_client().request( @@ -94,13 +81,13 @@ def sync_detailed( return _build_response(client=client, response=response) + def sync( *, client: AuthenticatedClient | Client, did: str, - -) -> IIRApiGetIssuerByDidResponse200 | None: - """ +) -> IirApiGetIssuerByDidResponse200 | None: + """ Args: did (str): @@ -109,23 +96,21 @@ def sync( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - IIRApiGetIssuerByDidResponse200 - """ - + IirApiGetIssuerByDidResponse200 + """ return sync_detailed( client=client, -did=did, - + did=did, ).parsed + async def asyncio_detailed( *, client: AuthenticatedClient | Client, did: str, - -) -> Response[IIRApiGetIssuerByDidResponse200]: - """ +) -> Response[IirApiGetIssuerByDidResponse200]: + """ Args: did (str): @@ -134,28 +119,24 @@ async def asyncio_detailed( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[IIRApiGetIssuerByDidResponse200] - """ - + Response[IirApiGetIssuerByDidResponse200] + """ kwargs = _get_kwargs( did=did, - ) - response = await client.get_async_httpx_client().request( - **kwargs - ) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) + async def asyncio( *, client: AuthenticatedClient | Client, did: str, - -) -> IIRApiGetIssuerByDidResponse200 | None: - """ +) -> IirApiGetIssuerByDidResponse200 | None: + """ Args: did (str): @@ -164,12 +145,12 @@ async def asyncio( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - IIRApiGetIssuerByDidResponse200 - """ - - - return (await asyncio_detailed( - client=client, -did=did, - - )).parsed + IirApiGetIssuerByDidResponse200 + """ + + return ( + await asyncio_detailed( + client=client, + did=did, + ) + ).parsed diff --git a/ce/iir/api/iir_client/api/iir_api/iir_api_get_issuers.py b/ce/iir/api/iir_client/api/iir_api/iir_api_get_issuers.py index 7b4b597..fb66818 100644 --- a/ce/iir/api/iir_client/api/iir_api/iir_api_get_issuers.py +++ b/ce/iir/api/iir_client/api/iir_api/iir_api_get_issuers.py @@ -1,17 +1,12 @@ from http import HTTPStatus -from typing import Any, cast -from urllib.parse import quote +from typing import Any import httpx2 -from ...client import AuthenticatedClient, Client -from ...types import Response, UNSET from ... import errors - -from ...models.iir_api_get_issuers_response_200 import IIRApiGetIssuersResponse200 -from ...types import UNSET, Unset -from typing import cast - +from ...client import AuthenticatedClient, Client +from ...models.iir_api_get_issuers_response_200 import IirApiGetIssuersResponse200 +from ...types import UNSET, Response, Unset def _get_kwargs( @@ -20,11 +15,7 @@ def _get_kwargs( page_size: int | Unset = UNSET, keyword: str | Unset = UNSET, task: str | Unset = UNSET, - ) -> dict[str, Any]: - - - params: dict[str, Any] = {} @@ -36,26 +27,22 @@ def _get_kwargs( params["task"] = task - params = {k: v for k, v in params.items() if v is not UNSET and v is not None} - _kwargs: dict[str, Any] = { "method": "get", "url": "/iir-api/issuers", "params": params, } - return _kwargs - -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> IIRApiGetIssuersResponse200 | None: +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx2.Response +) -> IirApiGetIssuersResponse200 | None: if response.status_code == 200: - response_200 = IIRApiGetIssuersResponse200.from_dict(response.json()) - - + response_200 = IirApiGetIssuersResponse200.from_dict(response.json()) return response_200 @@ -65,7 +52,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Re return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[IIRApiGetIssuersResponse200]: +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx2.Response +) -> Response[IirApiGetIssuersResponse200]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -81,9 +70,8 @@ def sync_detailed( page_size: int | Unset = UNSET, keyword: str | Unset = UNSET, task: str | Unset = UNSET, - -) -> Response[IIRApiGetIssuersResponse200]: - """ +) -> Response[IirApiGetIssuersResponse200]: + """ Args: page (int | Unset): page_size (int | Unset): @@ -95,16 +83,14 @@ def sync_detailed( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[IIRApiGetIssuersResponse200] - """ - + Response[IirApiGetIssuersResponse200] + """ kwargs = _get_kwargs( page=page, -page_size=page_size, -keyword=keyword, -task=task, - + page_size=page_size, + keyword=keyword, + task=task, ) response = client.get_httpx_client().request( @@ -113,6 +99,7 @@ def sync_detailed( return _build_response(client=client, response=response) + def sync( *, client: AuthenticatedClient | Client, @@ -120,9 +107,8 @@ def sync( page_size: int | Unset = UNSET, keyword: str | Unset = UNSET, task: str | Unset = UNSET, - -) -> IIRApiGetIssuersResponse200 | None: - """ +) -> IirApiGetIssuersResponse200 | None: + """ Args: page (int | Unset): page_size (int | Unset): @@ -134,19 +120,18 @@ def sync( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - IIRApiGetIssuersResponse200 - """ - + IirApiGetIssuersResponse200 + """ return sync_detailed( client=client, -page=page, -page_size=page_size, -keyword=keyword, -task=task, - + page=page, + page_size=page_size, + keyword=keyword, + task=task, ).parsed + async def asyncio_detailed( *, client: AuthenticatedClient | Client, @@ -154,9 +139,8 @@ async def asyncio_detailed( page_size: int | Unset = UNSET, keyword: str | Unset = UNSET, task: str | Unset = UNSET, - -) -> Response[IIRApiGetIssuersResponse200]: - """ +) -> Response[IirApiGetIssuersResponse200]: + """ Args: page (int | Unset): page_size (int | Unset): @@ -168,24 +152,21 @@ async def asyncio_detailed( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[IIRApiGetIssuersResponse200] - """ - + Response[IirApiGetIssuersResponse200] + """ kwargs = _get_kwargs( page=page, -page_size=page_size, -keyword=keyword, -task=task, - + page_size=page_size, + keyword=keyword, + task=task, ) - response = await client.get_async_httpx_client().request( - **kwargs - ) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) + async def asyncio( *, client: AuthenticatedClient | Client, @@ -193,9 +174,8 @@ async def asyncio( page_size: int | Unset = UNSET, keyword: str | Unset = UNSET, task: str | Unset = UNSET, - -) -> IIRApiGetIssuersResponse200 | None: - """ +) -> IirApiGetIssuersResponse200 | None: + """ Args: page (int | Unset): page_size (int | Unset): @@ -207,15 +187,15 @@ async def asyncio( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - IIRApiGetIssuersResponse200 - """ - - - return (await asyncio_detailed( - client=client, -page=page, -page_size=page_size, -keyword=keyword, -task=task, - - )).parsed + IirApiGetIssuersResponse200 + """ + + return ( + await asyncio_detailed( + client=client, + page=page, + page_size=page_size, + keyword=keyword, + task=task, + ) + ).parsed diff --git a/ce/iir/api/iir_client/api/iir_api/iir_api_get_issuers_by_user.py b/ce/iir/api/iir_client/api/iir_api/iir_api_get_issuers_by_user.py index ddfd3be..33c5845 100644 --- a/ce/iir/api/iir_client/api/iir_api/iir_api_get_issuers_by_user.py +++ b/ce/iir/api/iir_client/api/iir_api/iir_api_get_issuers_by_user.py @@ -1,18 +1,14 @@ from http import HTTPStatus -from typing import Any, cast +from typing import Any from urllib.parse import quote +from uuid import UUID import httpx2 -from ...client import AuthenticatedClient, Client -from ...types import Response, UNSET from ... import errors - -from ...models.iir_api_get_issuers_by_user_response_200 import IIRApiGetIssuersByUserResponse200 -from ...types import UNSET, Unset -from typing import cast -from uuid import UUID - +from ...client import AuthenticatedClient, Client +from ...models.iir_api_get_issuers_by_user_response_200 import IirApiGetIssuersByUserResponse200 +from ...types import UNSET, Response, Unset def _get_kwargs( @@ -22,11 +18,7 @@ def _get_kwargs( page_size: int | Unset = UNSET, keyword: str | Unset = UNSET, task: str | Unset = UNSET, - ) -> dict[str, Any]: - - - params: dict[str, Any] = {} @@ -38,26 +30,24 @@ def _get_kwargs( params["task"] = task - params = {k: v for k, v in params.items() if v is not UNSET and v is not None} - _kwargs: dict[str, Any] = { "method": "get", - "url": "/iir-api/users/{user_id}/issuers".format(user_id=quote(str(user_id), safe=""),), + "url": "/iir-api/users/{user_id}/issuers".format( + user_id=quote(str(user_id), safe=""), + ), "params": params, } - return _kwargs - -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> IIRApiGetIssuersByUserResponse200 | None: +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx2.Response +) -> IirApiGetIssuersByUserResponse200 | None: if response.status_code == 200: - response_200 = IIRApiGetIssuersByUserResponse200.from_dict(response.json()) - - + response_200 = IirApiGetIssuersByUserResponse200.from_dict(response.json()) return response_200 @@ -67,7 +57,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Re return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[IIRApiGetIssuersByUserResponse200]: +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx2.Response +) -> Response[IirApiGetIssuersByUserResponse200]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -84,9 +76,8 @@ def sync_detailed( page_size: int | Unset = UNSET, keyword: str | Unset = UNSET, task: str | Unset = UNSET, - -) -> Response[IIRApiGetIssuersByUserResponse200]: - """ +) -> Response[IirApiGetIssuersByUserResponse200]: + """ Args: user_id (UUID): page (int | Unset): @@ -99,17 +90,15 @@ def sync_detailed( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[IIRApiGetIssuersByUserResponse200] - """ - + Response[IirApiGetIssuersByUserResponse200] + """ kwargs = _get_kwargs( user_id=user_id, -page=page, -page_size=page_size, -keyword=keyword, -task=task, - + page=page, + page_size=page_size, + keyword=keyword, + task=task, ) response = client.get_httpx_client().request( @@ -118,6 +107,7 @@ def sync_detailed( return _build_response(client=client, response=response) + def sync( user_id: UUID, *, @@ -126,9 +116,8 @@ def sync( page_size: int | Unset = UNSET, keyword: str | Unset = UNSET, task: str | Unset = UNSET, - -) -> IIRApiGetIssuersByUserResponse200 | None: - """ +) -> IirApiGetIssuersByUserResponse200 | None: + """ Args: user_id (UUID): page (int | Unset): @@ -141,20 +130,19 @@ def sync( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - IIRApiGetIssuersByUserResponse200 - """ - + IirApiGetIssuersByUserResponse200 + """ return sync_detailed( user_id=user_id, -client=client, -page=page, -page_size=page_size, -keyword=keyword, -task=task, - + client=client, + page=page, + page_size=page_size, + keyword=keyword, + task=task, ).parsed + async def asyncio_detailed( user_id: UUID, *, @@ -163,9 +151,8 @@ async def asyncio_detailed( page_size: int | Unset = UNSET, keyword: str | Unset = UNSET, task: str | Unset = UNSET, - -) -> Response[IIRApiGetIssuersByUserResponse200]: - """ +) -> Response[IirApiGetIssuersByUserResponse200]: + """ Args: user_id (UUID): page (int | Unset): @@ -178,25 +165,22 @@ async def asyncio_detailed( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[IIRApiGetIssuersByUserResponse200] - """ - + Response[IirApiGetIssuersByUserResponse200] + """ kwargs = _get_kwargs( user_id=user_id, -page=page, -page_size=page_size, -keyword=keyword, -task=task, - + page=page, + page_size=page_size, + keyword=keyword, + task=task, ) - response = await client.get_async_httpx_client().request( - **kwargs - ) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) + async def asyncio( user_id: UUID, *, @@ -205,9 +189,8 @@ async def asyncio( page_size: int | Unset = UNSET, keyword: str | Unset = UNSET, task: str | Unset = UNSET, - -) -> IIRApiGetIssuersByUserResponse200 | None: - """ +) -> IirApiGetIssuersByUserResponse200 | None: + """ Args: user_id (UUID): page (int | Unset): @@ -220,16 +203,16 @@ async def asyncio( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - IIRApiGetIssuersByUserResponse200 - """ - - - return (await asyncio_detailed( - user_id=user_id, -client=client, -page=page, -page_size=page_size, -keyword=keyword, -task=task, - - )).parsed + IirApiGetIssuersByUserResponse200 + """ + + return ( + await asyncio_detailed( + user_id=user_id, + client=client, + page=page, + page_size=page_size, + keyword=keyword, + task=task, + ) + ).parsed diff --git a/ce/iir/api/iir_client/api/iir_api/iir_api_get_organization_iir_detail.py b/ce/iir/api/iir_client/api/iir_api/iir_api_get_organization_iir_detail.py index b1b7040..e826a57 100644 --- a/ce/iir/api/iir_client/api/iir_api/iir_api_get_organization_iir_detail.py +++ b/ce/iir/api/iir_client/api/iir_api/iir_api_get_organization_iir_detail.py @@ -1,51 +1,39 @@ from http import HTTPStatus -from typing import Any, cast -from urllib.parse import quote +from typing import Any import httpx2 -from ...client import AuthenticatedClient, Client -from ...types import Response, UNSET from ... import errors - -from ...models.iir_api_get_organization_iir_detail_response_200 import IIRApiGetOrganizationIIRDetailResponse200 -from typing import cast - +from ...client import AuthenticatedClient, Client +from ...models.iir_api_get_organization_iir_detail_response_200 import IirApiGetOrganizationIirDetailResponse200 +from ...types import UNSET, Response def _get_kwargs( *, ctid: str, - ) -> dict[str, Any]: - - - params: dict[str, Any] = {} params["ctid"] = ctid - params = {k: v for k, v in params.items() if v is not UNSET and v is not None} - _kwargs: dict[str, Any] = { "method": "get", "url": "/iir-api/getOrganizationIIRDetail", "params": params, } - return _kwargs - -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> IIRApiGetOrganizationIIRDetailResponse200 | None: +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx2.Response +) -> IirApiGetOrganizationIirDetailResponse200 | None: if response.status_code == 200: - response_200 = IIRApiGetOrganizationIIRDetailResponse200.from_dict(response.json()) - - + response_200 = IirApiGetOrganizationIirDetailResponse200.from_dict(response.json()) return response_200 @@ -55,7 +43,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Re return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[IIRApiGetOrganizationIIRDetailResponse200]: +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx2.Response +) -> Response[IirApiGetOrganizationIirDetailResponse200]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -68,9 +58,8 @@ def sync_detailed( *, client: AuthenticatedClient | Client, ctid: str, - -) -> Response[IIRApiGetOrganizationIIRDetailResponse200]: - """ +) -> Response[IirApiGetOrganizationIirDetailResponse200]: + """ Args: ctid (str): @@ -79,13 +68,11 @@ def sync_detailed( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[IIRApiGetOrganizationIIRDetailResponse200] - """ - + Response[IirApiGetOrganizationIirDetailResponse200] + """ kwargs = _get_kwargs( ctid=ctid, - ) response = client.get_httpx_client().request( @@ -94,13 +81,13 @@ def sync_detailed( return _build_response(client=client, response=response) + def sync( *, client: AuthenticatedClient | Client, ctid: str, - -) -> IIRApiGetOrganizationIIRDetailResponse200 | None: - """ +) -> IirApiGetOrganizationIirDetailResponse200 | None: + """ Args: ctid (str): @@ -109,23 +96,21 @@ def sync( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - IIRApiGetOrganizationIIRDetailResponse200 - """ - + IirApiGetOrganizationIirDetailResponse200 + """ return sync_detailed( client=client, -ctid=ctid, - + ctid=ctid, ).parsed + async def asyncio_detailed( *, client: AuthenticatedClient | Client, ctid: str, - -) -> Response[IIRApiGetOrganizationIIRDetailResponse200]: - """ +) -> Response[IirApiGetOrganizationIirDetailResponse200]: + """ Args: ctid (str): @@ -134,28 +119,24 @@ async def asyncio_detailed( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[IIRApiGetOrganizationIIRDetailResponse200] - """ - + Response[IirApiGetOrganizationIirDetailResponse200] + """ kwargs = _get_kwargs( ctid=ctid, - ) - response = await client.get_async_httpx_client().request( - **kwargs - ) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) + async def asyncio( *, client: AuthenticatedClient | Client, ctid: str, - -) -> IIRApiGetOrganizationIIRDetailResponse200 | None: - """ +) -> IirApiGetOrganizationIirDetailResponse200 | None: + """ Args: ctid (str): @@ -164,12 +145,12 @@ async def asyncio( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - IIRApiGetOrganizationIIRDetailResponse200 - """ - - - return (await asyncio_detailed( - client=client, -ctid=ctid, - - )).parsed + IirApiGetOrganizationIirDetailResponse200 + """ + + return ( + await asyncio_detailed( + client=client, + ctid=ctid, + ) + ).parsed diff --git a/ce/iir/api/iir_client/api/iir_api/iir_api_get_registry_resource.py b/ce/iir/api/iir_client/api/iir_api/iir_api_get_registry_resource.py index 97b88a0..a2d6985 100644 --- a/ce/iir/api/iir_client/api/iir_api/iir_api_get_registry_resource.py +++ b/ce/iir/api/iir_client/api/iir_api/iir_api_get_registry_resource.py @@ -1,51 +1,39 @@ from http import HTTPStatus -from typing import Any, cast -from urllib.parse import quote +from typing import Any import httpx2 -from ...client import AuthenticatedClient, Client -from ...types import Response, UNSET from ... import errors - -from ...models.iir_api_get_registry_resource_response_200 import IIRApiGetRegistryResourceResponse200 -from typing import cast - +from ...client import AuthenticatedClient, Client +from ...models.iir_api_get_registry_resource_response_200 import IirApiGetRegistryResourceResponse200 +from ...types import UNSET, Response def _get_kwargs( *, ctid: str, - ) -> dict[str, Any]: - - - params: dict[str, Any] = {} params["ctid"] = ctid - params = {k: v for k, v in params.items() if v is not UNSET and v is not None} - _kwargs: dict[str, Any] = { "method": "get", "url": "/iir-api/getRegistryResource", "params": params, } - return _kwargs - -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> IIRApiGetRegistryResourceResponse200 | None: +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx2.Response +) -> IirApiGetRegistryResourceResponse200 | None: if response.status_code == 200: - response_200 = IIRApiGetRegistryResourceResponse200.from_dict(response.json()) - - + response_200 = IirApiGetRegistryResourceResponse200.from_dict(response.json()) return response_200 @@ -55,7 +43,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Re return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[IIRApiGetRegistryResourceResponse200]: +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx2.Response +) -> Response[IirApiGetRegistryResourceResponse200]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -68,9 +58,8 @@ def sync_detailed( *, client: AuthenticatedClient | Client, ctid: str, - -) -> Response[IIRApiGetRegistryResourceResponse200]: - """ +) -> Response[IirApiGetRegistryResourceResponse200]: + """ Args: ctid (str): @@ -79,13 +68,11 @@ def sync_detailed( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[IIRApiGetRegistryResourceResponse200] - """ - + Response[IirApiGetRegistryResourceResponse200] + """ kwargs = _get_kwargs( ctid=ctid, - ) response = client.get_httpx_client().request( @@ -94,13 +81,13 @@ def sync_detailed( return _build_response(client=client, response=response) + def sync( *, client: AuthenticatedClient | Client, ctid: str, - -) -> IIRApiGetRegistryResourceResponse200 | None: - """ +) -> IirApiGetRegistryResourceResponse200 | None: + """ Args: ctid (str): @@ -109,23 +96,21 @@ def sync( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - IIRApiGetRegistryResourceResponse200 - """ - + IirApiGetRegistryResourceResponse200 + """ return sync_detailed( client=client, -ctid=ctid, - + ctid=ctid, ).parsed + async def asyncio_detailed( *, client: AuthenticatedClient | Client, ctid: str, - -) -> Response[IIRApiGetRegistryResourceResponse200]: - """ +) -> Response[IirApiGetRegistryResourceResponse200]: + """ Args: ctid (str): @@ -134,28 +119,24 @@ async def asyncio_detailed( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[IIRApiGetRegistryResourceResponse200] - """ - + Response[IirApiGetRegistryResourceResponse200] + """ kwargs = _get_kwargs( ctid=ctid, - ) - response = await client.get_async_httpx_client().request( - **kwargs - ) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) + async def asyncio( *, client: AuthenticatedClient | Client, ctid: str, - -) -> IIRApiGetRegistryResourceResponse200 | None: - """ +) -> IirApiGetRegistryResourceResponse200 | None: + """ Args: ctid (str): @@ -164,12 +145,12 @@ async def asyncio( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - IIRApiGetRegistryResourceResponse200 - """ - - - return (await asyncio_detailed( - client=client, -ctid=ctid, - - )).parsed + IirApiGetRegistryResourceResponse200 + """ + + return ( + await asyncio_detailed( + client=client, + ctid=ctid, + ) + ).parsed diff --git a/ce/iir/api/iir_client/api/iir_api/iir_api_is_user_a_member.py b/ce/iir/api/iir_client/api/iir_api/iir_api_is_user_a_member.py index b401650..1d91185 100644 --- a/ce/iir/api/iir_client/api/iir_api/iir_api_is_user_a_member.py +++ b/ce/iir/api/iir_client/api/iir_api/iir_api_is_user_a_member.py @@ -1,17 +1,14 @@ from http import HTTPStatus -from typing import Any, cast +from typing import Any from urllib.parse import quote +from uuid import UUID import httpx2 -from ...client import AuthenticatedClient, Client -from ...types import Response, UNSET from ... import errors - -from ...models.iir_api_is_user_a_member_response_200 import IIRApiIsUserAMemberResponse200 -from typing import cast -from uuid import UUID - +from ...client import AuthenticatedClient, Client +from ...models.iir_api_is_user_a_member_response_200 import IirApiIsUserAMemberResponse200 +from ...types import UNSET, Response def _get_kwargs( @@ -19,11 +16,7 @@ def _get_kwargs( *, task: str, ctid: str, - ) -> dict[str, Any]: - - - params: dict[str, Any] = {} @@ -31,26 +24,24 @@ def _get_kwargs( params["ctid"] = ctid - params = {k: v for k, v in params.items() if v is not UNSET and v is not None} - _kwargs: dict[str, Any] = { "method": "get", - "url": "/iir-api/isUserAMember/{user_id}".format(user_id=quote(str(user_id), safe=""),), + "url": "/iir-api/isUserAMember/{user_id}".format( + user_id=quote(str(user_id), safe=""), + ), "params": params, } - return _kwargs - -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> IIRApiIsUserAMemberResponse200 | None: +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx2.Response +) -> IirApiIsUserAMemberResponse200 | None: if response.status_code == 200: - response_200 = IIRApiIsUserAMemberResponse200.from_dict(response.json()) - - + response_200 = IirApiIsUserAMemberResponse200.from_dict(response.json()) return response_200 @@ -60,7 +51,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Re return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[IIRApiIsUserAMemberResponse200]: +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx2.Response +) -> Response[IirApiIsUserAMemberResponse200]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -75,9 +68,8 @@ def sync_detailed( client: AuthenticatedClient | Client, task: str, ctid: str, - -) -> Response[IIRApiIsUserAMemberResponse200]: - """ +) -> Response[IirApiIsUserAMemberResponse200]: + """ Args: user_id (UUID): task (str): @@ -88,15 +80,13 @@ def sync_detailed( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[IIRApiIsUserAMemberResponse200] - """ - + Response[IirApiIsUserAMemberResponse200] + """ kwargs = _get_kwargs( user_id=user_id, -task=task, -ctid=ctid, - + task=task, + ctid=ctid, ) response = client.get_httpx_client().request( @@ -105,15 +95,15 @@ def sync_detailed( return _build_response(client=client, response=response) + def sync( user_id: UUID, *, client: AuthenticatedClient | Client, task: str, ctid: str, - -) -> IIRApiIsUserAMemberResponse200 | None: - """ +) -> IirApiIsUserAMemberResponse200 | None: + """ Args: user_id (UUID): task (str): @@ -124,27 +114,25 @@ def sync( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - IIRApiIsUserAMemberResponse200 - """ - + IirApiIsUserAMemberResponse200 + """ return sync_detailed( user_id=user_id, -client=client, -task=task, -ctid=ctid, - + client=client, + task=task, + ctid=ctid, ).parsed + async def asyncio_detailed( user_id: UUID, *, client: AuthenticatedClient | Client, task: str, ctid: str, - -) -> Response[IIRApiIsUserAMemberResponse200]: - """ +) -> Response[IirApiIsUserAMemberResponse200]: + """ Args: user_id (UUID): task (str): @@ -155,32 +143,28 @@ async def asyncio_detailed( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[IIRApiIsUserAMemberResponse200] - """ - + Response[IirApiIsUserAMemberResponse200] + """ kwargs = _get_kwargs( user_id=user_id, -task=task, -ctid=ctid, - + task=task, + ctid=ctid, ) - response = await client.get_async_httpx_client().request( - **kwargs - ) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) + async def asyncio( user_id: UUID, *, client: AuthenticatedClient | Client, task: str, ctid: str, - -) -> IIRApiIsUserAMemberResponse200 | None: - """ +) -> IirApiIsUserAMemberResponse200 | None: + """ Args: user_id (UUID): task (str): @@ -191,14 +175,14 @@ async def asyncio( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - IIRApiIsUserAMemberResponse200 - """ - - - return (await asyncio_detailed( - user_id=user_id, -client=client, -task=task, -ctid=ctid, - - )).parsed + IirApiIsUserAMemberResponse200 + """ + + return ( + await asyncio_detailed( + user_id=user_id, + client=client, + task=task, + ctid=ctid, + ) + ).parsed diff --git a/ce/iir/api/iir_client/api/iir_api/iir_api_is_user_a_member_of_org.py b/ce/iir/api/iir_client/api/iir_api/iir_api_is_user_a_member_of_org.py index 8992004..96a00c0 100644 --- a/ce/iir/api/iir_client/api/iir_api/iir_api_is_user_a_member_of_org.py +++ b/ce/iir/api/iir_client/api/iir_api/iir_api_is_user_a_member_of_org.py @@ -1,27 +1,19 @@ from http import HTTPStatus -from typing import Any, cast -from urllib.parse import quote +from typing import Any import httpx2 -from ...client import AuthenticatedClient, Client -from ...types import Response, UNSET from ... import errors - -from ...models.iir_api_is_user_a_member_of_org_response_200 import IIRApiIsUserAMemberOfOrgResponse200 -from typing import cast - +from ...client import AuthenticatedClient, Client +from ...models.iir_api_is_user_a_member_of_org_response_200 import IirApiIsUserAMemberOfOrgResponse200 +from ...types import UNSET, Response def _get_kwargs( *, ctid: str, task: str, - ) -> dict[str, Any]: - - - params: dict[str, Any] = {} @@ -29,26 +21,22 @@ def _get_kwargs( params["task"] = task - params = {k: v for k, v in params.items() if v is not UNSET and v is not None} - _kwargs: dict[str, Any] = { "method": "get", "url": "/iir-api/IsUserAMemberOfOrg", "params": params, } - return _kwargs - -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> IIRApiIsUserAMemberOfOrgResponse200 | None: +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx2.Response +) -> IirApiIsUserAMemberOfOrgResponse200 | None: if response.status_code == 200: - response_200 = IIRApiIsUserAMemberOfOrgResponse200.from_dict(response.json()) - - + response_200 = IirApiIsUserAMemberOfOrgResponse200.from_dict(response.json()) return response_200 @@ -58,7 +46,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Re return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[IIRApiIsUserAMemberOfOrgResponse200]: +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx2.Response +) -> Response[IirApiIsUserAMemberOfOrgResponse200]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -72,9 +62,8 @@ def sync_detailed( client: AuthenticatedClient | Client, ctid: str, task: str, - -) -> Response[IIRApiIsUserAMemberOfOrgResponse200]: - """ +) -> Response[IirApiIsUserAMemberOfOrgResponse200]: + """ Args: ctid (str): task (str): @@ -84,14 +73,12 @@ def sync_detailed( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[IIRApiIsUserAMemberOfOrgResponse200] - """ - + Response[IirApiIsUserAMemberOfOrgResponse200] + """ kwargs = _get_kwargs( ctid=ctid, -task=task, - + task=task, ) response = client.get_httpx_client().request( @@ -100,14 +87,14 @@ def sync_detailed( return _build_response(client=client, response=response) + def sync( *, client: AuthenticatedClient | Client, ctid: str, task: str, - -) -> IIRApiIsUserAMemberOfOrgResponse200 | None: - """ +) -> IirApiIsUserAMemberOfOrgResponse200 | None: + """ Args: ctid (str): task (str): @@ -117,25 +104,23 @@ def sync( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - IIRApiIsUserAMemberOfOrgResponse200 - """ - + IirApiIsUserAMemberOfOrgResponse200 + """ return sync_detailed( client=client, -ctid=ctid, -task=task, - + ctid=ctid, + task=task, ).parsed + async def asyncio_detailed( *, client: AuthenticatedClient | Client, ctid: str, task: str, - -) -> Response[IIRApiIsUserAMemberOfOrgResponse200]: - """ +) -> Response[IirApiIsUserAMemberOfOrgResponse200]: + """ Args: ctid (str): task (str): @@ -145,30 +130,26 @@ async def asyncio_detailed( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[IIRApiIsUserAMemberOfOrgResponse200] - """ - + Response[IirApiIsUserAMemberOfOrgResponse200] + """ kwargs = _get_kwargs( ctid=ctid, -task=task, - + task=task, ) - response = await client.get_async_httpx_client().request( - **kwargs - ) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) + async def asyncio( *, client: AuthenticatedClient | Client, ctid: str, task: str, - -) -> IIRApiIsUserAMemberOfOrgResponse200 | None: - """ +) -> IirApiIsUserAMemberOfOrgResponse200 | None: + """ Args: ctid (str): task (str): @@ -178,13 +159,13 @@ async def asyncio( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - IIRApiIsUserAMemberOfOrgResponse200 - """ - - - return (await asyncio_detailed( - client=client, -ctid=ctid, -task=task, - - )).parsed + IirApiIsUserAMemberOfOrgResponse200 + """ + + return ( + await asyncio_detailed( + client=client, + ctid=ctid, + task=task, + ) + ).parsed diff --git a/ce/iir/api/iir_client/api/iir_api/iir_api_save_challenge_token.py b/ce/iir/api/iir_client/api/iir_api/iir_api_save_challenge_token.py index a676741..dfc8c71 100644 --- a/ce/iir/api/iir_client/api/iir_api/iir_api_save_challenge_token.py +++ b/ce/iir/api/iir_client/api/iir_api/iir_api_save_challenge_token.py @@ -1,31 +1,21 @@ from http import HTTPStatus -from typing import Any, cast -from urllib.parse import quote +from typing import Any import httpx2 -from ...client import AuthenticatedClient, Client -from ...types import Response, UNSET, Unset from ... import errors - -from ...models.iir_api_save_challenge_token_response_200 import IIRApiSaveChallengeTokenResponse200 +from ...client import AuthenticatedClient, Client +from ...models.iir_api_save_challenge_token_response_200 import IirApiSaveChallengeTokenResponse200 from ...models.save_challenge_token_request import SaveChallengeTokenRequest -from typing import cast - +from ...types import UNSET, Response def _get_kwargs( *, - body: SaveChallengeTokenRequest | SaveChallengeTokenRequest | Unset = UNSET, - + body: SaveChallengeTokenRequest | SaveChallengeTokenRequest | Unset = UNSET, ) -> dict[str, Any]: headers: dict[str, Any] = {} - - - - - _kwargs: dict[str, Any] = { "method": "post", "url": "/iir-api/saveChallengeToken", @@ -34,23 +24,20 @@ def _get_kwargs( if isinstance(body, SaveChallengeTokenRequest): _kwargs["json"] = body.to_dict() - headers["Content-Type"] = "application/json" if isinstance(body, SaveChallengeTokenRequest): _kwargs["data"] = body.to_dict() - headers["Content-Type"] = "application/x-www-form-urlencoded" _kwargs["headers"] = headers return _kwargs - -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> IIRApiSaveChallengeTokenResponse200 | None: +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx2.Response +) -> IirApiSaveChallengeTokenResponse200 | None: if response.status_code == 200: - response_200 = IIRApiSaveChallengeTokenResponse200.from_dict(response.json()) - - + response_200 = IirApiSaveChallengeTokenResponse200.from_dict(response.json()) return response_200 @@ -60,7 +47,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Re return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[IIRApiSaveChallengeTokenResponse200]: +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx2.Response +) -> Response[IirApiSaveChallengeTokenResponse200]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -72,10 +61,9 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Re def sync_detailed( *, client: AuthenticatedClient | Client, - body: SaveChallengeTokenRequest | SaveChallengeTokenRequest | Unset = UNSET, - -) -> Response[IIRApiSaveChallengeTokenResponse200]: - """ + body: SaveChallengeTokenRequest | SaveChallengeTokenRequest | Unset = UNSET, +) -> Response[IirApiSaveChallengeTokenResponse200]: + """ Args: body (SaveChallengeTokenRequest): body (SaveChallengeTokenRequest): @@ -85,13 +73,11 @@ def sync_detailed( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[IIRApiSaveChallengeTokenResponse200] - """ - + Response[IirApiSaveChallengeTokenResponse200] + """ kwargs = _get_kwargs( body=body, - ) response = client.get_httpx_client().request( @@ -100,13 +86,13 @@ def sync_detailed( return _build_response(client=client, response=response) + def sync( *, client: AuthenticatedClient | Client, - body: SaveChallengeTokenRequest | SaveChallengeTokenRequest | Unset = UNSET, - -) -> IIRApiSaveChallengeTokenResponse200 | None: - """ + body: SaveChallengeTokenRequest | SaveChallengeTokenRequest | Unset = UNSET, +) -> IirApiSaveChallengeTokenResponse200 | None: + """ Args: body (SaveChallengeTokenRequest): body (SaveChallengeTokenRequest): @@ -116,23 +102,21 @@ def sync( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - IIRApiSaveChallengeTokenResponse200 - """ - + IirApiSaveChallengeTokenResponse200 + """ return sync_detailed( client=client, -body=body, - + body=body, ).parsed + async def asyncio_detailed( *, client: AuthenticatedClient | Client, - body: SaveChallengeTokenRequest | SaveChallengeTokenRequest | Unset = UNSET, - -) -> Response[IIRApiSaveChallengeTokenResponse200]: - """ + body: SaveChallengeTokenRequest | SaveChallengeTokenRequest | Unset = UNSET, +) -> Response[IirApiSaveChallengeTokenResponse200]: + """ Args: body (SaveChallengeTokenRequest): body (SaveChallengeTokenRequest): @@ -142,28 +126,24 @@ async def asyncio_detailed( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[IIRApiSaveChallengeTokenResponse200] - """ - + Response[IirApiSaveChallengeTokenResponse200] + """ kwargs = _get_kwargs( body=body, - ) - response = await client.get_async_httpx_client().request( - **kwargs - ) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) + async def asyncio( *, client: AuthenticatedClient | Client, - body: SaveChallengeTokenRequest | SaveChallengeTokenRequest | Unset = UNSET, - -) -> IIRApiSaveChallengeTokenResponse200 | None: - """ + body: SaveChallengeTokenRequest | SaveChallengeTokenRequest | Unset = UNSET, +) -> IirApiSaveChallengeTokenResponse200 | None: + """ Args: body (SaveChallengeTokenRequest): body (SaveChallengeTokenRequest): @@ -173,12 +153,12 @@ async def asyncio( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - IIRApiSaveChallengeTokenResponse200 - """ - - - return (await asyncio_detailed( - client=client, -body=body, - - )).parsed + IirApiSaveChallengeTokenResponse200 + """ + + return ( + await asyncio_detailed( + client=client, + body=body, + ) + ).parsed diff --git a/ce/iir/api/iir_client/api/iir_api/iir_api_submit_to_iir.py b/ce/iir/api/iir_client/api/iir_api/iir_api_submit_to_iir.py index 3e23911..c8f92de 100644 --- a/ce/iir/api/iir_client/api/iir_api/iir_api_submit_to_iir.py +++ b/ce/iir/api/iir_client/api/iir_api/iir_api_submit_to_iir.py @@ -1,31 +1,21 @@ from http import HTTPStatus -from typing import Any, cast -from urllib.parse import quote +from typing import Any import httpx2 -from ...client import AuthenticatedClient, Client -from ...types import Response, UNSET, Unset from ... import errors - -from ...models.iir_api_submit_to_iir_response_200 import IIRApiSubmitToIIRResponse200 +from ...client import AuthenticatedClient, Client +from ...models.iir_api_submit_to_iir_response_200 import IirApiSubmitToIirResponse200 from ...models.pub_issuer_dto import PubIssuerDTO -from typing import cast - +from ...types import UNSET, Response def _get_kwargs( *, - body: PubIssuerDTO | PubIssuerDTO | Unset = UNSET, - + body: PubIssuerDTO | PubIssuerDTO | Unset = UNSET, ) -> dict[str, Any]: headers: dict[str, Any] = {} - - - - - _kwargs: dict[str, Any] = { "method": "post", "url": "/iir-api/submitToIIR", @@ -34,23 +24,20 @@ def _get_kwargs( if isinstance(body, PubIssuerDTO): _kwargs["json"] = body.to_dict() - headers["Content-Type"] = "application/json" if isinstance(body, PubIssuerDTO): _kwargs["data"] = body.to_dict() - headers["Content-Type"] = "application/x-www-form-urlencoded" _kwargs["headers"] = headers return _kwargs - -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> IIRApiSubmitToIIRResponse200 | None: +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx2.Response +) -> IirApiSubmitToIirResponse200 | None: if response.status_code == 200: - response_200 = IIRApiSubmitToIIRResponse200.from_dict(response.json()) - - + response_200 = IirApiSubmitToIirResponse200.from_dict(response.json()) return response_200 @@ -60,7 +47,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Re return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[IIRApiSubmitToIIRResponse200]: +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx2.Response +) -> Response[IirApiSubmitToIirResponse200]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -72,10 +61,9 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Re def sync_detailed( *, client: AuthenticatedClient | Client, - body: PubIssuerDTO | PubIssuerDTO | Unset = UNSET, - -) -> Response[IIRApiSubmitToIIRResponse200]: - """ + body: PubIssuerDTO | PubIssuerDTO | Unset = UNSET, +) -> Response[IirApiSubmitToIirResponse200]: + """ Args: body (PubIssuerDTO): body (PubIssuerDTO): @@ -85,13 +73,11 @@ def sync_detailed( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[IIRApiSubmitToIIRResponse200] - """ - + Response[IirApiSubmitToIirResponse200] + """ kwargs = _get_kwargs( body=body, - ) response = client.get_httpx_client().request( @@ -100,13 +86,13 @@ def sync_detailed( return _build_response(client=client, response=response) + def sync( *, client: AuthenticatedClient | Client, - body: PubIssuerDTO | PubIssuerDTO | Unset = UNSET, - -) -> IIRApiSubmitToIIRResponse200 | None: - """ + body: PubIssuerDTO | PubIssuerDTO | Unset = UNSET, +) -> IirApiSubmitToIirResponse200 | None: + """ Args: body (PubIssuerDTO): body (PubIssuerDTO): @@ -116,23 +102,21 @@ def sync( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - IIRApiSubmitToIIRResponse200 - """ - + IirApiSubmitToIirResponse200 + """ return sync_detailed( client=client, -body=body, - + body=body, ).parsed + async def asyncio_detailed( *, client: AuthenticatedClient | Client, - body: PubIssuerDTO | PubIssuerDTO | Unset = UNSET, - -) -> Response[IIRApiSubmitToIIRResponse200]: - """ + body: PubIssuerDTO | PubIssuerDTO | Unset = UNSET, +) -> Response[IirApiSubmitToIirResponse200]: + """ Args: body (PubIssuerDTO): body (PubIssuerDTO): @@ -142,28 +126,24 @@ async def asyncio_detailed( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[IIRApiSubmitToIIRResponse200] - """ - + Response[IirApiSubmitToIirResponse200] + """ kwargs = _get_kwargs( body=body, - ) - response = await client.get_async_httpx_client().request( - **kwargs - ) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) + async def asyncio( *, client: AuthenticatedClient | Client, - body: PubIssuerDTO | PubIssuerDTO | Unset = UNSET, - -) -> IIRApiSubmitToIIRResponse200 | None: - """ + body: PubIssuerDTO | PubIssuerDTO | Unset = UNSET, +) -> IirApiSubmitToIirResponse200 | None: + """ Args: body (PubIssuerDTO): body (PubIssuerDTO): @@ -173,12 +153,12 @@ async def asyncio( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - IIRApiSubmitToIIRResponse200 - """ - - - return (await asyncio_detailed( - client=client, -body=body, - - )).parsed + IirApiSubmitToIirResponse200 + """ + + return ( + await asyncio_detailed( + client=client, + body=body, + ) + ).parsed diff --git a/ce/iir/api/iir_client/api/iir_api/iir_api_update_issuer.py b/ce/iir/api/iir_client/api/iir_api/iir_api_update_issuer.py index 80be825..ef583a4 100644 --- a/ce/iir/api/iir_client/api/iir_api/iir_api_update_issuer.py +++ b/ce/iir/api/iir_client/api/iir_api/iir_api_update_issuer.py @@ -1,31 +1,21 @@ from http import HTTPStatus -from typing import Any, cast -from urllib.parse import quote +from typing import Any import httpx2 -from ...client import AuthenticatedClient, Client -from ...types import Response, UNSET from ... import errors - -from ...models.iir_api_update_issuer_response_200 import IIRApiUpdateIssuerResponse200 +from ...client import AuthenticatedClient, Client +from ...models.iir_api_update_issuer_response_200 import IirApiUpdateIssuerResponse200 from ...models.pub_issuer_dto import PubIssuerDTO -from typing import cast - +from ...types import UNSET, Response def _get_kwargs( *, - body: PubIssuerDTO | PubIssuerDTO | Unset = UNSET, - + body: PubIssuerDTO | PubIssuerDTO | Unset = UNSET, ) -> dict[str, Any]: headers: dict[str, Any] = {} - - - - - _kwargs: dict[str, Any] = { "method": "put", "url": "/iir-api/updateIssuer", @@ -34,23 +24,20 @@ def _get_kwargs( if isinstance(body, PubIssuerDTO): _kwargs["json"] = body.to_dict() - headers["Content-Type"] = "application/json" if isinstance(body, PubIssuerDTO): _kwargs["data"] = body.to_dict() - headers["Content-Type"] = "application/x-www-form-urlencoded" _kwargs["headers"] = headers return _kwargs - -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> IIRApiUpdateIssuerResponse200 | None: +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx2.Response +) -> IirApiUpdateIssuerResponse200 | None: if response.status_code == 200: - response_200 = IIRApiUpdateIssuerResponse200.from_dict(response.json()) - - + response_200 = IirApiUpdateIssuerResponse200.from_dict(response.json()) return response_200 @@ -60,7 +47,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Re return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[IIRApiUpdateIssuerResponse200]: +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx2.Response +) -> Response[IirApiUpdateIssuerResponse200]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -72,10 +61,9 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Re def sync_detailed( *, client: AuthenticatedClient | Client, - body: PubIssuerDTO | PubIssuerDTO | Unset = UNSET, - -) -> Response[IIRApiUpdateIssuerResponse200]: - """ + body: PubIssuerDTO | PubIssuerDTO | Unset = UNSET, +) -> Response[IirApiUpdateIssuerResponse200]: + """ Args: body (PubIssuerDTO): body (PubIssuerDTO): @@ -85,13 +73,11 @@ def sync_detailed( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[IIRApiUpdateIssuerResponse200] - """ - + Response[IirApiUpdateIssuerResponse200] + """ kwargs = _get_kwargs( body=body, - ) response = client.get_httpx_client().request( @@ -100,13 +86,13 @@ def sync_detailed( return _build_response(client=client, response=response) + def sync( *, client: AuthenticatedClient | Client, - body: PubIssuerDTO | PubIssuerDTO | Unset = UNSET, - -) -> IIRApiUpdateIssuerResponse200 | None: - """ + body: PubIssuerDTO | PubIssuerDTO | Unset = UNSET, +) -> IirApiUpdateIssuerResponse200 | None: + """ Args: body (PubIssuerDTO): body (PubIssuerDTO): @@ -116,23 +102,21 @@ def sync( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - IIRApiUpdateIssuerResponse200 - """ - + IirApiUpdateIssuerResponse200 + """ return sync_detailed( client=client, -body=body, - + body=body, ).parsed + async def asyncio_detailed( *, client: AuthenticatedClient | Client, - body: PubIssuerDTO | PubIssuerDTO | Unset = UNSET, - -) -> Response[IIRApiUpdateIssuerResponse200]: - """ + body: PubIssuerDTO | PubIssuerDTO | Unset = UNSET, +) -> Response[IirApiUpdateIssuerResponse200]: + """ Args: body (PubIssuerDTO): body (PubIssuerDTO): @@ -142,28 +126,24 @@ async def asyncio_detailed( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[IIRApiUpdateIssuerResponse200] - """ - + Response[IirApiUpdateIssuerResponse200] + """ kwargs = _get_kwargs( body=body, - ) - response = await client.get_async_httpx_client().request( - **kwargs - ) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) + async def asyncio( *, client: AuthenticatedClient | Client, - body: PubIssuerDTO | PubIssuerDTO | Unset = UNSET, - -) -> IIRApiUpdateIssuerResponse200 | None: - """ + body: PubIssuerDTO | PubIssuerDTO | Unset = UNSET, +) -> IirApiUpdateIssuerResponse200 | None: + """ Args: body (PubIssuerDTO): body (PubIssuerDTO): @@ -173,12 +153,12 @@ async def asyncio( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - IIRApiUpdateIssuerResponse200 - """ - - - return (await asyncio_detailed( - client=client, -body=body, - - )).parsed + IirApiUpdateIssuerResponse200 + """ + + return ( + await asyncio_detailed( + client=client, + body=body, + ) + ).parsed diff --git a/ce/iir/api/iir_client/api/iir_api/iir_api_validate_jwt_signature.py b/ce/iir/api/iir_client/api/iir_api/iir_api_validate_jwt_signature.py index 04e48db..888fb4f 100644 --- a/ce/iir/api/iir_client/api/iir_api/iir_api_validate_jwt_signature.py +++ b/ce/iir/api/iir_client/api/iir_api/iir_api_validate_jwt_signature.py @@ -1,31 +1,21 @@ from http import HTTPStatus -from typing import Any, cast -from urllib.parse import quote +from typing import Any import httpx2 -from ...client import AuthenticatedClient, Client -from ...types import Response, UNSET, Unset from ... import errors - -from ...models.iir_api_validate_jwt_signature_response_200 import IIRApiValidateJwtSignatureResponse200 +from ...client import AuthenticatedClient, Client +from ...models.iir_api_validate_jwt_signature_response_200 import IirApiValidateJwtSignatureResponse200 from ...models.validate_jwt_request import ValidateJwtRequest -from typing import cast - +from ...types import UNSET, Response def _get_kwargs( *, - body: ValidateJwtRequest | ValidateJwtRequest | Unset = UNSET, - + body: ValidateJwtRequest | ValidateJwtRequest | Unset = UNSET, ) -> dict[str, Any]: headers: dict[str, Any] = {} - - - - - _kwargs: dict[str, Any] = { "method": "post", "url": "/iir-api/validateJwt", @@ -34,23 +24,20 @@ def _get_kwargs( if isinstance(body, ValidateJwtRequest): _kwargs["json"] = body.to_dict() - headers["Content-Type"] = "application/json" if isinstance(body, ValidateJwtRequest): _kwargs["data"] = body.to_dict() - headers["Content-Type"] = "application/x-www-form-urlencoded" _kwargs["headers"] = headers return _kwargs - -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> IIRApiValidateJwtSignatureResponse200 | None: +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx2.Response +) -> IirApiValidateJwtSignatureResponse200 | None: if response.status_code == 200: - response_200 = IIRApiValidateJwtSignatureResponse200.from_dict(response.json()) - - + response_200 = IirApiValidateJwtSignatureResponse200.from_dict(response.json()) return response_200 @@ -60,7 +47,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Re return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[IIRApiValidateJwtSignatureResponse200]: +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx2.Response +) -> Response[IirApiValidateJwtSignatureResponse200]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -72,10 +61,9 @@ def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Re def sync_detailed( *, client: AuthenticatedClient | Client, - body: ValidateJwtRequest | ValidateJwtRequest | Unset = UNSET, - -) -> Response[IIRApiValidateJwtSignatureResponse200]: - """ + body: ValidateJwtRequest | ValidateJwtRequest | Unset = UNSET, +) -> Response[IirApiValidateJwtSignatureResponse200]: + """ Args: body (ValidateJwtRequest): body (ValidateJwtRequest): @@ -85,13 +73,11 @@ def sync_detailed( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[IIRApiValidateJwtSignatureResponse200] - """ - + Response[IirApiValidateJwtSignatureResponse200] + """ kwargs = _get_kwargs( body=body, - ) response = client.get_httpx_client().request( @@ -100,13 +86,13 @@ def sync_detailed( return _build_response(client=client, response=response) + def sync( *, client: AuthenticatedClient | Client, - body: ValidateJwtRequest | ValidateJwtRequest | Unset = UNSET, - -) -> IIRApiValidateJwtSignatureResponse200 | None: - """ + body: ValidateJwtRequest | ValidateJwtRequest | Unset = UNSET, +) -> IirApiValidateJwtSignatureResponse200 | None: + """ Args: body (ValidateJwtRequest): body (ValidateJwtRequest): @@ -116,23 +102,21 @@ def sync( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - IIRApiValidateJwtSignatureResponse200 - """ - + IirApiValidateJwtSignatureResponse200 + """ return sync_detailed( client=client, -body=body, - + body=body, ).parsed + async def asyncio_detailed( *, client: AuthenticatedClient | Client, - body: ValidateJwtRequest | ValidateJwtRequest | Unset = UNSET, - -) -> Response[IIRApiValidateJwtSignatureResponse200]: - """ + body: ValidateJwtRequest | ValidateJwtRequest | Unset = UNSET, +) -> Response[IirApiValidateJwtSignatureResponse200]: + """ Args: body (ValidateJwtRequest): body (ValidateJwtRequest): @@ -142,28 +126,24 @@ async def asyncio_detailed( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[IIRApiValidateJwtSignatureResponse200] - """ - + Response[IirApiValidateJwtSignatureResponse200] + """ kwargs = _get_kwargs( body=body, - ) - response = await client.get_async_httpx_client().request( - **kwargs - ) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) + async def asyncio( *, client: AuthenticatedClient | Client, - body: ValidateJwtRequest | ValidateJwtRequest | Unset = UNSET, - -) -> IIRApiValidateJwtSignatureResponse200 | None: - """ + body: ValidateJwtRequest | ValidateJwtRequest | Unset = UNSET, +) -> IirApiValidateJwtSignatureResponse200 | None: + """ Args: body (ValidateJwtRequest): body (ValidateJwtRequest): @@ -173,12 +153,12 @@ async def asyncio( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - IIRApiValidateJwtSignatureResponse200 - """ - - - return (await asyncio_detailed( - client=client, -body=body, - - )).parsed + IirApiValidateJwtSignatureResponse200 + """ + + return ( + await asyncio_detailed( + client=client, + body=body, + ) + ).parsed diff --git a/ce/iir/api/iir_client/api/iir_api/iir_api_validate_key.py b/ce/iir/api/iir_client/api/iir_api/iir_api_validate_key.py index 6e14043..7a8bb6a 100644 --- a/ce/iir/api/iir_client/api/iir_api/iir_api_validate_key.py +++ b/ce/iir/api/iir_client/api/iir_api/iir_api_validate_key.py @@ -1,27 +1,19 @@ from http import HTTPStatus -from typing import Any, cast -from urllib.parse import quote +from typing import Any import httpx2 -from ...client import AuthenticatedClient, Client -from ...types import Response, UNSET from ... import errors - -from ...models.iir_api_validate_key_response_200 import IIRApiValidateKeyResponse200 -from typing import cast - +from ...client import AuthenticatedClient, Client +from ...models.iir_api_validate_key_response_200 import IirApiValidateKeyResponse200 +from ...types import UNSET, Response def _get_kwargs( *, did: str, alg: str, - ) -> dict[str, Any]: - - - params: dict[str, Any] = {} @@ -29,26 +21,22 @@ def _get_kwargs( params["alg"] = alg - params = {k: v for k, v in params.items() if v is not UNSET and v is not None} - _kwargs: dict[str, Any] = { "method": "get", "url": "/iir-api/validateDidKey", "params": params, } - return _kwargs - -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> IIRApiValidateKeyResponse200 | None: +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx2.Response +) -> IirApiValidateKeyResponse200 | None: if response.status_code == 200: - response_200 = IIRApiValidateKeyResponse200.from_dict(response.json()) - - + response_200 = IirApiValidateKeyResponse200.from_dict(response.json()) return response_200 @@ -58,7 +46,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Re return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[IIRApiValidateKeyResponse200]: +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx2.Response +) -> Response[IirApiValidateKeyResponse200]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -72,9 +62,8 @@ def sync_detailed( client: AuthenticatedClient | Client, did: str, alg: str, - -) -> Response[IIRApiValidateKeyResponse200]: - """ +) -> Response[IirApiValidateKeyResponse200]: + """ Args: did (str): alg (str): @@ -84,14 +73,12 @@ def sync_detailed( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[IIRApiValidateKeyResponse200] - """ - + Response[IirApiValidateKeyResponse200] + """ kwargs = _get_kwargs( did=did, -alg=alg, - + alg=alg, ) response = client.get_httpx_client().request( @@ -100,14 +87,14 @@ def sync_detailed( return _build_response(client=client, response=response) + def sync( *, client: AuthenticatedClient | Client, did: str, alg: str, - -) -> IIRApiValidateKeyResponse200 | None: - """ +) -> IirApiValidateKeyResponse200 | None: + """ Args: did (str): alg (str): @@ -117,25 +104,23 @@ def sync( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - IIRApiValidateKeyResponse200 - """ - + IirApiValidateKeyResponse200 + """ return sync_detailed( client=client, -did=did, -alg=alg, - + did=did, + alg=alg, ).parsed + async def asyncio_detailed( *, client: AuthenticatedClient | Client, did: str, alg: str, - -) -> Response[IIRApiValidateKeyResponse200]: - """ +) -> Response[IirApiValidateKeyResponse200]: + """ Args: did (str): alg (str): @@ -145,30 +130,26 @@ async def asyncio_detailed( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[IIRApiValidateKeyResponse200] - """ - + Response[IirApiValidateKeyResponse200] + """ kwargs = _get_kwargs( did=did, -alg=alg, - + alg=alg, ) - response = await client.get_async_httpx_client().request( - **kwargs - ) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) + async def asyncio( *, client: AuthenticatedClient | Client, did: str, alg: str, - -) -> IIRApiValidateKeyResponse200 | None: - """ +) -> IirApiValidateKeyResponse200 | None: + """ Args: did (str): alg (str): @@ -178,13 +159,13 @@ async def asyncio( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - IIRApiValidateKeyResponse200 - """ - - - return (await asyncio_detailed( - client=client, -did=did, -alg=alg, - - )).parsed + IirApiValidateKeyResponse200 + """ + + return ( + await asyncio_detailed( + client=client, + did=did, + alg=alg, + ) + ).parsed diff --git a/ce/iir/api/iir_client/api/iir_api/iir_api_validate_web.py b/ce/iir/api/iir_client/api/iir_api/iir_api_validate_web.py index 1cd1f10..5b20f77 100644 --- a/ce/iir/api/iir_client/api/iir_api/iir_api_validate_web.py +++ b/ce/iir/api/iir_client/api/iir_api/iir_api_validate_web.py @@ -1,51 +1,39 @@ from http import HTTPStatus -from typing import Any, cast -from urllib.parse import quote +from typing import Any import httpx2 -from ...client import AuthenticatedClient, Client -from ...types import Response, UNSET from ... import errors - -from ...models.iir_api_validate_web_response_200 import IIRApiValidateWebResponse200 -from typing import cast - +from ...client import AuthenticatedClient, Client +from ...models.iir_api_validate_web_response_200 import IirApiValidateWebResponse200 +from ...types import UNSET, Response def _get_kwargs( *, did: str, - ) -> dict[str, Any]: - - - params: dict[str, Any] = {} params["did"] = did - params = {k: v for k, v in params.items() if v is not UNSET and v is not None} - _kwargs: dict[str, Any] = { "method": "get", "url": "/iir-api/validateDidWeb", "params": params, } - return _kwargs - -def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> IIRApiValidateWebResponse200 | None: +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx2.Response +) -> IirApiValidateWebResponse200 | None: if response.status_code == 200: - response_200 = IIRApiValidateWebResponse200.from_dict(response.json()) - - + response_200 = IirApiValidateWebResponse200.from_dict(response.json()) return response_200 @@ -55,7 +43,9 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx2.Re return None -def _build_response(*, client: AuthenticatedClient | Client, response: httpx2.Response) -> Response[IIRApiValidateWebResponse200]: +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx2.Response +) -> Response[IirApiValidateWebResponse200]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -68,9 +58,8 @@ def sync_detailed( *, client: AuthenticatedClient | Client, did: str, - -) -> Response[IIRApiValidateWebResponse200]: - """ +) -> Response[IirApiValidateWebResponse200]: + """ Args: did (str): @@ -79,13 +68,11 @@ def sync_detailed( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[IIRApiValidateWebResponse200] - """ - + Response[IirApiValidateWebResponse200] + """ kwargs = _get_kwargs( did=did, - ) response = client.get_httpx_client().request( @@ -94,13 +81,13 @@ def sync_detailed( return _build_response(client=client, response=response) + def sync( *, client: AuthenticatedClient | Client, did: str, - -) -> IIRApiValidateWebResponse200 | None: - """ +) -> IirApiValidateWebResponse200 | None: + """ Args: did (str): @@ -109,23 +96,21 @@ def sync( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - IIRApiValidateWebResponse200 - """ - + IirApiValidateWebResponse200 + """ return sync_detailed( client=client, -did=did, - + did=did, ).parsed + async def asyncio_detailed( *, client: AuthenticatedClient | Client, did: str, - -) -> Response[IIRApiValidateWebResponse200]: - """ +) -> Response[IirApiValidateWebResponse200]: + """ Args: did (str): @@ -134,28 +119,24 @@ async def asyncio_detailed( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[IIRApiValidateWebResponse200] - """ - + Response[IirApiValidateWebResponse200] + """ kwargs = _get_kwargs( did=did, - ) - response = await client.get_async_httpx_client().request( - **kwargs - ) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) + async def asyncio( *, client: AuthenticatedClient | Client, did: str, - -) -> IIRApiValidateWebResponse200 | None: - """ +) -> IirApiValidateWebResponse200 | None: + """ Args: did (str): @@ -164,12 +145,12 @@ async def asyncio( httpx2.TimeoutException: If the request takes longer than Client.timeout. Returns: - IIRApiValidateWebResponse200 - """ - - - return (await asyncio_detailed( - client=client, -did=did, - - )).parsed + IirApiValidateWebResponse200 + """ + + return ( + await asyncio_detailed( + client=client, + did=did, + ) + ).parsed diff --git a/ce/iir/api/iir_client/client.py b/ce/iir/api/iir_client/client.py index 963e055..136b83d 100644 --- a/ce/iir/api/iir_client/client.py +++ b/ce/iir/api/iir_client/client.py @@ -1,11 +1,8 @@ import ssl -from typing import Any +from typing import Any, Self -from attrs import define, field, evolve import httpx2 - - - +from attrs import define, evolve, field @define @@ -36,6 +33,7 @@ class Client: status code that was not documented in the source OpenAPI document. Can also be provided as a keyword argument to the constructor. """ + raise_on_unexpected_status: bool = field(default=False, kw_only=True) _base_url: str = field(alias="base_url") _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") @@ -71,7 +69,7 @@ def with_timeout(self, timeout: httpx2.Timeout) -> "Client": self._async_client.timeout = timeout return evolve(self, timeout=timeout) - def set_httpx_client(self, client: httpx2.Client) -> "Client": + def set_httpx_client(self, client: httpx2.Client) -> Self: """Manually set the underlying httpx2.Client **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. @@ -93,7 +91,7 @@ def get_httpx_client(self) -> httpx2.Client: ) return self._client - def __enter__(self) -> "Client": + def __enter__(self) -> Self: """Enter a context manager for self.client—you cannot enter twice (see httpx2 docs)""" self.get_httpx_client().__enter__() return self @@ -102,7 +100,7 @@ def __exit__(self, *args: Any, **kwargs: Any) -> None: """Exit a context manager for internal httpx2.Client (see httpx2 docs)""" self.get_httpx_client().__exit__(*args, **kwargs) - def set_async_httpx_client(self, async_client: httpx2.AsyncClient) -> "Client": + def set_async_httpx_client(self, async_client: httpx2.AsyncClient) -> Self: """Manually set the underlying httpx2.AsyncClient **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. @@ -124,7 +122,7 @@ def get_async_httpx_client(self) -> httpx2.AsyncClient: ) return self._async_client - async def __aenter__(self) -> "Client": + async def __aenter__(self) -> Self: """Enter a context manager for underlying httpx2.AsyncClient—you cannot enter twice (see httpx2 docs)""" await self.get_async_httpx_client().__aenter__() return self @@ -205,7 +203,7 @@ def with_timeout(self, timeout: httpx2.Timeout) -> "AuthenticatedClient": self._async_client.timeout = timeout return evolve(self, timeout=timeout) - def set_httpx_client(self, client: httpx2.Client) -> "AuthenticatedClient": + def set_httpx_client(self, client: httpx2.Client) -> Self: """Manually set the underlying httpx2.Client **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. @@ -228,7 +226,7 @@ def get_httpx_client(self) -> httpx2.Client: ) return self._client - def __enter__(self) -> "AuthenticatedClient": + def __enter__(self) -> Self: """Enter a context manager for self.client—you cannot enter twice (see httpx2 docs)""" self.get_httpx_client().__enter__() return self @@ -237,7 +235,7 @@ def __exit__(self, *args: Any, **kwargs: Any) -> None: """Exit a context manager for internal httpx2.Client (see httpx2 docs)""" self.get_httpx_client().__exit__(*args, **kwargs) - def set_async_httpx_client(self, async_client: httpx2.AsyncClient) -> "AuthenticatedClient": + def set_async_httpx_client(self, async_client: httpx2.AsyncClient) -> Self: """Manually set the underlying httpx2.AsyncClient **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. @@ -260,7 +258,7 @@ def get_async_httpx_client(self) -> httpx2.AsyncClient: ) return self._async_client - async def __aenter__(self) -> "AuthenticatedClient": + async def __aenter__(self) -> Self: """Enter a context manager for underlying httpx2.AsyncClient—you cannot enter twice (see httpx2 docs)""" await self.get_async_httpx_client().__aenter__() return self @@ -268,4 +266,3 @@ async def __aenter__(self) -> "AuthenticatedClient": async def __aexit__(self, *args: Any, **kwargs: Any) -> None: """Exit a context manager for underlying httpx2.AsyncClient (see httpx2 docs)""" await self.get_async_httpx_client().__aexit__(*args, **kwargs) - diff --git a/ce/iir/api/iir_client/errors.py b/ce/iir/api/iir_client/errors.py index b912123..5f92e76 100644 --- a/ce/iir/api/iir_client/errors.py +++ b/ce/iir/api/iir_client/errors.py @@ -1,4 +1,5 @@ -""" Contains shared errors types that can be raised from API functions """ +"""Contains shared errors types that can be raised from API functions""" + class UnexpectedStatus(Exception): """Raised by api functions when the response status an undocumented status and Client.raise_on_unexpected_status is True""" @@ -11,4 +12,5 @@ def __init__(self, status_code: int, content: bytes): f"Unexpected status code: {status_code}\n\nResponse content:\n{content.decode(errors='ignore')}" ) + __all__ = ["UnexpectedStatus"] diff --git a/ce/iir/api/iir_client/models/__init__.py b/ce/iir/api/iir_client/models/__init__.py index 4c9f955..92aec72 100644 --- a/ce/iir/api/iir_client/models/__init__.py +++ b/ce/iir/api/iir_client/models/__init__.py @@ -1,22 +1,22 @@ -""" Contains all the data models used in inputs/outputs """ +"""Contains all the data models used in inputs/outputs""" from .cancellation_token import CancellationToken from .create_challenges_request import CreateChallengesRequest -from .iir_api_create_challenges_response_200 import IIRApiCreateChallengesResponse200 -from .iir_api_federation_fetch_response_200 import IIRApiFederationFetchResponse200 -from .iir_api_get_issuer_by_did_response_200 import IIRApiGetIssuerByDidResponse200 -from .iir_api_get_issuers_by_user_response_200 import IIRApiGetIssuersByUserResponse200 -from .iir_api_get_issuers_response_200 import IIRApiGetIssuersResponse200 -from .iir_api_get_organization_iir_detail_response_200 import IIRApiGetOrganizationIIRDetailResponse200 -from .iir_api_get_registry_resource_response_200 import IIRApiGetRegistryResourceResponse200 -from .iir_api_is_user_a_member_of_org_response_200 import IIRApiIsUserAMemberOfOrgResponse200 -from .iir_api_is_user_a_member_response_200 import IIRApiIsUserAMemberResponse200 -from .iir_api_save_challenge_token_response_200 import IIRApiSaveChallengeTokenResponse200 -from .iir_api_submit_to_iir_response_200 import IIRApiSubmitToIIRResponse200 -from .iir_api_update_issuer_response_200 import IIRApiUpdateIssuerResponse200 -from .iir_api_validate_jwt_signature_response_200 import IIRApiValidateJwtSignatureResponse200 -from .iir_api_validate_key_response_200 import IIRApiValidateKeyResponse200 -from .iir_api_validate_web_response_200 import IIRApiValidateWebResponse200 +from .iir_api_create_challenges_response_200_item import IirApiCreateChallengesResponse200Item +from .iir_api_federation_fetch_response_200 import IirApiFederationFetchResponse200 +from .iir_api_get_issuer_by_did_response_200 import IirApiGetIssuerByDidResponse200 +from .iir_api_get_issuers_by_user_response_200 import IirApiGetIssuersByUserResponse200 +from .iir_api_get_issuers_response_200 import IirApiGetIssuersResponse200 +from .iir_api_get_organization_iir_detail_response_200 import IirApiGetOrganizationIirDetailResponse200 +from .iir_api_get_registry_resource_response_200 import IirApiGetRegistryResourceResponse200 +from .iir_api_is_user_a_member_of_org_response_200 import IirApiIsUserAMemberOfOrgResponse200 +from .iir_api_is_user_a_member_response_200 import IirApiIsUserAMemberResponse200 +from .iir_api_save_challenge_token_response_200 import IirApiSaveChallengeTokenResponse200 +from .iir_api_submit_to_iir_response_200 import IirApiSubmitToIirResponse200 +from .iir_api_update_issuer_response_200 import IirApiUpdateIssuerResponse200 +from .iir_api_validate_jwt_signature_response_200 import IirApiValidateJwtSignatureResponse200 +from .iir_api_validate_key_response_200 import IirApiValidateKeyResponse200 +from .iir_api_validate_web_response_200 import IirApiValidateWebResponse200 from .pub_issuer_dto import PubIssuerDTO from .safe_wait_handle import SafeWaitHandle from .save_challenge_token_request import SaveChallengeTokenRequest @@ -27,21 +27,21 @@ __all__ = ( "CancellationToken", "CreateChallengesRequest", - "IIRApiCreateChallengesResponse200", - "IIRApiFederationFetchResponse200", - "IIRApiGetIssuerByDidResponse200", - "IIRApiGetIssuersByUserResponse200", - "IIRApiGetIssuersResponse200", - "IIRApiGetOrganizationIIRDetailResponse200", - "IIRApiGetRegistryResourceResponse200", - "IIRApiIsUserAMemberOfOrgResponse200", - "IIRApiIsUserAMemberResponse200", - "IIRApiSaveChallengeTokenResponse200", - "IIRApiSubmitToIIRResponse200", - "IIRApiUpdateIssuerResponse200", - "IIRApiValidateJwtSignatureResponse200", - "IIRApiValidateKeyResponse200", - "IIRApiValidateWebResponse200", + "IirApiCreateChallengesResponse200Item", + "IirApiFederationFetchResponse200", + "IirApiGetIssuerByDidResponse200", + "IirApiGetIssuersByUserResponse200", + "IirApiGetIssuersResponse200", + "IirApiGetOrganizationIirDetailResponse200", + "IirApiGetRegistryResourceResponse200", + "IirApiIsUserAMemberOfOrgResponse200", + "IirApiIsUserAMemberResponse200", + "IirApiSaveChallengeTokenResponse200", + "IirApiSubmitToIirResponse200", + "IirApiUpdateIssuerResponse200", + "IirApiValidateJwtSignatureResponse200", + "IirApiValidateKeyResponse200", + "IirApiValidateWebResponse200", "PubIssuerDTO", "SafeWaitHandle", "SaveChallengeTokenRequest", diff --git a/ce/iir/api/iir_client/models/cancellation_token.py b/ce/iir/api/iir_client/models/cancellation_token.py index 980b76d..362b429 100644 --- a/ce/iir/api/iir_client/models/cancellation_token.py +++ b/ce/iir/api/iir_client/models/cancellation_token.py @@ -1,47 +1,35 @@ from __future__ import annotations from collections.abc import Mapping -from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field from ..types import UNSET, Unset -from ..types import UNSET, Unset -from typing import cast - if TYPE_CHECKING: - from ..models.wait_handle import WaitHandle - - - + from ..models.wait_handle import WaitHandle T = TypeVar("T", bound="CancellationToken") - @_attrs_define class CancellationToken: - """ - Attributes: - is_cancellation_requested (bool | Unset): - can_be_canceled (bool | Unset): - wait_handle (WaitHandle | Unset): - """ + """ + Attributes: + is_cancellation_requested (bool | Unset): + can_be_canceled (bool | Unset): + wait_handle (WaitHandle | Unset): + """ is_cancellation_requested: bool | Unset = UNSET can_be_canceled: bool | Unset = UNSET wait_handle: WaitHandle | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) - - - - def to_dict(self) -> dict[str, Any]: - from ..models.wait_handle import WaitHandle is_cancellation_requested = self.is_cancellation_requested can_be_canceled = self.can_be_canceled @@ -50,11 +38,9 @@ def to_dict(self) -> dict[str, Any]: if not isinstance(self.wait_handle, Unset): wait_handle = self.wait_handle.to_dict() - field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) - field_dict.update({ - }) + field_dict.update({}) if is_cancellation_requested is not UNSET: field_dict["IsCancellationRequested"] = is_cancellation_requested if can_be_canceled is not UNSET: @@ -64,11 +50,10 @@ def to_dict(self) -> dict[str, Any]: return field_dict - - @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: - from ..models.wait_handle import WaitHandle + from ..models.wait_handle import WaitHandle # noqa: PLC0415 + d = dict(src_dict) is_cancellation_requested = d.pop("IsCancellationRequested", UNSET) @@ -76,21 +61,17 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: _wait_handle = d.pop("WaitHandle", UNSET) wait_handle: WaitHandle | Unset - if isinstance(_wait_handle, Unset): + if isinstance(_wait_handle, Unset): wait_handle = UNSET else: wait_handle = WaitHandle.from_dict(_wait_handle) - - - cancellation_token = cls( is_cancellation_requested=is_cancellation_requested, can_be_canceled=can_be_canceled, wait_handle=wait_handle, ) - cancellation_token.additional_properties = d return cancellation_token diff --git a/ce/iir/api/iir_client/models/create_challenges_request.py b/ce/iir/api/iir_client/models/create_challenges_request.py index 99ca442..ec89b0e 100644 --- a/ce/iir/api/iir_client/models/create_challenges_request.py +++ b/ce/iir/api/iir_client/models/create_challenges_request.py @@ -1,41 +1,28 @@ from __future__ import annotations from collections.abc import Mapping -from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator +from typing import Any, TypeVar, cast from attrs import define as _attrs_define from attrs import field as _attrs_field from ..types import UNSET, Unset -from ..types import UNSET, Unset -from typing import cast - - - - - - T = TypeVar("T", bound="CreateChallengesRequest") - @_attrs_define class CreateChallengesRequest: - """ - Attributes: - ctid (str | Unset): - verification_method_ids (list[str] | Unset): - """ + """ + Attributes: + ctid (str | Unset): + verification_method_ids (list[str] | Unset): + """ ctid: str | Unset = UNSET verification_method_ids: list[str] | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) - - - - def to_dict(self) -> dict[str, Any]: ctid = self.ctid @@ -43,13 +30,9 @@ def to_dict(self) -> dict[str, Any]: if not isinstance(self.verification_method_ids, Unset): verification_method_ids = self.verification_method_ids - - - field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) - field_dict.update({ - }) + field_dict.update({}) if ctid is not UNSET: field_dict["Ctid"] = ctid if verification_method_ids is not UNSET: @@ -57,8 +40,6 @@ def to_dict(self) -> dict[str, Any]: return field_dict - - @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) @@ -66,13 +47,11 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: verification_method_ids = cast(list[str], d.pop("VerificationMethodIds", UNSET)) - create_challenges_request = cls( ctid=ctid, verification_method_ids=verification_method_ids, ) - create_challenges_request.additional_properties = d return create_challenges_request diff --git a/ce/iir/api/iir_client/models/iir_api_create_challenges_response_200.py b/ce/iir/api/iir_client/models/iir_api_create_challenges_response_200_item.py similarity index 69% rename from ce/iir/api/iir_client/models/iir_api_create_challenges_response_200.py rename to ce/iir/api/iir_client/models/iir_api_create_challenges_response_200_item.py index 1a3adb0..e79ffea 100644 --- a/ce/iir/api/iir_client/models/iir_api_create_challenges_response_200.py +++ b/ce/iir/api/iir_client/models/iir_api_create_challenges_response_200_item.py @@ -1,52 +1,32 @@ from __future__ import annotations from collections.abc import Mapping -from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field -from ..types import UNSET, Unset - - - - - - - -T = TypeVar("T", bound="IIRApiCreateChallengesResponse200") - +T = TypeVar("T", bound="IirApiCreateChallengesResponse200Item") @_attrs_define -class IIRApiCreateChallengesResponse200: - """ - """ - +class IirApiCreateChallengesResponse200Item: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) - - - - def to_dict(self) -> dict[str, Any]: - + field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) return field_dict - - @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) - iir_api_create_challenges_response_200 = cls( - ) - + iir_api_create_challenges_response_200_item = cls() - iir_api_create_challenges_response_200.additional_properties = d - return iir_api_create_challenges_response_200 + iir_api_create_challenges_response_200_item.additional_properties = d + return iir_api_create_challenges_response_200_item @property def additional_keys(self) -> list[str]: diff --git a/ce/iir/api/iir_client/models/iir_api_federation_fetch_response_200.py b/ce/iir/api/iir_client/models/iir_api_federation_fetch_response_200.py index 34e37bc..c62d6ae 100644 --- a/ce/iir/api/iir_client/models/iir_api_federation_fetch_response_200.py +++ b/ce/iir/api/iir_client/models/iir_api_federation_fetch_response_200.py @@ -1,49 +1,29 @@ from __future__ import annotations from collections.abc import Mapping -from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field -from ..types import UNSET, Unset - - - - - - - -T = TypeVar("T", bound="IIRApiFederationFetchResponse200") - +T = TypeVar("T", bound="IirApiFederationFetchResponse200") @_attrs_define -class IIRApiFederationFetchResponse200: - """ - """ - +class IirApiFederationFetchResponse200: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) - - - - def to_dict(self) -> dict[str, Any]: - + field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) return field_dict - - @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) - iir_api_federation_fetch_response_200 = cls( - ) - + iir_api_federation_fetch_response_200 = cls() iir_api_federation_fetch_response_200.additional_properties = d return iir_api_federation_fetch_response_200 diff --git a/ce/iir/api/iir_client/models/iir_api_get_issuer_by_did_response_200.py b/ce/iir/api/iir_client/models/iir_api_get_issuer_by_did_response_200.py index 7c16ea6..355ed32 100644 --- a/ce/iir/api/iir_client/models/iir_api_get_issuer_by_did_response_200.py +++ b/ce/iir/api/iir_client/models/iir_api_get_issuer_by_did_response_200.py @@ -1,49 +1,29 @@ from __future__ import annotations from collections.abc import Mapping -from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field -from ..types import UNSET, Unset - - - - - - - -T = TypeVar("T", bound="IIRApiGetIssuerByDidResponse200") - +T = TypeVar("T", bound="IirApiGetIssuerByDidResponse200") @_attrs_define -class IIRApiGetIssuerByDidResponse200: - """ - """ - +class IirApiGetIssuerByDidResponse200: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) - - - - def to_dict(self) -> dict[str, Any]: - + field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) return field_dict - - @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) - iir_api_get_issuer_by_did_response_200 = cls( - ) - + iir_api_get_issuer_by_did_response_200 = cls() iir_api_get_issuer_by_did_response_200.additional_properties = d return iir_api_get_issuer_by_did_response_200 diff --git a/ce/iir/api/iir_client/models/iir_api_get_issuers_by_user_response_200.py b/ce/iir/api/iir_client/models/iir_api_get_issuers_by_user_response_200.py index bfdd1e5..cb44d5c 100644 --- a/ce/iir/api/iir_client/models/iir_api_get_issuers_by_user_response_200.py +++ b/ce/iir/api/iir_client/models/iir_api_get_issuers_by_user_response_200.py @@ -1,49 +1,29 @@ from __future__ import annotations from collections.abc import Mapping -from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field -from ..types import UNSET, Unset - - - - - - - -T = TypeVar("T", bound="IIRApiGetIssuersByUserResponse200") - +T = TypeVar("T", bound="IirApiGetIssuersByUserResponse200") @_attrs_define -class IIRApiGetIssuersByUserResponse200: - """ - """ - +class IirApiGetIssuersByUserResponse200: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) - - - - def to_dict(self) -> dict[str, Any]: - + field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) return field_dict - - @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) - iir_api_get_issuers_by_user_response_200 = cls( - ) - + iir_api_get_issuers_by_user_response_200 = cls() iir_api_get_issuers_by_user_response_200.additional_properties = d return iir_api_get_issuers_by_user_response_200 diff --git a/ce/iir/api/iir_client/models/iir_api_get_issuers_response_200.py b/ce/iir/api/iir_client/models/iir_api_get_issuers_response_200.py index 10b50b4..325aae6 100644 --- a/ce/iir/api/iir_client/models/iir_api_get_issuers_response_200.py +++ b/ce/iir/api/iir_client/models/iir_api_get_issuers_response_200.py @@ -1,49 +1,29 @@ from __future__ import annotations from collections.abc import Mapping -from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field -from ..types import UNSET, Unset - - - - - - - -T = TypeVar("T", bound="IIRApiGetIssuersResponse200") - +T = TypeVar("T", bound="IirApiGetIssuersResponse200") @_attrs_define -class IIRApiGetIssuersResponse200: - """ - """ - +class IirApiGetIssuersResponse200: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) - - - - def to_dict(self) -> dict[str, Any]: - + field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) return field_dict - - @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) - iir_api_get_issuers_response_200 = cls( - ) - + iir_api_get_issuers_response_200 = cls() iir_api_get_issuers_response_200.additional_properties = d return iir_api_get_issuers_response_200 diff --git a/ce/iir/api/iir_client/models/iir_api_get_organization_iir_detail_response_200.py b/ce/iir/api/iir_client/models/iir_api_get_organization_iir_detail_response_200.py index b3b988a..1314f22 100644 --- a/ce/iir/api/iir_client/models/iir_api_get_organization_iir_detail_response_200.py +++ b/ce/iir/api/iir_client/models/iir_api_get_organization_iir_detail_response_200.py @@ -1,49 +1,29 @@ from __future__ import annotations from collections.abc import Mapping -from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field -from ..types import UNSET, Unset - - - - - - - -T = TypeVar("T", bound="IIRApiGetOrganizationIIRDetailResponse200") - +T = TypeVar("T", bound="IirApiGetOrganizationIirDetailResponse200") @_attrs_define -class IIRApiGetOrganizationIIRDetailResponse200: - """ - """ - +class IirApiGetOrganizationIirDetailResponse200: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) - - - - def to_dict(self) -> dict[str, Any]: - + field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) return field_dict - - @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) - iir_api_get_organization_iir_detail_response_200 = cls( - ) - + iir_api_get_organization_iir_detail_response_200 = cls() iir_api_get_organization_iir_detail_response_200.additional_properties = d return iir_api_get_organization_iir_detail_response_200 diff --git a/ce/iir/api/iir_client/models/iir_api_get_registry_resource_response_200.py b/ce/iir/api/iir_client/models/iir_api_get_registry_resource_response_200.py index dc77da3..dc8da95 100644 --- a/ce/iir/api/iir_client/models/iir_api_get_registry_resource_response_200.py +++ b/ce/iir/api/iir_client/models/iir_api_get_registry_resource_response_200.py @@ -1,49 +1,29 @@ from __future__ import annotations from collections.abc import Mapping -from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field -from ..types import UNSET, Unset - - - - - - - -T = TypeVar("T", bound="IIRApiGetRegistryResourceResponse200") - +T = TypeVar("T", bound="IirApiGetRegistryResourceResponse200") @_attrs_define -class IIRApiGetRegistryResourceResponse200: - """ - """ - +class IirApiGetRegistryResourceResponse200: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) - - - - def to_dict(self) -> dict[str, Any]: - + field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) return field_dict - - @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) - iir_api_get_registry_resource_response_200 = cls( - ) - + iir_api_get_registry_resource_response_200 = cls() iir_api_get_registry_resource_response_200.additional_properties = d return iir_api_get_registry_resource_response_200 diff --git a/ce/iir/api/iir_client/models/iir_api_is_user_a_member_of_org_response_200.py b/ce/iir/api/iir_client/models/iir_api_is_user_a_member_of_org_response_200.py index 9f84a58..05e9a66 100644 --- a/ce/iir/api/iir_client/models/iir_api_is_user_a_member_of_org_response_200.py +++ b/ce/iir/api/iir_client/models/iir_api_is_user_a_member_of_org_response_200.py @@ -1,49 +1,29 @@ from __future__ import annotations from collections.abc import Mapping -from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field -from ..types import UNSET, Unset - - - - - - - -T = TypeVar("T", bound="IIRApiIsUserAMemberOfOrgResponse200") - +T = TypeVar("T", bound="IirApiIsUserAMemberOfOrgResponse200") @_attrs_define -class IIRApiIsUserAMemberOfOrgResponse200: - """ - """ - +class IirApiIsUserAMemberOfOrgResponse200: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) - - - - def to_dict(self) -> dict[str, Any]: - + field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) return field_dict - - @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) - iir_api_is_user_a_member_of_org_response_200 = cls( - ) - + iir_api_is_user_a_member_of_org_response_200 = cls() iir_api_is_user_a_member_of_org_response_200.additional_properties = d return iir_api_is_user_a_member_of_org_response_200 diff --git a/ce/iir/api/iir_client/models/iir_api_is_user_a_member_response_200.py b/ce/iir/api/iir_client/models/iir_api_is_user_a_member_response_200.py index 722d5b7..3e49b9d 100644 --- a/ce/iir/api/iir_client/models/iir_api_is_user_a_member_response_200.py +++ b/ce/iir/api/iir_client/models/iir_api_is_user_a_member_response_200.py @@ -1,49 +1,29 @@ from __future__ import annotations from collections.abc import Mapping -from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field -from ..types import UNSET, Unset - - - - - - - -T = TypeVar("T", bound="IIRApiIsUserAMemberResponse200") - +T = TypeVar("T", bound="IirApiIsUserAMemberResponse200") @_attrs_define -class IIRApiIsUserAMemberResponse200: - """ - """ - +class IirApiIsUserAMemberResponse200: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) - - - - def to_dict(self) -> dict[str, Any]: - + field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) return field_dict - - @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) - iir_api_is_user_a_member_response_200 = cls( - ) - + iir_api_is_user_a_member_response_200 = cls() iir_api_is_user_a_member_response_200.additional_properties = d return iir_api_is_user_a_member_response_200 diff --git a/ce/iir/api/iir_client/models/iir_api_save_challenge_token_response_200.py b/ce/iir/api/iir_client/models/iir_api_save_challenge_token_response_200.py index 92f639a..9c90aeb 100644 --- a/ce/iir/api/iir_client/models/iir_api_save_challenge_token_response_200.py +++ b/ce/iir/api/iir_client/models/iir_api_save_challenge_token_response_200.py @@ -1,49 +1,29 @@ from __future__ import annotations from collections.abc import Mapping -from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field -from ..types import UNSET, Unset - - - - - - - -T = TypeVar("T", bound="IIRApiSaveChallengeTokenResponse200") - +T = TypeVar("T", bound="IirApiSaveChallengeTokenResponse200") @_attrs_define -class IIRApiSaveChallengeTokenResponse200: - """ - """ - +class IirApiSaveChallengeTokenResponse200: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) - - - - def to_dict(self) -> dict[str, Any]: - + field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) return field_dict - - @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) - iir_api_save_challenge_token_response_200 = cls( - ) - + iir_api_save_challenge_token_response_200 = cls() iir_api_save_challenge_token_response_200.additional_properties = d return iir_api_save_challenge_token_response_200 diff --git a/ce/iir/api/iir_client/models/iir_api_submit_to_iir_response_200.py b/ce/iir/api/iir_client/models/iir_api_submit_to_iir_response_200.py index 2428b40..45d2795 100644 --- a/ce/iir/api/iir_client/models/iir_api_submit_to_iir_response_200.py +++ b/ce/iir/api/iir_client/models/iir_api_submit_to_iir_response_200.py @@ -1,49 +1,29 @@ from __future__ import annotations from collections.abc import Mapping -from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field -from ..types import UNSET, Unset - - - - - - - -T = TypeVar("T", bound="IIRApiSubmitToIIRResponse200") - +T = TypeVar("T", bound="IirApiSubmitToIirResponse200") @_attrs_define -class IIRApiSubmitToIIRResponse200: - """ - """ - +class IirApiSubmitToIirResponse200: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) - - - - def to_dict(self) -> dict[str, Any]: - + field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) return field_dict - - @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) - iir_api_submit_to_iir_response_200 = cls( - ) - + iir_api_submit_to_iir_response_200 = cls() iir_api_submit_to_iir_response_200.additional_properties = d return iir_api_submit_to_iir_response_200 diff --git a/ce/iir/api/iir_client/models/iir_api_update_issuer_response_200.py b/ce/iir/api/iir_client/models/iir_api_update_issuer_response_200.py index b3d9b0f..ef6abb6 100644 --- a/ce/iir/api/iir_client/models/iir_api_update_issuer_response_200.py +++ b/ce/iir/api/iir_client/models/iir_api_update_issuer_response_200.py @@ -1,49 +1,29 @@ from __future__ import annotations from collections.abc import Mapping -from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field -from ..types import UNSET, Unset - - - - - - - -T = TypeVar("T", bound="IIRApiUpdateIssuerResponse200") - +T = TypeVar("T", bound="IirApiUpdateIssuerResponse200") @_attrs_define -class IIRApiUpdateIssuerResponse200: - """ - """ - +class IirApiUpdateIssuerResponse200: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) - - - - def to_dict(self) -> dict[str, Any]: - + field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) return field_dict - - @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) - iir_api_update_issuer_response_200 = cls( - ) - + iir_api_update_issuer_response_200 = cls() iir_api_update_issuer_response_200.additional_properties = d return iir_api_update_issuer_response_200 diff --git a/ce/iir/api/iir_client/models/iir_api_validate_jwt_signature_response_200.py b/ce/iir/api/iir_client/models/iir_api_validate_jwt_signature_response_200.py index bec4a1f..bafbb11 100644 --- a/ce/iir/api/iir_client/models/iir_api_validate_jwt_signature_response_200.py +++ b/ce/iir/api/iir_client/models/iir_api_validate_jwt_signature_response_200.py @@ -1,49 +1,29 @@ from __future__ import annotations from collections.abc import Mapping -from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field -from ..types import UNSET, Unset - - - - - - - -T = TypeVar("T", bound="IIRApiValidateJwtSignatureResponse200") - +T = TypeVar("T", bound="IirApiValidateJwtSignatureResponse200") @_attrs_define -class IIRApiValidateJwtSignatureResponse200: - """ - """ - +class IirApiValidateJwtSignatureResponse200: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) - - - - def to_dict(self) -> dict[str, Any]: - + field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) return field_dict - - @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) - iir_api_validate_jwt_signature_response_200 = cls( - ) - + iir_api_validate_jwt_signature_response_200 = cls() iir_api_validate_jwt_signature_response_200.additional_properties = d return iir_api_validate_jwt_signature_response_200 diff --git a/ce/iir/api/iir_client/models/iir_api_validate_key_response_200.py b/ce/iir/api/iir_client/models/iir_api_validate_key_response_200.py index 02ca3e8..840e4c7 100644 --- a/ce/iir/api/iir_client/models/iir_api_validate_key_response_200.py +++ b/ce/iir/api/iir_client/models/iir_api_validate_key_response_200.py @@ -1,49 +1,29 @@ from __future__ import annotations from collections.abc import Mapping -from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field -from ..types import UNSET, Unset - - - - - - - -T = TypeVar("T", bound="IIRApiValidateKeyResponse200") - +T = TypeVar("T", bound="IirApiValidateKeyResponse200") @_attrs_define -class IIRApiValidateKeyResponse200: - """ - """ - +class IirApiValidateKeyResponse200: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) - - - - def to_dict(self) -> dict[str, Any]: - + field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) return field_dict - - @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) - iir_api_validate_key_response_200 = cls( - ) - + iir_api_validate_key_response_200 = cls() iir_api_validate_key_response_200.additional_properties = d return iir_api_validate_key_response_200 diff --git a/ce/iir/api/iir_client/models/iir_api_validate_web_response_200.py b/ce/iir/api/iir_client/models/iir_api_validate_web_response_200.py index 438754d..3985972 100644 --- a/ce/iir/api/iir_client/models/iir_api_validate_web_response_200.py +++ b/ce/iir/api/iir_client/models/iir_api_validate_web_response_200.py @@ -1,49 +1,29 @@ from __future__ import annotations from collections.abc import Mapping -from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field -from ..types import UNSET, Unset - - - - - - - -T = TypeVar("T", bound="IIRApiValidateWebResponse200") - +T = TypeVar("T", bound="IirApiValidateWebResponse200") @_attrs_define -class IIRApiValidateWebResponse200: - """ - """ - +class IirApiValidateWebResponse200: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) - - - - def to_dict(self) -> dict[str, Any]: - + field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) return field_dict - - @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) - iir_api_validate_web_response_200 = cls( - ) - + iir_api_validate_web_response_200 = cls() iir_api_validate_web_response_200.additional_properties = d return iir_api_validate_web_response_200 diff --git a/ce/iir/api/iir_client/models/pub_issuer_dto.py b/ce/iir/api/iir_client/models/pub_issuer_dto.py index 0be5f14..2a15a4f 100644 --- a/ce/iir/api/iir_client/models/pub_issuer_dto.py +++ b/ce/iir/api/iir_client/models/pub_issuer_dto.py @@ -1,42 +1,32 @@ from __future__ import annotations +import datetime from collections.abc import Mapping -from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field from ..types import UNSET, Unset -from ..types import UNSET, Unset -from dateutil.parser import isoparse -from typing import cast -import datetime - - - - - - T = TypeVar("T", bound="PubIssuerDTO") - @_attrs_define class PubIssuerDTO: - """ - Attributes: - ctid (str | Unset): - did (str | Unset): - name (str | Unset): - legal_name (str | Unset): - credential_registry_uri (str | Unset): - subject_web_page (str | Unset): - logo_base_64 (str | Unset): - logo_uri (str | Unset): - valid_from (datetime.datetime | Unset): - valid_until (datetime.datetime | Unset): - """ + """ + Attributes: + ctid (str | Unset): + did (str | Unset): + name (str | Unset): + legal_name (str | Unset): + credential_registry_uri (str | Unset): + subject_web_page (str | Unset): + logo_base_64 (str | Unset): + logo_uri (str | Unset): + valid_from (datetime.datetime | Unset): + valid_until (datetime.datetime | Unset): + """ ctid: str | Unset = UNSET did: str | Unset = UNSET @@ -50,10 +40,6 @@ class PubIssuerDTO: valid_until: datetime.datetime | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) - - - - def to_dict(self) -> dict[str, Any]: ctid = self.ctid @@ -79,11 +65,9 @@ def to_dict(self) -> dict[str, Any]: if not isinstance(self.valid_until, Unset): valid_until = self.valid_until.isoformat() - field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) - field_dict.update({ - }) + field_dict.update({}) if ctid is not UNSET: field_dict["CTID"] = ctid if did is not UNSET: @@ -107,8 +91,6 @@ def to_dict(self) -> dict[str, Any]: return field_dict - - @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) @@ -130,23 +112,17 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: _valid_from = d.pop("ValidFrom", UNSET) valid_from: datetime.datetime | Unset - if isinstance(_valid_from, Unset): + if isinstance(_valid_from, Unset): valid_from = UNSET else: - valid_from = isoparse(_valid_from) - - - + valid_from = datetime.datetime.fromisoformat(_valid_from) _valid_until = d.pop("ValidUntil", UNSET) valid_until: datetime.datetime | Unset - if isinstance(_valid_until, Unset): + if isinstance(_valid_until, Unset): valid_until = UNSET else: - valid_until = isoparse(_valid_until) - - - + valid_until = datetime.datetime.fromisoformat(_valid_until) pub_issuer_dto = cls( ctid=ctid, @@ -161,7 +137,6 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: valid_until=valid_until, ) - pub_issuer_dto.additional_properties = d return pub_issuer_dto diff --git a/ce/iir/api/iir_client/models/safe_wait_handle.py b/ce/iir/api/iir_client/models/safe_wait_handle.py index b129b89..d53ed48 100644 --- a/ce/iir/api/iir_client/models/safe_wait_handle.py +++ b/ce/iir/api/iir_client/models/safe_wait_handle.py @@ -1,50 +1,36 @@ from __future__ import annotations from collections.abc import Mapping -from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field from ..types import UNSET, Unset -from ..types import UNSET, Unset - - - - - - T = TypeVar("T", bound="SafeWaitHandle") - @_attrs_define class SafeWaitHandle: - """ - Attributes: - is_invalid (bool | Unset): - is_closed (bool | Unset): - """ + """ + Attributes: + is_invalid (bool | Unset): + is_closed (bool | Unset): + """ is_invalid: bool | Unset = UNSET is_closed: bool | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) - - - - def to_dict(self) -> dict[str, Any]: is_invalid = self.is_invalid is_closed = self.is_closed - field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) - field_dict.update({ - }) + field_dict.update({}) if is_invalid is not UNSET: field_dict["IsInvalid"] = is_invalid if is_closed is not UNSET: @@ -52,8 +38,6 @@ def to_dict(self) -> dict[str, Any]: return field_dict - - @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) @@ -66,7 +50,6 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: is_closed=is_closed, ) - safe_wait_handle.additional_properties = d return safe_wait_handle diff --git a/ce/iir/api/iir_client/models/save_challenge_token_request.py b/ce/iir/api/iir_client/models/save_challenge_token_request.py index ea7f88b..d28c85b 100644 --- a/ce/iir/api/iir_client/models/save_challenge_token_request.py +++ b/ce/iir/api/iir_client/models/save_challenge_token_request.py @@ -1,43 +1,31 @@ from __future__ import annotations from collections.abc import Mapping -from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator +from typing import Any, TypeVar +from uuid import UUID from attrs import define as _attrs_define from attrs import field as _attrs_field from ..types import UNSET, Unset -from ..types import UNSET, Unset -from uuid import UUID - - - - - - T = TypeVar("T", bound="SaveChallengeTokenRequest") - @_attrs_define class SaveChallengeTokenRequest: - """ - Attributes: - ctid (str | Unset): - challenge_id (UUID | Unset): Example: 00000000-0000-0000-0000-000000000000. - token (str | Unset): - """ + """ + Attributes: + ctid (str | Unset): + challenge_id (UUID | Unset): Example: 00000000-0000-0000-0000-000000000000. + token (str | Unset): + """ ctid: str | Unset = UNSET challenge_id: UUID | Unset = UNSET token: str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) - - - - def to_dict(self) -> dict[str, Any]: ctid = self.ctid @@ -47,11 +35,9 @@ def to_dict(self) -> dict[str, Any]: token = self.token - field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) - field_dict.update({ - }) + field_dict.update({}) if ctid is not UNSET: field_dict["Ctid"] = ctid if challenge_id is not UNSET: @@ -61,8 +47,6 @@ def to_dict(self) -> dict[str, Any]: return field_dict - - @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) @@ -70,14 +54,11 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: _challenge_id = d.pop("ChallengeId", UNSET) challenge_id: UUID | Unset - if isinstance(_challenge_id, Unset): + if isinstance(_challenge_id, Unset): challenge_id = UNSET else: challenge_id = UUID(_challenge_id) - - - token = d.pop("Token", UNSET) save_challenge_token_request = cls( @@ -86,7 +67,6 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: token=token, ) - save_challenge_token_request.additional_properties = d return save_challenge_token_request diff --git a/ce/iir/api/iir_client/models/validate_jwt_request.py b/ce/iir/api/iir_client/models/validate_jwt_request.py index 409a355..bc25ae9 100644 --- a/ce/iir/api/iir_client/models/validate_jwt_request.py +++ b/ce/iir/api/iir_client/models/validate_jwt_request.py @@ -1,41 +1,29 @@ from __future__ import annotations from collections.abc import Mapping -from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator +from typing import Any, TypeVar +from uuid import UUID from attrs import define as _attrs_define from attrs import field as _attrs_field from ..types import UNSET, Unset -from ..types import UNSET, Unset -from uuid import UUID - - - - - - T = TypeVar("T", bound="ValidateJwtRequest") - @_attrs_define class ValidateJwtRequest: - """ - Attributes: - jwt (str | Unset): - challenge_id (UUID | Unset): Example: 00000000-0000-0000-0000-000000000000. - """ + """ + Attributes: + jwt (str | Unset): + challenge_id (UUID | Unset): Example: 00000000-0000-0000-0000-000000000000. + """ jwt: str | Unset = UNSET challenge_id: UUID | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) - - - - def to_dict(self) -> dict[str, Any]: jwt = self.jwt @@ -43,11 +31,9 @@ def to_dict(self) -> dict[str, Any]: if not isinstance(self.challenge_id, Unset): challenge_id = str(self.challenge_id) - field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) - field_dict.update({ - }) + field_dict.update({}) if jwt is not UNSET: field_dict["Jwt"] = jwt if challenge_id is not UNSET: @@ -55,8 +41,6 @@ def to_dict(self) -> dict[str, Any]: return field_dict - - @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) @@ -64,20 +48,16 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: _challenge_id = d.pop("ChallengeId", UNSET) challenge_id: UUID | Unset - if isinstance(_challenge_id, Unset): + if isinstance(_challenge_id, Unset): challenge_id = UNSET else: challenge_id = UUID(_challenge_id) - - - validate_jwt_request = cls( jwt=jwt, challenge_id=challenge_id, ) - validate_jwt_request.additional_properties = d return validate_jwt_request diff --git a/ce/iir/api/iir_client/models/wait_handle.py b/ce/iir/api/iir_client/models/wait_handle.py index 009fbaa..859bfa9 100644 --- a/ce/iir/api/iir_client/models/wait_handle.py +++ b/ce/iir/api/iir_client/models/wait_handle.py @@ -1,47 +1,34 @@ from __future__ import annotations from collections.abc import Mapping -from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field from ..types import UNSET, Unset -from ..types import UNSET, Unset -from typing import cast - if TYPE_CHECKING: - from ..models.safe_wait_handle import SafeWaitHandle - from ..models.wait_handle_handle import WaitHandleHandle - - - + from ..models.safe_wait_handle import SafeWaitHandle + from ..models.wait_handle_handle import WaitHandleHandle T = TypeVar("T", bound="WaitHandle") - @_attrs_define class WaitHandle: - """ - Attributes: - handle (WaitHandleHandle | Unset): - safe_wait_handle (SafeWaitHandle | Unset): - """ + """ + Attributes: + handle (WaitHandleHandle | Unset): + safe_wait_handle (SafeWaitHandle | Unset): + """ handle: WaitHandleHandle | Unset = UNSET safe_wait_handle: SafeWaitHandle | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) - - - - def to_dict(self) -> dict[str, Any]: - from ..models.safe_wait_handle import SafeWaitHandle - from ..models.wait_handle_handle import WaitHandleHandle handle: dict[str, Any] | Unset = UNSET if not isinstance(self.handle, Unset): handle = self.handle.to_dict() @@ -50,11 +37,9 @@ def to_dict(self) -> dict[str, Any]: if not isinstance(self.safe_wait_handle, Unset): safe_wait_handle = self.safe_wait_handle.to_dict() - field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) - field_dict.update({ - }) + field_dict.update({}) if handle is not UNSET: field_dict["Handle"] = handle if safe_wait_handle is not UNSET: @@ -62,39 +47,31 @@ def to_dict(self) -> dict[str, Any]: return field_dict - - @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: - from ..models.safe_wait_handle import SafeWaitHandle - from ..models.wait_handle_handle import WaitHandleHandle + from ..models.safe_wait_handle import SafeWaitHandle # noqa: PLC0415 + from ..models.wait_handle_handle import WaitHandleHandle # noqa: PLC0415 + d = dict(src_dict) _handle = d.pop("Handle", UNSET) handle: WaitHandleHandle | Unset - if isinstance(_handle, Unset): + if isinstance(_handle, Unset): handle = UNSET else: handle = WaitHandleHandle.from_dict(_handle) - - - _safe_wait_handle = d.pop("SafeWaitHandle", UNSET) safe_wait_handle: SafeWaitHandle | Unset - if isinstance(_safe_wait_handle, Unset): + if isinstance(_safe_wait_handle, Unset): safe_wait_handle = UNSET else: safe_wait_handle = SafeWaitHandle.from_dict(_safe_wait_handle) - - - wait_handle = cls( handle=handle, safe_wait_handle=safe_wait_handle, ) - wait_handle.additional_properties = d return wait_handle diff --git a/ce/iir/api/iir_client/models/wait_handle_handle.py b/ce/iir/api/iir_client/models/wait_handle_handle.py index d58424d..fc11e5b 100644 --- a/ce/iir/api/iir_client/models/wait_handle_handle.py +++ b/ce/iir/api/iir_client/models/wait_handle_handle.py @@ -1,49 +1,29 @@ from __future__ import annotations from collections.abc import Mapping -from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field -from ..types import UNSET, Unset - - - - - - - T = TypeVar("T", bound="WaitHandleHandle") - @_attrs_define class WaitHandleHandle: - """ - """ - additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) - - - - def to_dict(self) -> dict[str, Any]: - + field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) return field_dict - - @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) - wait_handle_handle = cls( - ) - + wait_handle_handle = cls() wait_handle_handle.additional_properties = d return wait_handle_handle diff --git a/ce/iir/api/iir_client/types.py b/ce/iir/api/iir_client/types.py index 2047c19..9090a26 100644 --- a/ce/iir/api/iir_client/types.py +++ b/ce/iir/api/iir_client/types.py @@ -1,8 +1,8 @@ -""" Contains some shared types for properties """ +"""Contains some shared types for properties""" from collections.abc import Mapping, MutableMapping from http import HTTPStatus -from typing import BinaryIO, Generic, TypeVar, Literal, IO +from typing import IO, BinaryIO, Generic, Literal, TypeVar from attrs import define @@ -24,16 +24,17 @@ def __bool__(self) -> Literal[False]: ) RequestFiles = list[tuple[str, FileTypes]] + @define class File: - """ Contains information for file uploads """ + """Contains information for file uploads""" payload: BinaryIO file_name: str | None = None mime_type: str | None = None def to_tuple(self) -> FileTypes: - """ Return a tuple representation that httpx2 will accept for multipart/form-data """ + """Return a tuple representation that httpx2 will accept for multipart/form-data""" return self.file_name, self.payload, self.mime_type @@ -42,7 +43,7 @@ def to_tuple(self) -> FileTypes: @define class Response(Generic[T]): - """ A response from an endpoint """ + """A response from an endpoint""" status_code: HTTPStatus content: bytes diff --git a/ce/iir/api/pyproject.toml b/ce/iir/api/pyproject.toml index 0c2f1e1..4d05d5a 100644 --- a/ce/iir/api/pyproject.toml +++ b/ce/iir/api/pyproject.toml @@ -11,9 +11,8 @@ include = ["iir_client/py.typed"] [tool.poetry.dependencies] python = "^3.11" -httpx2 = ">=2.16,<3" +httpx2 = ">=2.13.1,<3" attrs = ">=22.2.0" -python-dateutil = "^2.8.0" [build-system] requires = ["poetry-core>=2.0.0,<3.0.0"] diff --git a/ce/iir/openapi.json b/ce/iir/openapi.json index 448411d..57f1ac1 100644 --- a/ce/iir/openapi.json +++ b/ce/iir/openapi.json @@ -350,22 +350,34 @@ "content": { "application/json": { "schema": { - "type": "object" + "type": "array", + "items": { + "type": "object" + } } }, "text/json": { "schema": { - "type": "object" + "type": "array", + "items": { + "type": "object" + } } }, "application/xml": { "schema": { - "type": "object" + "type": "array", + "items": { + "type": "object" + } } }, "text/xml": { "schema": { - "type": "object" + "type": "array", + "items": { + "type": "object" + } } } } @@ -982,4 +994,4 @@ } } } -} \ No newline at end of file +} diff --git a/ce/iir/prepare_openapi.py b/ce/iir/prepare_openapi.py new file mode 100644 index 0000000..297d591 --- /dev/null +++ b/ce/iir/prepare_openapi.py @@ -0,0 +1,41 @@ +"""Correct the IIR OpenAPI document before the client is generated. + +Usage: python ce/iir/prepare_openapi.py ce/iir/openapi.json + +The IIR API's Swagger says createChallenges answers a single `object`, but the API answers a list +of challenge objects. Left alone, the generated client cannot read a real answer. This script +fixes the document so the client is generated, not edited by hand. Remove a fix here once the IIR +API's own Swagger is correct. +""" + +import json +import sys + +# (path, method, status) of each response that is really an array of the schema the spec gives. +ARRAY_RESPONSES = [("/iir-api/createChallenges", "post", "200")] + + +def prepare(document: dict) -> int: + changed = 0 + for path, method, status in ARRAY_RESPONSES: + response = document["paths"][path][method]["responses"][status] + for media in response["content"].values(): + schema = media["schema"] + if schema.get("type") != "array": + media["schema"] = {"type": "array", "items": schema} + changed += 1 + return changed + + +def main(path: str) -> None: + with open(path, encoding="utf-8") as f: + document = json.load(f) + changed = prepare(document) + with open(path, "w", encoding="utf-8", newline="\n") as f: + json.dump(document, f, indent=4) + f.write("\n") + print(f"{path}: {changed} schema(s) made arrays") + + +if __name__ == "__main__": + main(sys.argv[1]) diff --git a/generate.ps1 b/generate.ps1 index b9d98af..341942e 100644 --- a/generate.ps1 +++ b/generate.ps1 @@ -1,7 +1,9 @@ npm install -g swagger2openapi -pip install openapi-python-client --user +pip install openapi-python-client ruff --user +# Needs ruff on PATH: without it the generator skips its clean-up step and leaves unused imports. swagger2openapi ce/iir/swagger.json -o ce/iir/openapi.json +python ce/iir/prepare_openapi.py ce/iir/openapi.json python -m openapi_python_client generate ` --path ce/iir/openapi.json ` @@ -10,4 +12,4 @@ python -m openapi_python_client generate ` --overwrite Write-Host "`n--- OUTPUT ---" -Get-Content generate.log \ No newline at end of file +Get-Content generate.log From 1f38272f620c81e71c059d3f5c14a26acb16678a Mon Sep 17 00:00:00 2001 From: Cary Huang Date: Mon, 16 Nov 2026 11:13:56 -0800 Subject: [PATCH 3/3] Keep one request body type in the IIR spec --- .../api/iir_api/iir_api_create_challenges.py | 25 ++---- .../iir_api/iir_api_save_challenge_token.py | 25 ++---- .../api/iir_api/iir_api_submit_to_iir.py | 25 ++---- .../api/iir_api/iir_api_update_issuer.py | 25 ++---- .../iir_api/iir_api_validate_jwt_signature.py | 25 ++---- ce/iir/openapi.json | 80 ------------------- ce/iir/prepare_openapi.py | 33 +++++++- 7 files changed, 72 insertions(+), 166 deletions(-) diff --git a/ce/iir/api/iir_client/api/iir_api/iir_api_create_challenges.py b/ce/iir/api/iir_client/api/iir_api/iir_api_create_challenges.py index 07e5d24..ad462da 100644 --- a/ce/iir/api/iir_client/api/iir_api/iir_api_create_challenges.py +++ b/ce/iir/api/iir_client/api/iir_api/iir_api_create_challenges.py @@ -7,12 +7,12 @@ from ...client import AuthenticatedClient, Client from ...models.create_challenges_request import CreateChallengesRequest from ...models.iir_api_create_challenges_response_200_item import IirApiCreateChallengesResponse200Item -from ...types import UNSET, Response +from ...types import Response def _get_kwargs( *, - body: CreateChallengesRequest | CreateChallengesRequest | Unset = UNSET, + body: CreateChallengesRequest, ) -> dict[str, Any]: headers: dict[str, Any] = {} @@ -21,13 +21,8 @@ def _get_kwargs( "url": "/iir-api/createChallenges", } - if isinstance(body, CreateChallengesRequest): - _kwargs["json"] = body.to_dict() - - headers["Content-Type"] = "application/json" - if isinstance(body, CreateChallengesRequest): - _kwargs["data"] = body.to_dict() - headers["Content-Type"] = "application/x-www-form-urlencoded" + _kwargs["data"] = body.to_dict() + headers["Content-Type"] = "application/x-www-form-urlencoded" _kwargs["headers"] = headers return _kwargs @@ -66,12 +61,11 @@ def _build_response( def sync_detailed( *, client: AuthenticatedClient | Client, - body: CreateChallengesRequest | CreateChallengesRequest | Unset = UNSET, + body: CreateChallengesRequest, ) -> Response[list[IirApiCreateChallengesResponse200Item]]: """ Args: body (CreateChallengesRequest): - body (CreateChallengesRequest): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -95,12 +89,11 @@ def sync_detailed( def sync( *, client: AuthenticatedClient | Client, - body: CreateChallengesRequest | CreateChallengesRequest | Unset = UNSET, + body: CreateChallengesRequest, ) -> list[IirApiCreateChallengesResponse200Item] | None: """ Args: body (CreateChallengesRequest): - body (CreateChallengesRequest): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -119,12 +112,11 @@ def sync( async def asyncio_detailed( *, client: AuthenticatedClient | Client, - body: CreateChallengesRequest | CreateChallengesRequest | Unset = UNSET, + body: CreateChallengesRequest, ) -> Response[list[IirApiCreateChallengesResponse200Item]]: """ Args: body (CreateChallengesRequest): - body (CreateChallengesRequest): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -146,12 +138,11 @@ async def asyncio_detailed( async def asyncio( *, client: AuthenticatedClient | Client, - body: CreateChallengesRequest | CreateChallengesRequest | Unset = UNSET, + body: CreateChallengesRequest, ) -> list[IirApiCreateChallengesResponse200Item] | None: """ Args: body (CreateChallengesRequest): - body (CreateChallengesRequest): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. diff --git a/ce/iir/api/iir_client/api/iir_api/iir_api_save_challenge_token.py b/ce/iir/api/iir_client/api/iir_api/iir_api_save_challenge_token.py index dfc8c71..50bd200 100644 --- a/ce/iir/api/iir_client/api/iir_api/iir_api_save_challenge_token.py +++ b/ce/iir/api/iir_client/api/iir_api/iir_api_save_challenge_token.py @@ -7,12 +7,12 @@ from ...client import AuthenticatedClient, Client from ...models.iir_api_save_challenge_token_response_200 import IirApiSaveChallengeTokenResponse200 from ...models.save_challenge_token_request import SaveChallengeTokenRequest -from ...types import UNSET, Response +from ...types import Response def _get_kwargs( *, - body: SaveChallengeTokenRequest | SaveChallengeTokenRequest | Unset = UNSET, + body: SaveChallengeTokenRequest, ) -> dict[str, Any]: headers: dict[str, Any] = {} @@ -21,13 +21,8 @@ def _get_kwargs( "url": "/iir-api/saveChallengeToken", } - if isinstance(body, SaveChallengeTokenRequest): - _kwargs["json"] = body.to_dict() - - headers["Content-Type"] = "application/json" - if isinstance(body, SaveChallengeTokenRequest): - _kwargs["data"] = body.to_dict() - headers["Content-Type"] = "application/x-www-form-urlencoded" + _kwargs["data"] = body.to_dict() + headers["Content-Type"] = "application/x-www-form-urlencoded" _kwargs["headers"] = headers return _kwargs @@ -61,12 +56,11 @@ def _build_response( def sync_detailed( *, client: AuthenticatedClient | Client, - body: SaveChallengeTokenRequest | SaveChallengeTokenRequest | Unset = UNSET, + body: SaveChallengeTokenRequest, ) -> Response[IirApiSaveChallengeTokenResponse200]: """ Args: body (SaveChallengeTokenRequest): - body (SaveChallengeTokenRequest): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -90,12 +84,11 @@ def sync_detailed( def sync( *, client: AuthenticatedClient | Client, - body: SaveChallengeTokenRequest | SaveChallengeTokenRequest | Unset = UNSET, + body: SaveChallengeTokenRequest, ) -> IirApiSaveChallengeTokenResponse200 | None: """ Args: body (SaveChallengeTokenRequest): - body (SaveChallengeTokenRequest): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -114,12 +107,11 @@ def sync( async def asyncio_detailed( *, client: AuthenticatedClient | Client, - body: SaveChallengeTokenRequest | SaveChallengeTokenRequest | Unset = UNSET, + body: SaveChallengeTokenRequest, ) -> Response[IirApiSaveChallengeTokenResponse200]: """ Args: body (SaveChallengeTokenRequest): - body (SaveChallengeTokenRequest): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -141,12 +133,11 @@ async def asyncio_detailed( async def asyncio( *, client: AuthenticatedClient | Client, - body: SaveChallengeTokenRequest | SaveChallengeTokenRequest | Unset = UNSET, + body: SaveChallengeTokenRequest, ) -> IirApiSaveChallengeTokenResponse200 | None: """ Args: body (SaveChallengeTokenRequest): - body (SaveChallengeTokenRequest): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. diff --git a/ce/iir/api/iir_client/api/iir_api/iir_api_submit_to_iir.py b/ce/iir/api/iir_client/api/iir_api/iir_api_submit_to_iir.py index c8f92de..0b404aa 100644 --- a/ce/iir/api/iir_client/api/iir_api/iir_api_submit_to_iir.py +++ b/ce/iir/api/iir_client/api/iir_api/iir_api_submit_to_iir.py @@ -7,12 +7,12 @@ from ...client import AuthenticatedClient, Client from ...models.iir_api_submit_to_iir_response_200 import IirApiSubmitToIirResponse200 from ...models.pub_issuer_dto import PubIssuerDTO -from ...types import UNSET, Response +from ...types import Response def _get_kwargs( *, - body: PubIssuerDTO | PubIssuerDTO | Unset = UNSET, + body: PubIssuerDTO, ) -> dict[str, Any]: headers: dict[str, Any] = {} @@ -21,13 +21,8 @@ def _get_kwargs( "url": "/iir-api/submitToIIR", } - if isinstance(body, PubIssuerDTO): - _kwargs["json"] = body.to_dict() - - headers["Content-Type"] = "application/json" - if isinstance(body, PubIssuerDTO): - _kwargs["data"] = body.to_dict() - headers["Content-Type"] = "application/x-www-form-urlencoded" + _kwargs["data"] = body.to_dict() + headers["Content-Type"] = "application/x-www-form-urlencoded" _kwargs["headers"] = headers return _kwargs @@ -61,12 +56,11 @@ def _build_response( def sync_detailed( *, client: AuthenticatedClient | Client, - body: PubIssuerDTO | PubIssuerDTO | Unset = UNSET, + body: PubIssuerDTO, ) -> Response[IirApiSubmitToIirResponse200]: """ Args: body (PubIssuerDTO): - body (PubIssuerDTO): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -90,12 +84,11 @@ def sync_detailed( def sync( *, client: AuthenticatedClient | Client, - body: PubIssuerDTO | PubIssuerDTO | Unset = UNSET, + body: PubIssuerDTO, ) -> IirApiSubmitToIirResponse200 | None: """ Args: body (PubIssuerDTO): - body (PubIssuerDTO): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -114,12 +107,11 @@ def sync( async def asyncio_detailed( *, client: AuthenticatedClient | Client, - body: PubIssuerDTO | PubIssuerDTO | Unset = UNSET, + body: PubIssuerDTO, ) -> Response[IirApiSubmitToIirResponse200]: """ Args: body (PubIssuerDTO): - body (PubIssuerDTO): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -141,12 +133,11 @@ async def asyncio_detailed( async def asyncio( *, client: AuthenticatedClient | Client, - body: PubIssuerDTO | PubIssuerDTO | Unset = UNSET, + body: PubIssuerDTO, ) -> IirApiSubmitToIirResponse200 | None: """ Args: body (PubIssuerDTO): - body (PubIssuerDTO): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. diff --git a/ce/iir/api/iir_client/api/iir_api/iir_api_update_issuer.py b/ce/iir/api/iir_client/api/iir_api/iir_api_update_issuer.py index ef583a4..2cc81d9 100644 --- a/ce/iir/api/iir_client/api/iir_api/iir_api_update_issuer.py +++ b/ce/iir/api/iir_client/api/iir_api/iir_api_update_issuer.py @@ -7,12 +7,12 @@ from ...client import AuthenticatedClient, Client from ...models.iir_api_update_issuer_response_200 import IirApiUpdateIssuerResponse200 from ...models.pub_issuer_dto import PubIssuerDTO -from ...types import UNSET, Response +from ...types import Response def _get_kwargs( *, - body: PubIssuerDTO | PubIssuerDTO | Unset = UNSET, + body: PubIssuerDTO, ) -> dict[str, Any]: headers: dict[str, Any] = {} @@ -21,13 +21,8 @@ def _get_kwargs( "url": "/iir-api/updateIssuer", } - if isinstance(body, PubIssuerDTO): - _kwargs["json"] = body.to_dict() - - headers["Content-Type"] = "application/json" - if isinstance(body, PubIssuerDTO): - _kwargs["data"] = body.to_dict() - headers["Content-Type"] = "application/x-www-form-urlencoded" + _kwargs["data"] = body.to_dict() + headers["Content-Type"] = "application/x-www-form-urlencoded" _kwargs["headers"] = headers return _kwargs @@ -61,12 +56,11 @@ def _build_response( def sync_detailed( *, client: AuthenticatedClient | Client, - body: PubIssuerDTO | PubIssuerDTO | Unset = UNSET, + body: PubIssuerDTO, ) -> Response[IirApiUpdateIssuerResponse200]: """ Args: body (PubIssuerDTO): - body (PubIssuerDTO): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -90,12 +84,11 @@ def sync_detailed( def sync( *, client: AuthenticatedClient | Client, - body: PubIssuerDTO | PubIssuerDTO | Unset = UNSET, + body: PubIssuerDTO, ) -> IirApiUpdateIssuerResponse200 | None: """ Args: body (PubIssuerDTO): - body (PubIssuerDTO): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -114,12 +107,11 @@ def sync( async def asyncio_detailed( *, client: AuthenticatedClient | Client, - body: PubIssuerDTO | PubIssuerDTO | Unset = UNSET, + body: PubIssuerDTO, ) -> Response[IirApiUpdateIssuerResponse200]: """ Args: body (PubIssuerDTO): - body (PubIssuerDTO): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -141,12 +133,11 @@ async def asyncio_detailed( async def asyncio( *, client: AuthenticatedClient | Client, - body: PubIssuerDTO | PubIssuerDTO | Unset = UNSET, + body: PubIssuerDTO, ) -> IirApiUpdateIssuerResponse200 | None: """ Args: body (PubIssuerDTO): - body (PubIssuerDTO): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. diff --git a/ce/iir/api/iir_client/api/iir_api/iir_api_validate_jwt_signature.py b/ce/iir/api/iir_client/api/iir_api/iir_api_validate_jwt_signature.py index 888fb4f..b3fc42f 100644 --- a/ce/iir/api/iir_client/api/iir_api/iir_api_validate_jwt_signature.py +++ b/ce/iir/api/iir_client/api/iir_api/iir_api_validate_jwt_signature.py @@ -7,12 +7,12 @@ from ...client import AuthenticatedClient, Client from ...models.iir_api_validate_jwt_signature_response_200 import IirApiValidateJwtSignatureResponse200 from ...models.validate_jwt_request import ValidateJwtRequest -from ...types import UNSET, Response +from ...types import Response def _get_kwargs( *, - body: ValidateJwtRequest | ValidateJwtRequest | Unset = UNSET, + body: ValidateJwtRequest, ) -> dict[str, Any]: headers: dict[str, Any] = {} @@ -21,13 +21,8 @@ def _get_kwargs( "url": "/iir-api/validateJwt", } - if isinstance(body, ValidateJwtRequest): - _kwargs["json"] = body.to_dict() - - headers["Content-Type"] = "application/json" - if isinstance(body, ValidateJwtRequest): - _kwargs["data"] = body.to_dict() - headers["Content-Type"] = "application/x-www-form-urlencoded" + _kwargs["data"] = body.to_dict() + headers["Content-Type"] = "application/x-www-form-urlencoded" _kwargs["headers"] = headers return _kwargs @@ -61,12 +56,11 @@ def _build_response( def sync_detailed( *, client: AuthenticatedClient | Client, - body: ValidateJwtRequest | ValidateJwtRequest | Unset = UNSET, + body: ValidateJwtRequest, ) -> Response[IirApiValidateJwtSignatureResponse200]: """ Args: body (ValidateJwtRequest): - body (ValidateJwtRequest): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -90,12 +84,11 @@ def sync_detailed( def sync( *, client: AuthenticatedClient | Client, - body: ValidateJwtRequest | ValidateJwtRequest | Unset = UNSET, + body: ValidateJwtRequest, ) -> IirApiValidateJwtSignatureResponse200 | None: """ Args: body (ValidateJwtRequest): - body (ValidateJwtRequest): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -114,12 +107,11 @@ def sync( async def asyncio_detailed( *, client: AuthenticatedClient | Client, - body: ValidateJwtRequest | ValidateJwtRequest | Unset = UNSET, + body: ValidateJwtRequest, ) -> Response[IirApiValidateJwtSignatureResponse200]: """ Args: body (ValidateJwtRequest): - body (ValidateJwtRequest): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. @@ -141,12 +133,11 @@ async def asyncio_detailed( async def asyncio( *, client: AuthenticatedClient | Client, - body: ValidateJwtRequest | ValidateJwtRequest | Unset = UNSET, + body: ValidateJwtRequest, ) -> IirApiValidateJwtSignatureResponse200 | None: """ Args: body (ValidateJwtRequest): - body (ValidateJwtRequest): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. diff --git a/ce/iir/openapi.json b/ce/iir/openapi.json index 57f1ac1..e0482a3 100644 --- a/ce/iir/openapi.json +++ b/ce/iir/openapi.json @@ -316,26 +316,6 @@ "operationId": "IIRApi_CreateChallenges", "requestBody": { "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateChallengesRequest" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/CreateChallengesRequest" - } - }, - "application/xml": { - "schema": { - "$ref": "#/components/schemas/CreateChallengesRequest" - } - }, - "text/xml": { - "schema": { - "$ref": "#/components/schemas/CreateChallengesRequest" - } - }, "application/x-www-form-urlencoded": { "schema": { "$ref": "#/components/schemas/CreateChallengesRequest" @@ -393,26 +373,6 @@ "operationId": "IIRApi_ValidateJwtSignature", "requestBody": { "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ValidateJwtRequest" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/ValidateJwtRequest" - } - }, - "application/xml": { - "schema": { - "$ref": "#/components/schemas/ValidateJwtRequest" - } - }, - "text/xml": { - "schema": { - "$ref": "#/components/schemas/ValidateJwtRequest" - } - }, "application/x-www-form-urlencoded": { "schema": { "$ref": "#/components/schemas/ValidateJwtRequest" @@ -458,26 +418,6 @@ "operationId": "IIRApi_SaveChallengeToken", "requestBody": { "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SaveChallengeTokenRequest" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/SaveChallengeTokenRequest" - } - }, - "application/xml": { - "schema": { - "$ref": "#/components/schemas/SaveChallengeTokenRequest" - } - }, - "text/xml": { - "schema": { - "$ref": "#/components/schemas/SaveChallengeTokenRequest" - } - }, "application/x-www-form-urlencoded": { "schema": { "$ref": "#/components/schemas/SaveChallengeTokenRequest" @@ -842,26 +782,6 @@ "requestBodies": { "PubIssuerDTO": { "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PubIssuerDTO" - } - }, - "text/json": { - "schema": { - "$ref": "#/components/schemas/PubIssuerDTO" - } - }, - "application/xml": { - "schema": { - "$ref": "#/components/schemas/PubIssuerDTO" - } - }, - "text/xml": { - "schema": { - "$ref": "#/components/schemas/PubIssuerDTO" - } - }, "application/x-www-form-urlencoded": { "schema": { "$ref": "#/components/schemas/PubIssuerDTO" diff --git a/ce/iir/prepare_openapi.py b/ce/iir/prepare_openapi.py index 297d591..30c507e 100644 --- a/ce/iir/prepare_openapi.py +++ b/ce/iir/prepare_openapi.py @@ -6,6 +6,12 @@ of challenge objects. Left alone, the generated client cannot read a real answer. This script fixes the document so the client is generated, not edited by hand. Remove a fix here once the IIR API's own Swagger is correct. + +It also keeps one request body type per operation. The IIR Swagger offers the same body as JSON, form, +text/json and XML. The generator cannot write XML or text/json, and when two supported types share one +schema it writes `body: X | X | Unset` and leaves `Unset` out of the imports, so the module fails to import +on Python 3.13 (3.14 evaluates annotations late and hides it). Form is kept because it is what the client +has always sent: the old client set both `json` and `data`, and httpx sends `data` (form) when both are given. """ import json @@ -14,6 +20,9 @@ # (path, method, status) of each response that is really an array of the schema the spec gives. ARRAY_RESPONSES = [("/iir-api/createChallenges", "post", "200")] +# The one request body type kept, when an operation offers it. Other types are removed from every operation. +KEPT_REQUEST_TYPE = "application/x-www-form-urlencoded" + def prepare(document: dict) -> int: changed = 0 @@ -24,9 +33,31 @@ def prepare(document: dict) -> int: if schema.get("type") != "array": media["schema"] = {"type": "array", "items": schema} changed += 1 + changed += keep_one_request_type(document) return changed +def keep_one_request_type(document: dict) -> int: + # Request bodies are written in the operation or shared under components.requestBodies. + bodies = [ + operation.get("requestBody", {}) + for operations in document["paths"].values() + for operation in operations.values() + if isinstance(operation, dict) + ] + bodies += document.get("components", {}).get("requestBodies", {}).values() + + dropped = 0 + for body in bodies: + content = body.get("content", {}) + if KEPT_REQUEST_TYPE not in content: + continue + for media_type in [name for name in content if name != KEPT_REQUEST_TYPE]: + del content[media_type] + dropped += 1 + return dropped + + def main(path: str) -> None: with open(path, encoding="utf-8") as f: document = json.load(f) @@ -34,7 +65,7 @@ def main(path: str) -> None: with open(path, "w", encoding="utf-8", newline="\n") as f: json.dump(document, f, indent=4) f.write("\n") - print(f"{path}: {changed} schema(s) made arrays") + print(f"{path}: {changed} change(s) made") if __name__ == "__main__":