Coverage for src/hush_hush/_generated/api/credentials/list_credentials.py: 0%
46 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.credential import Credential
11from ...models.error import Error
12from ...types import UNSET, Response, Unset
15def _get_kwargs(
16 *,
17 limit: int | Unset = 50,
18 offset: int | Unset = UNSET,
19) -> dict[str, Any]:
21 params: dict[str, Any] = {}
23 params["limit"] = limit
25 params["offset"] = offset
27 params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
29 _kwargs: dict[str, Any] = {
30 "method": "get",
31 "url": "/credentials",
32 "params": params,
33 }
35 return _kwargs
38def _parse_response(
39 *, client: AuthenticatedClient | Client, response: httpx.Response
40) -> Error | list[Credential] | None:
41 if response.status_code == 200:
42 response_200 = []
43 _response_200 = response.json()
44 for response_200_item_data in _response_200:
45 response_200_item = Credential.from_dict(response_200_item_data)
47 response_200.append(response_200_item)
49 return response_200
51 if response.status_code == 400:
52 response_400 = Error.from_dict(response.json())
54 return response_400
56 if response.status_code == 401:
57 response_401 = Error.from_dict(response.json())
59 return response_401
61 if client.raise_on_unexpected_status:
62 raise errors.UnexpectedStatus(response.status_code, response.content)
63 else:
64 return None
67def _build_response(
68 *, client: AuthenticatedClient | Client, response: httpx.Response
69) -> Response[Error | list[Credential]]:
70 return Response(
71 status_code=HTTPStatus(response.status_code),
72 content=response.content,
73 headers=response.headers,
74 parsed=_parse_response(client=client, response=response),
75 )
78def sync_detailed(
79 *,
80 client: AuthenticatedClient,
81 limit: int | Unset = 50,
82 offset: int | Unset = UNSET,
83) -> Response[Error | list[Credential]]:
84 """List registered passkeys
86 Returns every credential registered to the admin account -
87 nickname, timestamps, never the public key material.
89 Args:
90 limit (int | Unset): Default: 50.
91 offset (int | Unset):
93 Raises:
94 errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
95 httpx.TimeoutException: If the request takes longer than Client.timeout.
97 Returns:
98 Response[Error | list[Credential]]
99 """
101 kwargs = _get_kwargs(
102 limit=limit,
103 offset=offset,
104 )
106 response = client.get_httpx_client().request(
107 **kwargs,
108 )
110 return _build_response(client=client, response=response)
113def sync(
114 *,
115 client: AuthenticatedClient,
116 limit: int | Unset = 50,
117 offset: int | Unset = UNSET,
118) -> Error | list[Credential] | None:
119 """List registered passkeys
121 Returns every credential registered to the admin account -
122 nickname, timestamps, never the public key material.
124 Args:
125 limit (int | Unset): Default: 50.
126 offset (int | Unset):
128 Raises:
129 errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
130 httpx.TimeoutException: If the request takes longer than Client.timeout.
132 Returns:
133 Error | list[Credential]
134 """
136 return sync_detailed(
137 client=client,
138 limit=limit,
139 offset=offset,
140 ).parsed
143async def asyncio_detailed(
144 *,
145 client: AuthenticatedClient,
146 limit: int | Unset = 50,
147 offset: int | Unset = UNSET,
148) -> Response[Error | list[Credential]]:
149 """List registered passkeys
151 Returns every credential registered to the admin account -
152 nickname, timestamps, never the public key material.
154 Args:
155 limit (int | Unset): Default: 50.
156 offset (int | Unset):
158 Raises:
159 errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
160 httpx.TimeoutException: If the request takes longer than Client.timeout.
162 Returns:
163 Response[Error | list[Credential]]
164 """
166 kwargs = _get_kwargs(
167 limit=limit,
168 offset=offset,
169 )
171 response = await client.get_async_httpx_client().request(**kwargs)
173 return _build_response(client=client, response=response)
176async def asyncio(
177 *,
178 client: AuthenticatedClient,
179 limit: int | Unset = 50,
180 offset: int | Unset = UNSET,
181) -> Error | list[Credential] | None:
182 """List registered passkeys
184 Returns every credential registered to the admin account -
185 nickname, timestamps, never the public key material.
187 Args:
188 limit (int | Unset): Default: 50.
189 offset (int | Unset):
191 Raises:
192 errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
193 httpx.TimeoutException: If the request takes longer than Client.timeout.
195 Returns:
196 Error | list[Credential]
197 """
199 return (
200 await asyncio_detailed(
201 client=client,
202 limit=limit,
203 offset=offset,
204 )
205 ).parsed