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

42 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, cast 

5 

6import httpx 

7 

8from ... import errors 

9from ...client import AuthenticatedClient, Client 

10from ...models.error import Error 

11from ...models.login_finish_request import LoginFinishRequest 

12from ...types import Response 

13 

14 

15def _get_kwargs( 

16 *, 

17 body: LoginFinishRequest, 

18) -> dict[str, Any]: 

19 headers: dict[str, Any] = {} 

20 

21 _kwargs: dict[str, Any] = { 

22 "method": "post", 

23 "url": "/auth/login/finish", 

24 } 

25 

26 _kwargs["json"] = body.to_dict() 

27 

28 headers["Content-Type"] = "application/json" 

29 

30 _kwargs["headers"] = headers 

31 return _kwargs 

32 

33 

34def _parse_response( 

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

36) -> Any | Error | None: 

37 if response.status_code == 204: 

38 response_204 = cast(Any, None) 

39 return response_204 

40 

41 if response.status_code == 401: 

42 response_401 = Error.from_dict(response.json()) 

43 

44 return response_401 

45 

46 if response.status_code == 413: 

47 response_413 = Error.from_dict(response.json()) 

48 

49 return response_413 

50 

51 if client.raise_on_unexpected_status: 

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

53 else: 

54 return None 

55 

56 

57def _build_response( 

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

59) -> Response[Any | Error]: 

60 return Response( 

61 status_code=HTTPStatus(response.status_code), 

62 content=response.content, 

63 headers=response.headers, 

64 parsed=_parse_response(client=client, response=response), 

65 ) 

66 

67 

68def sync_detailed( 

69 *, 

70 client: AuthenticatedClient | Client, 

71 body: LoginFinishRequest, 

72) -> Response[Any | Error]: 

73 """Complete passkey login 

74 

75 Verifies the browser's assertion response against a registered 

76 credential and, on success, issues a session. Also rejects a 

77 credential whose signature counter didn't advance, a sign a 

78 cloned authenticator was used. 

79 

80 Args: 

81 body (LoginFinishRequest): 

82 

83 Raises: 

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

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

86 

87 Returns: 

88 Response[Any | Error] 

89 """ 

90 

91 kwargs = _get_kwargs( 

92 body=body, 

93 ) 

94 

95 response = client.get_httpx_client().request( 

96 **kwargs, 

97 ) 

98 

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

100 

101 

102def sync( 

103 *, 

104 client: AuthenticatedClient | Client, 

105 body: LoginFinishRequest, 

106) -> Any | Error | None: 

107 """Complete passkey login 

108 

109 Verifies the browser's assertion response against a registered 

110 credential and, on success, issues a session. Also rejects a 

111 credential whose signature counter didn't advance, a sign a 

112 cloned authenticator was used. 

113 

114 Args: 

115 body (LoginFinishRequest): 

116 

117 Raises: 

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

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

120 

121 Returns: 

122 Any | Error 

123 """ 

124 

125 return sync_detailed( 

126 client=client, 

127 body=body, 

128 ).parsed 

129 

130 

131async def asyncio_detailed( 

132 *, 

133 client: AuthenticatedClient | Client, 

134 body: LoginFinishRequest, 

135) -> Response[Any | Error]: 

136 """Complete passkey login 

137 

138 Verifies the browser's assertion response against a registered 

139 credential and, on success, issues a session. Also rejects a 

140 credential whose signature counter didn't advance, a sign a 

141 cloned authenticator was used. 

142 

143 Args: 

144 body (LoginFinishRequest): 

145 

146 Raises: 

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

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

149 

150 Returns: 

151 Response[Any | Error] 

152 """ 

153 

154 kwargs = _get_kwargs( 

155 body=body, 

156 ) 

157 

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

159 

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

161 

162 

163async def asyncio( 

164 *, 

165 client: AuthenticatedClient | Client, 

166 body: LoginFinishRequest, 

167) -> Any | Error | None: 

168 """Complete passkey login 

169 

170 Verifies the browser's assertion response against a registered 

171 credential and, on success, issues a session. Also rejects a 

172 credential whose signature counter didn't advance, a sign a 

173 cloned authenticator was used. 

174 

175 Args: 

176 body (LoginFinishRequest): 

177 

178 Raises: 

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

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

181 

182 Returns: 

183 Any | Error 

184 """ 

185 

186 return ( 

187 await asyncio_detailed( 

188 client=client, 

189 body=body, 

190 ) 

191 ).parsed