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

1# Code generated by openapi-python-client from hush-hush/api/openapi.yaml; DO NOT EDIT. 

2 

3from http import HTTPStatus 

4from typing import Any 

5 

6import httpx 

7 

8from ... import errors 

9from ...client import AuthenticatedClient, Client 

10from ...models.health import Health 

11from ...types import Response 

12 

13 

14def _get_kwargs() -> dict[str, Any]: 

15 

16 _kwargs: dict[str, Any] = { 

17 "method": "get", 

18 "url": "/healthz", 

19 } 

20 

21 return _kwargs 

22 

23 

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()) 

29 

30 return response_200 

31 

32 if client.raise_on_unexpected_status: 

33 raise errors.UnexpectedStatus(response.status_code, response.content) 

34 else: 

35 return None 

36 

37 

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 ) 

47 

48 

49def sync_detailed( 

50 *, 

51 client: AuthenticatedClient | Client, 

52) -> Response[Health]: 

53 """Liveness 

54 

55 Answers 200 unconditionally. There's nothing behind this service to 

56 be unavailable. 

57 

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. 

61 

62 Returns: 

63 Response[Health] 

64 """ 

65 

66 kwargs = _get_kwargs() 

67 

68 response = client.get_httpx_client().request( 

69 **kwargs, 

70 ) 

71 

72 return _build_response(client=client, response=response) 

73 

74 

75def sync( 

76 *, 

77 client: AuthenticatedClient | Client, 

78) -> Health | None: 

79 """Liveness 

80 

81 Answers 200 unconditionally. There's nothing behind this service to 

82 be unavailable. 

83 

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. 

87 

88 Returns: 

89 Health 

90 """ 

91 

92 return sync_detailed( 

93 client=client, 

94 ).parsed 

95 

96 

97async def asyncio_detailed( 

98 *, 

99 client: AuthenticatedClient | Client, 

100) -> Response[Health]: 

101 """Liveness 

102 

103 Answers 200 unconditionally. There's nothing behind this service to 

104 be unavailable. 

105 

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. 

109 

110 Returns: 

111 Response[Health] 

112 """ 

113 

114 kwargs = _get_kwargs() 

115 

116 response = await client.get_async_httpx_client().request(**kwargs) 

117 

118 return _build_response(client=client, response=response) 

119 

120 

121async def asyncio( 

122 *, 

123 client: AuthenticatedClient | Client, 

124) -> Health | None: 

125 """Liveness 

126 

127 Answers 200 unconditionally. There's nothing behind this service to 

128 be unavailable. 

129 

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. 

133 

134 Returns: 

135 Health 

136 """ 

137 

138 return ( 

139 await asyncio_detailed( 

140 client=client, 

141 ) 

142 ).parsed