Coverage for src/hush_hush/_generated/api/auth/finish_login.py: 0%
42 statements
« prev ^ index » next coverage.py v7.16.0, created at 2026-10-16 16:01 +0000
« prev ^ index » next coverage.py v7.16.0, created at 2026-10-16 16:01 +0000
1# Code generated by openapi-python-client from hush-hush/api/openapi.yaml; DO NOT EDIT.
3from http import HTTPStatus
4from typing import Any, cast
6import httpx
8from ... import errors
9from ...client import AuthenticatedClient, Client
10from ...models.error import Error
11from ...models.login_finish_request import LoginFinishRequest
12from ...types import Response
15def _get_kwargs(
16 *,
17 body: LoginFinishRequest,
18) -> dict[str, Any]:
19 headers: dict[str, Any] = {}
21 _kwargs: dict[str, Any] = {
22 "method": "post",
23 "url": "/auth/login/finish",
24 }
26 _kwargs["json"] = body.to_dict()
28 headers["Content-Type"] = "application/json"
30 _kwargs["headers"] = headers
31 return _kwargs
34def _parse_response(
35 *, client: AuthenticatedClient | Client, response: httpx.Response
36) -> Any | Error | None:
37 if response.status_code == 204:
38 response_204 = cast(Any, None)
39 return response_204
41 if response.status_code == 401:
42 response_401 = Error.from_dict(response.json())
44 return response_401
46 if response.status_code == 413:
47 response_413 = Error.from_dict(response.json())
49 return response_413
51 if client.raise_on_unexpected_status:
52 raise errors.UnexpectedStatus(response.status_code, response.content)
53 else:
54 return None
57def _build_response(
58 *, client: AuthenticatedClient | Client, response: httpx.Response
59) -> Response[Any | Error]:
60 return Response(
61 status_code=HTTPStatus(response.status_code),
62 content=response.content,
63 headers=response.headers,
64 parsed=_parse_response(client=client, response=response),
65 )
68def sync_detailed(
69 *,
70 client: AuthenticatedClient | Client,
71 body: LoginFinishRequest,
72) -> Response[Any | Error]:
73 """Complete passkey login
75 Verifies the browser's assertion response against a registered
76 credential and, on success, issues a session. Also rejects a
77 credential whose signature counter didn't advance, a sign a
78 cloned authenticator was used.
80 Args:
81 body (LoginFinishRequest):
83 Raises:
84 errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
85 httpx.TimeoutException: If the request takes longer than Client.timeout.
87 Returns:
88 Response[Any | Error]
89 """
91 kwargs = _get_kwargs(
92 body=body,
93 )
95 response = client.get_httpx_client().request(
96 **kwargs,
97 )
99 return _build_response(client=client, response=response)
102def sync(
103 *,
104 client: AuthenticatedClient | Client,
105 body: LoginFinishRequest,
106) -> Any | Error | None:
107 """Complete passkey login
109 Verifies the browser's assertion response against a registered
110 credential and, on success, issues a session. Also rejects a
111 credential whose signature counter didn't advance, a sign a
112 cloned authenticator was used.
114 Args:
115 body (LoginFinishRequest):
117 Raises:
118 errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
119 httpx.TimeoutException: If the request takes longer than Client.timeout.
121 Returns:
122 Any | Error
123 """
125 return sync_detailed(
126 client=client,
127 body=body,
128 ).parsed
131async def asyncio_detailed(
132 *,
133 client: AuthenticatedClient | Client,
134 body: LoginFinishRequest,
135) -> Response[Any | Error]:
136 """Complete passkey login
138 Verifies the browser's assertion response against a registered
139 credential and, on success, issues a session. Also rejects a
140 credential whose signature counter didn't advance, a sign a
141 cloned authenticator was used.
143 Args:
144 body (LoginFinishRequest):
146 Raises:
147 errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
148 httpx.TimeoutException: If the request takes longer than Client.timeout.
150 Returns:
151 Response[Any | Error]
152 """
154 kwargs = _get_kwargs(
155 body=body,
156 )
158 response = await client.get_async_httpx_client().request(**kwargs)
160 return _build_response(client=client, response=response)
163async def asyncio(
164 *,
165 client: AuthenticatedClient | Client,
166 body: LoginFinishRequest,
167) -> Any | Error | None:
168 """Complete passkey login
170 Verifies the browser's assertion response against a registered
171 credential and, on success, issues a session. Also rejects a
172 credential whose signature counter didn't advance, a sign a
173 cloned authenticator was used.
175 Args:
176 body (LoginFinishRequest):
178 Raises:
179 errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
180 httpx.TimeoutException: If the request takes longer than Client.timeout.
182 Returns:
183 Any | Error
184 """
186 return (
187 await asyncio_detailed(
188 client=client,
189 body=body,
190 )
191 ).parsed