Coverage for src/hush_hush/_generated/api/health/health.py: 45%
31 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.health import Health
11from ...types import Response
14def _get_kwargs() -> dict[str, Any]:
16 _kwargs: dict[str, Any] = {
17 "method": "get",
18 "url": "/healthz",
19 }
21 return _kwargs
24def _parse_response(
25 *, client: AuthenticatedClient | Client, response: httpx.Response
26) -> Health | None:
27 if response.status_code == 200:
28 response_200 = Health.from_dict(response.json())
30 return response_200
32 if client.raise_on_unexpected_status:
33 raise errors.UnexpectedStatus(response.status_code, response.content)
34 else:
35 return None
38def _build_response(
39 *, client: AuthenticatedClient | Client, response: httpx.Response
40) -> Response[Health]:
41 return Response(
42 status_code=HTTPStatus(response.status_code),
43 content=response.content,
44 headers=response.headers,
45 parsed=_parse_response(client=client, response=response),
46 )
49def sync_detailed(
50 *,
51 client: AuthenticatedClient | Client,
52) -> Response[Health]:
53 """Liveness
55 Answers 200 unconditionally. There's nothing behind this service to
56 be unavailable.
58 Raises:
59 errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
60 httpx.TimeoutException: If the request takes longer than Client.timeout.
62 Returns:
63 Response[Health]
64 """
66 kwargs = _get_kwargs()
68 response = client.get_httpx_client().request(
69 **kwargs,
70 )
72 return _build_response(client=client, response=response)
75def sync(
76 *,
77 client: AuthenticatedClient | Client,
78) -> Health | None:
79 """Liveness
81 Answers 200 unconditionally. There's nothing behind this service to
82 be unavailable.
84 Raises:
85 errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
86 httpx.TimeoutException: If the request takes longer than Client.timeout.
88 Returns:
89 Health
90 """
92 return sync_detailed(
93 client=client,
94 ).parsed
97async def asyncio_detailed(
98 *,
99 client: AuthenticatedClient | Client,
100) -> Response[Health]:
101 """Liveness
103 Answers 200 unconditionally. There's nothing behind this service to
104 be unavailable.
106 Raises:
107 errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
108 httpx.TimeoutException: If the request takes longer than Client.timeout.
110 Returns:
111 Response[Health]
112 """
114 kwargs = _get_kwargs()
116 response = await client.get_async_httpx_client().request(**kwargs)
118 return _build_response(client=client, response=response)
121async def asyncio(
122 *,
123 client: AuthenticatedClient | Client,
124) -> Health | None:
125 """Liveness
127 Answers 200 unconditionally. There's nothing behind this service to
128 be unavailable.
130 Raises:
131 errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
132 httpx.TimeoutException: If the request takes longer than Client.timeout.
134 Returns:
135 Health
136 """
138 return (
139 await asyncio_detailed(
140 client=client,
141 )
142 ).parsed