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

15 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: Subscription Service → Get Subscription Actions 

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

20 client: RWSClient, 

21 action: str | None = None, 

22) -> httpx.Response: 

23 """ 

24 Get Subscription Actions. 

25 

26 Route: ``GET /subscription`` 

27 ABB constraints: The form body is in standard form data format and consists of three 

28 name-value pairs per resource. 1st pair - resources=<identifier> e.g. resources=1 2nd 

29 pair - <identifier>=<subscription-resource> e.g. 

30 1=/rw/iosystem/signals/Virtual1/Board1/do1;state 3rd pair - <identifier>-p=<0|1|2> 1-p=1 

31 In th... 

32 

33 Args: 

34 client: Open RWSClient instance. 

35 action: Query parameter. Optional. 

36 

37 Returns: 

38 Raw HTTP response. Expected success: HTTP 200. 

39 

40 Raises: 

41 RWSAuthenticationError: On HTTP 401. 

42 RWSNotFoundError: On HTTP 404. 

43 RWSHTTPError: On any other HTTP >= 400. 

44 # ABB codes: BAD_REQUEST(400), see 

45 

46 Example: 

47 ```python 

48 >>> await get_subscription_actions(client) 

49 <Response [200]> 

50 ``` 

51 """ 

52 return await client.get( 

53 "/subscription", 

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

55 ) 

56 

57 

58async def subscribe_on_resources( 

59 client: RWSClient, 

60 identifier: str | None = None, 

61 identifier_p: str | None = None, 

62) -> httpx.Response: 

63 """ 

64 Subscribe on resources. 

65 

66 Route: ``POST /subscription`` 

67 ABB constraints: The sequence of steps involved to setup subscription and start listening for 

68 events are shown below: Subscribe on resources Response to this HTTP request is a list of 

69 initial events for the subscribed resources along with the location header. Retrieve 

70 Location header and use this value to setup w... 

71 

72 Args: 

73 client: Open RWSClient instance. 

74 identifier: Body parameter. Optional. 

75 identifier_p: Body parameter. Optional. 

76 

77 Returns: 

78 Raw HTTP response. Expected success: HTTP 201. 

79 

80 Raises: 

81 RWSAuthenticationError: On HTTP 401. 

82 RWSNotFoundError: On HTTP 404. 

83 RWSHTTPError: On any other HTTP >= 400. 

84 # ABB codes: BAD_REQUEST(400), UNSUPPORTED_MEDIA(415) See 

85 

86 Example: 

87 ```python 

88 >>> await subscribe_on_resources(client) 

89 <Response [201]> 

90 ``` 

91 """ 

92 return await client.post( 

93 "/subscription", 

94 data={ 

95 k: v 

96 for k, v in {"identifier": identifier, "identifier_p": identifier_p}.items() 

97 if v is not None 

98 }, 

99 ) 

100 

101 

102async def get_subscription_group_actions( 

103 client: RWSClient, 

104 group_id: str, 

105 action: str | None = None, 

106) -> httpx.Response: 

107 """ 

108 Get Subscription Group Actions. 

109 

110 Route: ``GET /subscription/{group-id}`` 

111 ABB constraints: The form body is in standard form data format and consists of three 

112 name-value pairs per resource. 1st pair - resources=<identifier> e.g. resources=1 2nd 

113 pair - <identifier>=<subscription-resource> e.g. 

114 1=/rw/iosystem/signals/Virtual1/Board1/do1;state 3rd pair - <identifier>-p=<0|1|2> 1-p=1 

115 In th... 

116 

117 Args: 

118 client: Open RWSClient instance. 

119 group_id: URL path parameter. 

120 action: Query parameter. Optional. 

121 

122 Returns: 

123 Raw HTTP response. Expected success: HTTP 200. 

124 

125 Raises: 

126 RWSAuthenticationError: On HTTP 401. 

127 RWSNotFoundError: On HTTP 404. 

128 RWSHTTPError: On any other HTTP >= 400. 

129 # ABB codes: BAD_REQUEST(400) See 

130 

131 Example: 

132 ```python 

133 >>> await get_subscription_group_actions(client, "group_id_value") 

134 <Response [200]> 

135 ``` 

136 """ 

137 return await client.get( 

138 f"/subscription/{group_id}", 

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

140 ) 

141 

142 

143async def add_new_resources_remove_existing_resources_or( 

144 client: RWSClient, 

145 group_id: str, 

146 identifier: str | None = None, 

147 identifier_p: str | None = None, 

148) -> httpx.Response: 

149 """ 

150 Add new resources, Remove existing Resources or change existing resources priorities.. 

151 

152 Route: ``PUT /subscription/{group-id}`` 

153 ABB constraints: maximum 1000 resources can be subscribed per group Each client can have 

154 maximum 2 groups. Low priority subscription(p=0) is allowed on any resource. Medium 

155 priority subscription(p=1) is allowed on any resource. RobotWebservice clients can 

156 subscribe maximum of 64 resources with High priority (p=2)... 

157 

158 Args: 

159 client: Open RWSClient instance. 

160 group_id: URL path parameter. 

161 identifier: Body parameter. Optional. 

162 identifier_p: Body parameter. Optional. 

163 

164 Returns: 

165 Raw HTTP response. Expected success: HTTP 200. 

166 

167 Raises: 

168 RWSAuthenticationError: On HTTP 401. 

169 RWSNotFoundError: On HTTP 404. 

170 RWSHTTPError: On any other HTTP >= 400. 

171 # ABB codes: BAD_REQUEST(400), UNSUPPORTED_MEDIA(415), see 

172 

173 Example: 

174 ```python 

175 >>> await add_new_resources_remove_existing_resources_or(client, "group_id_value") 

176 <Response [200]> 

177 ``` 

178 """ 

179 return await client.put( 

180 f"/subscription/{group_id}", 

181 data={ 

182 k: v 

183 for k, v in {"identifier": identifier, "identifier_p": identifier_p}.items() 

184 if v is not None 

185 }, 

186 ) 

187 

188 

189async def unsubscribe_or_remove_the_subscription_group_resources( 

190 client: RWSClient, 

191 group_id: str, 

192) -> httpx.Response: 

193 """ 

194 Unsubscribe or remove the subscription group/resources in group.. 

195 

196 Route: ``DELETE /subscription/{group-id}`` 

197 ABB constraints: Not supported in bootserver mode 

198 

199 Args: 

200 client: Open RWSClient instance. 

201 group_id: URL path parameter. 

202 

203 Returns: 

204 Raw HTTP response. Expected success: HTTP 200. 

205 

206 Raises: 

207 RWSAuthenticationError: On HTTP 401. 

208 RWSNotFoundError: On HTTP 404. 

209 RWSHTTPError: On any other HTTP >= 400. 

210 # ABB codes: BAD_REQUEST(400), see 

211 

212 Example: 

213 ```python 

214 >>> await unsubscribe_or_remove_the_subscription_group_resources( 

215 ... client, 

216 ... "group_id_value" 

217 ... ) 

218 <Response [200]> 

219 ``` 

220 """ 

221 return await client.delete(f"/subscription/{group_id}") 

222 

223 

224async def unsubscribe_or_remove_the_resource_from_subscription( 

225 client: RWSClient, 

226 group_id: str, 

227 resource_uri: str, 

228) -> httpx.Response: 

229 """ 

230 Unsubscribe or remove the resource from subscription group.. 

231 

232 Route: ``DELETE /subscription/{group-id}/{resource-uri}`` 

233 ABB constraints: Not supported in bootserver mode 

234 

235 Args: 

236 client: Open RWSClient instance. 

237 group_id: URL path parameter. 

238 resource_uri: URL path parameter. 

239 

240 Returns: 

241 Raw HTTP response. Expected success: HTTP 200. 

242 

243 Raises: 

244 RWSAuthenticationError: On HTTP 401. 

245 RWSNotFoundError: On HTTP 404. 

246 RWSHTTPError: On any other HTTP >= 400. 

247 # ABB codes: BAD_REQUEST(400), see 

248 

249 Example: 

250 ```python 

251 >>> await unsubscribe_or_remove_the_resource_from_subscription( 

252 ... client, 

253 ... "group_id_value", 

254 ... "resource_uri_value" 

255 ... ) 

256 <Response [200]> 

257 ``` 

258 """ 

259 return await client.delete(f"/subscription/{group_id}/{resource_uri}")