evcloud 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (635) hide show
  1. evcloud/__init__.py +802 -0
  2. evcloud/_default_clients.py +30 -0
  3. evcloud/client.py +200 -0
  4. evcloud/core/__init__.py +67 -0
  5. evcloud/core/api_error.py +23 -0
  6. evcloud/core/client_wrapper.py +108 -0
  7. evcloud/core/datetime_utils.py +70 -0
  8. evcloud/core/file.py +67 -0
  9. evcloud/core/force_multipart.py +18 -0
  10. evcloud/core/http_client.py +840 -0
  11. evcloud/core/http_response.py +59 -0
  12. evcloud/core/http_sse/__init__.py +9 -0
  13. evcloud/core/http_sse/_api.py +112 -0
  14. evcloud/core/http_sse/_decoders.py +61 -0
  15. evcloud/core/http_sse/_exceptions.py +7 -0
  16. evcloud/core/http_sse/_models.py +17 -0
  17. evcloud/core/jsonable_encoder.py +120 -0
  18. evcloud/core/logging.py +107 -0
  19. evcloud/core/pagination.py +82 -0
  20. evcloud/core/parse_error.py +36 -0
  21. evcloud/core/pydantic_utilities.py +634 -0
  22. evcloud/core/query_encoder.py +58 -0
  23. evcloud/core/remove_none_from_dict.py +11 -0
  24. evcloud/core/request_options.py +35 -0
  25. evcloud/core/serialization.py +276 -0
  26. evcloud/cpo/__init__.py +31 -0
  27. evcloud/cpo/cdrs/__init__.py +4 -0
  28. evcloud/cpo/cdrs/client.py +311 -0
  29. evcloud/cpo/cdrs/raw_client.py +592 -0
  30. evcloud/cpo/charge_points/__init__.py +7 -0
  31. evcloud/cpo/charge_points/client.py +1436 -0
  32. evcloud/cpo/charge_points/raw_client.py +2809 -0
  33. evcloud/cpo/charge_points/types/__init__.py +7 -0
  34. evcloud/cpo/charge_points/types/list_charge_points_request_ocpp_version.py +5 -0
  35. evcloud/cpo/client.py +62 -0
  36. evcloud/cpo/connectors/__init__.py +4 -0
  37. evcloud/cpo/connectors/client.py +698 -0
  38. evcloud/cpo/connectors/raw_client.py +1457 -0
  39. evcloud/cpo/evses/__init__.py +4 -0
  40. evcloud/cpo/evses/client.py +691 -0
  41. evcloud/cpo/evses/raw_client.py +1457 -0
  42. evcloud/cpo/health/__init__.py +4 -0
  43. evcloud/cpo/health/client.py +100 -0
  44. evcloud/cpo/health/raw_client.py +192 -0
  45. evcloud/cpo/locations/__init__.py +4 -0
  46. evcloud/cpo/locations/client.py +1021 -0
  47. evcloud/cpo/locations/raw_client.py +1887 -0
  48. evcloud/cpo/raw_client.py +13 -0
  49. evcloud/cpo/sessions/__init__.py +7 -0
  50. evcloud/cpo/sessions/client.py +430 -0
  51. evcloud/cpo/sessions/raw_client.py +889 -0
  52. evcloud/cpo/sessions/types/__init__.py +8 -0
  53. evcloud/cpo/sessions/types/list_sessions_request_billing_state.py +5 -0
  54. evcloud/cpo/sessions/types/list_sessions_request_status.py +7 -0
  55. evcloud/cpo/tariffs/__init__.py +17 -0
  56. evcloud/cpo/tariffs/client.py +1232 -0
  57. evcloud/cpo/tariffs/raw_client.py +2526 -0
  58. evcloud/cpo/tariffs/types/__init__.py +15 -0
  59. evcloud/cpo/tariffs/types/list_tariffs_request_type.py +7 -0
  60. evcloud/cpo/tariffs/types/tariff_create_ocpi_version.py +5 -0
  61. evcloud/cpo/tariffs/types/tariff_create_preauthorize_amount.py +5 -0
  62. evcloud/cpo/tariffs/types/tariff_patch_preauthorize_amount.py +5 -0
  63. evcloud/emsp/__init__.py +55 -0
  64. evcloud/emsp/cdrs/__init__.py +4 -0
  65. evcloud/emsp/cdrs/client.py +300 -0
  66. evcloud/emsp/cdrs/raw_client.py +610 -0
  67. evcloud/emsp/chargers/__init__.py +7 -0
  68. evcloud/emsp/chargers/client.py +167 -0
  69. evcloud/emsp/chargers/raw_client.py +331 -0
  70. evcloud/emsp/chargers/types/__init__.py +11 -0
  71. evcloud/emsp/chargers/types/resolve_chargers_response.py +53 -0
  72. evcloud/emsp/client.py +77 -0
  73. evcloud/emsp/commands/__init__.py +7 -0
  74. evcloud/emsp/commands/client.py +516 -0
  75. evcloud/emsp/commands/raw_client.py +979 -0
  76. evcloud/emsp/commands/types/__init__.py +7 -0
  77. evcloud/emsp/commands/types/send_commands_request_command.py +7 -0
  78. evcloud/emsp/emp_identities/__init__.py +4 -0
  79. evcloud/emsp/emp_identities/client.py +548 -0
  80. evcloud/emsp/emp_identities/raw_client.py +1277 -0
  81. evcloud/emsp/evses/__init__.py +4 -0
  82. evcloud/emsp/evses/client.py +154 -0
  83. evcloud/emsp/evses/raw_client.py +288 -0
  84. evcloud/emsp/health/__init__.py +4 -0
  85. evcloud/emsp/health/client.py +100 -0
  86. evcloud/emsp/health/raw_client.py +192 -0
  87. evcloud/emsp/locations/__init__.py +4 -0
  88. evcloud/emsp/locations/client.py +1386 -0
  89. evcloud/emsp/locations/raw_client.py +2903 -0
  90. evcloud/emsp/networks/__init__.py +7 -0
  91. evcloud/emsp/networks/client.py +1615 -0
  92. evcloud/emsp/networks/raw_client.py +3725 -0
  93. evcloud/emsp/networks/types/__init__.py +9 -0
  94. evcloud/emsp/networks/types/list_networks_request_network_type.py +5 -0
  95. evcloud/emsp/networks/types/list_rules_networks_request_validity.py +5 -0
  96. evcloud/emsp/networks/types/network_rule_create_request_rule_type.py +5 -0
  97. evcloud/emsp/raw_client.py +13 -0
  98. evcloud/emsp/sessions/__init__.py +4 -0
  99. evcloud/emsp/sessions/client.py +300 -0
  100. evcloud/emsp/sessions/raw_client.py +610 -0
  101. evcloud/emsp/tariffs/__init__.py +7 -0
  102. evcloud/emsp/tariffs/client.py +421 -0
  103. evcloud/emsp/tariffs/raw_client.py +883 -0
  104. evcloud/emsp/tariffs/types/__init__.py +8 -0
  105. evcloud/emsp/tariffs/types/estimate_request_kwh.py +5 -0
  106. evcloud/emsp/tariffs/types/estimate_request_minutes.py +5 -0
  107. evcloud/emsp/tenant/__init__.py +4 -0
  108. evcloud/emsp/tenant/client.py +328 -0
  109. evcloud/emsp/tenant/raw_client.py +869 -0
  110. evcloud/emsp/token_groups/__init__.py +7 -0
  111. evcloud/emsp/token_groups/client.py +1256 -0
  112. evcloud/emsp/token_groups/raw_client.py +3288 -0
  113. evcloud/emsp/token_groups/types/__init__.py +7 -0
  114. evcloud/emsp/token_groups/types/remove_token_token_groups_request_type.py +5 -0
  115. evcloud/emsp/tokens/__init__.py +7 -0
  116. evcloud/emsp/tokens/client.py +1298 -0
  117. evcloud/emsp/tokens/raw_client.py +2947 -0
  118. evcloud/emsp/tokens/types/__init__.py +10 -0
  119. evcloud/emsp/tokens/types/list_tokens_request_status.py +7 -0
  120. evcloud/emsp/tokens/types/list_tokens_request_type.py +5 -0
  121. evcloud/emsp/tokens/types/token_update_default_profile_type.py +5 -0
  122. evcloud/emsp/tokens/types/token_update_whitelist.py +5 -0
  123. evcloud/energy/__init__.py +8 -0
  124. evcloud/energy/client.py +47 -0
  125. evcloud/energy/control_requests/__init__.py +7 -0
  126. evcloud/energy/control_requests/client.py +399 -0
  127. evcloud/energy/control_requests/raw_client.py +835 -0
  128. evcloud/energy/control_requests/types/__init__.py +7 -0
  129. evcloud/energy/control_requests/types/list_control_requests_request_result.py +15 -0
  130. evcloud/energy/health/__init__.py +4 -0
  131. evcloud/energy/health/client.py +100 -0
  132. evcloud/energy/health/raw_client.py +192 -0
  133. evcloud/energy/power_measurements/__init__.py +4 -0
  134. evcloud/energy/power_measurements/client.py +254 -0
  135. evcloud/energy/power_measurements/raw_client.py +527 -0
  136. evcloud/energy/raw_client.py +13 -0
  137. evcloud/environment.py +7 -0
  138. evcloud/errors/__init__.py +25 -0
  139. evcloud/errors/bad_gateway_error.py +11 -0
  140. evcloud/errors/bad_request_error.py +11 -0
  141. evcloud/errors/conflict_error.py +11 -0
  142. evcloud/errors/forbidden_error.py +11 -0
  143. evcloud/errors/gateway_timeout_error.py +11 -0
  144. evcloud/errors/not_found_error.py +11 -0
  145. evcloud/errors/too_many_requests_error.py +11 -0
  146. evcloud/errors/unauthorized_error.py +11 -0
  147. evcloud/errors/unprocessable_entity_error.py +11 -0
  148. evcloud/health/__init__.py +4 -0
  149. evcloud/health/client.py +99 -0
  150. evcloud/health/raw_client.py +100 -0
  151. evcloud/ocpi/__init__.py +123 -0
  152. evcloud/ocpi/client.py +56 -0
  153. evcloud/ocpi/cpo_data/__init__.py +31 -0
  154. evcloud/ocpi/cpo_data/client.py +1553 -0
  155. evcloud/ocpi/cpo_data/raw_client.py +3119 -0
  156. evcloud/ocpi/cpo_data/types/__init__.py +29 -0
  157. evcloud/ocpi/cpo_data/types/cancel_reservation_cpo_data_request_version.py +5 -0
  158. evcloud/ocpi/cpo_data/types/create_cdr_cpo_data_request_version.py +5 -0
  159. evcloud/ocpi/cpo_data/types/delete_tariff_cpo_data_request_version.py +5 -0
  160. evcloud/ocpi/cpo_data/types/send_active_charging_profile_cpo_data_request_version.py +5 -0
  161. evcloud/ocpi/cpo_data/types/update_connector_cpo_data_request_version.py +5 -0
  162. evcloud/ocpi/cpo_data/types/update_evse_status_cpo_data_request_version.py +5 -0
  163. evcloud/ocpi/cpo_data/types/update_location_cpo_data_request_version.py +5 -0
  164. evcloud/ocpi/cpo_data/types/update_session_cpo_data_request_version.py +5 -0
  165. evcloud/ocpi/cpo_data/types/upsert_location_cpo_data_request_version.py +5 -0
  166. evcloud/ocpi/cpo_data/types/upsert_session_cpo_data_request_version.py +5 -0
  167. evcloud/ocpi/cpo_data/types/upsert_tariff_cpo_data_request_version.py +5 -0
  168. evcloud/ocpi/credentials/__init__.py +31 -0
  169. evcloud/ocpi/credentials/client.py +750 -0
  170. evcloud/ocpi/credentials/raw_client.py +1537 -0
  171. evcloud/ocpi/credentials/types/__init__.py +29 -0
  172. evcloud/ocpi/credentials/types/partner_versions_pull_request_partner_token_encoding.py +5 -0
  173. evcloud/ocpi/credentials/types/pull_versions_credentials_request_role.py +5 -0
  174. evcloud/ocpi/credentials/types/pull_versions_credentials_request_version.py +5 -0
  175. evcloud/ocpi/credentials/types/rotate_credentials_request_role.py +5 -0
  176. evcloud/ocpi/credentials/types/rotate_credentials_request_version.py +5 -0
  177. evcloud/ocpi/credentials/types/start_handshake_credentials_request_role.py +5 -0
  178. evcloud/ocpi/credentials/types/start_handshake_credentials_request_version.py +5 -0
  179. evcloud/ocpi/credentials/types/status_credentials_request_role.py +5 -0
  180. evcloud/ocpi/credentials/types/status_credentials_request_version.py +5 -0
  181. evcloud/ocpi/credentials/types/unregister_credentials_request_role.py +5 -0
  182. evcloud/ocpi/credentials/types/unregister_credentials_request_version.py +5 -0
  183. evcloud/ocpi/emsp/__init__.py +27 -0
  184. evcloud/ocpi/emsp/client.py +1142 -0
  185. evcloud/ocpi/emsp/raw_client.py +2209 -0
  186. evcloud/ocpi/emsp/types/__init__.py +25 -0
  187. evcloud/ocpi/emsp/types/charging_preferences_request_profile_type.py +5 -0
  188. evcloud/ocpi/emsp/types/clear_charging_profile_emsp_request_version.py +5 -0
  189. evcloud/ocpi/emsp/types/get_active_charging_profile_emsp_request_version.py +5 -0
  190. evcloud/ocpi/emsp/types/send_command_emsp_request_command.py +7 -0
  191. evcloud/ocpi/emsp/types/send_command_emsp_request_version.py +5 -0
  192. evcloud/ocpi/emsp/types/set_charging_preferences_emsp_request_version.py +5 -0
  193. evcloud/ocpi/emsp/types/set_charging_profile_emsp_request_version.py +5 -0
  194. evcloud/ocpi/emsp/types/update_token_emsp_request_version.py +5 -0
  195. evcloud/ocpi/emsp/types/upsert_token_emsp_request_version.py +5 -0
  196. evcloud/ocpi/invites/__init__.py +19 -0
  197. evcloud/ocpi/invites/client.py +385 -0
  198. evcloud/ocpi/invites/raw_client.py +887 -0
  199. evcloud/ocpi/invites/types/__init__.py +17 -0
  200. evcloud/ocpi/invites/types/partner_invite_create_request_gateway_role.py +5 -0
  201. evcloud/ocpi/invites/types/partner_invite_create_request_role.py +5 -0
  202. evcloud/ocpi/invites/types/partner_invite_create_request_version.py +5 -0
  203. evcloud/ocpi/invites/types/partner_invite_update_request_gateway_role.py +5 -0
  204. evcloud/ocpi/invites/types/partner_invite_update_request_version.py +5 -0
  205. evcloud/ocpi/partners/__init__.py +7 -0
  206. evcloud/ocpi/partners/client.py +581 -0
  207. evcloud/ocpi/partners/raw_client.py +1340 -0
  208. evcloud/ocpi/partners/types/__init__.py +8 -0
  209. evcloud/ocpi/partners/types/partner_register_request_ocpi_version.py +5 -0
  210. evcloud/ocpi/partners/types/partner_update_request_ocpi_version.py +5 -0
  211. evcloud/ocpi/raw_client.py +13 -0
  212. evcloud/ocpi/sync/__init__.py +33 -0
  213. evcloud/ocpi/sync/client.py +1701 -0
  214. evcloud/ocpi/sync/raw_client.py +3685 -0
  215. evcloud/ocpi/sync/types/__init__.py +31 -0
  216. evcloud/ocpi/sync/types/pull_cdrs_sync_request_version.py +5 -0
  217. evcloud/ocpi/sync/types/pull_hub_client_info_as_cpo_sync_request_version.py +5 -0
  218. evcloud/ocpi/sync/types/pull_hub_client_info_as_emsp_sync_request_version.py +5 -0
  219. evcloud/ocpi/sync/types/pull_locations_sync_request_version.py +5 -0
  220. evcloud/ocpi/sync/types/pull_sessions_sync_request_version.py +5 -0
  221. evcloud/ocpi/sync/types/pull_tariffs_sync_request_version.py +5 -0
  222. evcloud/ocpi/sync/types/pull_tokens_sync_request_version.py +5 -0
  223. evcloud/ocpi/sync/types/push_cdr_sync_request_version.py +5 -0
  224. evcloud/ocpi/sync/types/push_location_sync_request_version.py +5 -0
  225. evcloud/ocpi/sync/types/push_session_sync_request_version.py +5 -0
  226. evcloud/ocpi/sync/types/push_tariff_sync_request_version.py +5 -0
  227. evcloud/ocpi/sync/types/push_token_sync_request_version.py +5 -0
  228. evcloud/py.typed +0 -0
  229. evcloud/types/__init__.py +759 -0
  230. evcloud/types/access_mode.py +5 -0
  231. evcloud/types/asset_connector.py +26 -0
  232. evcloud/types/asset_updated_event.py +29 -0
  233. evcloud/types/availability_page.py +26 -0
  234. evcloud/types/batch_response.py +26 -0
  235. evcloud/types/batch_response_missing_item.py +7 -0
  236. evcloud/types/cdr_event.py +41 -0
  237. evcloud/types/cdr_out.py +75 -0
  238. evcloud/types/cdr_out_auth_method.py +7 -0
  239. evcloud/types/cdr_out_auth_method_zero.py +5 -0
  240. evcloud/types/cdr_out_origin.py +7 -0
  241. evcloud/types/cdr_out_origin_zero.py +5 -0
  242. evcloud/types/cdr_page.py +27 -0
  243. evcloud/types/cdr_write_response.py +26 -0
  244. evcloud/types/charge_point_created_out.py +74 -0
  245. evcloud/types/charge_point_created_out_access_mode.py +7 -0
  246. evcloud/types/charge_point_created_out_access_mode_zero.py +5 -0
  247. evcloud/types/charge_point_created_out_pricing.py +7 -0
  248. evcloud/types/charge_point_created_out_pricing_zero.py +5 -0
  249. evcloud/types/charge_point_created_out_site_type.py +7 -0
  250. evcloud/types/charge_point_created_out_site_type_zero.py +5 -0
  251. evcloud/types/charge_point_out.py +73 -0
  252. evcloud/types/charge_point_out_access_mode.py +7 -0
  253. evcloud/types/charge_point_out_access_mode_zero.py +5 -0
  254. evcloud/types/charge_point_out_pricing.py +7 -0
  255. evcloud/types/charge_point_out_pricing_zero.py +5 -0
  256. evcloud/types/charge_point_out_site_type.py +7 -0
  257. evcloud/types/charge_point_out_site_type_zero.py +5 -0
  258. evcloud/types/charge_point_page.py +27 -0
  259. evcloud/types/charging_preferences_response.py +28 -0
  260. evcloud/types/charging_preferences_response_result.py +10 -0
  261. evcloud/types/charging_profile.py +30 -0
  262. evcloud/types/charging_profile_charging_rate_unit.py +5 -0
  263. evcloud/types/charging_profile_period.py +31 -0
  264. evcloud/types/charging_profile_response.py +32 -0
  265. evcloud/types/cluster_page.py +26 -0
  266. evcloud/types/command_accepted.py +30 -0
  267. evcloud/types/command_accepted_route.py +53 -0
  268. evcloud/types/command_accepted_route_own.py +28 -0
  269. evcloud/types/command_accepted_route_own_ocpi_version.py +7 -0
  270. evcloud/types/command_accepted_route_own_ocpi_version_zero.py +5 -0
  271. evcloud/types/command_accepted_route_roaming.py +30 -0
  272. evcloud/types/command_accepted_route_roaming_ocpi_version.py +7 -0
  273. evcloud/types/command_accepted_route_roaming_ocpi_version_zero.py +5 -0
  274. evcloud/types/command_accepted_status.py +7 -0
  275. evcloud/types/command_accepted_status_zero.py +20 -0
  276. evcloud/types/command_page.py +26 -0
  277. evcloud/types/command_record.py +40 -0
  278. evcloud/types/command_record_command.py +7 -0
  279. evcloud/types/command_record_command_zero.py +7 -0
  280. evcloud/types/command_record_route.py +53 -0
  281. evcloud/types/command_record_route_own.py +28 -0
  282. evcloud/types/command_record_route_own_ocpi_version.py +7 -0
  283. evcloud/types/command_record_route_own_ocpi_version_zero.py +5 -0
  284. evcloud/types/command_record_route_roaming.py +30 -0
  285. evcloud/types/command_record_route_roaming_ocpi_version.py +7 -0
  286. evcloud/types/command_record_route_roaming_ocpi_version_zero.py +5 -0
  287. evcloud/types/command_record_status.py +7 -0
  288. evcloud/types/command_record_status_zero.py +20 -0
  289. evcloud/types/command_response_out.py +26 -0
  290. evcloud/types/command_response_out_result.py +7 -0
  291. evcloud/types/command_response_out_result_zero.py +7 -0
  292. evcloud/types/command_result_event.py +39 -0
  293. evcloud/types/command_result_event_module.py +5 -0
  294. evcloud/types/command_result_event_protocol.py +5 -0
  295. evcloud/types/command_result_event_status.py +5 -0
  296. evcloud/types/command_send_response.py +31 -0
  297. evcloud/types/command_token.py +36 -0
  298. evcloud/types/connector_format.py +5 -0
  299. evcloud/types/connector_page.py +27 -0
  300. evcloud/types/connector_status_event.py +29 -0
  301. evcloud/types/connector_write_response.py +27 -0
  302. evcloud/types/control_action.py +5 -0
  303. evcloud/types/control_request_page.py +27 -0
  304. evcloud/types/control_request_response.py +38 -0
  305. evcloud/types/control_request_response_action.py +7 -0
  306. evcloud/types/control_request_response_action_zero.py +7 -0
  307. evcloud/types/control_request_response_result.py +7 -0
  308. evcloud/types/control_request_response_result_zero.py +15 -0
  309. evcloud/types/control_request_response_unit.py +7 -0
  310. evcloud/types/control_request_response_unit_zero.py +5 -0
  311. evcloud/types/control_response_event.py +38 -0
  312. evcloud/types/control_response_event_action.py +5 -0
  313. evcloud/types/control_response_event_result.py +15 -0
  314. evcloud/types/control_response_event_unit.py +5 -0
  315. evcloud/types/cpo_connector_out.py +58 -0
  316. evcloud/types/cpo_connector_out_format.py +7 -0
  317. evcloud/types/cpo_connector_out_format_zero.py +5 -0
  318. evcloud/types/cpo_connector_out_ocpi_status.py +7 -0
  319. evcloud/types/cpo_connector_out_ocpi_status_zero.py +10 -0
  320. evcloud/types/cpo_connector_out_power_type.py +7 -0
  321. evcloud/types/cpo_connector_out_power_type_zero.py +7 -0
  322. evcloud/types/cpo_evse_out.py +61 -0
  323. evcloud/types/cpo_evse_out_origin.py +7 -0
  324. evcloud/types/cpo_evse_out_origin_zero.py +5 -0
  325. evcloud/types/cpo_evse_out_status.py +7 -0
  326. evcloud/types/cpo_evse_out_status_zero.py +10 -0
  327. evcloud/types/credentials_handshake_request.py +44 -0
  328. evcloud/types/credentials_handshake_request_partner_token_encoding.py +5 -0
  329. evcloud/types/credentials_handshake_response.py +32 -0
  330. evcloud/types/credentials_handshake_response_action.py +7 -0
  331. evcloud/types/credentials_handshake_response_version.py +5 -0
  332. evcloud/types/deliver_event_response.py +23 -0
  333. evcloud/types/delivery_drift_event.py +30 -0
  334. evcloud/types/display_text.py +24 -0
  335. evcloud/types/effective_cpo.py +27 -0
  336. evcloud/types/effective_cpo_source.py +7 -0
  337. evcloud/types/effective_cpo_source_zero.py +5 -0
  338. evcloud/types/effective_view_response.py +29 -0
  339. evcloud/types/emp_identity_out.py +35 -0
  340. evcloud/types/emp_identity_out_status.py +7 -0
  341. evcloud/types/emp_identity_out_status_zero.py +5 -0
  342. evcloud/types/emp_identity_page.py +26 -0
  343. evcloud/types/emsp_cdr_out.py +41 -0
  344. evcloud/types/emsp_cdr_out_source.py +7 -0
  345. evcloud/types/emsp_cdr_out_source_zero.py +5 -0
  346. evcloud/types/emsp_cdr_page.py +26 -0
  347. evcloud/types/emsp_connector_out.py +30 -0
  348. evcloud/types/emsp_evse_out.py +32 -0
  349. evcloud/types/emsp_gateway_schema_commands_location_key.py +25 -0
  350. evcloud/types/emsp_gateway_schema_location_lookup_location_key.py +25 -0
  351. evcloud/types/emsp_gateway_schema_locations_location_out.py +47 -0
  352. evcloud/types/emsp_gateway_schema_locations_location_page.py +26 -0
  353. evcloud/types/emsp_gateway_schema_networks_location_out.py +37 -0
  354. evcloud/types/emsp_gateway_schema_networks_location_page.py +26 -0
  355. evcloud/types/emsp_session_out.py +41 -0
  356. evcloud/types/emsp_session_out_source.py +7 -0
  357. evcloud/types/emsp_session_out_source_zero.py +5 -0
  358. evcloud/types/emsp_session_page.py +26 -0
  359. evcloud/types/emsp_tariff_page.py +26 -0
  360. evcloud/types/energy_contract.py +24 -0
  361. evcloud/types/estimate_line.py +27 -0
  362. evcloud/types/estimate_line_type.py +7 -0
  363. evcloud/types/estimate_line_type_zero.py +5 -0
  364. evcloud/types/estimate_response.py +30 -0
  365. evcloud/types/event_type_list.py +24 -0
  366. evcloud/types/event_type_response.py +27 -0
  367. evcloud/types/event_type_response_type.py +7 -0
  368. evcloud/types/event_type_response_type_zero.py +27 -0
  369. evcloud/types/event_type_version.py +24 -0
  370. evcloud/types/evse_connector_status.py +26 -0
  371. evcloud/types/evse_page.py +27 -0
  372. evcloud/types/evse_parking.py +25 -0
  373. evcloud/types/evse_parking_evse_position.py +7 -0
  374. evcloud/types/evse_parking_evse_position_zero.py +5 -0
  375. evcloud/types/evse_status_event.py +31 -0
  376. evcloud/types/evse_status_out.py +32 -0
  377. evcloud/types/evse_status_write_response.py +28 -0
  378. evcloud/types/facility_count.py +24 -0
  379. evcloud/types/facility_page.py +26 -0
  380. evcloud/types/health_ok.py +24 -0
  381. evcloud/types/health_ok_status.py +7 -0
  382. evcloud/types/health_ok_status_zero.py +5 -0
  383. evcloud/types/http_error_response.py +29 -0
  384. evcloud/types/http_validation_error.py +24 -0
  385. evcloud/types/limit_unit.py +5 -0
  386. evcloud/types/location_availability.py +28 -0
  387. evcloud/types/location_availability_status.py +7 -0
  388. evcloud/types/location_availability_status_zero.py +7 -0
  389. evcloud/types/location_base.py +53 -0
  390. evcloud/types/location_base_parking_type.py +7 -0
  391. evcloud/types/location_base_parking_type_zero.py +8 -0
  392. evcloud/types/location_cluster.py +26 -0
  393. evcloud/types/location_detail.py +51 -0
  394. evcloud/types/location_key_input.py +25 -0
  395. evcloud/types/location_list.py +24 -0
  396. evcloud/types/location_out.py +79 -0
  397. evcloud/types/location_out_access_mode.py +7 -0
  398. evcloud/types/location_out_access_mode_zero.py +5 -0
  399. evcloud/types/location_out_ocpi_version.py +7 -0
  400. evcloud/types/location_out_ocpi_version_zero.py +5 -0
  401. evcloud/types/location_out_origin.py +7 -0
  402. evcloud/types/location_out_origin_zero.py +5 -0
  403. evcloud/types/location_out_parking_type.py +7 -0
  404. evcloud/types/location_out_parking_type_zero.py +8 -0
  405. evcloud/types/location_out_role.py +7 -0
  406. evcloud/types/location_out_role_zero.py +5 -0
  407. evcloud/types/location_out_site_type.py +7 -0
  408. evcloud/types/location_out_site_type_zero.py +5 -0
  409. evcloud/types/location_page.py +27 -0
  410. evcloud/types/location_summary.py +43 -0
  411. evcloud/types/location_updated_event.py +30 -0
  412. evcloud/types/location_write_response.py +26 -0
  413. evcloud/types/map_cluster.py +28 -0
  414. evcloud/types/map_page.py +29 -0
  415. evcloud/types/network_consumer.py +25 -0
  416. evcloud/types/network_consumer_page.py +26 -0
  417. evcloud/types/network_detail_response.py +49 -0
  418. evcloud/types/network_detail_response_network_type.py +7 -0
  419. evcloud/types/network_detail_response_network_type_zero.py +5 -0
  420. evcloud/types/network_detail_response_publish_state.py +7 -0
  421. evcloud/types/network_detail_response_publish_state_zero.py +7 -0
  422. evcloud/types/network_page.py +26 -0
  423. evcloud/types/network_priority_order.py +23 -0
  424. evcloud/types/network_response.py +46 -0
  425. evcloud/types/network_response_network_type.py +7 -0
  426. evcloud/types/network_response_network_type_zero.py +5 -0
  427. evcloud/types/network_response_publish_state.py +7 -0
  428. evcloud/types/network_response_publish_state_zero.py +5 -0
  429. evcloud/types/network_rule_page.py +26 -0
  430. evcloud/types/network_rule_response.py +33 -0
  431. evcloud/types/network_rule_response_rule_type.py +7 -0
  432. evcloud/types/network_rule_response_rule_type_zero.py +5 -0
  433. evcloud/types/ocpi_business_details.py +26 -0
  434. evcloud/types/ocpi_business_details_input.py +26 -0
  435. evcloud/types/ocpi_cdr_dimension.py +24 -0
  436. evcloud/types/ocpi_cdr_location.py +30 -0
  437. evcloud/types/ocpi_cdr_token.py +30 -0
  438. evcloud/types/ocpi_charging_period.py +27 -0
  439. evcloud/types/ocpi_display_text.py +24 -0
  440. evcloud/types/ocpi_energy_mix.py +29 -0
  441. evcloud/types/ocpi_energy_mix_input.py +29 -0
  442. evcloud/types/ocpi_energy_source.py +24 -0
  443. evcloud/types/ocpi_energy_source_input.py +24 -0
  444. evcloud/types/ocpi_environmental_impact.py +24 -0
  445. evcloud/types/ocpi_evse_parking.py +24 -0
  446. evcloud/types/ocpi_exceptional_period.py +25 -0
  447. evcloud/types/ocpi_geo_location.py +24 -0
  448. evcloud/types/ocpi_geo_location_in.py +24 -0
  449. evcloud/types/ocpi_image.py +28 -0
  450. evcloud/types/ocpi_image_input.py +28 -0
  451. evcloud/types/ocpi_opening_times.py +28 -0
  452. evcloud/types/ocpi_opening_times_input.py +28 -0
  453. evcloud/types/ocpi_parking_place.py +44 -0
  454. evcloud/types/ocpi_parking_place_input.py +44 -0
  455. evcloud/types/ocpi_price_component_input.py +28 -0
  456. evcloud/types/ocpi_price_component_input_price.py +5 -0
  457. evcloud/types/ocpi_price_component_input_vat.py +5 -0
  458. evcloud/types/ocpi_price_component_output.py +26 -0
  459. evcloud/types/ocpi_price_input.py +26 -0
  460. evcloud/types/ocpi_price_input_excl_vat.py +5 -0
  461. evcloud/types/ocpi_price_input_incl_vat.py +5 -0
  462. evcloud/types/ocpi_price_output.py +24 -0
  463. evcloud/types/ocpi_publish_token.py +27 -0
  464. evcloud/types/ocpi_regular_hours.py +25 -0
  465. evcloud/types/ocpi_regular_hours_input.py +25 -0
  466. evcloud/types/ocpi_related_location.py +26 -0
  467. evcloud/types/ocpi_signed_data.py +28 -0
  468. evcloud/types/ocpi_signed_value.py +25 -0
  469. evcloud/types/ocpi_status_schedule.py +26 -0
  470. evcloud/types/ocpi_tariff_element_input.py +26 -0
  471. evcloud/types/ocpi_tariff_element_output.py +26 -0
  472. evcloud/types/ocpi_tariff_restrictions_input.py +33 -0
  473. evcloud/types/ocpi_tariff_restrictions_input_max_kwh.py +5 -0
  474. evcloud/types/ocpi_tariff_restrictions_input_min_kwh.py +5 -0
  475. evcloud/types/ocpi_tariff_restrictions_output.py +31 -0
  476. evcloud/types/ocpi_tariff_snapshot.py +26 -0
  477. evcloud/types/ocpp_version.py +5 -0
  478. evcloud/types/page_info.py +24 -0
  479. evcloud/types/parking.py +45 -0
  480. evcloud/types/parking_direction.py +7 -0
  481. evcloud/types/parking_direction_zero.py +5 -0
  482. evcloud/types/parking_type.py +8 -0
  483. evcloud/types/parking_vehicle_types_item.py +7 -0
  484. evcloud/types/parking_vehicle_types_item_zero.py +18 -0
  485. evcloud/types/partner_invite_response.py +47 -0
  486. evcloud/types/partner_invite_response_action.py +5 -0
  487. evcloud/types/partner_invite_response_role.py +5 -0
  488. evcloud/types/partner_invite_response_version.py +5 -0
  489. evcloud/types/partner_invite_revoke_response.py +31 -0
  490. evcloud/types/partner_invite_revoke_response_role.py +5 -0
  491. evcloud/types/partner_response.py +41 -0
  492. evcloud/types/partner_response_ocpi_version.py +5 -0
  493. evcloud/types/partner_token_updated_event.py +35 -0
  494. evcloud/types/partner_versions_pull_response.py +29 -0
  495. evcloud/types/partner_versions_pull_response_code.py +8 -0
  496. evcloud/types/partner_versions_pull_response_version.py +5 -0
  497. evcloud/types/power_measurement.py +30 -0
  498. evcloud/types/power_measurement_event.py +30 -0
  499. evcloud/types/power_measurement_list.py +24 -0
  500. evcloud/types/power_type.py +5 -0
  501. evcloud/types/price_component.py +26 -0
  502. evcloud/types/price_limit.py +24 -0
  503. evcloud/types/pricing_mode.py +5 -0
  504. evcloud/types/queue_health.py +34 -0
  505. evcloud/types/reservation_cancel_response.py +25 -0
  506. evcloud/types/resolve_chargers_response_own.py +28 -0
  507. evcloud/types/resolve_chargers_response_own_ocpi_version.py +7 -0
  508. evcloud/types/resolve_chargers_response_own_ocpi_version_zero.py +5 -0
  509. evcloud/types/resolve_chargers_response_roaming.py +30 -0
  510. evcloud/types/resolve_chargers_response_roaming_ocpi_version.py +7 -0
  511. evcloud/types/resolve_chargers_response_roaming_ocpi_version_zero.py +5 -0
  512. evcloud/types/session_event.py +39 -0
  513. evcloud/types/session_out.py +60 -0
  514. evcloud/types/session_out_auth_method.py +7 -0
  515. evcloud/types/session_out_auth_method_zero.py +5 -0
  516. evcloud/types/session_out_billing_state.py +7 -0
  517. evcloud/types/session_out_billing_state_zero.py +5 -0
  518. evcloud/types/session_out_origin.py +7 -0
  519. evcloud/types/session_out_origin_zero.py +5 -0
  520. evcloud/types/session_out_status.py +7 -0
  521. evcloud/types/session_out_status_zero.py +7 -0
  522. evcloud/types/session_page.py +27 -0
  523. evcloud/types/session_write_response.py +27 -0
  524. evcloud/types/sharing_slot.py +25 -0
  525. evcloud/types/sharing_slot_input.py +25 -0
  526. evcloud/types/site_type.py +5 -0
  527. evcloud/types/sync_patch_request.py +26 -0
  528. evcloud/types/sync_pull_response.py +31 -0
  529. evcloud/types/sync_push_response.py +31 -0
  530. evcloud/types/sync_push_response_status.py +5 -0
  531. evcloud/types/tariff.py +42 -0
  532. evcloud/types/tariff_assignment_out.py +32 -0
  533. evcloud/types/tariff_assignment_page.py +27 -0
  534. evcloud/types/tariff_delete_response.py +26 -0
  535. evcloud/types/tariff_display.py +27 -0
  536. evcloud/types/tariff_element.py +26 -0
  537. evcloud/types/tariff_out.py +57 -0
  538. evcloud/types/tariff_out_origin.py +7 -0
  539. evcloud/types/tariff_out_origin_zero.py +5 -0
  540. evcloud/types/tariff_out_tax_included.py +7 -0
  541. evcloud/types/tariff_out_tax_included_zero.py +5 -0
  542. evcloud/types/tariff_out_type.py +7 -0
  543. evcloud/types/tariff_out_type_zero.py +7 -0
  544. evcloud/types/tariff_page.py +27 -0
  545. evcloud/types/tariff_restrictions.py +36 -0
  546. evcloud/types/tariff_summary.py +29 -0
  547. evcloud/types/tariff_tax_included.py +7 -0
  548. evcloud/types/tariff_tax_included_zero.py +5 -0
  549. evcloud/types/tariff_type.py +7 -0
  550. evcloud/types/tariff_updated_event.py +29 -0
  551. evcloud/types/tariff_write_response.py +26 -0
  552. evcloud/types/tax_included.py +5 -0
  553. evcloud/types/tenant_profile_out.py +31 -0
  554. evcloud/types/token_bulk_out.py +26 -0
  555. evcloud/types/token_create.py +46 -0
  556. evcloud/types/token_create_default_profile_type.py +5 -0
  557. evcloud/types/token_create_ocpi_version.py +5 -0
  558. evcloud/types/token_create_type.py +5 -0
  559. evcloud/types/token_create_whitelist.py +5 -0
  560. evcloud/types/token_event_data.py +47 -0
  561. evcloud/types/token_event_data_status.py +7 -0
  562. evcloud/types/token_event_data_type.py +5 -0
  563. evcloud/types/token_event_data_whitelist.py +5 -0
  564. evcloud/types/token_event_out.py +32 -0
  565. evcloud/types/token_event_out_event.py +7 -0
  566. evcloud/types/token_event_out_event_zero.py +7 -0
  567. evcloud/types/token_event_page.py +26 -0
  568. evcloud/types/token_failure_item.py +24 -0
  569. evcloud/types/token_group_action_out.py +27 -0
  570. evcloud/types/token_group_failure.py +24 -0
  571. evcloud/types/token_group_member_out.py +26 -0
  572. evcloud/types/token_group_network_out.py +35 -0
  573. evcloud/types/token_group_network_page.py +26 -0
  574. evcloud/types/token_group_out.py +31 -0
  575. evcloud/types/token_group_page.py +26 -0
  576. evcloud/types/token_out.py +55 -0
  577. evcloud/types/token_out_status.py +7 -0
  578. evcloud/types/token_out_status_zero.py +7 -0
  579. evcloud/types/token_out_type.py +7 -0
  580. evcloud/types/token_out_type_zero.py +5 -0
  581. evcloud/types/token_out_whitelist.py +7 -0
  582. evcloud/types/token_out_whitelist_zero.py +5 -0
  583. evcloud/types/token_page.py +26 -0
  584. evcloud/types/token_reason.py +23 -0
  585. evcloud/types/token_ref.py +26 -0
  586. evcloud/types/token_ref_ocpi_version.py +5 -0
  587. evcloud/types/token_write_response.py +28 -0
  588. evcloud/types/validation_error.py +28 -0
  589. evcloud/types/validation_error_loc_item.py +5 -0
  590. evcloud/types/webhook_delivery_page.py +27 -0
  591. evcloud/types/webhook_delivery_response.py +35 -0
  592. evcloud/types/webhook_page.py +27 -0
  593. evcloud/types/webhook_response.py +42 -0
  594. evcloud/types/webhook_response_event.py +7 -0
  595. evcloud/types/webhook_response_event_zero.py +27 -0
  596. evcloud/types/webhook_response_status.py +7 -0
  597. evcloud/types/webhook_response_status_zero.py +5 -0
  598. evcloud/types/webhook_test_result.py +25 -0
  599. evcloud/types/webhook_with_secret_response.py +43 -0
  600. evcloud/types/webhook_with_secret_response_event.py +7 -0
  601. evcloud/types/webhook_with_secret_response_event_zero.py +27 -0
  602. evcloud/types/webhook_with_secret_response_status.py +7 -0
  603. evcloud/types/webhook_with_secret_response_status_zero.py +5 -0
  604. evcloud/version.py +3 -0
  605. evcloud/webhooks/__init__.py +28 -0
  606. evcloud/webhooks/client.py +53 -0
  607. evcloud/webhooks/deliveries/__init__.py +4 -0
  608. evcloud/webhooks/deliveries/client.py +141 -0
  609. evcloud/webhooks/deliveries/raw_client.py +268 -0
  610. evcloud/webhooks/endpoints/__init__.py +17 -0
  611. evcloud/webhooks/endpoints/client.py +642 -0
  612. evcloud/webhooks/endpoints/raw_client.py +1521 -0
  613. evcloud/webhooks/endpoints/types/__init__.py +15 -0
  614. evcloud/webhooks/endpoints/types/list_endpoints_request_event_types_item.py +27 -0
  615. evcloud/webhooks/endpoints/types/webhook_create_request_api_version.py +5 -0
  616. evcloud/webhooks/endpoints/types/webhook_create_request_event.py +27 -0
  617. evcloud/webhooks/endpoints/types/webhook_update_request_status.py +5 -0
  618. evcloud/webhooks/event_types/__init__.py +7 -0
  619. evcloud/webhooks/event_types/client.py +176 -0
  620. evcloud/webhooks/event_types/raw_client.py +418 -0
  621. evcloud/webhooks/event_types/types/__init__.py +7 -0
  622. evcloud/webhooks/event_types/types/get_event_types_request_type.py +27 -0
  623. evcloud/webhooks/events/__init__.py +7 -0
  624. evcloud/webhooks/events/client.py +207 -0
  625. evcloud/webhooks/events/raw_client.py +355 -0
  626. evcloud/webhooks/events/types/__init__.py +8 -0
  627. evcloud/webhooks/events/types/deliver_event_request_data.py +33 -0
  628. evcloud/webhooks/events/types/deliver_event_request_event.py +27 -0
  629. evcloud/webhooks/health/__init__.py +4 -0
  630. evcloud/webhooks/health/client.py +161 -0
  631. evcloud/webhooks/health/raw_client.py +380 -0
  632. evcloud/webhooks/raw_client.py +13 -0
  633. evcloud-0.1.0.dist-info/METADATA +257 -0
  634. evcloud-0.1.0.dist-info/RECORD +635 -0
  635. evcloud-0.1.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,3288 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from json.decoder import JSONDecodeError
5
+
6
+ from ...core.api_error import ApiError
7
+ from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
+ from ...core.http_response import AsyncHttpResponse, HttpResponse
9
+ from ...core.jsonable_encoder import encode_path_param
10
+ from ...core.pagination import AsyncPager, SyncPager
11
+ from ...core.parse_error import ParsingError
12
+ from ...core.pydantic_utilities import parse_obj_as
13
+ from ...core.request_options import RequestOptions
14
+ from ...core.serialization import convert_and_respect_annotation_metadata
15
+ from ...errors.bad_gateway_error import BadGatewayError
16
+ from ...errors.conflict_error import ConflictError
17
+ from ...errors.gateway_timeout_error import GatewayTimeoutError
18
+ from ...errors.not_found_error import NotFoundError
19
+ from ...errors.too_many_requests_error import TooManyRequestsError
20
+ from ...errors.unauthorized_error import UnauthorizedError
21
+ from ...errors.unprocessable_entity_error import UnprocessableEntityError
22
+ from ...types.http_error_response import HttpErrorResponse
23
+ from ...types.http_validation_error import HttpValidationError
24
+ from ...types.token_group_action_out import TokenGroupActionOut
25
+ from ...types.token_group_network_out import TokenGroupNetworkOut
26
+ from ...types.token_group_network_page import TokenGroupNetworkPage
27
+ from ...types.token_group_out import TokenGroupOut
28
+ from ...types.token_group_page import TokenGroupPage
29
+ from ...types.token_ref import TokenRef
30
+ from .types.remove_token_token_groups_request_type import RemoveTokenTokenGroupsRequestType
31
+ from pydantic import ValidationError
32
+
33
+ # this is used as the default value for optional parameters
34
+ OMIT = typing.cast(typing.Any, ...)
35
+
36
+
37
+ class RawTokenGroupsClient:
38
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
39
+ self._client_wrapper = client_wrapper
40
+
41
+ def list(
42
+ self,
43
+ *,
44
+ after: typing.Optional[str] = None,
45
+ limit: typing.Optional[int] = None,
46
+ request_options: typing.Optional[RequestOptions] = None,
47
+ ) -> SyncPager[TokenGroupOut, TokenGroupPage]:
48
+ """
49
+ Your token groups with their members.
50
+
51
+ Parameters
52
+ ----------
53
+ after : typing.Optional[str]
54
+ Cursor: the previous page's ``pagination.end_cursor``. Omit it for the first page.
55
+
56
+ limit : typing.Optional[int]
57
+ Maximum rows per page (default 50, max 200).
58
+
59
+ request_options : typing.Optional[RequestOptions]
60
+ Request-specific configuration.
61
+
62
+ Returns
63
+ -------
64
+ SyncPager[TokenGroupOut, TokenGroupPage]
65
+ One page of groups with their members.
66
+ """
67
+ _response = self._client_wrapper.httpx_client.request(
68
+ "emsp/token-groups",
69
+ method="GET",
70
+ params={
71
+ "after": after,
72
+ "limit": limit,
73
+ },
74
+ request_options=request_options,
75
+ )
76
+ try:
77
+ if 200 <= _response.status_code < 300:
78
+ _parsed_response = typing.cast(
79
+ TokenGroupPage,
80
+ parse_obj_as(
81
+ type_=TokenGroupPage, # type: ignore
82
+ object_=_response.json(),
83
+ ),
84
+ )
85
+ _items = _parsed_response.data
86
+ _has_next = False
87
+ _get_next = None
88
+ if _parsed_response.pagination is not None:
89
+ _parsed_next = _parsed_response.pagination.end_cursor
90
+ _has_next = _parsed_next is not None and _parsed_next != ""
91
+ _get_next = lambda: self.list(
92
+ after=_parsed_next,
93
+ limit=limit,
94
+ request_options=request_options,
95
+ )
96
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
97
+ if _response.status_code == 401:
98
+ raise UnauthorizedError(
99
+ headers=dict(_response.headers),
100
+ body=typing.cast(
101
+ HttpErrorResponse,
102
+ parse_obj_as(
103
+ type_=HttpErrorResponse, # type: ignore
104
+ object_=_response.json(),
105
+ ),
106
+ ),
107
+ )
108
+ if _response.status_code == 422:
109
+ raise UnprocessableEntityError(
110
+ headers=dict(_response.headers),
111
+ body=typing.cast(
112
+ HttpValidationError,
113
+ parse_obj_as(
114
+ type_=HttpValidationError, # type: ignore
115
+ object_=_response.json(),
116
+ ),
117
+ ),
118
+ )
119
+ if _response.status_code == 429:
120
+ raise TooManyRequestsError(
121
+ headers=dict(_response.headers),
122
+ body=typing.cast(
123
+ HttpErrorResponse,
124
+ parse_obj_as(
125
+ type_=HttpErrorResponse, # type: ignore
126
+ object_=_response.json(),
127
+ ),
128
+ ),
129
+ )
130
+ if _response.status_code == 502:
131
+ raise BadGatewayError(
132
+ headers=dict(_response.headers),
133
+ body=typing.cast(
134
+ HttpErrorResponse,
135
+ parse_obj_as(
136
+ type_=HttpErrorResponse, # type: ignore
137
+ object_=_response.json(),
138
+ ),
139
+ ),
140
+ )
141
+ if _response.status_code == 504:
142
+ raise GatewayTimeoutError(
143
+ headers=dict(_response.headers),
144
+ body=typing.cast(
145
+ HttpErrorResponse,
146
+ parse_obj_as(
147
+ type_=HttpErrorResponse, # type: ignore
148
+ object_=_response.json(),
149
+ ),
150
+ ),
151
+ )
152
+ _response_json = _response.json()
153
+ except JSONDecodeError:
154
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
155
+ except ValidationError as e:
156
+ raise ParsingError(
157
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
158
+ )
159
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
160
+
161
+ def create(
162
+ self,
163
+ *,
164
+ idempotency_key: str,
165
+ name: str,
166
+ description: typing.Optional[str] = OMIT,
167
+ request_options: typing.Optional[RequestOptions] = None,
168
+ ) -> HttpResponse[TokenGroupOut]:
169
+ """
170
+ An empty group; add tokens and assign networks to it afterwards.
171
+
172
+ Parameters
173
+ ----------
174
+ idempotency_key : str
175
+ A unique key you choose for this call, e.g. a UUID. Retrying with the same key returns the first result instead of acting twice.
176
+
177
+ name : str
178
+
179
+ description : typing.Optional[str]
180
+
181
+ request_options : typing.Optional[RequestOptions]
182
+ Request-specific configuration.
183
+
184
+ Returns
185
+ -------
186
+ HttpResponse[TokenGroupOut]
187
+ The created, empty group.
188
+ """
189
+ _response = self._client_wrapper.httpx_client.request(
190
+ "emsp/token-groups",
191
+ method="POST",
192
+ json={
193
+ "name": name,
194
+ "description": description,
195
+ },
196
+ headers={
197
+ "content-type": "application/json",
198
+ "Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None,
199
+ },
200
+ request_options=request_options,
201
+ omit=OMIT,
202
+ )
203
+ try:
204
+ if 200 <= _response.status_code < 300:
205
+ _data = typing.cast(
206
+ TokenGroupOut,
207
+ parse_obj_as(
208
+ type_=TokenGroupOut, # type: ignore
209
+ object_=_response.json(),
210
+ ),
211
+ )
212
+ return HttpResponse(response=_response, data=_data)
213
+ if _response.status_code == 401:
214
+ raise UnauthorizedError(
215
+ headers=dict(_response.headers),
216
+ body=typing.cast(
217
+ HttpErrorResponse,
218
+ parse_obj_as(
219
+ type_=HttpErrorResponse, # type: ignore
220
+ object_=_response.json(),
221
+ ),
222
+ ),
223
+ )
224
+ if _response.status_code == 409:
225
+ raise ConflictError(
226
+ headers=dict(_response.headers),
227
+ body=typing.cast(
228
+ HttpErrorResponse,
229
+ parse_obj_as(
230
+ type_=HttpErrorResponse, # type: ignore
231
+ object_=_response.json(),
232
+ ),
233
+ ),
234
+ )
235
+ if _response.status_code == 422:
236
+ raise UnprocessableEntityError(
237
+ headers=dict(_response.headers),
238
+ body=typing.cast(
239
+ HttpValidationError,
240
+ parse_obj_as(
241
+ type_=HttpValidationError, # type: ignore
242
+ object_=_response.json(),
243
+ ),
244
+ ),
245
+ )
246
+ if _response.status_code == 429:
247
+ raise TooManyRequestsError(
248
+ headers=dict(_response.headers),
249
+ body=typing.cast(
250
+ HttpErrorResponse,
251
+ parse_obj_as(
252
+ type_=HttpErrorResponse, # type: ignore
253
+ object_=_response.json(),
254
+ ),
255
+ ),
256
+ )
257
+ if _response.status_code == 502:
258
+ raise BadGatewayError(
259
+ headers=dict(_response.headers),
260
+ body=typing.cast(
261
+ HttpErrorResponse,
262
+ parse_obj_as(
263
+ type_=HttpErrorResponse, # type: ignore
264
+ object_=_response.json(),
265
+ ),
266
+ ),
267
+ )
268
+ if _response.status_code == 504:
269
+ raise GatewayTimeoutError(
270
+ headers=dict(_response.headers),
271
+ body=typing.cast(
272
+ HttpErrorResponse,
273
+ parse_obj_as(
274
+ type_=HttpErrorResponse, # type: ignore
275
+ object_=_response.json(),
276
+ ),
277
+ ),
278
+ )
279
+ _response_json = _response.json()
280
+ except JSONDecodeError:
281
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
282
+ except ValidationError as e:
283
+ raise ParsingError(
284
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
285
+ )
286
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
287
+
288
+ def get(
289
+ self, group_id: int, *, request_options: typing.Optional[RequestOptions] = None
290
+ ) -> HttpResponse[TokenGroupOut]:
291
+ """
292
+ One group with its members.
293
+
294
+ Parameters
295
+ ----------
296
+ group_id : int
297
+ The token group's ``id``.
298
+
299
+ request_options : typing.Optional[RequestOptions]
300
+ Request-specific configuration.
301
+
302
+ Returns
303
+ -------
304
+ HttpResponse[TokenGroupOut]
305
+ The group with its members.
306
+ """
307
+ _response = self._client_wrapper.httpx_client.request(
308
+ f"emsp/token-groups/{encode_path_param(group_id)}",
309
+ method="GET",
310
+ request_options=request_options,
311
+ )
312
+ try:
313
+ if 200 <= _response.status_code < 300:
314
+ _data = typing.cast(
315
+ TokenGroupOut,
316
+ parse_obj_as(
317
+ type_=TokenGroupOut, # type: ignore
318
+ object_=_response.json(),
319
+ ),
320
+ )
321
+ return HttpResponse(response=_response, data=_data)
322
+ if _response.status_code == 401:
323
+ raise UnauthorizedError(
324
+ headers=dict(_response.headers),
325
+ body=typing.cast(
326
+ HttpErrorResponse,
327
+ parse_obj_as(
328
+ type_=HttpErrorResponse, # type: ignore
329
+ object_=_response.json(),
330
+ ),
331
+ ),
332
+ )
333
+ if _response.status_code == 404:
334
+ raise NotFoundError(
335
+ headers=dict(_response.headers),
336
+ body=typing.cast(
337
+ HttpErrorResponse,
338
+ parse_obj_as(
339
+ type_=HttpErrorResponse, # type: ignore
340
+ object_=_response.json(),
341
+ ),
342
+ ),
343
+ )
344
+ if _response.status_code == 422:
345
+ raise UnprocessableEntityError(
346
+ headers=dict(_response.headers),
347
+ body=typing.cast(
348
+ HttpValidationError,
349
+ parse_obj_as(
350
+ type_=HttpValidationError, # type: ignore
351
+ object_=_response.json(),
352
+ ),
353
+ ),
354
+ )
355
+ if _response.status_code == 429:
356
+ raise TooManyRequestsError(
357
+ headers=dict(_response.headers),
358
+ body=typing.cast(
359
+ HttpErrorResponse,
360
+ parse_obj_as(
361
+ type_=HttpErrorResponse, # type: ignore
362
+ object_=_response.json(),
363
+ ),
364
+ ),
365
+ )
366
+ if _response.status_code == 502:
367
+ raise BadGatewayError(
368
+ headers=dict(_response.headers),
369
+ body=typing.cast(
370
+ HttpErrorResponse,
371
+ parse_obj_as(
372
+ type_=HttpErrorResponse, # type: ignore
373
+ object_=_response.json(),
374
+ ),
375
+ ),
376
+ )
377
+ if _response.status_code == 504:
378
+ raise GatewayTimeoutError(
379
+ headers=dict(_response.headers),
380
+ body=typing.cast(
381
+ HttpErrorResponse,
382
+ parse_obj_as(
383
+ type_=HttpErrorResponse, # type: ignore
384
+ object_=_response.json(),
385
+ ),
386
+ ),
387
+ )
388
+ _response_json = _response.json()
389
+ except JSONDecodeError:
390
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
391
+ except ValidationError as e:
392
+ raise ParsingError(
393
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
394
+ )
395
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
396
+
397
+ def update(
398
+ self,
399
+ group_id: int,
400
+ *,
401
+ name: typing.Optional[str] = OMIT,
402
+ description: typing.Optional[str] = OMIT,
403
+ request_options: typing.Optional[RequestOptions] = None,
404
+ ) -> HttpResponse[TokenGroupOut]:
405
+ """
406
+ Rename the group or replace its description; send ``description: null`` to clear it.
407
+
408
+ Parameters
409
+ ----------
410
+ group_id : int
411
+ The token group's ``id``.
412
+
413
+ name : typing.Optional[str]
414
+
415
+ description : typing.Optional[str]
416
+
417
+ request_options : typing.Optional[RequestOptions]
418
+ Request-specific configuration.
419
+
420
+ Returns
421
+ -------
422
+ HttpResponse[TokenGroupOut]
423
+ The group after the update.
424
+ """
425
+ _response = self._client_wrapper.httpx_client.request(
426
+ f"emsp/token-groups/{encode_path_param(group_id)}",
427
+ method="PATCH",
428
+ json={
429
+ "name": name,
430
+ "description": description,
431
+ },
432
+ headers={
433
+ "content-type": "application/json",
434
+ },
435
+ request_options=request_options,
436
+ omit=OMIT,
437
+ )
438
+ try:
439
+ if 200 <= _response.status_code < 300:
440
+ _data = typing.cast(
441
+ TokenGroupOut,
442
+ parse_obj_as(
443
+ type_=TokenGroupOut, # type: ignore
444
+ object_=_response.json(),
445
+ ),
446
+ )
447
+ return HttpResponse(response=_response, data=_data)
448
+ if _response.status_code == 401:
449
+ raise UnauthorizedError(
450
+ headers=dict(_response.headers),
451
+ body=typing.cast(
452
+ HttpErrorResponse,
453
+ parse_obj_as(
454
+ type_=HttpErrorResponse, # type: ignore
455
+ object_=_response.json(),
456
+ ),
457
+ ),
458
+ )
459
+ if _response.status_code == 404:
460
+ raise NotFoundError(
461
+ headers=dict(_response.headers),
462
+ body=typing.cast(
463
+ HttpErrorResponse,
464
+ parse_obj_as(
465
+ type_=HttpErrorResponse, # type: ignore
466
+ object_=_response.json(),
467
+ ),
468
+ ),
469
+ )
470
+ if _response.status_code == 422:
471
+ raise UnprocessableEntityError(
472
+ headers=dict(_response.headers),
473
+ body=typing.cast(
474
+ HttpValidationError,
475
+ parse_obj_as(
476
+ type_=HttpValidationError, # type: ignore
477
+ object_=_response.json(),
478
+ ),
479
+ ),
480
+ )
481
+ if _response.status_code == 429:
482
+ raise TooManyRequestsError(
483
+ headers=dict(_response.headers),
484
+ body=typing.cast(
485
+ HttpErrorResponse,
486
+ parse_obj_as(
487
+ type_=HttpErrorResponse, # type: ignore
488
+ object_=_response.json(),
489
+ ),
490
+ ),
491
+ )
492
+ if _response.status_code == 502:
493
+ raise BadGatewayError(
494
+ headers=dict(_response.headers),
495
+ body=typing.cast(
496
+ HttpErrorResponse,
497
+ parse_obj_as(
498
+ type_=HttpErrorResponse, # type: ignore
499
+ object_=_response.json(),
500
+ ),
501
+ ),
502
+ )
503
+ if _response.status_code == 504:
504
+ raise GatewayTimeoutError(
505
+ headers=dict(_response.headers),
506
+ body=typing.cast(
507
+ HttpErrorResponse,
508
+ parse_obj_as(
509
+ type_=HttpErrorResponse, # type: ignore
510
+ object_=_response.json(),
511
+ ),
512
+ ),
513
+ )
514
+ _response_json = _response.json()
515
+ except JSONDecodeError:
516
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
517
+ except ValidationError as e:
518
+ raise ParsingError(
519
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
520
+ )
521
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
522
+
523
+ def activate(
524
+ self, group_id: int, *, idempotency_key: str, request_options: typing.Optional[RequestOptions] = None
525
+ ) -> HttpResponse[TokenGroupActionOut]:
526
+ """
527
+ PROVISIONED members are activated and SUSPENDED ones reactivated, and pushed to partners with ``valid: true``. Revoked members stay invalid.
528
+
529
+ Parameters
530
+ ----------
531
+ group_id : int
532
+ The token group's ``id``.
533
+
534
+ idempotency_key : str
535
+ A unique key you choose for this call, e.g. a UUID. Retrying with the same key returns the first result instead of acting twice.
536
+
537
+ request_options : typing.Optional[RequestOptions]
538
+ Request-specific configuration.
539
+
540
+ Returns
541
+ -------
542
+ HttpResponse[TokenGroupActionOut]
543
+ The group after ``activate``, with the members that could not be changed.
544
+ """
545
+ _response = self._client_wrapper.httpx_client.request(
546
+ f"emsp/token-groups/{encode_path_param(group_id)}/activate",
547
+ method="POST",
548
+ headers={
549
+ "Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None,
550
+ },
551
+ request_options=request_options,
552
+ )
553
+ try:
554
+ if 200 <= _response.status_code < 300:
555
+ _data = typing.cast(
556
+ TokenGroupActionOut,
557
+ parse_obj_as(
558
+ type_=TokenGroupActionOut, # type: ignore
559
+ object_=_response.json(),
560
+ ),
561
+ )
562
+ return HttpResponse(response=_response, data=_data)
563
+ if _response.status_code == 401:
564
+ raise UnauthorizedError(
565
+ headers=dict(_response.headers),
566
+ body=typing.cast(
567
+ HttpErrorResponse,
568
+ parse_obj_as(
569
+ type_=HttpErrorResponse, # type: ignore
570
+ object_=_response.json(),
571
+ ),
572
+ ),
573
+ )
574
+ if _response.status_code == 404:
575
+ raise NotFoundError(
576
+ headers=dict(_response.headers),
577
+ body=typing.cast(
578
+ HttpErrorResponse,
579
+ parse_obj_as(
580
+ type_=HttpErrorResponse, # type: ignore
581
+ object_=_response.json(),
582
+ ),
583
+ ),
584
+ )
585
+ if _response.status_code == 409:
586
+ raise ConflictError(
587
+ headers=dict(_response.headers),
588
+ body=typing.cast(
589
+ HttpErrorResponse,
590
+ parse_obj_as(
591
+ type_=HttpErrorResponse, # type: ignore
592
+ object_=_response.json(),
593
+ ),
594
+ ),
595
+ )
596
+ if _response.status_code == 422:
597
+ raise UnprocessableEntityError(
598
+ headers=dict(_response.headers),
599
+ body=typing.cast(
600
+ HttpValidationError,
601
+ parse_obj_as(
602
+ type_=HttpValidationError, # type: ignore
603
+ object_=_response.json(),
604
+ ),
605
+ ),
606
+ )
607
+ if _response.status_code == 429:
608
+ raise TooManyRequestsError(
609
+ headers=dict(_response.headers),
610
+ body=typing.cast(
611
+ HttpErrorResponse,
612
+ parse_obj_as(
613
+ type_=HttpErrorResponse, # type: ignore
614
+ object_=_response.json(),
615
+ ),
616
+ ),
617
+ )
618
+ if _response.status_code == 502:
619
+ raise BadGatewayError(
620
+ headers=dict(_response.headers),
621
+ body=typing.cast(
622
+ HttpErrorResponse,
623
+ parse_obj_as(
624
+ type_=HttpErrorResponse, # type: ignore
625
+ object_=_response.json(),
626
+ ),
627
+ ),
628
+ )
629
+ if _response.status_code == 504:
630
+ raise GatewayTimeoutError(
631
+ headers=dict(_response.headers),
632
+ body=typing.cast(
633
+ HttpErrorResponse,
634
+ parse_obj_as(
635
+ type_=HttpErrorResponse, # type: ignore
636
+ object_=_response.json(),
637
+ ),
638
+ ),
639
+ )
640
+ _response_json = _response.json()
641
+ except JSONDecodeError:
642
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
643
+ except ValidationError as e:
644
+ raise ParsingError(
645
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
646
+ )
647
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
648
+
649
+ def list_networks(
650
+ self,
651
+ group_id: int,
652
+ *,
653
+ after: typing.Optional[str] = None,
654
+ limit: typing.Optional[int] = None,
655
+ request_options: typing.Optional[RequestOptions] = None,
656
+ ) -> SyncPager[TokenGroupNetworkOut, TokenGroupNetworkPage]:
657
+ """
658
+ Member tokens reach the CPOs of these networks.
659
+
660
+ Parameters
661
+ ----------
662
+ group_id : int
663
+ The token group's ``id``.
664
+
665
+ after : typing.Optional[str]
666
+ Cursor: the previous page's ``pagination.end_cursor``. Omit it for the first page.
667
+
668
+ limit : typing.Optional[int]
669
+ Maximum rows per page (default 50, max 200).
670
+
671
+ request_options : typing.Optional[RequestOptions]
672
+ Request-specific configuration.
673
+
674
+ Returns
675
+ -------
676
+ SyncPager[TokenGroupNetworkOut, TokenGroupNetworkPage]
677
+ One page of the networks assigned to the group.
678
+ """
679
+ _response = self._client_wrapper.httpx_client.request(
680
+ f"emsp/token-groups/{encode_path_param(group_id)}/networks",
681
+ method="GET",
682
+ params={
683
+ "after": after,
684
+ "limit": limit,
685
+ },
686
+ request_options=request_options,
687
+ )
688
+ try:
689
+ if 200 <= _response.status_code < 300:
690
+ _parsed_response = typing.cast(
691
+ TokenGroupNetworkPage,
692
+ parse_obj_as(
693
+ type_=TokenGroupNetworkPage, # type: ignore
694
+ object_=_response.json(),
695
+ ),
696
+ )
697
+ _items = _parsed_response.data
698
+ _has_next = False
699
+ _get_next = None
700
+ if _parsed_response.pagination is not None:
701
+ _parsed_next = _parsed_response.pagination.end_cursor
702
+ _has_next = _parsed_next is not None and _parsed_next != ""
703
+ _get_next = lambda: self.list_networks(
704
+ group_id,
705
+ after=_parsed_next,
706
+ limit=limit,
707
+ request_options=request_options,
708
+ )
709
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
710
+ if _response.status_code == 401:
711
+ raise UnauthorizedError(
712
+ headers=dict(_response.headers),
713
+ body=typing.cast(
714
+ HttpErrorResponse,
715
+ parse_obj_as(
716
+ type_=HttpErrorResponse, # type: ignore
717
+ object_=_response.json(),
718
+ ),
719
+ ),
720
+ )
721
+ if _response.status_code == 404:
722
+ raise NotFoundError(
723
+ headers=dict(_response.headers),
724
+ body=typing.cast(
725
+ HttpErrorResponse,
726
+ parse_obj_as(
727
+ type_=HttpErrorResponse, # type: ignore
728
+ object_=_response.json(),
729
+ ),
730
+ ),
731
+ )
732
+ if _response.status_code == 422:
733
+ raise UnprocessableEntityError(
734
+ headers=dict(_response.headers),
735
+ body=typing.cast(
736
+ HttpValidationError,
737
+ parse_obj_as(
738
+ type_=HttpValidationError, # type: ignore
739
+ object_=_response.json(),
740
+ ),
741
+ ),
742
+ )
743
+ if _response.status_code == 429:
744
+ raise TooManyRequestsError(
745
+ headers=dict(_response.headers),
746
+ body=typing.cast(
747
+ HttpErrorResponse,
748
+ parse_obj_as(
749
+ type_=HttpErrorResponse, # type: ignore
750
+ object_=_response.json(),
751
+ ),
752
+ ),
753
+ )
754
+ if _response.status_code == 502:
755
+ raise BadGatewayError(
756
+ headers=dict(_response.headers),
757
+ body=typing.cast(
758
+ HttpErrorResponse,
759
+ parse_obj_as(
760
+ type_=HttpErrorResponse, # type: ignore
761
+ object_=_response.json(),
762
+ ),
763
+ ),
764
+ )
765
+ if _response.status_code == 504:
766
+ raise GatewayTimeoutError(
767
+ headers=dict(_response.headers),
768
+ body=typing.cast(
769
+ HttpErrorResponse,
770
+ parse_obj_as(
771
+ type_=HttpErrorResponse, # type: ignore
772
+ object_=_response.json(),
773
+ ),
774
+ ),
775
+ )
776
+ _response_json = _response.json()
777
+ except JSONDecodeError:
778
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
779
+ except ValidationError as e:
780
+ raise ParsingError(
781
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
782
+ )
783
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
784
+
785
+ def assign_network(
786
+ self,
787
+ group_id: int,
788
+ *,
789
+ idempotency_key: str,
790
+ network_id: int,
791
+ request_options: typing.Optional[RequestOptions] = None,
792
+ ) -> HttpResponse[TokenGroupNetworkOut]:
793
+ """
794
+ The group's tokens reach the network's CPOs, and the group can scope location searches.
795
+
796
+ Parameters
797
+ ----------
798
+ group_id : int
799
+ The token group's ``id``.
800
+
801
+ idempotency_key : str
802
+ A unique key you choose for this call, e.g. a UUID. Retrying with the same key returns the first result instead of acting twice.
803
+
804
+ network_id : int
805
+
806
+ request_options : typing.Optional[RequestOptions]
807
+ Request-specific configuration.
808
+
809
+ Returns
810
+ -------
811
+ HttpResponse[TokenGroupNetworkOut]
812
+ The assigned network.
813
+ """
814
+ _response = self._client_wrapper.httpx_client.request(
815
+ f"emsp/token-groups/{encode_path_param(group_id)}/networks",
816
+ method="POST",
817
+ json={
818
+ "network_id": network_id,
819
+ },
820
+ headers={
821
+ "content-type": "application/json",
822
+ "Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None,
823
+ },
824
+ request_options=request_options,
825
+ omit=OMIT,
826
+ )
827
+ try:
828
+ if 200 <= _response.status_code < 300:
829
+ _data = typing.cast(
830
+ TokenGroupNetworkOut,
831
+ parse_obj_as(
832
+ type_=TokenGroupNetworkOut, # type: ignore
833
+ object_=_response.json(),
834
+ ),
835
+ )
836
+ return HttpResponse(response=_response, data=_data)
837
+ if _response.status_code == 401:
838
+ raise UnauthorizedError(
839
+ headers=dict(_response.headers),
840
+ body=typing.cast(
841
+ HttpErrorResponse,
842
+ parse_obj_as(
843
+ type_=HttpErrorResponse, # type: ignore
844
+ object_=_response.json(),
845
+ ),
846
+ ),
847
+ )
848
+ if _response.status_code == 404:
849
+ raise NotFoundError(
850
+ headers=dict(_response.headers),
851
+ body=typing.cast(
852
+ HttpErrorResponse,
853
+ parse_obj_as(
854
+ type_=HttpErrorResponse, # type: ignore
855
+ object_=_response.json(),
856
+ ),
857
+ ),
858
+ )
859
+ if _response.status_code == 409:
860
+ raise ConflictError(
861
+ headers=dict(_response.headers),
862
+ body=typing.cast(
863
+ HttpErrorResponse,
864
+ parse_obj_as(
865
+ type_=HttpErrorResponse, # type: ignore
866
+ object_=_response.json(),
867
+ ),
868
+ ),
869
+ )
870
+ if _response.status_code == 422:
871
+ raise UnprocessableEntityError(
872
+ headers=dict(_response.headers),
873
+ body=typing.cast(
874
+ HttpValidationError,
875
+ parse_obj_as(
876
+ type_=HttpValidationError, # type: ignore
877
+ object_=_response.json(),
878
+ ),
879
+ ),
880
+ )
881
+ if _response.status_code == 429:
882
+ raise TooManyRequestsError(
883
+ headers=dict(_response.headers),
884
+ body=typing.cast(
885
+ HttpErrorResponse,
886
+ parse_obj_as(
887
+ type_=HttpErrorResponse, # type: ignore
888
+ object_=_response.json(),
889
+ ),
890
+ ),
891
+ )
892
+ if _response.status_code == 502:
893
+ raise BadGatewayError(
894
+ headers=dict(_response.headers),
895
+ body=typing.cast(
896
+ HttpErrorResponse,
897
+ parse_obj_as(
898
+ type_=HttpErrorResponse, # type: ignore
899
+ object_=_response.json(),
900
+ ),
901
+ ),
902
+ )
903
+ if _response.status_code == 504:
904
+ raise GatewayTimeoutError(
905
+ headers=dict(_response.headers),
906
+ body=typing.cast(
907
+ HttpErrorResponse,
908
+ parse_obj_as(
909
+ type_=HttpErrorResponse, # type: ignore
910
+ object_=_response.json(),
911
+ ),
912
+ ),
913
+ )
914
+ _response_json = _response.json()
915
+ except JSONDecodeError:
916
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
917
+ except ValidationError as e:
918
+ raise ParsingError(
919
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
920
+ )
921
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
922
+
923
+ def unassign_network(
924
+ self, group_id: int, network_id: int, *, request_options: typing.Optional[RequestOptions] = None
925
+ ) -> HttpResponse[None]:
926
+ """
927
+ The network itself is kept; only its assignment to the group is removed.
928
+
929
+ Parameters
930
+ ----------
931
+ group_id : int
932
+ The token group's ``id``.
933
+
934
+ network_id : int
935
+ The network's ``network_id``.
936
+
937
+ request_options : typing.Optional[RequestOptions]
938
+ Request-specific configuration.
939
+
940
+ Returns
941
+ -------
942
+ HttpResponse[None]
943
+ """
944
+ _response = self._client_wrapper.httpx_client.request(
945
+ f"emsp/token-groups/{encode_path_param(group_id)}/networks/{encode_path_param(network_id)}",
946
+ method="DELETE",
947
+ request_options=request_options,
948
+ )
949
+ try:
950
+ if 200 <= _response.status_code < 300:
951
+ return HttpResponse(response=_response, data=None)
952
+ if _response.status_code == 401:
953
+ raise UnauthorizedError(
954
+ headers=dict(_response.headers),
955
+ body=typing.cast(
956
+ HttpErrorResponse,
957
+ parse_obj_as(
958
+ type_=HttpErrorResponse, # type: ignore
959
+ object_=_response.json(),
960
+ ),
961
+ ),
962
+ )
963
+ if _response.status_code == 404:
964
+ raise NotFoundError(
965
+ headers=dict(_response.headers),
966
+ body=typing.cast(
967
+ HttpErrorResponse,
968
+ parse_obj_as(
969
+ type_=HttpErrorResponse, # type: ignore
970
+ object_=_response.json(),
971
+ ),
972
+ ),
973
+ )
974
+ if _response.status_code == 422:
975
+ raise UnprocessableEntityError(
976
+ headers=dict(_response.headers),
977
+ body=typing.cast(
978
+ HttpValidationError,
979
+ parse_obj_as(
980
+ type_=HttpValidationError, # type: ignore
981
+ object_=_response.json(),
982
+ ),
983
+ ),
984
+ )
985
+ if _response.status_code == 429:
986
+ raise TooManyRequestsError(
987
+ headers=dict(_response.headers),
988
+ body=typing.cast(
989
+ HttpErrorResponse,
990
+ parse_obj_as(
991
+ type_=HttpErrorResponse, # type: ignore
992
+ object_=_response.json(),
993
+ ),
994
+ ),
995
+ )
996
+ if _response.status_code == 502:
997
+ raise BadGatewayError(
998
+ headers=dict(_response.headers),
999
+ body=typing.cast(
1000
+ HttpErrorResponse,
1001
+ parse_obj_as(
1002
+ type_=HttpErrorResponse, # type: ignore
1003
+ object_=_response.json(),
1004
+ ),
1005
+ ),
1006
+ )
1007
+ if _response.status_code == 504:
1008
+ raise GatewayTimeoutError(
1009
+ headers=dict(_response.headers),
1010
+ body=typing.cast(
1011
+ HttpErrorResponse,
1012
+ parse_obj_as(
1013
+ type_=HttpErrorResponse, # type: ignore
1014
+ object_=_response.json(),
1015
+ ),
1016
+ ),
1017
+ )
1018
+ _response_json = _response.json()
1019
+ except JSONDecodeError:
1020
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1021
+ except ValidationError as e:
1022
+ raise ParsingError(
1023
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
1024
+ )
1025
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1026
+
1027
+ def reactivate(
1028
+ self, group_id: int, *, idempotency_key: str, request_options: typing.Optional[RequestOptions] = None
1029
+ ) -> HttpResponse[TokenGroupActionOut]:
1030
+ """
1031
+ SUSPENDED members are pushed to partners with ``valid: true`` again. Revoked members stay invalid.
1032
+
1033
+ Parameters
1034
+ ----------
1035
+ group_id : int
1036
+ The token group's ``id``.
1037
+
1038
+ idempotency_key : str
1039
+ A unique key you choose for this call, e.g. a UUID. Retrying with the same key returns the first result instead of acting twice.
1040
+
1041
+ request_options : typing.Optional[RequestOptions]
1042
+ Request-specific configuration.
1043
+
1044
+ Returns
1045
+ -------
1046
+ HttpResponse[TokenGroupActionOut]
1047
+ The group after ``reactivate``, with the members that could not be changed.
1048
+ """
1049
+ _response = self._client_wrapper.httpx_client.request(
1050
+ f"emsp/token-groups/{encode_path_param(group_id)}/reactivate",
1051
+ method="POST",
1052
+ headers={
1053
+ "Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None,
1054
+ },
1055
+ request_options=request_options,
1056
+ )
1057
+ try:
1058
+ if 200 <= _response.status_code < 300:
1059
+ _data = typing.cast(
1060
+ TokenGroupActionOut,
1061
+ parse_obj_as(
1062
+ type_=TokenGroupActionOut, # type: ignore
1063
+ object_=_response.json(),
1064
+ ),
1065
+ )
1066
+ return HttpResponse(response=_response, data=_data)
1067
+ if _response.status_code == 401:
1068
+ raise UnauthorizedError(
1069
+ headers=dict(_response.headers),
1070
+ body=typing.cast(
1071
+ HttpErrorResponse,
1072
+ parse_obj_as(
1073
+ type_=HttpErrorResponse, # type: ignore
1074
+ object_=_response.json(),
1075
+ ),
1076
+ ),
1077
+ )
1078
+ if _response.status_code == 404:
1079
+ raise NotFoundError(
1080
+ headers=dict(_response.headers),
1081
+ body=typing.cast(
1082
+ HttpErrorResponse,
1083
+ parse_obj_as(
1084
+ type_=HttpErrorResponse, # type: ignore
1085
+ object_=_response.json(),
1086
+ ),
1087
+ ),
1088
+ )
1089
+ if _response.status_code == 409:
1090
+ raise ConflictError(
1091
+ headers=dict(_response.headers),
1092
+ body=typing.cast(
1093
+ HttpErrorResponse,
1094
+ parse_obj_as(
1095
+ type_=HttpErrorResponse, # type: ignore
1096
+ object_=_response.json(),
1097
+ ),
1098
+ ),
1099
+ )
1100
+ if _response.status_code == 422:
1101
+ raise UnprocessableEntityError(
1102
+ headers=dict(_response.headers),
1103
+ body=typing.cast(
1104
+ HttpValidationError,
1105
+ parse_obj_as(
1106
+ type_=HttpValidationError, # type: ignore
1107
+ object_=_response.json(),
1108
+ ),
1109
+ ),
1110
+ )
1111
+ if _response.status_code == 429:
1112
+ raise TooManyRequestsError(
1113
+ headers=dict(_response.headers),
1114
+ body=typing.cast(
1115
+ HttpErrorResponse,
1116
+ parse_obj_as(
1117
+ type_=HttpErrorResponse, # type: ignore
1118
+ object_=_response.json(),
1119
+ ),
1120
+ ),
1121
+ )
1122
+ if _response.status_code == 502:
1123
+ raise BadGatewayError(
1124
+ headers=dict(_response.headers),
1125
+ body=typing.cast(
1126
+ HttpErrorResponse,
1127
+ parse_obj_as(
1128
+ type_=HttpErrorResponse, # type: ignore
1129
+ object_=_response.json(),
1130
+ ),
1131
+ ),
1132
+ )
1133
+ if _response.status_code == 504:
1134
+ raise GatewayTimeoutError(
1135
+ headers=dict(_response.headers),
1136
+ body=typing.cast(
1137
+ HttpErrorResponse,
1138
+ parse_obj_as(
1139
+ type_=HttpErrorResponse, # type: ignore
1140
+ object_=_response.json(),
1141
+ ),
1142
+ ),
1143
+ )
1144
+ _response_json = _response.json()
1145
+ except JSONDecodeError:
1146
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1147
+ except ValidationError as e:
1148
+ raise ParsingError(
1149
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
1150
+ )
1151
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1152
+
1153
+ def revoke(
1154
+ self, group_id: int, *, idempotency_key: str, request_options: typing.Optional[RequestOptions] = None
1155
+ ) -> HttpResponse[TokenGroupActionOut]:
1156
+ """
1157
+ Every member that is not yet revoked is pushed with ``valid: false`` and marked revoked: later group activations leave it invalid.
1158
+
1159
+ Parameters
1160
+ ----------
1161
+ group_id : int
1162
+ The token group's ``id``.
1163
+
1164
+ idempotency_key : str
1165
+ A unique key you choose for this call, e.g. a UUID. Retrying with the same key returns the first result instead of acting twice.
1166
+
1167
+ request_options : typing.Optional[RequestOptions]
1168
+ Request-specific configuration.
1169
+
1170
+ Returns
1171
+ -------
1172
+ HttpResponse[TokenGroupActionOut]
1173
+ The group after ``revoke``, with the members that could not be changed.
1174
+ """
1175
+ _response = self._client_wrapper.httpx_client.request(
1176
+ f"emsp/token-groups/{encode_path_param(group_id)}/revoke",
1177
+ method="POST",
1178
+ headers={
1179
+ "Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None,
1180
+ },
1181
+ request_options=request_options,
1182
+ )
1183
+ try:
1184
+ if 200 <= _response.status_code < 300:
1185
+ _data = typing.cast(
1186
+ TokenGroupActionOut,
1187
+ parse_obj_as(
1188
+ type_=TokenGroupActionOut, # type: ignore
1189
+ object_=_response.json(),
1190
+ ),
1191
+ )
1192
+ return HttpResponse(response=_response, data=_data)
1193
+ if _response.status_code == 401:
1194
+ raise UnauthorizedError(
1195
+ headers=dict(_response.headers),
1196
+ body=typing.cast(
1197
+ HttpErrorResponse,
1198
+ parse_obj_as(
1199
+ type_=HttpErrorResponse, # type: ignore
1200
+ object_=_response.json(),
1201
+ ),
1202
+ ),
1203
+ )
1204
+ if _response.status_code == 404:
1205
+ raise NotFoundError(
1206
+ headers=dict(_response.headers),
1207
+ body=typing.cast(
1208
+ HttpErrorResponse,
1209
+ parse_obj_as(
1210
+ type_=HttpErrorResponse, # type: ignore
1211
+ object_=_response.json(),
1212
+ ),
1213
+ ),
1214
+ )
1215
+ if _response.status_code == 409:
1216
+ raise ConflictError(
1217
+ headers=dict(_response.headers),
1218
+ body=typing.cast(
1219
+ HttpErrorResponse,
1220
+ parse_obj_as(
1221
+ type_=HttpErrorResponse, # type: ignore
1222
+ object_=_response.json(),
1223
+ ),
1224
+ ),
1225
+ )
1226
+ if _response.status_code == 422:
1227
+ raise UnprocessableEntityError(
1228
+ headers=dict(_response.headers),
1229
+ body=typing.cast(
1230
+ HttpValidationError,
1231
+ parse_obj_as(
1232
+ type_=HttpValidationError, # type: ignore
1233
+ object_=_response.json(),
1234
+ ),
1235
+ ),
1236
+ )
1237
+ if _response.status_code == 429:
1238
+ raise TooManyRequestsError(
1239
+ headers=dict(_response.headers),
1240
+ body=typing.cast(
1241
+ HttpErrorResponse,
1242
+ parse_obj_as(
1243
+ type_=HttpErrorResponse, # type: ignore
1244
+ object_=_response.json(),
1245
+ ),
1246
+ ),
1247
+ )
1248
+ if _response.status_code == 502:
1249
+ raise BadGatewayError(
1250
+ headers=dict(_response.headers),
1251
+ body=typing.cast(
1252
+ HttpErrorResponse,
1253
+ parse_obj_as(
1254
+ type_=HttpErrorResponse, # type: ignore
1255
+ object_=_response.json(),
1256
+ ),
1257
+ ),
1258
+ )
1259
+ if _response.status_code == 504:
1260
+ raise GatewayTimeoutError(
1261
+ headers=dict(_response.headers),
1262
+ body=typing.cast(
1263
+ HttpErrorResponse,
1264
+ parse_obj_as(
1265
+ type_=HttpErrorResponse, # type: ignore
1266
+ object_=_response.json(),
1267
+ ),
1268
+ ),
1269
+ )
1270
+ _response_json = _response.json()
1271
+ except JSONDecodeError:
1272
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1273
+ except ValidationError as e:
1274
+ raise ParsingError(
1275
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
1276
+ )
1277
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1278
+
1279
+ def suspend(
1280
+ self, group_id: int, *, idempotency_key: str, request_options: typing.Optional[RequestOptions] = None
1281
+ ) -> HttpResponse[TokenGroupActionOut]:
1282
+ """
1283
+ ACTIVE members are pushed to partners with ``valid: false`` until the group is reactivated.
1284
+
1285
+ Parameters
1286
+ ----------
1287
+ group_id : int
1288
+ The token group's ``id``.
1289
+
1290
+ idempotency_key : str
1291
+ A unique key you choose for this call, e.g. a UUID. Retrying with the same key returns the first result instead of acting twice.
1292
+
1293
+ request_options : typing.Optional[RequestOptions]
1294
+ Request-specific configuration.
1295
+
1296
+ Returns
1297
+ -------
1298
+ HttpResponse[TokenGroupActionOut]
1299
+ The group after ``suspend``, with the members that could not be changed.
1300
+ """
1301
+ _response = self._client_wrapper.httpx_client.request(
1302
+ f"emsp/token-groups/{encode_path_param(group_id)}/suspend",
1303
+ method="POST",
1304
+ headers={
1305
+ "Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None,
1306
+ },
1307
+ request_options=request_options,
1308
+ )
1309
+ try:
1310
+ if 200 <= _response.status_code < 300:
1311
+ _data = typing.cast(
1312
+ TokenGroupActionOut,
1313
+ parse_obj_as(
1314
+ type_=TokenGroupActionOut, # type: ignore
1315
+ object_=_response.json(),
1316
+ ),
1317
+ )
1318
+ return HttpResponse(response=_response, data=_data)
1319
+ if _response.status_code == 401:
1320
+ raise UnauthorizedError(
1321
+ headers=dict(_response.headers),
1322
+ body=typing.cast(
1323
+ HttpErrorResponse,
1324
+ parse_obj_as(
1325
+ type_=HttpErrorResponse, # type: ignore
1326
+ object_=_response.json(),
1327
+ ),
1328
+ ),
1329
+ )
1330
+ if _response.status_code == 404:
1331
+ raise NotFoundError(
1332
+ headers=dict(_response.headers),
1333
+ body=typing.cast(
1334
+ HttpErrorResponse,
1335
+ parse_obj_as(
1336
+ type_=HttpErrorResponse, # type: ignore
1337
+ object_=_response.json(),
1338
+ ),
1339
+ ),
1340
+ )
1341
+ if _response.status_code == 409:
1342
+ raise ConflictError(
1343
+ headers=dict(_response.headers),
1344
+ body=typing.cast(
1345
+ HttpErrorResponse,
1346
+ parse_obj_as(
1347
+ type_=HttpErrorResponse, # type: ignore
1348
+ object_=_response.json(),
1349
+ ),
1350
+ ),
1351
+ )
1352
+ if _response.status_code == 422:
1353
+ raise UnprocessableEntityError(
1354
+ headers=dict(_response.headers),
1355
+ body=typing.cast(
1356
+ HttpValidationError,
1357
+ parse_obj_as(
1358
+ type_=HttpValidationError, # type: ignore
1359
+ object_=_response.json(),
1360
+ ),
1361
+ ),
1362
+ )
1363
+ if _response.status_code == 429:
1364
+ raise TooManyRequestsError(
1365
+ headers=dict(_response.headers),
1366
+ body=typing.cast(
1367
+ HttpErrorResponse,
1368
+ parse_obj_as(
1369
+ type_=HttpErrorResponse, # type: ignore
1370
+ object_=_response.json(),
1371
+ ),
1372
+ ),
1373
+ )
1374
+ if _response.status_code == 502:
1375
+ raise BadGatewayError(
1376
+ headers=dict(_response.headers),
1377
+ body=typing.cast(
1378
+ HttpErrorResponse,
1379
+ parse_obj_as(
1380
+ type_=HttpErrorResponse, # type: ignore
1381
+ object_=_response.json(),
1382
+ ),
1383
+ ),
1384
+ )
1385
+ if _response.status_code == 504:
1386
+ raise GatewayTimeoutError(
1387
+ headers=dict(_response.headers),
1388
+ body=typing.cast(
1389
+ HttpErrorResponse,
1390
+ parse_obj_as(
1391
+ type_=HttpErrorResponse, # type: ignore
1392
+ object_=_response.json(),
1393
+ ),
1394
+ ),
1395
+ )
1396
+ _response_json = _response.json()
1397
+ except JSONDecodeError:
1398
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1399
+ except ValidationError as e:
1400
+ raise ParsingError(
1401
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
1402
+ )
1403
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1404
+
1405
+ def add_tokens(
1406
+ self,
1407
+ group_id: int,
1408
+ *,
1409
+ idempotency_key: str,
1410
+ tokens: typing.Sequence[TokenRef],
1411
+ request_options: typing.Optional[RequestOptions] = None,
1412
+ ) -> HttpResponse[TokenGroupOut]:
1413
+ """
1414
+ Tokens already in the group are left as they are. Their ``valid`` flag is not changed.
1415
+
1416
+ Parameters
1417
+ ----------
1418
+ group_id : int
1419
+ The token group's ``id``.
1420
+
1421
+ idempotency_key : str
1422
+ A unique key you choose for this call, e.g. a UUID. Retrying with the same key returns the first result instead of acting twice.
1423
+
1424
+ tokens : typing.Sequence[TokenRef]
1425
+
1426
+ request_options : typing.Optional[RequestOptions]
1427
+ Request-specific configuration.
1428
+
1429
+ Returns
1430
+ -------
1431
+ HttpResponse[TokenGroupOut]
1432
+ The group with its members.
1433
+ """
1434
+ _response = self._client_wrapper.httpx_client.request(
1435
+ f"emsp/token-groups/{encode_path_param(group_id)}/tokens",
1436
+ method="POST",
1437
+ json={
1438
+ "tokens": convert_and_respect_annotation_metadata(
1439
+ object_=tokens, annotation=typing.Sequence[TokenRef], direction="write"
1440
+ ),
1441
+ },
1442
+ headers={
1443
+ "content-type": "application/json",
1444
+ "Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None,
1445
+ },
1446
+ request_options=request_options,
1447
+ omit=OMIT,
1448
+ )
1449
+ try:
1450
+ if 200 <= _response.status_code < 300:
1451
+ _data = typing.cast(
1452
+ TokenGroupOut,
1453
+ parse_obj_as(
1454
+ type_=TokenGroupOut, # type: ignore
1455
+ object_=_response.json(),
1456
+ ),
1457
+ )
1458
+ return HttpResponse(response=_response, data=_data)
1459
+ if _response.status_code == 401:
1460
+ raise UnauthorizedError(
1461
+ headers=dict(_response.headers),
1462
+ body=typing.cast(
1463
+ HttpErrorResponse,
1464
+ parse_obj_as(
1465
+ type_=HttpErrorResponse, # type: ignore
1466
+ object_=_response.json(),
1467
+ ),
1468
+ ),
1469
+ )
1470
+ if _response.status_code == 404:
1471
+ raise NotFoundError(
1472
+ headers=dict(_response.headers),
1473
+ body=typing.cast(
1474
+ HttpErrorResponse,
1475
+ parse_obj_as(
1476
+ type_=HttpErrorResponse, # type: ignore
1477
+ object_=_response.json(),
1478
+ ),
1479
+ ),
1480
+ )
1481
+ if _response.status_code == 409:
1482
+ raise ConflictError(
1483
+ headers=dict(_response.headers),
1484
+ body=typing.cast(
1485
+ HttpErrorResponse,
1486
+ parse_obj_as(
1487
+ type_=HttpErrorResponse, # type: ignore
1488
+ object_=_response.json(),
1489
+ ),
1490
+ ),
1491
+ )
1492
+ if _response.status_code == 422:
1493
+ raise UnprocessableEntityError(
1494
+ headers=dict(_response.headers),
1495
+ body=typing.cast(
1496
+ HttpValidationError,
1497
+ parse_obj_as(
1498
+ type_=HttpValidationError, # type: ignore
1499
+ object_=_response.json(),
1500
+ ),
1501
+ ),
1502
+ )
1503
+ if _response.status_code == 429:
1504
+ raise TooManyRequestsError(
1505
+ headers=dict(_response.headers),
1506
+ body=typing.cast(
1507
+ HttpErrorResponse,
1508
+ parse_obj_as(
1509
+ type_=HttpErrorResponse, # type: ignore
1510
+ object_=_response.json(),
1511
+ ),
1512
+ ),
1513
+ )
1514
+ if _response.status_code == 502:
1515
+ raise BadGatewayError(
1516
+ headers=dict(_response.headers),
1517
+ body=typing.cast(
1518
+ HttpErrorResponse,
1519
+ parse_obj_as(
1520
+ type_=HttpErrorResponse, # type: ignore
1521
+ object_=_response.json(),
1522
+ ),
1523
+ ),
1524
+ )
1525
+ if _response.status_code == 504:
1526
+ raise GatewayTimeoutError(
1527
+ headers=dict(_response.headers),
1528
+ body=typing.cast(
1529
+ HttpErrorResponse,
1530
+ parse_obj_as(
1531
+ type_=HttpErrorResponse, # type: ignore
1532
+ object_=_response.json(),
1533
+ ),
1534
+ ),
1535
+ )
1536
+ _response_json = _response.json()
1537
+ except JSONDecodeError:
1538
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1539
+ except ValidationError as e:
1540
+ raise ParsingError(
1541
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
1542
+ )
1543
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1544
+
1545
+ def remove_token(
1546
+ self,
1547
+ group_id: int,
1548
+ token_uid: str,
1549
+ *,
1550
+ type: RemoveTokenTokenGroupsRequestType,
1551
+ request_options: typing.Optional[RequestOptions] = None,
1552
+ ) -> HttpResponse[None]:
1553
+ """
1554
+ The token keeps its current ``valid`` flag.
1555
+
1556
+ Parameters
1557
+ ----------
1558
+ group_id : int
1559
+ The token group's ``id``.
1560
+
1561
+ token_uid : str
1562
+ OCPI token ``uid``.
1563
+
1564
+ type : RemoveTokenTokenGroupsRequestType
1565
+ The token's OCPI type, e.g. RFID.
1566
+
1567
+ request_options : typing.Optional[RequestOptions]
1568
+ Request-specific configuration.
1569
+
1570
+ Returns
1571
+ -------
1572
+ HttpResponse[None]
1573
+ """
1574
+ _response = self._client_wrapper.httpx_client.request(
1575
+ f"emsp/token-groups/{encode_path_param(group_id)}/tokens/{encode_path_param(token_uid)}",
1576
+ method="DELETE",
1577
+ params={
1578
+ "type": type,
1579
+ },
1580
+ request_options=request_options,
1581
+ )
1582
+ try:
1583
+ if 200 <= _response.status_code < 300:
1584
+ return HttpResponse(response=_response, data=None)
1585
+ if _response.status_code == 401:
1586
+ raise UnauthorizedError(
1587
+ headers=dict(_response.headers),
1588
+ body=typing.cast(
1589
+ HttpErrorResponse,
1590
+ parse_obj_as(
1591
+ type_=HttpErrorResponse, # type: ignore
1592
+ object_=_response.json(),
1593
+ ),
1594
+ ),
1595
+ )
1596
+ if _response.status_code == 404:
1597
+ raise NotFoundError(
1598
+ headers=dict(_response.headers),
1599
+ body=typing.cast(
1600
+ HttpErrorResponse,
1601
+ parse_obj_as(
1602
+ type_=HttpErrorResponse, # type: ignore
1603
+ object_=_response.json(),
1604
+ ),
1605
+ ),
1606
+ )
1607
+ if _response.status_code == 422:
1608
+ raise UnprocessableEntityError(
1609
+ headers=dict(_response.headers),
1610
+ body=typing.cast(
1611
+ HttpValidationError,
1612
+ parse_obj_as(
1613
+ type_=HttpValidationError, # type: ignore
1614
+ object_=_response.json(),
1615
+ ),
1616
+ ),
1617
+ )
1618
+ if _response.status_code == 429:
1619
+ raise TooManyRequestsError(
1620
+ headers=dict(_response.headers),
1621
+ body=typing.cast(
1622
+ HttpErrorResponse,
1623
+ parse_obj_as(
1624
+ type_=HttpErrorResponse, # type: ignore
1625
+ object_=_response.json(),
1626
+ ),
1627
+ ),
1628
+ )
1629
+ if _response.status_code == 502:
1630
+ raise BadGatewayError(
1631
+ headers=dict(_response.headers),
1632
+ body=typing.cast(
1633
+ HttpErrorResponse,
1634
+ parse_obj_as(
1635
+ type_=HttpErrorResponse, # type: ignore
1636
+ object_=_response.json(),
1637
+ ),
1638
+ ),
1639
+ )
1640
+ if _response.status_code == 504:
1641
+ raise GatewayTimeoutError(
1642
+ headers=dict(_response.headers),
1643
+ body=typing.cast(
1644
+ HttpErrorResponse,
1645
+ parse_obj_as(
1646
+ type_=HttpErrorResponse, # type: ignore
1647
+ object_=_response.json(),
1648
+ ),
1649
+ ),
1650
+ )
1651
+ _response_json = _response.json()
1652
+ except JSONDecodeError:
1653
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1654
+ except ValidationError as e:
1655
+ raise ParsingError(
1656
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
1657
+ )
1658
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1659
+
1660
+
1661
+ class AsyncRawTokenGroupsClient:
1662
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
1663
+ self._client_wrapper = client_wrapper
1664
+
1665
+ async def list(
1666
+ self,
1667
+ *,
1668
+ after: typing.Optional[str] = None,
1669
+ limit: typing.Optional[int] = None,
1670
+ request_options: typing.Optional[RequestOptions] = None,
1671
+ ) -> AsyncPager[TokenGroupOut, TokenGroupPage]:
1672
+ """
1673
+ Your token groups with their members.
1674
+
1675
+ Parameters
1676
+ ----------
1677
+ after : typing.Optional[str]
1678
+ Cursor: the previous page's ``pagination.end_cursor``. Omit it for the first page.
1679
+
1680
+ limit : typing.Optional[int]
1681
+ Maximum rows per page (default 50, max 200).
1682
+
1683
+ request_options : typing.Optional[RequestOptions]
1684
+ Request-specific configuration.
1685
+
1686
+ Returns
1687
+ -------
1688
+ AsyncPager[TokenGroupOut, TokenGroupPage]
1689
+ One page of groups with their members.
1690
+ """
1691
+ _response = await self._client_wrapper.httpx_client.request(
1692
+ "emsp/token-groups",
1693
+ method="GET",
1694
+ params={
1695
+ "after": after,
1696
+ "limit": limit,
1697
+ },
1698
+ request_options=request_options,
1699
+ )
1700
+ try:
1701
+ if 200 <= _response.status_code < 300:
1702
+ _parsed_response = typing.cast(
1703
+ TokenGroupPage,
1704
+ parse_obj_as(
1705
+ type_=TokenGroupPage, # type: ignore
1706
+ object_=_response.json(),
1707
+ ),
1708
+ )
1709
+ _items = _parsed_response.data
1710
+ _has_next = False
1711
+ _get_next = None
1712
+ if _parsed_response.pagination is not None:
1713
+ _parsed_next = _parsed_response.pagination.end_cursor
1714
+ _has_next = _parsed_next is not None and _parsed_next != ""
1715
+
1716
+ async def _get_next():
1717
+ return await self.list(
1718
+ after=_parsed_next,
1719
+ limit=limit,
1720
+ request_options=request_options,
1721
+ )
1722
+
1723
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
1724
+ if _response.status_code == 401:
1725
+ raise UnauthorizedError(
1726
+ headers=dict(_response.headers),
1727
+ body=typing.cast(
1728
+ HttpErrorResponse,
1729
+ parse_obj_as(
1730
+ type_=HttpErrorResponse, # type: ignore
1731
+ object_=_response.json(),
1732
+ ),
1733
+ ),
1734
+ )
1735
+ if _response.status_code == 422:
1736
+ raise UnprocessableEntityError(
1737
+ headers=dict(_response.headers),
1738
+ body=typing.cast(
1739
+ HttpValidationError,
1740
+ parse_obj_as(
1741
+ type_=HttpValidationError, # type: ignore
1742
+ object_=_response.json(),
1743
+ ),
1744
+ ),
1745
+ )
1746
+ if _response.status_code == 429:
1747
+ raise TooManyRequestsError(
1748
+ headers=dict(_response.headers),
1749
+ body=typing.cast(
1750
+ HttpErrorResponse,
1751
+ parse_obj_as(
1752
+ type_=HttpErrorResponse, # type: ignore
1753
+ object_=_response.json(),
1754
+ ),
1755
+ ),
1756
+ )
1757
+ if _response.status_code == 502:
1758
+ raise BadGatewayError(
1759
+ headers=dict(_response.headers),
1760
+ body=typing.cast(
1761
+ HttpErrorResponse,
1762
+ parse_obj_as(
1763
+ type_=HttpErrorResponse, # type: ignore
1764
+ object_=_response.json(),
1765
+ ),
1766
+ ),
1767
+ )
1768
+ if _response.status_code == 504:
1769
+ raise GatewayTimeoutError(
1770
+ headers=dict(_response.headers),
1771
+ body=typing.cast(
1772
+ HttpErrorResponse,
1773
+ parse_obj_as(
1774
+ type_=HttpErrorResponse, # type: ignore
1775
+ object_=_response.json(),
1776
+ ),
1777
+ ),
1778
+ )
1779
+ _response_json = _response.json()
1780
+ except JSONDecodeError:
1781
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1782
+ except ValidationError as e:
1783
+ raise ParsingError(
1784
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
1785
+ )
1786
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1787
+
1788
+ async def create(
1789
+ self,
1790
+ *,
1791
+ idempotency_key: str,
1792
+ name: str,
1793
+ description: typing.Optional[str] = OMIT,
1794
+ request_options: typing.Optional[RequestOptions] = None,
1795
+ ) -> AsyncHttpResponse[TokenGroupOut]:
1796
+ """
1797
+ An empty group; add tokens and assign networks to it afterwards.
1798
+
1799
+ Parameters
1800
+ ----------
1801
+ idempotency_key : str
1802
+ A unique key you choose for this call, e.g. a UUID. Retrying with the same key returns the first result instead of acting twice.
1803
+
1804
+ name : str
1805
+
1806
+ description : typing.Optional[str]
1807
+
1808
+ request_options : typing.Optional[RequestOptions]
1809
+ Request-specific configuration.
1810
+
1811
+ Returns
1812
+ -------
1813
+ AsyncHttpResponse[TokenGroupOut]
1814
+ The created, empty group.
1815
+ """
1816
+ _response = await self._client_wrapper.httpx_client.request(
1817
+ "emsp/token-groups",
1818
+ method="POST",
1819
+ json={
1820
+ "name": name,
1821
+ "description": description,
1822
+ },
1823
+ headers={
1824
+ "content-type": "application/json",
1825
+ "Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None,
1826
+ },
1827
+ request_options=request_options,
1828
+ omit=OMIT,
1829
+ )
1830
+ try:
1831
+ if 200 <= _response.status_code < 300:
1832
+ _data = typing.cast(
1833
+ TokenGroupOut,
1834
+ parse_obj_as(
1835
+ type_=TokenGroupOut, # type: ignore
1836
+ object_=_response.json(),
1837
+ ),
1838
+ )
1839
+ return AsyncHttpResponse(response=_response, data=_data)
1840
+ if _response.status_code == 401:
1841
+ raise UnauthorizedError(
1842
+ headers=dict(_response.headers),
1843
+ body=typing.cast(
1844
+ HttpErrorResponse,
1845
+ parse_obj_as(
1846
+ type_=HttpErrorResponse, # type: ignore
1847
+ object_=_response.json(),
1848
+ ),
1849
+ ),
1850
+ )
1851
+ if _response.status_code == 409:
1852
+ raise ConflictError(
1853
+ headers=dict(_response.headers),
1854
+ body=typing.cast(
1855
+ HttpErrorResponse,
1856
+ parse_obj_as(
1857
+ type_=HttpErrorResponse, # type: ignore
1858
+ object_=_response.json(),
1859
+ ),
1860
+ ),
1861
+ )
1862
+ if _response.status_code == 422:
1863
+ raise UnprocessableEntityError(
1864
+ headers=dict(_response.headers),
1865
+ body=typing.cast(
1866
+ HttpValidationError,
1867
+ parse_obj_as(
1868
+ type_=HttpValidationError, # type: ignore
1869
+ object_=_response.json(),
1870
+ ),
1871
+ ),
1872
+ )
1873
+ if _response.status_code == 429:
1874
+ raise TooManyRequestsError(
1875
+ headers=dict(_response.headers),
1876
+ body=typing.cast(
1877
+ HttpErrorResponse,
1878
+ parse_obj_as(
1879
+ type_=HttpErrorResponse, # type: ignore
1880
+ object_=_response.json(),
1881
+ ),
1882
+ ),
1883
+ )
1884
+ if _response.status_code == 502:
1885
+ raise BadGatewayError(
1886
+ headers=dict(_response.headers),
1887
+ body=typing.cast(
1888
+ HttpErrorResponse,
1889
+ parse_obj_as(
1890
+ type_=HttpErrorResponse, # type: ignore
1891
+ object_=_response.json(),
1892
+ ),
1893
+ ),
1894
+ )
1895
+ if _response.status_code == 504:
1896
+ raise GatewayTimeoutError(
1897
+ headers=dict(_response.headers),
1898
+ body=typing.cast(
1899
+ HttpErrorResponse,
1900
+ parse_obj_as(
1901
+ type_=HttpErrorResponse, # type: ignore
1902
+ object_=_response.json(),
1903
+ ),
1904
+ ),
1905
+ )
1906
+ _response_json = _response.json()
1907
+ except JSONDecodeError:
1908
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1909
+ except ValidationError as e:
1910
+ raise ParsingError(
1911
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
1912
+ )
1913
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1914
+
1915
+ async def get(
1916
+ self, group_id: int, *, request_options: typing.Optional[RequestOptions] = None
1917
+ ) -> AsyncHttpResponse[TokenGroupOut]:
1918
+ """
1919
+ One group with its members.
1920
+
1921
+ Parameters
1922
+ ----------
1923
+ group_id : int
1924
+ The token group's ``id``.
1925
+
1926
+ request_options : typing.Optional[RequestOptions]
1927
+ Request-specific configuration.
1928
+
1929
+ Returns
1930
+ -------
1931
+ AsyncHttpResponse[TokenGroupOut]
1932
+ The group with its members.
1933
+ """
1934
+ _response = await self._client_wrapper.httpx_client.request(
1935
+ f"emsp/token-groups/{encode_path_param(group_id)}",
1936
+ method="GET",
1937
+ request_options=request_options,
1938
+ )
1939
+ try:
1940
+ if 200 <= _response.status_code < 300:
1941
+ _data = typing.cast(
1942
+ TokenGroupOut,
1943
+ parse_obj_as(
1944
+ type_=TokenGroupOut, # type: ignore
1945
+ object_=_response.json(),
1946
+ ),
1947
+ )
1948
+ return AsyncHttpResponse(response=_response, data=_data)
1949
+ if _response.status_code == 401:
1950
+ raise UnauthorizedError(
1951
+ headers=dict(_response.headers),
1952
+ body=typing.cast(
1953
+ HttpErrorResponse,
1954
+ parse_obj_as(
1955
+ type_=HttpErrorResponse, # type: ignore
1956
+ object_=_response.json(),
1957
+ ),
1958
+ ),
1959
+ )
1960
+ if _response.status_code == 404:
1961
+ raise NotFoundError(
1962
+ headers=dict(_response.headers),
1963
+ body=typing.cast(
1964
+ HttpErrorResponse,
1965
+ parse_obj_as(
1966
+ type_=HttpErrorResponse, # type: ignore
1967
+ object_=_response.json(),
1968
+ ),
1969
+ ),
1970
+ )
1971
+ if _response.status_code == 422:
1972
+ raise UnprocessableEntityError(
1973
+ headers=dict(_response.headers),
1974
+ body=typing.cast(
1975
+ HttpValidationError,
1976
+ parse_obj_as(
1977
+ type_=HttpValidationError, # type: ignore
1978
+ object_=_response.json(),
1979
+ ),
1980
+ ),
1981
+ )
1982
+ if _response.status_code == 429:
1983
+ raise TooManyRequestsError(
1984
+ headers=dict(_response.headers),
1985
+ body=typing.cast(
1986
+ HttpErrorResponse,
1987
+ parse_obj_as(
1988
+ type_=HttpErrorResponse, # type: ignore
1989
+ object_=_response.json(),
1990
+ ),
1991
+ ),
1992
+ )
1993
+ if _response.status_code == 502:
1994
+ raise BadGatewayError(
1995
+ headers=dict(_response.headers),
1996
+ body=typing.cast(
1997
+ HttpErrorResponse,
1998
+ parse_obj_as(
1999
+ type_=HttpErrorResponse, # type: ignore
2000
+ object_=_response.json(),
2001
+ ),
2002
+ ),
2003
+ )
2004
+ if _response.status_code == 504:
2005
+ raise GatewayTimeoutError(
2006
+ headers=dict(_response.headers),
2007
+ body=typing.cast(
2008
+ HttpErrorResponse,
2009
+ parse_obj_as(
2010
+ type_=HttpErrorResponse, # type: ignore
2011
+ object_=_response.json(),
2012
+ ),
2013
+ ),
2014
+ )
2015
+ _response_json = _response.json()
2016
+ except JSONDecodeError:
2017
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2018
+ except ValidationError as e:
2019
+ raise ParsingError(
2020
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
2021
+ )
2022
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2023
+
2024
+ async def update(
2025
+ self,
2026
+ group_id: int,
2027
+ *,
2028
+ name: typing.Optional[str] = OMIT,
2029
+ description: typing.Optional[str] = OMIT,
2030
+ request_options: typing.Optional[RequestOptions] = None,
2031
+ ) -> AsyncHttpResponse[TokenGroupOut]:
2032
+ """
2033
+ Rename the group or replace its description; send ``description: null`` to clear it.
2034
+
2035
+ Parameters
2036
+ ----------
2037
+ group_id : int
2038
+ The token group's ``id``.
2039
+
2040
+ name : typing.Optional[str]
2041
+
2042
+ description : typing.Optional[str]
2043
+
2044
+ request_options : typing.Optional[RequestOptions]
2045
+ Request-specific configuration.
2046
+
2047
+ Returns
2048
+ -------
2049
+ AsyncHttpResponse[TokenGroupOut]
2050
+ The group after the update.
2051
+ """
2052
+ _response = await self._client_wrapper.httpx_client.request(
2053
+ f"emsp/token-groups/{encode_path_param(group_id)}",
2054
+ method="PATCH",
2055
+ json={
2056
+ "name": name,
2057
+ "description": description,
2058
+ },
2059
+ headers={
2060
+ "content-type": "application/json",
2061
+ },
2062
+ request_options=request_options,
2063
+ omit=OMIT,
2064
+ )
2065
+ try:
2066
+ if 200 <= _response.status_code < 300:
2067
+ _data = typing.cast(
2068
+ TokenGroupOut,
2069
+ parse_obj_as(
2070
+ type_=TokenGroupOut, # type: ignore
2071
+ object_=_response.json(),
2072
+ ),
2073
+ )
2074
+ return AsyncHttpResponse(response=_response, data=_data)
2075
+ if _response.status_code == 401:
2076
+ raise UnauthorizedError(
2077
+ headers=dict(_response.headers),
2078
+ body=typing.cast(
2079
+ HttpErrorResponse,
2080
+ parse_obj_as(
2081
+ type_=HttpErrorResponse, # type: ignore
2082
+ object_=_response.json(),
2083
+ ),
2084
+ ),
2085
+ )
2086
+ if _response.status_code == 404:
2087
+ raise NotFoundError(
2088
+ headers=dict(_response.headers),
2089
+ body=typing.cast(
2090
+ HttpErrorResponse,
2091
+ parse_obj_as(
2092
+ type_=HttpErrorResponse, # type: ignore
2093
+ object_=_response.json(),
2094
+ ),
2095
+ ),
2096
+ )
2097
+ if _response.status_code == 422:
2098
+ raise UnprocessableEntityError(
2099
+ headers=dict(_response.headers),
2100
+ body=typing.cast(
2101
+ HttpValidationError,
2102
+ parse_obj_as(
2103
+ type_=HttpValidationError, # type: ignore
2104
+ object_=_response.json(),
2105
+ ),
2106
+ ),
2107
+ )
2108
+ if _response.status_code == 429:
2109
+ raise TooManyRequestsError(
2110
+ headers=dict(_response.headers),
2111
+ body=typing.cast(
2112
+ HttpErrorResponse,
2113
+ parse_obj_as(
2114
+ type_=HttpErrorResponse, # type: ignore
2115
+ object_=_response.json(),
2116
+ ),
2117
+ ),
2118
+ )
2119
+ if _response.status_code == 502:
2120
+ raise BadGatewayError(
2121
+ headers=dict(_response.headers),
2122
+ body=typing.cast(
2123
+ HttpErrorResponse,
2124
+ parse_obj_as(
2125
+ type_=HttpErrorResponse, # type: ignore
2126
+ object_=_response.json(),
2127
+ ),
2128
+ ),
2129
+ )
2130
+ if _response.status_code == 504:
2131
+ raise GatewayTimeoutError(
2132
+ headers=dict(_response.headers),
2133
+ body=typing.cast(
2134
+ HttpErrorResponse,
2135
+ parse_obj_as(
2136
+ type_=HttpErrorResponse, # type: ignore
2137
+ object_=_response.json(),
2138
+ ),
2139
+ ),
2140
+ )
2141
+ _response_json = _response.json()
2142
+ except JSONDecodeError:
2143
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2144
+ except ValidationError as e:
2145
+ raise ParsingError(
2146
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
2147
+ )
2148
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2149
+
2150
+ async def activate(
2151
+ self, group_id: int, *, idempotency_key: str, request_options: typing.Optional[RequestOptions] = None
2152
+ ) -> AsyncHttpResponse[TokenGroupActionOut]:
2153
+ """
2154
+ PROVISIONED members are activated and SUSPENDED ones reactivated, and pushed to partners with ``valid: true``. Revoked members stay invalid.
2155
+
2156
+ Parameters
2157
+ ----------
2158
+ group_id : int
2159
+ The token group's ``id``.
2160
+
2161
+ idempotency_key : str
2162
+ A unique key you choose for this call, e.g. a UUID. Retrying with the same key returns the first result instead of acting twice.
2163
+
2164
+ request_options : typing.Optional[RequestOptions]
2165
+ Request-specific configuration.
2166
+
2167
+ Returns
2168
+ -------
2169
+ AsyncHttpResponse[TokenGroupActionOut]
2170
+ The group after ``activate``, with the members that could not be changed.
2171
+ """
2172
+ _response = await self._client_wrapper.httpx_client.request(
2173
+ f"emsp/token-groups/{encode_path_param(group_id)}/activate",
2174
+ method="POST",
2175
+ headers={
2176
+ "Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None,
2177
+ },
2178
+ request_options=request_options,
2179
+ )
2180
+ try:
2181
+ if 200 <= _response.status_code < 300:
2182
+ _data = typing.cast(
2183
+ TokenGroupActionOut,
2184
+ parse_obj_as(
2185
+ type_=TokenGroupActionOut, # type: ignore
2186
+ object_=_response.json(),
2187
+ ),
2188
+ )
2189
+ return AsyncHttpResponse(response=_response, data=_data)
2190
+ if _response.status_code == 401:
2191
+ raise UnauthorizedError(
2192
+ headers=dict(_response.headers),
2193
+ body=typing.cast(
2194
+ HttpErrorResponse,
2195
+ parse_obj_as(
2196
+ type_=HttpErrorResponse, # type: ignore
2197
+ object_=_response.json(),
2198
+ ),
2199
+ ),
2200
+ )
2201
+ if _response.status_code == 404:
2202
+ raise NotFoundError(
2203
+ headers=dict(_response.headers),
2204
+ body=typing.cast(
2205
+ HttpErrorResponse,
2206
+ parse_obj_as(
2207
+ type_=HttpErrorResponse, # type: ignore
2208
+ object_=_response.json(),
2209
+ ),
2210
+ ),
2211
+ )
2212
+ if _response.status_code == 409:
2213
+ raise ConflictError(
2214
+ headers=dict(_response.headers),
2215
+ body=typing.cast(
2216
+ HttpErrorResponse,
2217
+ parse_obj_as(
2218
+ type_=HttpErrorResponse, # type: ignore
2219
+ object_=_response.json(),
2220
+ ),
2221
+ ),
2222
+ )
2223
+ if _response.status_code == 422:
2224
+ raise UnprocessableEntityError(
2225
+ headers=dict(_response.headers),
2226
+ body=typing.cast(
2227
+ HttpValidationError,
2228
+ parse_obj_as(
2229
+ type_=HttpValidationError, # type: ignore
2230
+ object_=_response.json(),
2231
+ ),
2232
+ ),
2233
+ )
2234
+ if _response.status_code == 429:
2235
+ raise TooManyRequestsError(
2236
+ headers=dict(_response.headers),
2237
+ body=typing.cast(
2238
+ HttpErrorResponse,
2239
+ parse_obj_as(
2240
+ type_=HttpErrorResponse, # type: ignore
2241
+ object_=_response.json(),
2242
+ ),
2243
+ ),
2244
+ )
2245
+ if _response.status_code == 502:
2246
+ raise BadGatewayError(
2247
+ headers=dict(_response.headers),
2248
+ body=typing.cast(
2249
+ HttpErrorResponse,
2250
+ parse_obj_as(
2251
+ type_=HttpErrorResponse, # type: ignore
2252
+ object_=_response.json(),
2253
+ ),
2254
+ ),
2255
+ )
2256
+ if _response.status_code == 504:
2257
+ raise GatewayTimeoutError(
2258
+ headers=dict(_response.headers),
2259
+ body=typing.cast(
2260
+ HttpErrorResponse,
2261
+ parse_obj_as(
2262
+ type_=HttpErrorResponse, # type: ignore
2263
+ object_=_response.json(),
2264
+ ),
2265
+ ),
2266
+ )
2267
+ _response_json = _response.json()
2268
+ except JSONDecodeError:
2269
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2270
+ except ValidationError as e:
2271
+ raise ParsingError(
2272
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
2273
+ )
2274
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2275
+
2276
+ async def list_networks(
2277
+ self,
2278
+ group_id: int,
2279
+ *,
2280
+ after: typing.Optional[str] = None,
2281
+ limit: typing.Optional[int] = None,
2282
+ request_options: typing.Optional[RequestOptions] = None,
2283
+ ) -> AsyncPager[TokenGroupNetworkOut, TokenGroupNetworkPage]:
2284
+ """
2285
+ Member tokens reach the CPOs of these networks.
2286
+
2287
+ Parameters
2288
+ ----------
2289
+ group_id : int
2290
+ The token group's ``id``.
2291
+
2292
+ after : typing.Optional[str]
2293
+ Cursor: the previous page's ``pagination.end_cursor``. Omit it for the first page.
2294
+
2295
+ limit : typing.Optional[int]
2296
+ Maximum rows per page (default 50, max 200).
2297
+
2298
+ request_options : typing.Optional[RequestOptions]
2299
+ Request-specific configuration.
2300
+
2301
+ Returns
2302
+ -------
2303
+ AsyncPager[TokenGroupNetworkOut, TokenGroupNetworkPage]
2304
+ One page of the networks assigned to the group.
2305
+ """
2306
+ _response = await self._client_wrapper.httpx_client.request(
2307
+ f"emsp/token-groups/{encode_path_param(group_id)}/networks",
2308
+ method="GET",
2309
+ params={
2310
+ "after": after,
2311
+ "limit": limit,
2312
+ },
2313
+ request_options=request_options,
2314
+ )
2315
+ try:
2316
+ if 200 <= _response.status_code < 300:
2317
+ _parsed_response = typing.cast(
2318
+ TokenGroupNetworkPage,
2319
+ parse_obj_as(
2320
+ type_=TokenGroupNetworkPage, # type: ignore
2321
+ object_=_response.json(),
2322
+ ),
2323
+ )
2324
+ _items = _parsed_response.data
2325
+ _has_next = False
2326
+ _get_next = None
2327
+ if _parsed_response.pagination is not None:
2328
+ _parsed_next = _parsed_response.pagination.end_cursor
2329
+ _has_next = _parsed_next is not None and _parsed_next != ""
2330
+
2331
+ async def _get_next():
2332
+ return await self.list_networks(
2333
+ group_id,
2334
+ after=_parsed_next,
2335
+ limit=limit,
2336
+ request_options=request_options,
2337
+ )
2338
+
2339
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
2340
+ if _response.status_code == 401:
2341
+ raise UnauthorizedError(
2342
+ headers=dict(_response.headers),
2343
+ body=typing.cast(
2344
+ HttpErrorResponse,
2345
+ parse_obj_as(
2346
+ type_=HttpErrorResponse, # type: ignore
2347
+ object_=_response.json(),
2348
+ ),
2349
+ ),
2350
+ )
2351
+ if _response.status_code == 404:
2352
+ raise NotFoundError(
2353
+ headers=dict(_response.headers),
2354
+ body=typing.cast(
2355
+ HttpErrorResponse,
2356
+ parse_obj_as(
2357
+ type_=HttpErrorResponse, # type: ignore
2358
+ object_=_response.json(),
2359
+ ),
2360
+ ),
2361
+ )
2362
+ if _response.status_code == 422:
2363
+ raise UnprocessableEntityError(
2364
+ headers=dict(_response.headers),
2365
+ body=typing.cast(
2366
+ HttpValidationError,
2367
+ parse_obj_as(
2368
+ type_=HttpValidationError, # type: ignore
2369
+ object_=_response.json(),
2370
+ ),
2371
+ ),
2372
+ )
2373
+ if _response.status_code == 429:
2374
+ raise TooManyRequestsError(
2375
+ headers=dict(_response.headers),
2376
+ body=typing.cast(
2377
+ HttpErrorResponse,
2378
+ parse_obj_as(
2379
+ type_=HttpErrorResponse, # type: ignore
2380
+ object_=_response.json(),
2381
+ ),
2382
+ ),
2383
+ )
2384
+ if _response.status_code == 502:
2385
+ raise BadGatewayError(
2386
+ headers=dict(_response.headers),
2387
+ body=typing.cast(
2388
+ HttpErrorResponse,
2389
+ parse_obj_as(
2390
+ type_=HttpErrorResponse, # type: ignore
2391
+ object_=_response.json(),
2392
+ ),
2393
+ ),
2394
+ )
2395
+ if _response.status_code == 504:
2396
+ raise GatewayTimeoutError(
2397
+ headers=dict(_response.headers),
2398
+ body=typing.cast(
2399
+ HttpErrorResponse,
2400
+ parse_obj_as(
2401
+ type_=HttpErrorResponse, # type: ignore
2402
+ object_=_response.json(),
2403
+ ),
2404
+ ),
2405
+ )
2406
+ _response_json = _response.json()
2407
+ except JSONDecodeError:
2408
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2409
+ except ValidationError as e:
2410
+ raise ParsingError(
2411
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
2412
+ )
2413
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2414
+
2415
+ async def assign_network(
2416
+ self,
2417
+ group_id: int,
2418
+ *,
2419
+ idempotency_key: str,
2420
+ network_id: int,
2421
+ request_options: typing.Optional[RequestOptions] = None,
2422
+ ) -> AsyncHttpResponse[TokenGroupNetworkOut]:
2423
+ """
2424
+ The group's tokens reach the network's CPOs, and the group can scope location searches.
2425
+
2426
+ Parameters
2427
+ ----------
2428
+ group_id : int
2429
+ The token group's ``id``.
2430
+
2431
+ idempotency_key : str
2432
+ A unique key you choose for this call, e.g. a UUID. Retrying with the same key returns the first result instead of acting twice.
2433
+
2434
+ network_id : int
2435
+
2436
+ request_options : typing.Optional[RequestOptions]
2437
+ Request-specific configuration.
2438
+
2439
+ Returns
2440
+ -------
2441
+ AsyncHttpResponse[TokenGroupNetworkOut]
2442
+ The assigned network.
2443
+ """
2444
+ _response = await self._client_wrapper.httpx_client.request(
2445
+ f"emsp/token-groups/{encode_path_param(group_id)}/networks",
2446
+ method="POST",
2447
+ json={
2448
+ "network_id": network_id,
2449
+ },
2450
+ headers={
2451
+ "content-type": "application/json",
2452
+ "Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None,
2453
+ },
2454
+ request_options=request_options,
2455
+ omit=OMIT,
2456
+ )
2457
+ try:
2458
+ if 200 <= _response.status_code < 300:
2459
+ _data = typing.cast(
2460
+ TokenGroupNetworkOut,
2461
+ parse_obj_as(
2462
+ type_=TokenGroupNetworkOut, # type: ignore
2463
+ object_=_response.json(),
2464
+ ),
2465
+ )
2466
+ return AsyncHttpResponse(response=_response, data=_data)
2467
+ if _response.status_code == 401:
2468
+ raise UnauthorizedError(
2469
+ headers=dict(_response.headers),
2470
+ body=typing.cast(
2471
+ HttpErrorResponse,
2472
+ parse_obj_as(
2473
+ type_=HttpErrorResponse, # type: ignore
2474
+ object_=_response.json(),
2475
+ ),
2476
+ ),
2477
+ )
2478
+ if _response.status_code == 404:
2479
+ raise NotFoundError(
2480
+ headers=dict(_response.headers),
2481
+ body=typing.cast(
2482
+ HttpErrorResponse,
2483
+ parse_obj_as(
2484
+ type_=HttpErrorResponse, # type: ignore
2485
+ object_=_response.json(),
2486
+ ),
2487
+ ),
2488
+ )
2489
+ if _response.status_code == 409:
2490
+ raise ConflictError(
2491
+ headers=dict(_response.headers),
2492
+ body=typing.cast(
2493
+ HttpErrorResponse,
2494
+ parse_obj_as(
2495
+ type_=HttpErrorResponse, # type: ignore
2496
+ object_=_response.json(),
2497
+ ),
2498
+ ),
2499
+ )
2500
+ if _response.status_code == 422:
2501
+ raise UnprocessableEntityError(
2502
+ headers=dict(_response.headers),
2503
+ body=typing.cast(
2504
+ HttpValidationError,
2505
+ parse_obj_as(
2506
+ type_=HttpValidationError, # type: ignore
2507
+ object_=_response.json(),
2508
+ ),
2509
+ ),
2510
+ )
2511
+ if _response.status_code == 429:
2512
+ raise TooManyRequestsError(
2513
+ headers=dict(_response.headers),
2514
+ body=typing.cast(
2515
+ HttpErrorResponse,
2516
+ parse_obj_as(
2517
+ type_=HttpErrorResponse, # type: ignore
2518
+ object_=_response.json(),
2519
+ ),
2520
+ ),
2521
+ )
2522
+ if _response.status_code == 502:
2523
+ raise BadGatewayError(
2524
+ headers=dict(_response.headers),
2525
+ body=typing.cast(
2526
+ HttpErrorResponse,
2527
+ parse_obj_as(
2528
+ type_=HttpErrorResponse, # type: ignore
2529
+ object_=_response.json(),
2530
+ ),
2531
+ ),
2532
+ )
2533
+ if _response.status_code == 504:
2534
+ raise GatewayTimeoutError(
2535
+ headers=dict(_response.headers),
2536
+ body=typing.cast(
2537
+ HttpErrorResponse,
2538
+ parse_obj_as(
2539
+ type_=HttpErrorResponse, # type: ignore
2540
+ object_=_response.json(),
2541
+ ),
2542
+ ),
2543
+ )
2544
+ _response_json = _response.json()
2545
+ except JSONDecodeError:
2546
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2547
+ except ValidationError as e:
2548
+ raise ParsingError(
2549
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
2550
+ )
2551
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2552
+
2553
+ async def unassign_network(
2554
+ self, group_id: int, network_id: int, *, request_options: typing.Optional[RequestOptions] = None
2555
+ ) -> AsyncHttpResponse[None]:
2556
+ """
2557
+ The network itself is kept; only its assignment to the group is removed.
2558
+
2559
+ Parameters
2560
+ ----------
2561
+ group_id : int
2562
+ The token group's ``id``.
2563
+
2564
+ network_id : int
2565
+ The network's ``network_id``.
2566
+
2567
+ request_options : typing.Optional[RequestOptions]
2568
+ Request-specific configuration.
2569
+
2570
+ Returns
2571
+ -------
2572
+ AsyncHttpResponse[None]
2573
+ """
2574
+ _response = await self._client_wrapper.httpx_client.request(
2575
+ f"emsp/token-groups/{encode_path_param(group_id)}/networks/{encode_path_param(network_id)}",
2576
+ method="DELETE",
2577
+ request_options=request_options,
2578
+ )
2579
+ try:
2580
+ if 200 <= _response.status_code < 300:
2581
+ return AsyncHttpResponse(response=_response, data=None)
2582
+ if _response.status_code == 401:
2583
+ raise UnauthorizedError(
2584
+ headers=dict(_response.headers),
2585
+ body=typing.cast(
2586
+ HttpErrorResponse,
2587
+ parse_obj_as(
2588
+ type_=HttpErrorResponse, # type: ignore
2589
+ object_=_response.json(),
2590
+ ),
2591
+ ),
2592
+ )
2593
+ if _response.status_code == 404:
2594
+ raise NotFoundError(
2595
+ headers=dict(_response.headers),
2596
+ body=typing.cast(
2597
+ HttpErrorResponse,
2598
+ parse_obj_as(
2599
+ type_=HttpErrorResponse, # type: ignore
2600
+ object_=_response.json(),
2601
+ ),
2602
+ ),
2603
+ )
2604
+ if _response.status_code == 422:
2605
+ raise UnprocessableEntityError(
2606
+ headers=dict(_response.headers),
2607
+ body=typing.cast(
2608
+ HttpValidationError,
2609
+ parse_obj_as(
2610
+ type_=HttpValidationError, # type: ignore
2611
+ object_=_response.json(),
2612
+ ),
2613
+ ),
2614
+ )
2615
+ if _response.status_code == 429:
2616
+ raise TooManyRequestsError(
2617
+ headers=dict(_response.headers),
2618
+ body=typing.cast(
2619
+ HttpErrorResponse,
2620
+ parse_obj_as(
2621
+ type_=HttpErrorResponse, # type: ignore
2622
+ object_=_response.json(),
2623
+ ),
2624
+ ),
2625
+ )
2626
+ if _response.status_code == 502:
2627
+ raise BadGatewayError(
2628
+ headers=dict(_response.headers),
2629
+ body=typing.cast(
2630
+ HttpErrorResponse,
2631
+ parse_obj_as(
2632
+ type_=HttpErrorResponse, # type: ignore
2633
+ object_=_response.json(),
2634
+ ),
2635
+ ),
2636
+ )
2637
+ if _response.status_code == 504:
2638
+ raise GatewayTimeoutError(
2639
+ headers=dict(_response.headers),
2640
+ body=typing.cast(
2641
+ HttpErrorResponse,
2642
+ parse_obj_as(
2643
+ type_=HttpErrorResponse, # type: ignore
2644
+ object_=_response.json(),
2645
+ ),
2646
+ ),
2647
+ )
2648
+ _response_json = _response.json()
2649
+ except JSONDecodeError:
2650
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2651
+ except ValidationError as e:
2652
+ raise ParsingError(
2653
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
2654
+ )
2655
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2656
+
2657
+ async def reactivate(
2658
+ self, group_id: int, *, idempotency_key: str, request_options: typing.Optional[RequestOptions] = None
2659
+ ) -> AsyncHttpResponse[TokenGroupActionOut]:
2660
+ """
2661
+ SUSPENDED members are pushed to partners with ``valid: true`` again. Revoked members stay invalid.
2662
+
2663
+ Parameters
2664
+ ----------
2665
+ group_id : int
2666
+ The token group's ``id``.
2667
+
2668
+ idempotency_key : str
2669
+ A unique key you choose for this call, e.g. a UUID. Retrying with the same key returns the first result instead of acting twice.
2670
+
2671
+ request_options : typing.Optional[RequestOptions]
2672
+ Request-specific configuration.
2673
+
2674
+ Returns
2675
+ -------
2676
+ AsyncHttpResponse[TokenGroupActionOut]
2677
+ The group after ``reactivate``, with the members that could not be changed.
2678
+ """
2679
+ _response = await self._client_wrapper.httpx_client.request(
2680
+ f"emsp/token-groups/{encode_path_param(group_id)}/reactivate",
2681
+ method="POST",
2682
+ headers={
2683
+ "Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None,
2684
+ },
2685
+ request_options=request_options,
2686
+ )
2687
+ try:
2688
+ if 200 <= _response.status_code < 300:
2689
+ _data = typing.cast(
2690
+ TokenGroupActionOut,
2691
+ parse_obj_as(
2692
+ type_=TokenGroupActionOut, # type: ignore
2693
+ object_=_response.json(),
2694
+ ),
2695
+ )
2696
+ return AsyncHttpResponse(response=_response, data=_data)
2697
+ if _response.status_code == 401:
2698
+ raise UnauthorizedError(
2699
+ headers=dict(_response.headers),
2700
+ body=typing.cast(
2701
+ HttpErrorResponse,
2702
+ parse_obj_as(
2703
+ type_=HttpErrorResponse, # type: ignore
2704
+ object_=_response.json(),
2705
+ ),
2706
+ ),
2707
+ )
2708
+ if _response.status_code == 404:
2709
+ raise NotFoundError(
2710
+ headers=dict(_response.headers),
2711
+ body=typing.cast(
2712
+ HttpErrorResponse,
2713
+ parse_obj_as(
2714
+ type_=HttpErrorResponse, # type: ignore
2715
+ object_=_response.json(),
2716
+ ),
2717
+ ),
2718
+ )
2719
+ if _response.status_code == 409:
2720
+ raise ConflictError(
2721
+ headers=dict(_response.headers),
2722
+ body=typing.cast(
2723
+ HttpErrorResponse,
2724
+ parse_obj_as(
2725
+ type_=HttpErrorResponse, # type: ignore
2726
+ object_=_response.json(),
2727
+ ),
2728
+ ),
2729
+ )
2730
+ if _response.status_code == 422:
2731
+ raise UnprocessableEntityError(
2732
+ headers=dict(_response.headers),
2733
+ body=typing.cast(
2734
+ HttpValidationError,
2735
+ parse_obj_as(
2736
+ type_=HttpValidationError, # type: ignore
2737
+ object_=_response.json(),
2738
+ ),
2739
+ ),
2740
+ )
2741
+ if _response.status_code == 429:
2742
+ raise TooManyRequestsError(
2743
+ headers=dict(_response.headers),
2744
+ body=typing.cast(
2745
+ HttpErrorResponse,
2746
+ parse_obj_as(
2747
+ type_=HttpErrorResponse, # type: ignore
2748
+ object_=_response.json(),
2749
+ ),
2750
+ ),
2751
+ )
2752
+ if _response.status_code == 502:
2753
+ raise BadGatewayError(
2754
+ headers=dict(_response.headers),
2755
+ body=typing.cast(
2756
+ HttpErrorResponse,
2757
+ parse_obj_as(
2758
+ type_=HttpErrorResponse, # type: ignore
2759
+ object_=_response.json(),
2760
+ ),
2761
+ ),
2762
+ )
2763
+ if _response.status_code == 504:
2764
+ raise GatewayTimeoutError(
2765
+ headers=dict(_response.headers),
2766
+ body=typing.cast(
2767
+ HttpErrorResponse,
2768
+ parse_obj_as(
2769
+ type_=HttpErrorResponse, # type: ignore
2770
+ object_=_response.json(),
2771
+ ),
2772
+ ),
2773
+ )
2774
+ _response_json = _response.json()
2775
+ except JSONDecodeError:
2776
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2777
+ except ValidationError as e:
2778
+ raise ParsingError(
2779
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
2780
+ )
2781
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2782
+
2783
+ async def revoke(
2784
+ self, group_id: int, *, idempotency_key: str, request_options: typing.Optional[RequestOptions] = None
2785
+ ) -> AsyncHttpResponse[TokenGroupActionOut]:
2786
+ """
2787
+ Every member that is not yet revoked is pushed with ``valid: false`` and marked revoked: later group activations leave it invalid.
2788
+
2789
+ Parameters
2790
+ ----------
2791
+ group_id : int
2792
+ The token group's ``id``.
2793
+
2794
+ idempotency_key : str
2795
+ A unique key you choose for this call, e.g. a UUID. Retrying with the same key returns the first result instead of acting twice.
2796
+
2797
+ request_options : typing.Optional[RequestOptions]
2798
+ Request-specific configuration.
2799
+
2800
+ Returns
2801
+ -------
2802
+ AsyncHttpResponse[TokenGroupActionOut]
2803
+ The group after ``revoke``, with the members that could not be changed.
2804
+ """
2805
+ _response = await self._client_wrapper.httpx_client.request(
2806
+ f"emsp/token-groups/{encode_path_param(group_id)}/revoke",
2807
+ method="POST",
2808
+ headers={
2809
+ "Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None,
2810
+ },
2811
+ request_options=request_options,
2812
+ )
2813
+ try:
2814
+ if 200 <= _response.status_code < 300:
2815
+ _data = typing.cast(
2816
+ TokenGroupActionOut,
2817
+ parse_obj_as(
2818
+ type_=TokenGroupActionOut, # type: ignore
2819
+ object_=_response.json(),
2820
+ ),
2821
+ )
2822
+ return AsyncHttpResponse(response=_response, data=_data)
2823
+ if _response.status_code == 401:
2824
+ raise UnauthorizedError(
2825
+ headers=dict(_response.headers),
2826
+ body=typing.cast(
2827
+ HttpErrorResponse,
2828
+ parse_obj_as(
2829
+ type_=HttpErrorResponse, # type: ignore
2830
+ object_=_response.json(),
2831
+ ),
2832
+ ),
2833
+ )
2834
+ if _response.status_code == 404:
2835
+ raise NotFoundError(
2836
+ headers=dict(_response.headers),
2837
+ body=typing.cast(
2838
+ HttpErrorResponse,
2839
+ parse_obj_as(
2840
+ type_=HttpErrorResponse, # type: ignore
2841
+ object_=_response.json(),
2842
+ ),
2843
+ ),
2844
+ )
2845
+ if _response.status_code == 409:
2846
+ raise ConflictError(
2847
+ headers=dict(_response.headers),
2848
+ body=typing.cast(
2849
+ HttpErrorResponse,
2850
+ parse_obj_as(
2851
+ type_=HttpErrorResponse, # type: ignore
2852
+ object_=_response.json(),
2853
+ ),
2854
+ ),
2855
+ )
2856
+ if _response.status_code == 422:
2857
+ raise UnprocessableEntityError(
2858
+ headers=dict(_response.headers),
2859
+ body=typing.cast(
2860
+ HttpValidationError,
2861
+ parse_obj_as(
2862
+ type_=HttpValidationError, # type: ignore
2863
+ object_=_response.json(),
2864
+ ),
2865
+ ),
2866
+ )
2867
+ if _response.status_code == 429:
2868
+ raise TooManyRequestsError(
2869
+ headers=dict(_response.headers),
2870
+ body=typing.cast(
2871
+ HttpErrorResponse,
2872
+ parse_obj_as(
2873
+ type_=HttpErrorResponse, # type: ignore
2874
+ object_=_response.json(),
2875
+ ),
2876
+ ),
2877
+ )
2878
+ if _response.status_code == 502:
2879
+ raise BadGatewayError(
2880
+ headers=dict(_response.headers),
2881
+ body=typing.cast(
2882
+ HttpErrorResponse,
2883
+ parse_obj_as(
2884
+ type_=HttpErrorResponse, # type: ignore
2885
+ object_=_response.json(),
2886
+ ),
2887
+ ),
2888
+ )
2889
+ if _response.status_code == 504:
2890
+ raise GatewayTimeoutError(
2891
+ headers=dict(_response.headers),
2892
+ body=typing.cast(
2893
+ HttpErrorResponse,
2894
+ parse_obj_as(
2895
+ type_=HttpErrorResponse, # type: ignore
2896
+ object_=_response.json(),
2897
+ ),
2898
+ ),
2899
+ )
2900
+ _response_json = _response.json()
2901
+ except JSONDecodeError:
2902
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
2903
+ except ValidationError as e:
2904
+ raise ParsingError(
2905
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
2906
+ )
2907
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
2908
+
2909
+ async def suspend(
2910
+ self, group_id: int, *, idempotency_key: str, request_options: typing.Optional[RequestOptions] = None
2911
+ ) -> AsyncHttpResponse[TokenGroupActionOut]:
2912
+ """
2913
+ ACTIVE members are pushed to partners with ``valid: false`` until the group is reactivated.
2914
+
2915
+ Parameters
2916
+ ----------
2917
+ group_id : int
2918
+ The token group's ``id``.
2919
+
2920
+ idempotency_key : str
2921
+ A unique key you choose for this call, e.g. a UUID. Retrying with the same key returns the first result instead of acting twice.
2922
+
2923
+ request_options : typing.Optional[RequestOptions]
2924
+ Request-specific configuration.
2925
+
2926
+ Returns
2927
+ -------
2928
+ AsyncHttpResponse[TokenGroupActionOut]
2929
+ The group after ``suspend``, with the members that could not be changed.
2930
+ """
2931
+ _response = await self._client_wrapper.httpx_client.request(
2932
+ f"emsp/token-groups/{encode_path_param(group_id)}/suspend",
2933
+ method="POST",
2934
+ headers={
2935
+ "Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None,
2936
+ },
2937
+ request_options=request_options,
2938
+ )
2939
+ try:
2940
+ if 200 <= _response.status_code < 300:
2941
+ _data = typing.cast(
2942
+ TokenGroupActionOut,
2943
+ parse_obj_as(
2944
+ type_=TokenGroupActionOut, # type: ignore
2945
+ object_=_response.json(),
2946
+ ),
2947
+ )
2948
+ return AsyncHttpResponse(response=_response, data=_data)
2949
+ if _response.status_code == 401:
2950
+ raise UnauthorizedError(
2951
+ headers=dict(_response.headers),
2952
+ body=typing.cast(
2953
+ HttpErrorResponse,
2954
+ parse_obj_as(
2955
+ type_=HttpErrorResponse, # type: ignore
2956
+ object_=_response.json(),
2957
+ ),
2958
+ ),
2959
+ )
2960
+ if _response.status_code == 404:
2961
+ raise NotFoundError(
2962
+ headers=dict(_response.headers),
2963
+ body=typing.cast(
2964
+ HttpErrorResponse,
2965
+ parse_obj_as(
2966
+ type_=HttpErrorResponse, # type: ignore
2967
+ object_=_response.json(),
2968
+ ),
2969
+ ),
2970
+ )
2971
+ if _response.status_code == 409:
2972
+ raise ConflictError(
2973
+ headers=dict(_response.headers),
2974
+ body=typing.cast(
2975
+ HttpErrorResponse,
2976
+ parse_obj_as(
2977
+ type_=HttpErrorResponse, # type: ignore
2978
+ object_=_response.json(),
2979
+ ),
2980
+ ),
2981
+ )
2982
+ if _response.status_code == 422:
2983
+ raise UnprocessableEntityError(
2984
+ headers=dict(_response.headers),
2985
+ body=typing.cast(
2986
+ HttpValidationError,
2987
+ parse_obj_as(
2988
+ type_=HttpValidationError, # type: ignore
2989
+ object_=_response.json(),
2990
+ ),
2991
+ ),
2992
+ )
2993
+ if _response.status_code == 429:
2994
+ raise TooManyRequestsError(
2995
+ headers=dict(_response.headers),
2996
+ body=typing.cast(
2997
+ HttpErrorResponse,
2998
+ parse_obj_as(
2999
+ type_=HttpErrorResponse, # type: ignore
3000
+ object_=_response.json(),
3001
+ ),
3002
+ ),
3003
+ )
3004
+ if _response.status_code == 502:
3005
+ raise BadGatewayError(
3006
+ headers=dict(_response.headers),
3007
+ body=typing.cast(
3008
+ HttpErrorResponse,
3009
+ parse_obj_as(
3010
+ type_=HttpErrorResponse, # type: ignore
3011
+ object_=_response.json(),
3012
+ ),
3013
+ ),
3014
+ )
3015
+ if _response.status_code == 504:
3016
+ raise GatewayTimeoutError(
3017
+ headers=dict(_response.headers),
3018
+ body=typing.cast(
3019
+ HttpErrorResponse,
3020
+ parse_obj_as(
3021
+ type_=HttpErrorResponse, # type: ignore
3022
+ object_=_response.json(),
3023
+ ),
3024
+ ),
3025
+ )
3026
+ _response_json = _response.json()
3027
+ except JSONDecodeError:
3028
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
3029
+ except ValidationError as e:
3030
+ raise ParsingError(
3031
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
3032
+ )
3033
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
3034
+
3035
+ async def add_tokens(
3036
+ self,
3037
+ group_id: int,
3038
+ *,
3039
+ idempotency_key: str,
3040
+ tokens: typing.Sequence[TokenRef],
3041
+ request_options: typing.Optional[RequestOptions] = None,
3042
+ ) -> AsyncHttpResponse[TokenGroupOut]:
3043
+ """
3044
+ Tokens already in the group are left as they are. Their ``valid`` flag is not changed.
3045
+
3046
+ Parameters
3047
+ ----------
3048
+ group_id : int
3049
+ The token group's ``id``.
3050
+
3051
+ idempotency_key : str
3052
+ A unique key you choose for this call, e.g. a UUID. Retrying with the same key returns the first result instead of acting twice.
3053
+
3054
+ tokens : typing.Sequence[TokenRef]
3055
+
3056
+ request_options : typing.Optional[RequestOptions]
3057
+ Request-specific configuration.
3058
+
3059
+ Returns
3060
+ -------
3061
+ AsyncHttpResponse[TokenGroupOut]
3062
+ The group with its members.
3063
+ """
3064
+ _response = await self._client_wrapper.httpx_client.request(
3065
+ f"emsp/token-groups/{encode_path_param(group_id)}/tokens",
3066
+ method="POST",
3067
+ json={
3068
+ "tokens": convert_and_respect_annotation_metadata(
3069
+ object_=tokens, annotation=typing.Sequence[TokenRef], direction="write"
3070
+ ),
3071
+ },
3072
+ headers={
3073
+ "content-type": "application/json",
3074
+ "Idempotency-Key": str(idempotency_key) if idempotency_key is not None else None,
3075
+ },
3076
+ request_options=request_options,
3077
+ omit=OMIT,
3078
+ )
3079
+ try:
3080
+ if 200 <= _response.status_code < 300:
3081
+ _data = typing.cast(
3082
+ TokenGroupOut,
3083
+ parse_obj_as(
3084
+ type_=TokenGroupOut, # type: ignore
3085
+ object_=_response.json(),
3086
+ ),
3087
+ )
3088
+ return AsyncHttpResponse(response=_response, data=_data)
3089
+ if _response.status_code == 401:
3090
+ raise UnauthorizedError(
3091
+ headers=dict(_response.headers),
3092
+ body=typing.cast(
3093
+ HttpErrorResponse,
3094
+ parse_obj_as(
3095
+ type_=HttpErrorResponse, # type: ignore
3096
+ object_=_response.json(),
3097
+ ),
3098
+ ),
3099
+ )
3100
+ if _response.status_code == 404:
3101
+ raise NotFoundError(
3102
+ headers=dict(_response.headers),
3103
+ body=typing.cast(
3104
+ HttpErrorResponse,
3105
+ parse_obj_as(
3106
+ type_=HttpErrorResponse, # type: ignore
3107
+ object_=_response.json(),
3108
+ ),
3109
+ ),
3110
+ )
3111
+ if _response.status_code == 409:
3112
+ raise ConflictError(
3113
+ headers=dict(_response.headers),
3114
+ body=typing.cast(
3115
+ HttpErrorResponse,
3116
+ parse_obj_as(
3117
+ type_=HttpErrorResponse, # type: ignore
3118
+ object_=_response.json(),
3119
+ ),
3120
+ ),
3121
+ )
3122
+ if _response.status_code == 422:
3123
+ raise UnprocessableEntityError(
3124
+ headers=dict(_response.headers),
3125
+ body=typing.cast(
3126
+ HttpValidationError,
3127
+ parse_obj_as(
3128
+ type_=HttpValidationError, # type: ignore
3129
+ object_=_response.json(),
3130
+ ),
3131
+ ),
3132
+ )
3133
+ if _response.status_code == 429:
3134
+ raise TooManyRequestsError(
3135
+ headers=dict(_response.headers),
3136
+ body=typing.cast(
3137
+ HttpErrorResponse,
3138
+ parse_obj_as(
3139
+ type_=HttpErrorResponse, # type: ignore
3140
+ object_=_response.json(),
3141
+ ),
3142
+ ),
3143
+ )
3144
+ if _response.status_code == 502:
3145
+ raise BadGatewayError(
3146
+ headers=dict(_response.headers),
3147
+ body=typing.cast(
3148
+ HttpErrorResponse,
3149
+ parse_obj_as(
3150
+ type_=HttpErrorResponse, # type: ignore
3151
+ object_=_response.json(),
3152
+ ),
3153
+ ),
3154
+ )
3155
+ if _response.status_code == 504:
3156
+ raise GatewayTimeoutError(
3157
+ headers=dict(_response.headers),
3158
+ body=typing.cast(
3159
+ HttpErrorResponse,
3160
+ parse_obj_as(
3161
+ type_=HttpErrorResponse, # type: ignore
3162
+ object_=_response.json(),
3163
+ ),
3164
+ ),
3165
+ )
3166
+ _response_json = _response.json()
3167
+ except JSONDecodeError:
3168
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
3169
+ except ValidationError as e:
3170
+ raise ParsingError(
3171
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
3172
+ )
3173
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
3174
+
3175
+ async def remove_token(
3176
+ self,
3177
+ group_id: int,
3178
+ token_uid: str,
3179
+ *,
3180
+ type: RemoveTokenTokenGroupsRequestType,
3181
+ request_options: typing.Optional[RequestOptions] = None,
3182
+ ) -> AsyncHttpResponse[None]:
3183
+ """
3184
+ The token keeps its current ``valid`` flag.
3185
+
3186
+ Parameters
3187
+ ----------
3188
+ group_id : int
3189
+ The token group's ``id``.
3190
+
3191
+ token_uid : str
3192
+ OCPI token ``uid``.
3193
+
3194
+ type : RemoveTokenTokenGroupsRequestType
3195
+ The token's OCPI type, e.g. RFID.
3196
+
3197
+ request_options : typing.Optional[RequestOptions]
3198
+ Request-specific configuration.
3199
+
3200
+ Returns
3201
+ -------
3202
+ AsyncHttpResponse[None]
3203
+ """
3204
+ _response = await self._client_wrapper.httpx_client.request(
3205
+ f"emsp/token-groups/{encode_path_param(group_id)}/tokens/{encode_path_param(token_uid)}",
3206
+ method="DELETE",
3207
+ params={
3208
+ "type": type,
3209
+ },
3210
+ request_options=request_options,
3211
+ )
3212
+ try:
3213
+ if 200 <= _response.status_code < 300:
3214
+ return AsyncHttpResponse(response=_response, data=None)
3215
+ if _response.status_code == 401:
3216
+ raise UnauthorizedError(
3217
+ headers=dict(_response.headers),
3218
+ body=typing.cast(
3219
+ HttpErrorResponse,
3220
+ parse_obj_as(
3221
+ type_=HttpErrorResponse, # type: ignore
3222
+ object_=_response.json(),
3223
+ ),
3224
+ ),
3225
+ )
3226
+ if _response.status_code == 404:
3227
+ raise NotFoundError(
3228
+ headers=dict(_response.headers),
3229
+ body=typing.cast(
3230
+ HttpErrorResponse,
3231
+ parse_obj_as(
3232
+ type_=HttpErrorResponse, # type: ignore
3233
+ object_=_response.json(),
3234
+ ),
3235
+ ),
3236
+ )
3237
+ if _response.status_code == 422:
3238
+ raise UnprocessableEntityError(
3239
+ headers=dict(_response.headers),
3240
+ body=typing.cast(
3241
+ HttpValidationError,
3242
+ parse_obj_as(
3243
+ type_=HttpValidationError, # type: ignore
3244
+ object_=_response.json(),
3245
+ ),
3246
+ ),
3247
+ )
3248
+ if _response.status_code == 429:
3249
+ raise TooManyRequestsError(
3250
+ headers=dict(_response.headers),
3251
+ body=typing.cast(
3252
+ HttpErrorResponse,
3253
+ parse_obj_as(
3254
+ type_=HttpErrorResponse, # type: ignore
3255
+ object_=_response.json(),
3256
+ ),
3257
+ ),
3258
+ )
3259
+ if _response.status_code == 502:
3260
+ raise BadGatewayError(
3261
+ headers=dict(_response.headers),
3262
+ body=typing.cast(
3263
+ HttpErrorResponse,
3264
+ parse_obj_as(
3265
+ type_=HttpErrorResponse, # type: ignore
3266
+ object_=_response.json(),
3267
+ ),
3268
+ ),
3269
+ )
3270
+ if _response.status_code == 504:
3271
+ raise GatewayTimeoutError(
3272
+ headers=dict(_response.headers),
3273
+ body=typing.cast(
3274
+ HttpErrorResponse,
3275
+ parse_obj_as(
3276
+ type_=HttpErrorResponse, # type: ignore
3277
+ object_=_response.json(),
3278
+ ),
3279
+ ),
3280
+ )
3281
+ _response_json = _response.json()
3282
+ except JSONDecodeError:
3283
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
3284
+ except ValidationError as e:
3285
+ raise ParsingError(
3286
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
3287
+ )
3288
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)