Coverage for src/hush_hush/_generated/api/auth/begin_login.py: 0%
38 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
6import httpx
8from ... import errors
9from ...client import AuthenticatedClient, Client
10from ...models.error import Error
11from ...models.login_options import LoginOptions
12from ...types import Response
15def _get_kwargs() -> dict[str, Any]:
17 _kwargs: dict[str, Any] = {
18 "method": "post",
19 "url": "/auth/login/begin",
20 }
22 return _kwargs
25def _parse_response(
26 *, client: AuthenticatedClient | Client, response: httpx.Response
27) -> Error | LoginOptions | None:
28 if response.status_code == 200:
29 response_200 = LoginOptions.from_dict(response.json())
31 return response_200
33 if response.status_code == 400:
34 response_400 = Error.from_dict(response.json())
36 return response_400
38 if response.status_code == 413:
39 response_413 = Error.from_dict(response.json())
41 return response_413
43 if client.raise_on_unexpected_status:
44 raise errors.UnexpectedStatus(response.status_code, response.content)
45 else:
46 return None
49def _build_response(
50 *, client: AuthenticatedClient | Client, response: httpx.Response
51) -> Response[Error | LoginOptions]:
52 return Response(
53 status_code=HTTPStatus(response.status_code),
54 content=response.content,
55 headers=response.headers,
56 parsed=_parse_response(client=client, response=response),
57 )
60def sync_detailed(
61 *,
62 client: AuthenticatedClient | Client,
63) -> Response[Error | LoginOptions]:
64 """Begin passkey login
66 Starts a WebAuthn login ceremony and returns the credential-request
67 options a browser passes to `navigator.credentials.get()`.
69 Raises:
70 errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
71 httpx.TimeoutException: If the request takes longer than Client.timeout.
73 Returns:
74 Response[Error | LoginOptions]
75 """
77 kwargs = _get_kwargs()
79 response = client.get_httpx_client().request(
80 **kwargs,
81 )
83 return _build_response(client=client, response=response)
86def sync(
87 *,
88 client: AuthenticatedClient | Client,
89) -> Error | LoginOptions | None:
90 """Begin passkey login
92 Starts a WebAuthn login ceremony and returns the credential-request
93 options a browser passes to `navigator.credentials.get()`.
95 Raises:
96 errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
97 httpx.TimeoutException: If the request takes longer than Client.timeout.
99 Returns:
100 Error | LoginOptions
101 """
103 return sync_detailed(
104 client=client,
105 ).parsed
108async def asyncio_detailed(
109 *,
110 client: AuthenticatedClient | Client,
111) -> Response[Error | LoginOptions]:
112 """Begin passkey login
114 Starts a WebAuthn login ceremony and returns the credential-request
115 options a browser passes to `navigator.credentials.get()`.
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 Response[Error | LoginOptions]
123 """
125 kwargs = _get_kwargs()
127 response = await client.get_async_httpx_client().request(**kwargs)
129 return _build_response(client=client, response=response)
132async def asyncio(
133 *,
134 client: AuthenticatedClient | Client,
135) -> Error | LoginOptions | None:
136 """Begin passkey login
138 Starts a WebAuthn login ceremony and returns the credential-request
139 options a browser passes to `navigator.credentials.get()`.
141 Raises:
142 errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
143 httpx.TimeoutException: If the request takes longer than Client.timeout.
145 Returns:
146 Error | LoginOptions
147 """
149 return (
150 await asyncio_detailed(
151 client=client,
152 )
153 ).parsed