Coverage for src/hush_hush/_generated/api/credentials/list_credentials.py: 0%

46 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.credential import Credential 

11from ...models.error import Error 

12from ...types import UNSET, Response, Unset 

13 

14 

15def _get_kwargs( 

16 *, 

17 limit: int | Unset = 50, 

18 offset: int | Unset = UNSET, 

19) -> dict[str, Any]: 

20 

21 params: dict[str, Any] = {} 

22 

23 params["limit"] = limit 

24 

25 params["offset"] = offset 

26 

27 params = {k: v for k, v in params.items() if v is not UNSET and v is not None} 

28 

29 _kwargs: dict[str, Any] = { 

30 "method": "get", 

31 "url": "/credentials", 

32 "params": params, 

33 } 

34 

35 return _kwargs 

36 

37 

38def _parse_response( 

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

40) -> Error | list[Credential] | None: 

41 if response.status_code == 200: 

42 response_200 = [] 

43 _response_200 = response.json() 

44 for response_200_item_data in _response_200: 

45 response_200_item = Credential.from_dict(response_200_item_data) 

46 

47 response_200.append(response_200_item) 

48 

49 return response_200 

50 

51 if response.status_code == 400: 

52 response_400 = Error.from_dict(response.json()) 

53 

54 return response_400 

55 

56 if response.status_code == 401: 

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

58 

59 return response_401 

60 

61 if client.raise_on_unexpected_status: 

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

63 else: 

64 return None 

65 

66 

67def _build_response( 

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

69) -> Response[Error | list[Credential]]: 

70 return Response( 

71 status_code=HTTPStatus(response.status_code), 

72 content=response.content, 

73 headers=response.headers, 

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

75 ) 

76 

77 

78def sync_detailed( 

79 *, 

80 client: AuthenticatedClient, 

81 limit: int | Unset = 50, 

82 offset: int | Unset = UNSET, 

83) -> Response[Error | list[Credential]]: 

84 """List registered passkeys 

85 

86 Returns every credential registered to the admin account - 

87 nickname, timestamps, never the public key material. 

88 

89 Args: 

90 limit (int | Unset): Default: 50. 

91 offset (int | Unset): 

92 

93 Raises: 

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

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

96 

97 Returns: 

98 Response[Error | list[Credential]] 

99 """ 

100 

101 kwargs = _get_kwargs( 

102 limit=limit, 

103 offset=offset, 

104 ) 

105 

106 response = client.get_httpx_client().request( 

107 **kwargs, 

108 ) 

109 

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

111 

112 

113def sync( 

114 *, 

115 client: AuthenticatedClient, 

116 limit: int | Unset = 50, 

117 offset: int | Unset = UNSET, 

118) -> Error | list[Credential] | None: 

119 """List registered passkeys 

120 

121 Returns every credential registered to the admin account - 

122 nickname, timestamps, never the public key material. 

123 

124 Args: 

125 limit (int | Unset): Default: 50. 

126 offset (int | Unset): 

127 

128 Raises: 

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

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

131 

132 Returns: 

133 Error | list[Credential] 

134 """ 

135 

136 return sync_detailed( 

137 client=client, 

138 limit=limit, 

139 offset=offset, 

140 ).parsed 

141 

142 

143async def asyncio_detailed( 

144 *, 

145 client: AuthenticatedClient, 

146 limit: int | Unset = 50, 

147 offset: int | Unset = UNSET, 

148) -> Response[Error | list[Credential]]: 

149 """List registered passkeys 

150 

151 Returns every credential registered to the admin account - 

152 nickname, timestamps, never the public key material. 

153 

154 Args: 

155 limit (int | Unset): Default: 50. 

156 offset (int | Unset): 

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 Response[Error | list[Credential]] 

164 """ 

165 

166 kwargs = _get_kwargs( 

167 limit=limit, 

168 offset=offset, 

169 ) 

170 

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

172 

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

174 

175 

176async def asyncio( 

177 *, 

178 client: AuthenticatedClient, 

179 limit: int | Unset = 50, 

180 offset: int | Unset = UNSET, 

181) -> Error | list[Credential] | None: 

182 """List registered passkeys 

183 

184 Returns every credential registered to the admin account - 

185 nickname, timestamps, never the public key material. 

186 

187 Args: 

188 limit (int | Unset): Default: 50. 

189 offset (int | Unset): 

190 

191 Raises: 

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

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

194 

195 Returns: 

196 Error | list[Credential] 

197 """ 

198 

199 return ( 

200 await asyncio_detailed( 

201 client=client, 

202 limit=limit, 

203 offset=offset, 

204 ) 

205 ).parsed