Coverage for src/hush_hush/_generated/api/auth/get_auth_status.py: 0%

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.auth_status import AuthStatus 

11from ...types import Response 

12 

13 

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

15 

16 _kwargs: dict[str, Any] = { 

17 "method": "get", 

18 "url": "/auth/status", 

19 } 

20 

21 return _kwargs 

22 

23 

24def _parse_response( 

25 *, client: AuthenticatedClient | Client, response: httpx.Response 

26) -> AuthStatus | None: 

27 if response.status_code == 200: 

28 response_200 = AuthStatus.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[AuthStatus]: 

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[AuthStatus]: 

53 """Report whether an admin account exists and whether the caller has a session 

54 

55 A read-only, side-effect-free check the login page uses to decide 

56 whether to offer registering the first passkey or logging in with 

57 one - no cookie set, no ceremony started. Leaks nothing new: 

58 `POST /auth/login/begin` already reveals this same boolean today 

59 via its 400 error body 

60 (openspec/changes/gate-passkey-registration-ui/design.md). 

61 `authenticated` reports only the caller's own state, so the web UI 

62 can tell whether to show the signed-in navigation without probing 

63 a credentialed endpoint and being answered with a 401. 

64 

65 Raises: 

66 errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. 

67 httpx.TimeoutException: If the request takes longer than Client.timeout. 

68 

69 Returns: 

70 Response[AuthStatus] 

71 """ 

72 

73 kwargs = _get_kwargs() 

74 

75 response = client.get_httpx_client().request( 

76 **kwargs, 

77 ) 

78 

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

80 

81 

82def sync( 

83 *, 

84 client: AuthenticatedClient | Client, 

85) -> AuthStatus | None: 

86 """Report whether an admin account exists and whether the caller has a session 

87 

88 A read-only, side-effect-free check the login page uses to decide 

89 whether to offer registering the first passkey or logging in with 

90 one - no cookie set, no ceremony started. Leaks nothing new: 

91 `POST /auth/login/begin` already reveals this same boolean today 

92 via its 400 error body 

93 (openspec/changes/gate-passkey-registration-ui/design.md). 

94 `authenticated` reports only the caller's own state, so the web UI 

95 can tell whether to show the signed-in navigation without probing 

96 a credentialed endpoint and being answered with a 401. 

97 

98 Raises: 

99 errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. 

100 httpx.TimeoutException: If the request takes longer than Client.timeout. 

101 

102 Returns: 

103 AuthStatus 

104 """ 

105 

106 return sync_detailed( 

107 client=client, 

108 ).parsed 

109 

110 

111async def asyncio_detailed( 

112 *, 

113 client: AuthenticatedClient | Client, 

114) -> Response[AuthStatus]: 

115 """Report whether an admin account exists and whether the caller has a session 

116 

117 A read-only, side-effect-free check the login page uses to decide 

118 whether to offer registering the first passkey or logging in with 

119 one - no cookie set, no ceremony started. Leaks nothing new: 

120 `POST /auth/login/begin` already reveals this same boolean today 

121 via its 400 error body 

122 (openspec/changes/gate-passkey-registration-ui/design.md). 

123 `authenticated` reports only the caller's own state, so the web UI 

124 can tell whether to show the signed-in navigation without probing 

125 a credentialed endpoint and being answered with a 401. 

126 

127 Raises: 

128 errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. 

129 httpx.TimeoutException: If the request takes longer than Client.timeout. 

130 

131 Returns: 

132 Response[AuthStatus] 

133 """ 

134 

135 kwargs = _get_kwargs() 

136 

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

138 

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

140 

141 

142async def asyncio( 

143 *, 

144 client: AuthenticatedClient | Client, 

145) -> AuthStatus | None: 

146 """Report whether an admin account exists and whether the caller has a session 

147 

148 A read-only, side-effect-free check the login page uses to decide 

149 whether to offer registering the first passkey or logging in with 

150 one - no cookie set, no ceremony started. Leaks nothing new: 

151 `POST /auth/login/begin` already reveals this same boolean today 

152 via its 400 error body 

153 (openspec/changes/gate-passkey-registration-ui/design.md). 

154 `authenticated` reports only the caller's own state, so the web UI 

155 can tell whether to show the signed-in navigation without probing 

156 a credentialed endpoint and being answered with a 401. 

157 

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. 

161 

162 Returns: 

163 AuthStatus 

164 """ 

165 

166 return ( 

167 await asyncio_detailed( 

168 client=client, 

169 ) 

170 ).parsed