Coverage for src/hush_hush/_generated/api/objects/list_objects.py: 0%
54 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.object_metadata import ObjectMetadata
12from ...types import UNSET, Response, Unset
15def _get_kwargs(
16 *,
17 used_by: str | Unset = UNSET,
18 tag: list[str] | Unset = UNSET,
19 limit: int | Unset = 50,
20 offset: int | Unset = UNSET,
21) -> dict[str, Any]:
23 params: dict[str, Any] = {}
25 params["used_by"] = used_by
27 json_tag: list[str] | Unset = UNSET
28 if not isinstance(tag, Unset):
29 json_tag = tag
31 params["tag"] = json_tag
33 params["limit"] = limit
35 params["offset"] = offset
37 params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
39 _kwargs: dict[str, Any] = {
40 "method": "get",
41 "url": "/objects",
42 "params": params,
43 }
45 return _kwargs
48def _parse_response(
49 *, client: AuthenticatedClient | Client, response: httpx.Response
50) -> Error | list[ObjectMetadata] | None:
51 if response.status_code == 200:
52 response_200 = []
53 _response_200 = response.json()
54 for response_200_item_data in _response_200:
55 response_200_item = ObjectMetadata.from_dict(response_200_item_data)
57 response_200.append(response_200_item)
59 return response_200
61 if response.status_code == 400:
62 response_400 = Error.from_dict(response.json())
64 return response_400
66 if response.status_code == 401:
67 response_401 = Error.from_dict(response.json())
69 return response_401
71 if response.status_code == 422:
72 response_422 = Error.from_dict(response.json())
74 return response_422
76 if client.raise_on_unexpected_status:
77 raise errors.UnexpectedStatus(response.status_code, response.content)
78 else:
79 return None
82def _build_response(
83 *, client: AuthenticatedClient | Client, response: httpx.Response
84) -> Response[Error | list[ObjectMetadata]]:
85 return Response(
86 status_code=HTTPStatus(response.status_code),
87 content=response.content,
88 headers=response.headers,
89 parsed=_parse_response(client=client, response=response),
90 )
93def sync_detailed(
94 *,
95 client: AuthenticatedClient,
96 used_by: str | Unset = UNSET,
97 tag: list[str] | Unset = UNSET,
98 limit: int | Unset = 50,
99 offset: int | Unset = UNSET,
100) -> Response[Error | list[ObjectMetadata]]:
101 """List stored objects
103 Returns every stored object's metadata (slug, used_by, tags,
104 description, and who created and last updated it and when) - never
105 the sealed value, and never the internal id as something
106 addressable. Gated by a write token or a session unlike every
107 other read path here: a slug-scoped read only ever discloses what
108 a caller already knows the slug of, but enumerating every object
109 is a capability none of those reads grant on their own. The web UI
110 holds a session, never a bearer token, and uses this for its
111 secrets overview - the two credentials are equally valid here
112 (auth/spec.md's "A session authenticates secret-object access"
113 requirement).
115 Args:
116 used_by (str | Unset):
117 tag (list[str] | Unset):
118 limit (int | Unset): Default: 50.
119 offset (int | Unset):
121 Raises:
122 errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
123 httpx.TimeoutException: If the request takes longer than Client.timeout.
125 Returns:
126 Response[Error | list[ObjectMetadata]]
127 """
129 kwargs = _get_kwargs(
130 used_by=used_by,
131 tag=tag,
132 limit=limit,
133 offset=offset,
134 )
136 response = client.get_httpx_client().request(
137 **kwargs,
138 )
140 return _build_response(client=client, response=response)
143def sync(
144 *,
145 client: AuthenticatedClient,
146 used_by: str | Unset = UNSET,
147 tag: list[str] | Unset = UNSET,
148 limit: int | Unset = 50,
149 offset: int | Unset = UNSET,
150) -> Error | list[ObjectMetadata] | None:
151 """List stored objects
153 Returns every stored object's metadata (slug, used_by, tags,
154 description, and who created and last updated it and when) - never
155 the sealed value, and never the internal id as something
156 addressable. Gated by a write token or a session unlike every
157 other read path here: a slug-scoped read only ever discloses what
158 a caller already knows the slug of, but enumerating every object
159 is a capability none of those reads grant on their own. The web UI
160 holds a session, never a bearer token, and uses this for its
161 secrets overview - the two credentials are equally valid here
162 (auth/spec.md's "A session authenticates secret-object access"
163 requirement).
165 Args:
166 used_by (str | Unset):
167 tag (list[str] | Unset):
168 limit (int | Unset): Default: 50.
169 offset (int | Unset):
171 Raises:
172 errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
173 httpx.TimeoutException: If the request takes longer than Client.timeout.
175 Returns:
176 Error | list[ObjectMetadata]
177 """
179 return sync_detailed(
180 client=client,
181 used_by=used_by,
182 tag=tag,
183 limit=limit,
184 offset=offset,
185 ).parsed
188async def asyncio_detailed(
189 *,
190 client: AuthenticatedClient,
191 used_by: str | Unset = UNSET,
192 tag: list[str] | Unset = UNSET,
193 limit: int | Unset = 50,
194 offset: int | Unset = UNSET,
195) -> Response[Error | list[ObjectMetadata]]:
196 """List stored objects
198 Returns every stored object's metadata (slug, used_by, tags,
199 description, and who created and last updated it and when) - never
200 the sealed value, and never the internal id as something
201 addressable. Gated by a write token or a session unlike every
202 other read path here: a slug-scoped read only ever discloses what
203 a caller already knows the slug of, but enumerating every object
204 is a capability none of those reads grant on their own. The web UI
205 holds a session, never a bearer token, and uses this for its
206 secrets overview - the two credentials are equally valid here
207 (auth/spec.md's "A session authenticates secret-object access"
208 requirement).
210 Args:
211 used_by (str | Unset):
212 tag (list[str] | Unset):
213 limit (int | Unset): Default: 50.
214 offset (int | Unset):
216 Raises:
217 errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
218 httpx.TimeoutException: If the request takes longer than Client.timeout.
220 Returns:
221 Response[Error | list[ObjectMetadata]]
222 """
224 kwargs = _get_kwargs(
225 used_by=used_by,
226 tag=tag,
227 limit=limit,
228 offset=offset,
229 )
231 response = await client.get_async_httpx_client().request(**kwargs)
233 return _build_response(client=client, response=response)
236async def asyncio(
237 *,
238 client: AuthenticatedClient,
239 used_by: str | Unset = UNSET,
240 tag: list[str] | Unset = UNSET,
241 limit: int | Unset = 50,
242 offset: int | Unset = UNSET,
243) -> Error | list[ObjectMetadata] | None:
244 """List stored objects
246 Returns every stored object's metadata (slug, used_by, tags,
247 description, and who created and last updated it and when) - never
248 the sealed value, and never the internal id as something
249 addressable. Gated by a write token or a session unlike every
250 other read path here: a slug-scoped read only ever discloses what
251 a caller already knows the slug of, but enumerating every object
252 is a capability none of those reads grant on their own. The web UI
253 holds a session, never a bearer token, and uses this for its
254 secrets overview - the two credentials are equally valid here
255 (auth/spec.md's "A session authenticates secret-object access"
256 requirement).
258 Args:
259 used_by (str | Unset):
260 tag (list[str] | Unset):
261 limit (int | Unset): Default: 50.
262 offset (int | Unset):
264 Raises:
265 errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
266 httpx.TimeoutException: If the request takes longer than Client.timeout.
268 Returns:
269 Error | list[ObjectMetadata]
270 """
272 return (
273 await asyncio_detailed(
274 client=client,
275 used_by=used_by,
276 tag=tag,
277 limit=limit,
278 offset=offset,
279 )
280 ).parsed