Coverage for abb_rws_client_python_rw6/rws/users/users.py: 100%

13 statements  

« prev     ^ index     » next       coverage.py v7.15.4, created at 2026-08-13 22:17 +0000

1# This file is AUTO-GENERATED by utils/generator/main.py 

2# DO NOT EDIT MANUALLY — run the generator to regenerate. 

3# Generator author: Clement RACINET 

4""" 

5RWS module: User Service → Get User Resources 

6 

71:1 mirror of the ABB RobotWare 6 REST API. 

8Each function maps to exactly one HTTP endpoint. 

9No composed logic — see highlevel/ for wrappers. 

10""" 

11 

12from __future__ import annotations 

13 

14import httpx 

15 

16from abb_rws_client_python_rw6.core.client import RWSClient 

17 

18 

19async def get_user_resources( 

20 client: RWSClient, 

21 user_type: str | None = None, 

22) -> httpx.Response: 

23 """ 

24 Get User Resources. 

25 

26 Route: ``GET /users`` 

27 ABB constraints: Supported in bootserver mode 

28 

29 Args: 

30 client: Open RWSClient instance. 

31 user_type: Query parameter. Optional. 

32 

33 Returns: 

34 Raw HTTP response. Expected success: HTTP 200. 

35 

36 Raises: 

37 RWSAuthenticationError: On HTTP 401. 

38 RWSNotFoundError: On HTTP 404. 

39 RWSHTTPError: On any other HTTP >= 400. 

40 

41 Example: 

42 ```python 

43 >>> await get_user_resources(client) 

44 <Response [200]> 

45 ``` 

46 """ 

47 return await client.get( 

48 "/users", 

49 params={k: v for k, v in {"user_type": user_type}.items() if v is not None}, 

50 ) 

51 

52 

53async def get_user_actions( 

54 client: RWSClient, 

55 action: str | None = None, 

56) -> httpx.Response: 

57 """ 

58 Get User Actions. 

59 

60 Route: ``GET /users`` 

61 ABB constraints: Supported in bootserver mode 

62 

63 Args: 

64 client: Open RWSClient instance. 

65 action: Query parameter. Optional. 

66 

67 Returns: 

68 Raw HTTP response. Expected success: HTTP 200. 

69 

70 Raises: 

71 RWSAuthenticationError: On HTTP 401. 

72 RWSNotFoundError: On HTTP 404. 

73 RWSHTTPError: On any other HTTP >= 400. 

74 # ABB codes: BAD_REQUEST(400) 

75 

76 Example: 

77 ```python 

78 >>> await get_user_actions(client) 

79 <Response [200]> 

80 ``` 

81 """ 

82 return await client.get( 

83 "/users", 

84 params={k: v for k, v in {"action": action}.items() if v is not None}, 

85 ) 

86 

87 

88async def register_the_user(client: RWSClient) -> httpx.Response: 

89 """ 

90 Register the user. 

91 

92 Route: ``POST /users`` 

93 ABB constraints: Supported in bootserver mode. Given username, application and location are 

94 used only as free-text information. User can be registered as local client 

95 (ulocale=local) only if the request comes from service port or the TPU port. 

96 

97 Args: 

98 client: Open RWSClient instance. 

99 

100 Returns: 

101 Raw HTTP response. Expected success: HTTP 201. 

102 

103 Raises: 

104 RWSAuthenticationError: On HTTP 401. 

105 RWSNotFoundError: On HTTP 404. 

106 RWSHTTPError: On any other HTTP >= 400. 

107 # ABB codes: UNSUPPORTED_MEDIA(415), BAD_REQUEST(400) 

108 

109 Example: 

110 ```python 

111 >>> await register_the_user(client) 

112 <Response [201]> 

113 ``` 

114 """ 

115 return await client.post( 

116 "/users", 

117 data={}, 

118 ) 

119 

120 

121async def impersonate_user( 

122 client: RWSClient, 

123 action: str | None = None, 

124) -> httpx.Response: 

125 """ 

126 Impersonate a user. 

127 

128 Route: ``POST /users`` 

129 ABB constraints: Supported in bootserver mode 

130 

131 Args: 

132 client: Open RWSClient instance. 

133 action: Query parameter. Optional. 

134 

135 Returns: 

136 Raw HTTP response. Expected success: HTTP 200. 

137 

138 Raises: 

139 RWSAuthenticationError: On HTTP 401. 

140 RWSNotFoundError: On HTTP 404. 

141 RWSHTTPError: On any other HTTP >= 400. 

142 # ABB codes: BAD_REQUEST(400), FORBIDDEN(403) 

143 

144 Example: 

145 ```python 

146 >>> await impersonate_user(client) 

147 <Response [200]> 

148 ``` 

149 """ 

150 return await client.post( 

151 "/users", 

152 params={k: v for k, v in {"action": action}.items() if v is not None}, 

153 data={}, 

154 ) 

155 

156 

157async def login_as_local_user( 

158 client: RWSClient, 

159 action: str | None = None, 

160 type: str | None = None, 

161) -> httpx.Response: 

162 """ 

163 Login as Local User. 

164 

165 Route: ``POST /users`` 

166 ABB constraints: Supported in bootserver mode 

167 

168 Args: 

169 client: Open RWSClient instance. 

170 action: Query parameter. Optional. 

171 type: Body parameter. Optional. 

172 

173 Returns: 

174 Raw HTTP response. Expected success: HTTP 200. 

175 

176 Raises: 

177 RWSAuthenticationError: On HTTP 401. 

178 RWSNotFoundError: On HTTP 404. 

179 RWSHTTPError: On any other HTTP >= 400. 

180 # ABB codes: CONFLICT(409) : if the user has already logged in as remote or local client 

181 and sets the type as remote or local respectively. 

182 

183 Example: 

184 ```python 

185 >>> await login_as_local_user(client) 

186 <Response [200]> 

187 ``` 

188 """ 

189 return await client.post( 

190 "/users", 

191 params={k: v for k, v in {"action": action}.items() if v is not None}, 

192 data={k: v for k, v in {"type": type}.items() if v is not None}, 

193 )