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