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,3685 @@
|
|
|
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.datetime_utils import serialize_datetime
|
|
10
|
+
from ...core.http_response import AsyncHttpResponse, HttpResponse
|
|
11
|
+
from ...core.jsonable_encoder import encode_path_param
|
|
12
|
+
from ...core.parse_error import ParsingError
|
|
13
|
+
from ...core.pydantic_utilities import parse_obj_as
|
|
14
|
+
from ...core.request_options import RequestOptions
|
|
15
|
+
from ...core.serialization import convert_and_respect_annotation_metadata
|
|
16
|
+
from ...errors.bad_gateway_error import BadGatewayError
|
|
17
|
+
from ...errors.bad_request_error import BadRequestError
|
|
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.http_error_response import HttpErrorResponse
|
|
24
|
+
from ...types.http_validation_error import HttpValidationError
|
|
25
|
+
from ...types.sync_patch_request import SyncPatchRequest
|
|
26
|
+
from ...types.sync_pull_response import SyncPullResponse
|
|
27
|
+
from ...types.sync_push_response import SyncPushResponse
|
|
28
|
+
from .types.pull_cdrs_sync_request_version import PullCdrsSyncRequestVersion
|
|
29
|
+
from .types.pull_hub_client_info_as_cpo_sync_request_version import PullHubClientInfoAsCpoSyncRequestVersion
|
|
30
|
+
from .types.pull_hub_client_info_as_emsp_sync_request_version import PullHubClientInfoAsEmspSyncRequestVersion
|
|
31
|
+
from .types.pull_locations_sync_request_version import PullLocationsSyncRequestVersion
|
|
32
|
+
from .types.pull_sessions_sync_request_version import PullSessionsSyncRequestVersion
|
|
33
|
+
from .types.pull_tariffs_sync_request_version import PullTariffsSyncRequestVersion
|
|
34
|
+
from .types.pull_tokens_sync_request_version import PullTokensSyncRequestVersion
|
|
35
|
+
from .types.push_cdr_sync_request_version import PushCdrSyncRequestVersion
|
|
36
|
+
from .types.push_location_sync_request_version import PushLocationSyncRequestVersion
|
|
37
|
+
from .types.push_session_sync_request_version import PushSessionSyncRequestVersion
|
|
38
|
+
from .types.push_tariff_sync_request_version import PushTariffSyncRequestVersion
|
|
39
|
+
from .types.push_token_sync_request_version import PushTokenSyncRequestVersion
|
|
40
|
+
from pydantic import ValidationError
|
|
41
|
+
|
|
42
|
+
# this is used as the default value for optional parameters
|
|
43
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class RawSyncClient:
|
|
47
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
48
|
+
self._client_wrapper = client_wrapper
|
|
49
|
+
|
|
50
|
+
def push_location(
|
|
51
|
+
self,
|
|
52
|
+
version: PushLocationSyncRequestVersion,
|
|
53
|
+
location_id: str,
|
|
54
|
+
*,
|
|
55
|
+
partner_id: int,
|
|
56
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
57
|
+
) -> HttpResponse[SyncPushResponse]:
|
|
58
|
+
"""
|
|
59
|
+
Sends a stored location to a partner eMSP (PUT to its Locations module). ``partner_id`` is the roaming partner id (``roaming_partner_id``), not the operation id from ``GET /ocpi/partners``.
|
|
60
|
+
|
|
61
|
+
Parameters
|
|
62
|
+
----------
|
|
63
|
+
version : PushLocationSyncRequestVersion
|
|
64
|
+
OCPI version: ``211`` (2.1.1), ``221`` (2.2.1) or ``230`` (2.3.0).
|
|
65
|
+
|
|
66
|
+
location_id : str
|
|
67
|
+
OCPI ``id`` of the location.
|
|
68
|
+
|
|
69
|
+
partner_id : int
|
|
70
|
+
Roaming partner to talk to: the ``roaming_partner_id`` from ``GET /ocpi/partners``, not its ``id``.
|
|
71
|
+
|
|
72
|
+
request_options : typing.Optional[RequestOptions]
|
|
73
|
+
Request-specific configuration.
|
|
74
|
+
|
|
75
|
+
Returns
|
|
76
|
+
-------
|
|
77
|
+
HttpResponse[SyncPushResponse]
|
|
78
|
+
Successful Response
|
|
79
|
+
"""
|
|
80
|
+
_request_options_with_retries_disabled: typing.Optional[RequestOptions] = (
|
|
81
|
+
{**request_options, "max_retries": 0} if request_options is not None else {"max_retries": 0}
|
|
82
|
+
)
|
|
83
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
84
|
+
f"ocpi/sync/{encode_path_param(version)}/cpo/locations/{encode_path_param(location_id)}/push",
|
|
85
|
+
method="POST",
|
|
86
|
+
params={
|
|
87
|
+
"partner_id": partner_id,
|
|
88
|
+
},
|
|
89
|
+
request_options=_request_options_with_retries_disabled,
|
|
90
|
+
)
|
|
91
|
+
try:
|
|
92
|
+
if 200 <= _response.status_code < 300:
|
|
93
|
+
_data = typing.cast(
|
|
94
|
+
SyncPushResponse,
|
|
95
|
+
parse_obj_as(
|
|
96
|
+
type_=SyncPushResponse, # type: ignore
|
|
97
|
+
object_=_response.json(),
|
|
98
|
+
),
|
|
99
|
+
)
|
|
100
|
+
return HttpResponse(response=_response, data=_data)
|
|
101
|
+
if _response.status_code == 400:
|
|
102
|
+
raise BadRequestError(
|
|
103
|
+
headers=dict(_response.headers),
|
|
104
|
+
body=typing.cast(
|
|
105
|
+
HttpErrorResponse,
|
|
106
|
+
parse_obj_as(
|
|
107
|
+
type_=HttpErrorResponse, # type: ignore
|
|
108
|
+
object_=_response.json(),
|
|
109
|
+
),
|
|
110
|
+
),
|
|
111
|
+
)
|
|
112
|
+
if _response.status_code == 401:
|
|
113
|
+
raise UnauthorizedError(
|
|
114
|
+
headers=dict(_response.headers),
|
|
115
|
+
body=typing.cast(
|
|
116
|
+
HttpErrorResponse,
|
|
117
|
+
parse_obj_as(
|
|
118
|
+
type_=HttpErrorResponse, # type: ignore
|
|
119
|
+
object_=_response.json(),
|
|
120
|
+
),
|
|
121
|
+
),
|
|
122
|
+
)
|
|
123
|
+
if _response.status_code == 404:
|
|
124
|
+
raise NotFoundError(
|
|
125
|
+
headers=dict(_response.headers),
|
|
126
|
+
body=typing.cast(
|
|
127
|
+
HttpErrorResponse,
|
|
128
|
+
parse_obj_as(
|
|
129
|
+
type_=HttpErrorResponse, # type: ignore
|
|
130
|
+
object_=_response.json(),
|
|
131
|
+
),
|
|
132
|
+
),
|
|
133
|
+
)
|
|
134
|
+
if _response.status_code == 422:
|
|
135
|
+
raise UnprocessableEntityError(
|
|
136
|
+
headers=dict(_response.headers),
|
|
137
|
+
body=typing.cast(
|
|
138
|
+
HttpValidationError,
|
|
139
|
+
parse_obj_as(
|
|
140
|
+
type_=HttpValidationError, # type: ignore
|
|
141
|
+
object_=_response.json(),
|
|
142
|
+
),
|
|
143
|
+
),
|
|
144
|
+
)
|
|
145
|
+
if _response.status_code == 429:
|
|
146
|
+
raise TooManyRequestsError(
|
|
147
|
+
headers=dict(_response.headers),
|
|
148
|
+
body=typing.cast(
|
|
149
|
+
HttpErrorResponse,
|
|
150
|
+
parse_obj_as(
|
|
151
|
+
type_=HttpErrorResponse, # type: ignore
|
|
152
|
+
object_=_response.json(),
|
|
153
|
+
),
|
|
154
|
+
),
|
|
155
|
+
)
|
|
156
|
+
if _response.status_code == 502:
|
|
157
|
+
raise BadGatewayError(
|
|
158
|
+
headers=dict(_response.headers),
|
|
159
|
+
body=typing.cast(
|
|
160
|
+
HttpErrorResponse,
|
|
161
|
+
parse_obj_as(
|
|
162
|
+
type_=HttpErrorResponse, # type: ignore
|
|
163
|
+
object_=_response.json(),
|
|
164
|
+
),
|
|
165
|
+
),
|
|
166
|
+
)
|
|
167
|
+
if _response.status_code == 504:
|
|
168
|
+
raise GatewayTimeoutError(
|
|
169
|
+
headers=dict(_response.headers),
|
|
170
|
+
body=typing.cast(
|
|
171
|
+
HttpErrorResponse,
|
|
172
|
+
parse_obj_as(
|
|
173
|
+
type_=HttpErrorResponse, # type: ignore
|
|
174
|
+
object_=_response.json(),
|
|
175
|
+
),
|
|
176
|
+
),
|
|
177
|
+
)
|
|
178
|
+
_response_json = _response.json()
|
|
179
|
+
except JSONDecodeError:
|
|
180
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
181
|
+
except ValidationError as e:
|
|
182
|
+
raise ParsingError(
|
|
183
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
184
|
+
)
|
|
185
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
186
|
+
|
|
187
|
+
def push_cdr(
|
|
188
|
+
self,
|
|
189
|
+
version: PushCdrSyncRequestVersion,
|
|
190
|
+
cdr_id: str,
|
|
191
|
+
*,
|
|
192
|
+
partner_id: int,
|
|
193
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
194
|
+
) -> HttpResponse[SyncPushResponse]:
|
|
195
|
+
"""
|
|
196
|
+
Sends a stored CDR to a partner eMSP (POST to its CDRs module). ``partner_id`` is the roaming partner id (``roaming_partner_id``), not the operation id from ``GET /ocpi/partners``.
|
|
197
|
+
|
|
198
|
+
Parameters
|
|
199
|
+
----------
|
|
200
|
+
version : PushCdrSyncRequestVersion
|
|
201
|
+
OCPI version: ``211`` (2.1.1), ``221`` (2.2.1) or ``230`` (2.3.0).
|
|
202
|
+
|
|
203
|
+
cdr_id : str
|
|
204
|
+
OCPI ``id`` of the CDR.
|
|
205
|
+
|
|
206
|
+
partner_id : int
|
|
207
|
+
Roaming partner to talk to: the ``roaming_partner_id`` from ``GET /ocpi/partners``, not its ``id``.
|
|
208
|
+
|
|
209
|
+
request_options : typing.Optional[RequestOptions]
|
|
210
|
+
Request-specific configuration.
|
|
211
|
+
|
|
212
|
+
Returns
|
|
213
|
+
-------
|
|
214
|
+
HttpResponse[SyncPushResponse]
|
|
215
|
+
Successful Response
|
|
216
|
+
"""
|
|
217
|
+
_request_options_with_retries_disabled: typing.Optional[RequestOptions] = (
|
|
218
|
+
{**request_options, "max_retries": 0} if request_options is not None else {"max_retries": 0}
|
|
219
|
+
)
|
|
220
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
221
|
+
f"ocpi/sync/{encode_path_param(version)}/cpo/cdrs/{encode_path_param(cdr_id)}/push",
|
|
222
|
+
method="POST",
|
|
223
|
+
params={
|
|
224
|
+
"partner_id": partner_id,
|
|
225
|
+
},
|
|
226
|
+
request_options=_request_options_with_retries_disabled,
|
|
227
|
+
)
|
|
228
|
+
try:
|
|
229
|
+
if 200 <= _response.status_code < 300:
|
|
230
|
+
_data = typing.cast(
|
|
231
|
+
SyncPushResponse,
|
|
232
|
+
parse_obj_as(
|
|
233
|
+
type_=SyncPushResponse, # type: ignore
|
|
234
|
+
object_=_response.json(),
|
|
235
|
+
),
|
|
236
|
+
)
|
|
237
|
+
return HttpResponse(response=_response, data=_data)
|
|
238
|
+
if _response.status_code == 400:
|
|
239
|
+
raise BadRequestError(
|
|
240
|
+
headers=dict(_response.headers),
|
|
241
|
+
body=typing.cast(
|
|
242
|
+
HttpErrorResponse,
|
|
243
|
+
parse_obj_as(
|
|
244
|
+
type_=HttpErrorResponse, # type: ignore
|
|
245
|
+
object_=_response.json(),
|
|
246
|
+
),
|
|
247
|
+
),
|
|
248
|
+
)
|
|
249
|
+
if _response.status_code == 401:
|
|
250
|
+
raise UnauthorizedError(
|
|
251
|
+
headers=dict(_response.headers),
|
|
252
|
+
body=typing.cast(
|
|
253
|
+
HttpErrorResponse,
|
|
254
|
+
parse_obj_as(
|
|
255
|
+
type_=HttpErrorResponse, # type: ignore
|
|
256
|
+
object_=_response.json(),
|
|
257
|
+
),
|
|
258
|
+
),
|
|
259
|
+
)
|
|
260
|
+
if _response.status_code == 404:
|
|
261
|
+
raise NotFoundError(
|
|
262
|
+
headers=dict(_response.headers),
|
|
263
|
+
body=typing.cast(
|
|
264
|
+
HttpErrorResponse,
|
|
265
|
+
parse_obj_as(
|
|
266
|
+
type_=HttpErrorResponse, # type: ignore
|
|
267
|
+
object_=_response.json(),
|
|
268
|
+
),
|
|
269
|
+
),
|
|
270
|
+
)
|
|
271
|
+
if _response.status_code == 422:
|
|
272
|
+
raise UnprocessableEntityError(
|
|
273
|
+
headers=dict(_response.headers),
|
|
274
|
+
body=typing.cast(
|
|
275
|
+
HttpValidationError,
|
|
276
|
+
parse_obj_as(
|
|
277
|
+
type_=HttpValidationError, # type: ignore
|
|
278
|
+
object_=_response.json(),
|
|
279
|
+
),
|
|
280
|
+
),
|
|
281
|
+
)
|
|
282
|
+
if _response.status_code == 429:
|
|
283
|
+
raise TooManyRequestsError(
|
|
284
|
+
headers=dict(_response.headers),
|
|
285
|
+
body=typing.cast(
|
|
286
|
+
HttpErrorResponse,
|
|
287
|
+
parse_obj_as(
|
|
288
|
+
type_=HttpErrorResponse, # type: ignore
|
|
289
|
+
object_=_response.json(),
|
|
290
|
+
),
|
|
291
|
+
),
|
|
292
|
+
)
|
|
293
|
+
if _response.status_code == 502:
|
|
294
|
+
raise BadGatewayError(
|
|
295
|
+
headers=dict(_response.headers),
|
|
296
|
+
body=typing.cast(
|
|
297
|
+
HttpErrorResponse,
|
|
298
|
+
parse_obj_as(
|
|
299
|
+
type_=HttpErrorResponse, # type: ignore
|
|
300
|
+
object_=_response.json(),
|
|
301
|
+
),
|
|
302
|
+
),
|
|
303
|
+
)
|
|
304
|
+
if _response.status_code == 504:
|
|
305
|
+
raise GatewayTimeoutError(
|
|
306
|
+
headers=dict(_response.headers),
|
|
307
|
+
body=typing.cast(
|
|
308
|
+
HttpErrorResponse,
|
|
309
|
+
parse_obj_as(
|
|
310
|
+
type_=HttpErrorResponse, # type: ignore
|
|
311
|
+
object_=_response.json(),
|
|
312
|
+
),
|
|
313
|
+
),
|
|
314
|
+
)
|
|
315
|
+
_response_json = _response.json()
|
|
316
|
+
except JSONDecodeError:
|
|
317
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
318
|
+
except ValidationError as e:
|
|
319
|
+
raise ParsingError(
|
|
320
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
321
|
+
)
|
|
322
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
323
|
+
|
|
324
|
+
def push_tariff(
|
|
325
|
+
self,
|
|
326
|
+
version: PushTariffSyncRequestVersion,
|
|
327
|
+
tariff_id: str,
|
|
328
|
+
*,
|
|
329
|
+
partner_id: int,
|
|
330
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
331
|
+
) -> HttpResponse[SyncPushResponse]:
|
|
332
|
+
"""
|
|
333
|
+
Sends a stored tariff to a partner eMSP (PUT to its Tariffs module). ``partner_id`` is the roaming partner id (``roaming_partner_id``), not the operation id from ``GET /ocpi/partners``.
|
|
334
|
+
|
|
335
|
+
Parameters
|
|
336
|
+
----------
|
|
337
|
+
version : PushTariffSyncRequestVersion
|
|
338
|
+
OCPI version: ``211`` (2.1.1), ``221`` (2.2.1) or ``230`` (2.3.0).
|
|
339
|
+
|
|
340
|
+
tariff_id : str
|
|
341
|
+
OCPI ``id`` of the tariff.
|
|
342
|
+
|
|
343
|
+
partner_id : int
|
|
344
|
+
Roaming partner to talk to: the ``roaming_partner_id`` from ``GET /ocpi/partners``, not its ``id``.
|
|
345
|
+
|
|
346
|
+
request_options : typing.Optional[RequestOptions]
|
|
347
|
+
Request-specific configuration.
|
|
348
|
+
|
|
349
|
+
Returns
|
|
350
|
+
-------
|
|
351
|
+
HttpResponse[SyncPushResponse]
|
|
352
|
+
Successful Response
|
|
353
|
+
"""
|
|
354
|
+
_request_options_with_retries_disabled: typing.Optional[RequestOptions] = (
|
|
355
|
+
{**request_options, "max_retries": 0} if request_options is not None else {"max_retries": 0}
|
|
356
|
+
)
|
|
357
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
358
|
+
f"ocpi/sync/{encode_path_param(version)}/cpo/tariffs/{encode_path_param(tariff_id)}/push",
|
|
359
|
+
method="POST",
|
|
360
|
+
params={
|
|
361
|
+
"partner_id": partner_id,
|
|
362
|
+
},
|
|
363
|
+
request_options=_request_options_with_retries_disabled,
|
|
364
|
+
)
|
|
365
|
+
try:
|
|
366
|
+
if 200 <= _response.status_code < 300:
|
|
367
|
+
_data = typing.cast(
|
|
368
|
+
SyncPushResponse,
|
|
369
|
+
parse_obj_as(
|
|
370
|
+
type_=SyncPushResponse, # type: ignore
|
|
371
|
+
object_=_response.json(),
|
|
372
|
+
),
|
|
373
|
+
)
|
|
374
|
+
return HttpResponse(response=_response, data=_data)
|
|
375
|
+
if _response.status_code == 400:
|
|
376
|
+
raise BadRequestError(
|
|
377
|
+
headers=dict(_response.headers),
|
|
378
|
+
body=typing.cast(
|
|
379
|
+
HttpErrorResponse,
|
|
380
|
+
parse_obj_as(
|
|
381
|
+
type_=HttpErrorResponse, # type: ignore
|
|
382
|
+
object_=_response.json(),
|
|
383
|
+
),
|
|
384
|
+
),
|
|
385
|
+
)
|
|
386
|
+
if _response.status_code == 401:
|
|
387
|
+
raise UnauthorizedError(
|
|
388
|
+
headers=dict(_response.headers),
|
|
389
|
+
body=typing.cast(
|
|
390
|
+
HttpErrorResponse,
|
|
391
|
+
parse_obj_as(
|
|
392
|
+
type_=HttpErrorResponse, # type: ignore
|
|
393
|
+
object_=_response.json(),
|
|
394
|
+
),
|
|
395
|
+
),
|
|
396
|
+
)
|
|
397
|
+
if _response.status_code == 404:
|
|
398
|
+
raise NotFoundError(
|
|
399
|
+
headers=dict(_response.headers),
|
|
400
|
+
body=typing.cast(
|
|
401
|
+
HttpErrorResponse,
|
|
402
|
+
parse_obj_as(
|
|
403
|
+
type_=HttpErrorResponse, # type: ignore
|
|
404
|
+
object_=_response.json(),
|
|
405
|
+
),
|
|
406
|
+
),
|
|
407
|
+
)
|
|
408
|
+
if _response.status_code == 422:
|
|
409
|
+
raise UnprocessableEntityError(
|
|
410
|
+
headers=dict(_response.headers),
|
|
411
|
+
body=typing.cast(
|
|
412
|
+
HttpValidationError,
|
|
413
|
+
parse_obj_as(
|
|
414
|
+
type_=HttpValidationError, # type: ignore
|
|
415
|
+
object_=_response.json(),
|
|
416
|
+
),
|
|
417
|
+
),
|
|
418
|
+
)
|
|
419
|
+
if _response.status_code == 429:
|
|
420
|
+
raise TooManyRequestsError(
|
|
421
|
+
headers=dict(_response.headers),
|
|
422
|
+
body=typing.cast(
|
|
423
|
+
HttpErrorResponse,
|
|
424
|
+
parse_obj_as(
|
|
425
|
+
type_=HttpErrorResponse, # type: ignore
|
|
426
|
+
object_=_response.json(),
|
|
427
|
+
),
|
|
428
|
+
),
|
|
429
|
+
)
|
|
430
|
+
if _response.status_code == 502:
|
|
431
|
+
raise BadGatewayError(
|
|
432
|
+
headers=dict(_response.headers),
|
|
433
|
+
body=typing.cast(
|
|
434
|
+
HttpErrorResponse,
|
|
435
|
+
parse_obj_as(
|
|
436
|
+
type_=HttpErrorResponse, # type: ignore
|
|
437
|
+
object_=_response.json(),
|
|
438
|
+
),
|
|
439
|
+
),
|
|
440
|
+
)
|
|
441
|
+
if _response.status_code == 504:
|
|
442
|
+
raise GatewayTimeoutError(
|
|
443
|
+
headers=dict(_response.headers),
|
|
444
|
+
body=typing.cast(
|
|
445
|
+
HttpErrorResponse,
|
|
446
|
+
parse_obj_as(
|
|
447
|
+
type_=HttpErrorResponse, # type: ignore
|
|
448
|
+
object_=_response.json(),
|
|
449
|
+
),
|
|
450
|
+
),
|
|
451
|
+
)
|
|
452
|
+
_response_json = _response.json()
|
|
453
|
+
except JSONDecodeError:
|
|
454
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
455
|
+
except ValidationError as e:
|
|
456
|
+
raise ParsingError(
|
|
457
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
458
|
+
)
|
|
459
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
460
|
+
|
|
461
|
+
def push_session(
|
|
462
|
+
self,
|
|
463
|
+
version: PushSessionSyncRequestVersion,
|
|
464
|
+
session_id: str,
|
|
465
|
+
*,
|
|
466
|
+
partner_id: int,
|
|
467
|
+
request: typing.Optional[SyncPatchRequest] = None,
|
|
468
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
469
|
+
) -> HttpResponse[SyncPushResponse]:
|
|
470
|
+
"""
|
|
471
|
+
Sends a stored session to a partner eMSP: the full object, or only ``patch_body`` as a PATCH. ``partner_id`` is the roaming partner id (``roaming_partner_id``), not the operation id from ``GET /ocpi/partners``.
|
|
472
|
+
|
|
473
|
+
Parameters
|
|
474
|
+
----------
|
|
475
|
+
version : PushSessionSyncRequestVersion
|
|
476
|
+
OCPI version: ``211`` (2.1.1), ``221`` (2.2.1) or ``230`` (2.3.0).
|
|
477
|
+
|
|
478
|
+
session_id : str
|
|
479
|
+
OCPI ``id`` of the charging session.
|
|
480
|
+
|
|
481
|
+
partner_id : int
|
|
482
|
+
Roaming partner to talk to: the ``roaming_partner_id`` from ``GET /ocpi/partners``, not its ``id``.
|
|
483
|
+
|
|
484
|
+
request : typing.Optional[SyncPatchRequest]
|
|
485
|
+
|
|
486
|
+
request_options : typing.Optional[RequestOptions]
|
|
487
|
+
Request-specific configuration.
|
|
488
|
+
|
|
489
|
+
Returns
|
|
490
|
+
-------
|
|
491
|
+
HttpResponse[SyncPushResponse]
|
|
492
|
+
Successful Response
|
|
493
|
+
"""
|
|
494
|
+
_request_options_with_retries_disabled: typing.Optional[RequestOptions] = (
|
|
495
|
+
{**request_options, "max_retries": 0} if request_options is not None else {"max_retries": 0}
|
|
496
|
+
)
|
|
497
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
498
|
+
f"ocpi/sync/{encode_path_param(version)}/cpo/sessions/{encode_path_param(session_id)}/push",
|
|
499
|
+
method="POST",
|
|
500
|
+
params={
|
|
501
|
+
"partner_id": partner_id,
|
|
502
|
+
},
|
|
503
|
+
json=convert_and_respect_annotation_metadata(
|
|
504
|
+
object_=request, annotation=typing.Optional[SyncPatchRequest], direction="write"
|
|
505
|
+
),
|
|
506
|
+
headers={
|
|
507
|
+
"content-type": "application/json",
|
|
508
|
+
},
|
|
509
|
+
request_options=_request_options_with_retries_disabled,
|
|
510
|
+
omit=OMIT,
|
|
511
|
+
)
|
|
512
|
+
try:
|
|
513
|
+
if 200 <= _response.status_code < 300:
|
|
514
|
+
_data = typing.cast(
|
|
515
|
+
SyncPushResponse,
|
|
516
|
+
parse_obj_as(
|
|
517
|
+
type_=SyncPushResponse, # type: ignore
|
|
518
|
+
object_=_response.json(),
|
|
519
|
+
),
|
|
520
|
+
)
|
|
521
|
+
return HttpResponse(response=_response, data=_data)
|
|
522
|
+
if _response.status_code == 400:
|
|
523
|
+
raise BadRequestError(
|
|
524
|
+
headers=dict(_response.headers),
|
|
525
|
+
body=typing.cast(
|
|
526
|
+
HttpErrorResponse,
|
|
527
|
+
parse_obj_as(
|
|
528
|
+
type_=HttpErrorResponse, # type: ignore
|
|
529
|
+
object_=_response.json(),
|
|
530
|
+
),
|
|
531
|
+
),
|
|
532
|
+
)
|
|
533
|
+
if _response.status_code == 401:
|
|
534
|
+
raise UnauthorizedError(
|
|
535
|
+
headers=dict(_response.headers),
|
|
536
|
+
body=typing.cast(
|
|
537
|
+
HttpErrorResponse,
|
|
538
|
+
parse_obj_as(
|
|
539
|
+
type_=HttpErrorResponse, # type: ignore
|
|
540
|
+
object_=_response.json(),
|
|
541
|
+
),
|
|
542
|
+
),
|
|
543
|
+
)
|
|
544
|
+
if _response.status_code == 404:
|
|
545
|
+
raise NotFoundError(
|
|
546
|
+
headers=dict(_response.headers),
|
|
547
|
+
body=typing.cast(
|
|
548
|
+
HttpErrorResponse,
|
|
549
|
+
parse_obj_as(
|
|
550
|
+
type_=HttpErrorResponse, # type: ignore
|
|
551
|
+
object_=_response.json(),
|
|
552
|
+
),
|
|
553
|
+
),
|
|
554
|
+
)
|
|
555
|
+
if _response.status_code == 422:
|
|
556
|
+
raise UnprocessableEntityError(
|
|
557
|
+
headers=dict(_response.headers),
|
|
558
|
+
body=typing.cast(
|
|
559
|
+
HttpValidationError,
|
|
560
|
+
parse_obj_as(
|
|
561
|
+
type_=HttpValidationError, # type: ignore
|
|
562
|
+
object_=_response.json(),
|
|
563
|
+
),
|
|
564
|
+
),
|
|
565
|
+
)
|
|
566
|
+
if _response.status_code == 429:
|
|
567
|
+
raise TooManyRequestsError(
|
|
568
|
+
headers=dict(_response.headers),
|
|
569
|
+
body=typing.cast(
|
|
570
|
+
HttpErrorResponse,
|
|
571
|
+
parse_obj_as(
|
|
572
|
+
type_=HttpErrorResponse, # type: ignore
|
|
573
|
+
object_=_response.json(),
|
|
574
|
+
),
|
|
575
|
+
),
|
|
576
|
+
)
|
|
577
|
+
if _response.status_code == 502:
|
|
578
|
+
raise BadGatewayError(
|
|
579
|
+
headers=dict(_response.headers),
|
|
580
|
+
body=typing.cast(
|
|
581
|
+
HttpErrorResponse,
|
|
582
|
+
parse_obj_as(
|
|
583
|
+
type_=HttpErrorResponse, # type: ignore
|
|
584
|
+
object_=_response.json(),
|
|
585
|
+
),
|
|
586
|
+
),
|
|
587
|
+
)
|
|
588
|
+
if _response.status_code == 504:
|
|
589
|
+
raise GatewayTimeoutError(
|
|
590
|
+
headers=dict(_response.headers),
|
|
591
|
+
body=typing.cast(
|
|
592
|
+
HttpErrorResponse,
|
|
593
|
+
parse_obj_as(
|
|
594
|
+
type_=HttpErrorResponse, # type: ignore
|
|
595
|
+
object_=_response.json(),
|
|
596
|
+
),
|
|
597
|
+
),
|
|
598
|
+
)
|
|
599
|
+
_response_json = _response.json()
|
|
600
|
+
except JSONDecodeError:
|
|
601
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
602
|
+
except ValidationError as e:
|
|
603
|
+
raise ParsingError(
|
|
604
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
605
|
+
)
|
|
606
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
607
|
+
|
|
608
|
+
def push_token(
|
|
609
|
+
self,
|
|
610
|
+
version: PushTokenSyncRequestVersion,
|
|
611
|
+
token_uid: str,
|
|
612
|
+
*,
|
|
613
|
+
partner_id: int,
|
|
614
|
+
type: typing.Optional[str] = None,
|
|
615
|
+
request: typing.Optional[SyncPatchRequest] = None,
|
|
616
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
617
|
+
) -> HttpResponse[SyncPushResponse]:
|
|
618
|
+
"""
|
|
619
|
+
Sends a stored token to a partner CPO: the full object, or only ``patch_body`` as a PATCH. ``partner_id`` is the roaming partner id (``roaming_partner_id``), not the operation id from ``GET /ocpi/partners``.
|
|
620
|
+
|
|
621
|
+
Parameters
|
|
622
|
+
----------
|
|
623
|
+
version : PushTokenSyncRequestVersion
|
|
624
|
+
OCPI version: ``211`` (2.1.1), ``221`` (2.2.1) or ``230`` (2.3.0).
|
|
625
|
+
|
|
626
|
+
token_uid : str
|
|
627
|
+
OCPI ``uid`` of the token.
|
|
628
|
+
|
|
629
|
+
partner_id : int
|
|
630
|
+
Roaming partner to talk to: the ``roaming_partner_id`` from ``GET /ocpi/partners``, not its ``id``.
|
|
631
|
+
|
|
632
|
+
type : typing.Optional[str]
|
|
633
|
+
Token type (e.g. ``RFID``, ``APP_USER``), used to find the token when the OCPI body does not carry ``type``.
|
|
634
|
+
|
|
635
|
+
request : typing.Optional[SyncPatchRequest]
|
|
636
|
+
|
|
637
|
+
request_options : typing.Optional[RequestOptions]
|
|
638
|
+
Request-specific configuration.
|
|
639
|
+
|
|
640
|
+
Returns
|
|
641
|
+
-------
|
|
642
|
+
HttpResponse[SyncPushResponse]
|
|
643
|
+
Successful Response
|
|
644
|
+
"""
|
|
645
|
+
_request_options_with_retries_disabled: typing.Optional[RequestOptions] = (
|
|
646
|
+
{**request_options, "max_retries": 0} if request_options is not None else {"max_retries": 0}
|
|
647
|
+
)
|
|
648
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
649
|
+
f"ocpi/sync/{encode_path_param(version)}/emsp/tokens/{encode_path_param(token_uid)}/push",
|
|
650
|
+
method="POST",
|
|
651
|
+
params={
|
|
652
|
+
"partner_id": partner_id,
|
|
653
|
+
"type": type,
|
|
654
|
+
},
|
|
655
|
+
json=convert_and_respect_annotation_metadata(
|
|
656
|
+
object_=request, annotation=typing.Optional[SyncPatchRequest], direction="write"
|
|
657
|
+
),
|
|
658
|
+
headers={
|
|
659
|
+
"content-type": "application/json",
|
|
660
|
+
},
|
|
661
|
+
request_options=_request_options_with_retries_disabled,
|
|
662
|
+
omit=OMIT,
|
|
663
|
+
)
|
|
664
|
+
try:
|
|
665
|
+
if 200 <= _response.status_code < 300:
|
|
666
|
+
_data = typing.cast(
|
|
667
|
+
SyncPushResponse,
|
|
668
|
+
parse_obj_as(
|
|
669
|
+
type_=SyncPushResponse, # type: ignore
|
|
670
|
+
object_=_response.json(),
|
|
671
|
+
),
|
|
672
|
+
)
|
|
673
|
+
return HttpResponse(response=_response, data=_data)
|
|
674
|
+
if _response.status_code == 400:
|
|
675
|
+
raise BadRequestError(
|
|
676
|
+
headers=dict(_response.headers),
|
|
677
|
+
body=typing.cast(
|
|
678
|
+
HttpErrorResponse,
|
|
679
|
+
parse_obj_as(
|
|
680
|
+
type_=HttpErrorResponse, # type: ignore
|
|
681
|
+
object_=_response.json(),
|
|
682
|
+
),
|
|
683
|
+
),
|
|
684
|
+
)
|
|
685
|
+
if _response.status_code == 401:
|
|
686
|
+
raise UnauthorizedError(
|
|
687
|
+
headers=dict(_response.headers),
|
|
688
|
+
body=typing.cast(
|
|
689
|
+
HttpErrorResponse,
|
|
690
|
+
parse_obj_as(
|
|
691
|
+
type_=HttpErrorResponse, # type: ignore
|
|
692
|
+
object_=_response.json(),
|
|
693
|
+
),
|
|
694
|
+
),
|
|
695
|
+
)
|
|
696
|
+
if _response.status_code == 404:
|
|
697
|
+
raise NotFoundError(
|
|
698
|
+
headers=dict(_response.headers),
|
|
699
|
+
body=typing.cast(
|
|
700
|
+
HttpErrorResponse,
|
|
701
|
+
parse_obj_as(
|
|
702
|
+
type_=HttpErrorResponse, # type: ignore
|
|
703
|
+
object_=_response.json(),
|
|
704
|
+
),
|
|
705
|
+
),
|
|
706
|
+
)
|
|
707
|
+
if _response.status_code == 422:
|
|
708
|
+
raise UnprocessableEntityError(
|
|
709
|
+
headers=dict(_response.headers),
|
|
710
|
+
body=typing.cast(
|
|
711
|
+
HttpValidationError,
|
|
712
|
+
parse_obj_as(
|
|
713
|
+
type_=HttpValidationError, # type: ignore
|
|
714
|
+
object_=_response.json(),
|
|
715
|
+
),
|
|
716
|
+
),
|
|
717
|
+
)
|
|
718
|
+
if _response.status_code == 429:
|
|
719
|
+
raise TooManyRequestsError(
|
|
720
|
+
headers=dict(_response.headers),
|
|
721
|
+
body=typing.cast(
|
|
722
|
+
HttpErrorResponse,
|
|
723
|
+
parse_obj_as(
|
|
724
|
+
type_=HttpErrorResponse, # type: ignore
|
|
725
|
+
object_=_response.json(),
|
|
726
|
+
),
|
|
727
|
+
),
|
|
728
|
+
)
|
|
729
|
+
if _response.status_code == 502:
|
|
730
|
+
raise BadGatewayError(
|
|
731
|
+
headers=dict(_response.headers),
|
|
732
|
+
body=typing.cast(
|
|
733
|
+
HttpErrorResponse,
|
|
734
|
+
parse_obj_as(
|
|
735
|
+
type_=HttpErrorResponse, # type: ignore
|
|
736
|
+
object_=_response.json(),
|
|
737
|
+
),
|
|
738
|
+
),
|
|
739
|
+
)
|
|
740
|
+
if _response.status_code == 504:
|
|
741
|
+
raise GatewayTimeoutError(
|
|
742
|
+
headers=dict(_response.headers),
|
|
743
|
+
body=typing.cast(
|
|
744
|
+
HttpErrorResponse,
|
|
745
|
+
parse_obj_as(
|
|
746
|
+
type_=HttpErrorResponse, # type: ignore
|
|
747
|
+
object_=_response.json(),
|
|
748
|
+
),
|
|
749
|
+
),
|
|
750
|
+
)
|
|
751
|
+
_response_json = _response.json()
|
|
752
|
+
except JSONDecodeError:
|
|
753
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
754
|
+
except ValidationError as e:
|
|
755
|
+
raise ParsingError(
|
|
756
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
757
|
+
)
|
|
758
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
759
|
+
|
|
760
|
+
def pull_tokens(
|
|
761
|
+
self,
|
|
762
|
+
version: PullTokensSyncRequestVersion,
|
|
763
|
+
*,
|
|
764
|
+
partner_id: int,
|
|
765
|
+
date_from: typing.Optional[dt.datetime] = None,
|
|
766
|
+
date_to: typing.Optional[dt.datetime] = None,
|
|
767
|
+
offset: typing.Optional[int] = None,
|
|
768
|
+
limit: typing.Optional[int] = None,
|
|
769
|
+
full_replace: typing.Optional[bool] = None,
|
|
770
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
771
|
+
) -> HttpResponse[SyncPullResponse]:
|
|
772
|
+
"""
|
|
773
|
+
Fetches tokens from a partner eMSP's Tokens module, page by page. Results are stored in the OCPI store. Pulls are incremental from the last sync; set ``full_replace=true`` for a full resync (``date_from`` is then ignored). ``partner_id`` is the roaming partner id (``roaming_partner_id``), not the operation id from ``GET /ocpi/partners``.
|
|
774
|
+
|
|
775
|
+
Parameters
|
|
776
|
+
----------
|
|
777
|
+
version : PullTokensSyncRequestVersion
|
|
778
|
+
OCPI version: ``211`` (2.1.1), ``221`` (2.2.1) or ``230`` (2.3.0).
|
|
779
|
+
|
|
780
|
+
partner_id : int
|
|
781
|
+
Roaming partner to pull from: its ``roaming_partner_id`` from GET /ocpi/partners.
|
|
782
|
+
|
|
783
|
+
date_from : typing.Optional[dt.datetime]
|
|
784
|
+
Only objects changed at or after this time. Default: since the last sync.
|
|
785
|
+
|
|
786
|
+
date_to : typing.Optional[dt.datetime]
|
|
787
|
+
Only objects changed before this time.
|
|
788
|
+
|
|
789
|
+
offset : typing.Optional[int]
|
|
790
|
+
Start at this object in the partner's list.
|
|
791
|
+
|
|
792
|
+
limit : typing.Optional[int]
|
|
793
|
+
Objects to request per page.
|
|
794
|
+
|
|
795
|
+
full_replace : typing.Optional[bool]
|
|
796
|
+
Full pull: ``date_from``/``date_to`` and the stored cursor are ignored. For eMSP locations and tariffs it crawls the whole list and, after a clean last page, soft-deletes this partner's rows no page listed.
|
|
797
|
+
|
|
798
|
+
request_options : typing.Optional[RequestOptions]
|
|
799
|
+
Request-specific configuration.
|
|
800
|
+
|
|
801
|
+
Returns
|
|
802
|
+
-------
|
|
803
|
+
HttpResponse[SyncPullResponse]
|
|
804
|
+
Successful Response
|
|
805
|
+
"""
|
|
806
|
+
_request_options_with_retries_disabled: typing.Optional[RequestOptions] = (
|
|
807
|
+
{**request_options, "max_retries": 0} if request_options is not None else {"max_retries": 0}
|
|
808
|
+
)
|
|
809
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
810
|
+
f"ocpi/sync/{encode_path_param(version)}/cpo/tokens/pull",
|
|
811
|
+
method="POST",
|
|
812
|
+
params={
|
|
813
|
+
"partner_id": partner_id,
|
|
814
|
+
"date_from": serialize_datetime(date_from) if date_from is not None else None,
|
|
815
|
+
"date_to": serialize_datetime(date_to) if date_to is not None else None,
|
|
816
|
+
"offset": offset,
|
|
817
|
+
"limit": limit,
|
|
818
|
+
"full_replace": full_replace,
|
|
819
|
+
},
|
|
820
|
+
request_options=_request_options_with_retries_disabled,
|
|
821
|
+
)
|
|
822
|
+
try:
|
|
823
|
+
if 200 <= _response.status_code < 300:
|
|
824
|
+
_data = typing.cast(
|
|
825
|
+
SyncPullResponse,
|
|
826
|
+
parse_obj_as(
|
|
827
|
+
type_=SyncPullResponse, # type: ignore
|
|
828
|
+
object_=_response.json(),
|
|
829
|
+
),
|
|
830
|
+
)
|
|
831
|
+
return HttpResponse(response=_response, data=_data)
|
|
832
|
+
if _response.status_code == 400:
|
|
833
|
+
raise BadRequestError(
|
|
834
|
+
headers=dict(_response.headers),
|
|
835
|
+
body=typing.cast(
|
|
836
|
+
HttpErrorResponse,
|
|
837
|
+
parse_obj_as(
|
|
838
|
+
type_=HttpErrorResponse, # type: ignore
|
|
839
|
+
object_=_response.json(),
|
|
840
|
+
),
|
|
841
|
+
),
|
|
842
|
+
)
|
|
843
|
+
if _response.status_code == 401:
|
|
844
|
+
raise UnauthorizedError(
|
|
845
|
+
headers=dict(_response.headers),
|
|
846
|
+
body=typing.cast(
|
|
847
|
+
HttpErrorResponse,
|
|
848
|
+
parse_obj_as(
|
|
849
|
+
type_=HttpErrorResponse, # type: ignore
|
|
850
|
+
object_=_response.json(),
|
|
851
|
+
),
|
|
852
|
+
),
|
|
853
|
+
)
|
|
854
|
+
if _response.status_code == 404:
|
|
855
|
+
raise NotFoundError(
|
|
856
|
+
headers=dict(_response.headers),
|
|
857
|
+
body=typing.cast(
|
|
858
|
+
HttpErrorResponse,
|
|
859
|
+
parse_obj_as(
|
|
860
|
+
type_=HttpErrorResponse, # type: ignore
|
|
861
|
+
object_=_response.json(),
|
|
862
|
+
),
|
|
863
|
+
),
|
|
864
|
+
)
|
|
865
|
+
if _response.status_code == 422:
|
|
866
|
+
raise UnprocessableEntityError(
|
|
867
|
+
headers=dict(_response.headers),
|
|
868
|
+
body=typing.cast(
|
|
869
|
+
HttpValidationError,
|
|
870
|
+
parse_obj_as(
|
|
871
|
+
type_=HttpValidationError, # type: ignore
|
|
872
|
+
object_=_response.json(),
|
|
873
|
+
),
|
|
874
|
+
),
|
|
875
|
+
)
|
|
876
|
+
if _response.status_code == 429:
|
|
877
|
+
raise TooManyRequestsError(
|
|
878
|
+
headers=dict(_response.headers),
|
|
879
|
+
body=typing.cast(
|
|
880
|
+
HttpErrorResponse,
|
|
881
|
+
parse_obj_as(
|
|
882
|
+
type_=HttpErrorResponse, # type: ignore
|
|
883
|
+
object_=_response.json(),
|
|
884
|
+
),
|
|
885
|
+
),
|
|
886
|
+
)
|
|
887
|
+
if _response.status_code == 502:
|
|
888
|
+
raise BadGatewayError(
|
|
889
|
+
headers=dict(_response.headers),
|
|
890
|
+
body=typing.cast(
|
|
891
|
+
HttpErrorResponse,
|
|
892
|
+
parse_obj_as(
|
|
893
|
+
type_=HttpErrorResponse, # type: ignore
|
|
894
|
+
object_=_response.json(),
|
|
895
|
+
),
|
|
896
|
+
),
|
|
897
|
+
)
|
|
898
|
+
if _response.status_code == 504:
|
|
899
|
+
raise GatewayTimeoutError(
|
|
900
|
+
headers=dict(_response.headers),
|
|
901
|
+
body=typing.cast(
|
|
902
|
+
HttpErrorResponse,
|
|
903
|
+
parse_obj_as(
|
|
904
|
+
type_=HttpErrorResponse, # type: ignore
|
|
905
|
+
object_=_response.json(),
|
|
906
|
+
),
|
|
907
|
+
),
|
|
908
|
+
)
|
|
909
|
+
_response_json = _response.json()
|
|
910
|
+
except JSONDecodeError:
|
|
911
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
912
|
+
except ValidationError as e:
|
|
913
|
+
raise ParsingError(
|
|
914
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
915
|
+
)
|
|
916
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
917
|
+
|
|
918
|
+
def pull_locations(
|
|
919
|
+
self,
|
|
920
|
+
version: PullLocationsSyncRequestVersion,
|
|
921
|
+
*,
|
|
922
|
+
partner_id: int,
|
|
923
|
+
date_from: typing.Optional[dt.datetime] = None,
|
|
924
|
+
date_to: typing.Optional[dt.datetime] = None,
|
|
925
|
+
offset: typing.Optional[int] = None,
|
|
926
|
+
limit: typing.Optional[int] = None,
|
|
927
|
+
full_replace: typing.Optional[bool] = None,
|
|
928
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
929
|
+
) -> HttpResponse[SyncPullResponse]:
|
|
930
|
+
"""
|
|
931
|
+
Fetches locations from a partner CPO's Locations module, page by page. Results are stored in the OCPI store. Pulls are incremental from the last sync; set ``full_replace=true`` for a full resync (``date_from`` is then ignored). ``partner_id`` is the roaming partner id (``roaming_partner_id``), not the operation id from ``GET /ocpi/partners``.
|
|
932
|
+
|
|
933
|
+
Parameters
|
|
934
|
+
----------
|
|
935
|
+
version : PullLocationsSyncRequestVersion
|
|
936
|
+
OCPI version: ``211`` (2.1.1), ``221`` (2.2.1) or ``230`` (2.3.0).
|
|
937
|
+
|
|
938
|
+
partner_id : int
|
|
939
|
+
Roaming partner to pull from: its ``roaming_partner_id`` from GET /ocpi/partners.
|
|
940
|
+
|
|
941
|
+
date_from : typing.Optional[dt.datetime]
|
|
942
|
+
Only objects changed at or after this time. Default: since the last sync.
|
|
943
|
+
|
|
944
|
+
date_to : typing.Optional[dt.datetime]
|
|
945
|
+
Only objects changed before this time.
|
|
946
|
+
|
|
947
|
+
offset : typing.Optional[int]
|
|
948
|
+
Start at this object in the partner's list.
|
|
949
|
+
|
|
950
|
+
limit : typing.Optional[int]
|
|
951
|
+
Objects to request per page.
|
|
952
|
+
|
|
953
|
+
full_replace : typing.Optional[bool]
|
|
954
|
+
Full pull: ``date_from``/``date_to`` and the stored cursor are ignored. For eMSP locations and tariffs it crawls the whole list and, after a clean last page, soft-deletes this partner's rows no page listed.
|
|
955
|
+
|
|
956
|
+
request_options : typing.Optional[RequestOptions]
|
|
957
|
+
Request-specific configuration.
|
|
958
|
+
|
|
959
|
+
Returns
|
|
960
|
+
-------
|
|
961
|
+
HttpResponse[SyncPullResponse]
|
|
962
|
+
Successful Response
|
|
963
|
+
"""
|
|
964
|
+
_request_options_with_retries_disabled: typing.Optional[RequestOptions] = (
|
|
965
|
+
{**request_options, "max_retries": 0} if request_options is not None else {"max_retries": 0}
|
|
966
|
+
)
|
|
967
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
968
|
+
f"ocpi/sync/{encode_path_param(version)}/emsp/locations/pull",
|
|
969
|
+
method="POST",
|
|
970
|
+
params={
|
|
971
|
+
"partner_id": partner_id,
|
|
972
|
+
"date_from": serialize_datetime(date_from) if date_from is not None else None,
|
|
973
|
+
"date_to": serialize_datetime(date_to) if date_to is not None else None,
|
|
974
|
+
"offset": offset,
|
|
975
|
+
"limit": limit,
|
|
976
|
+
"full_replace": full_replace,
|
|
977
|
+
},
|
|
978
|
+
request_options=_request_options_with_retries_disabled,
|
|
979
|
+
)
|
|
980
|
+
try:
|
|
981
|
+
if 200 <= _response.status_code < 300:
|
|
982
|
+
_data = typing.cast(
|
|
983
|
+
SyncPullResponse,
|
|
984
|
+
parse_obj_as(
|
|
985
|
+
type_=SyncPullResponse, # type: ignore
|
|
986
|
+
object_=_response.json(),
|
|
987
|
+
),
|
|
988
|
+
)
|
|
989
|
+
return HttpResponse(response=_response, data=_data)
|
|
990
|
+
if _response.status_code == 400:
|
|
991
|
+
raise BadRequestError(
|
|
992
|
+
headers=dict(_response.headers),
|
|
993
|
+
body=typing.cast(
|
|
994
|
+
HttpErrorResponse,
|
|
995
|
+
parse_obj_as(
|
|
996
|
+
type_=HttpErrorResponse, # type: ignore
|
|
997
|
+
object_=_response.json(),
|
|
998
|
+
),
|
|
999
|
+
),
|
|
1000
|
+
)
|
|
1001
|
+
if _response.status_code == 401:
|
|
1002
|
+
raise UnauthorizedError(
|
|
1003
|
+
headers=dict(_response.headers),
|
|
1004
|
+
body=typing.cast(
|
|
1005
|
+
HttpErrorResponse,
|
|
1006
|
+
parse_obj_as(
|
|
1007
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1008
|
+
object_=_response.json(),
|
|
1009
|
+
),
|
|
1010
|
+
),
|
|
1011
|
+
)
|
|
1012
|
+
if _response.status_code == 404:
|
|
1013
|
+
raise NotFoundError(
|
|
1014
|
+
headers=dict(_response.headers),
|
|
1015
|
+
body=typing.cast(
|
|
1016
|
+
HttpErrorResponse,
|
|
1017
|
+
parse_obj_as(
|
|
1018
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1019
|
+
object_=_response.json(),
|
|
1020
|
+
),
|
|
1021
|
+
),
|
|
1022
|
+
)
|
|
1023
|
+
if _response.status_code == 422:
|
|
1024
|
+
raise UnprocessableEntityError(
|
|
1025
|
+
headers=dict(_response.headers),
|
|
1026
|
+
body=typing.cast(
|
|
1027
|
+
HttpValidationError,
|
|
1028
|
+
parse_obj_as(
|
|
1029
|
+
type_=HttpValidationError, # type: ignore
|
|
1030
|
+
object_=_response.json(),
|
|
1031
|
+
),
|
|
1032
|
+
),
|
|
1033
|
+
)
|
|
1034
|
+
if _response.status_code == 429:
|
|
1035
|
+
raise TooManyRequestsError(
|
|
1036
|
+
headers=dict(_response.headers),
|
|
1037
|
+
body=typing.cast(
|
|
1038
|
+
HttpErrorResponse,
|
|
1039
|
+
parse_obj_as(
|
|
1040
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1041
|
+
object_=_response.json(),
|
|
1042
|
+
),
|
|
1043
|
+
),
|
|
1044
|
+
)
|
|
1045
|
+
if _response.status_code == 502:
|
|
1046
|
+
raise BadGatewayError(
|
|
1047
|
+
headers=dict(_response.headers),
|
|
1048
|
+
body=typing.cast(
|
|
1049
|
+
HttpErrorResponse,
|
|
1050
|
+
parse_obj_as(
|
|
1051
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1052
|
+
object_=_response.json(),
|
|
1053
|
+
),
|
|
1054
|
+
),
|
|
1055
|
+
)
|
|
1056
|
+
if _response.status_code == 504:
|
|
1057
|
+
raise GatewayTimeoutError(
|
|
1058
|
+
headers=dict(_response.headers),
|
|
1059
|
+
body=typing.cast(
|
|
1060
|
+
HttpErrorResponse,
|
|
1061
|
+
parse_obj_as(
|
|
1062
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1063
|
+
object_=_response.json(),
|
|
1064
|
+
),
|
|
1065
|
+
),
|
|
1066
|
+
)
|
|
1067
|
+
_response_json = _response.json()
|
|
1068
|
+
except JSONDecodeError:
|
|
1069
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1070
|
+
except ValidationError as e:
|
|
1071
|
+
raise ParsingError(
|
|
1072
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
1073
|
+
)
|
|
1074
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1075
|
+
|
|
1076
|
+
def pull_sessions(
|
|
1077
|
+
self,
|
|
1078
|
+
version: PullSessionsSyncRequestVersion,
|
|
1079
|
+
*,
|
|
1080
|
+
partner_id: int,
|
|
1081
|
+
date_from: typing.Optional[dt.datetime] = None,
|
|
1082
|
+
date_to: typing.Optional[dt.datetime] = None,
|
|
1083
|
+
offset: typing.Optional[int] = None,
|
|
1084
|
+
limit: typing.Optional[int] = None,
|
|
1085
|
+
full_replace: typing.Optional[bool] = None,
|
|
1086
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1087
|
+
) -> HttpResponse[SyncPullResponse]:
|
|
1088
|
+
"""
|
|
1089
|
+
Fetches sessions from a partner CPO's Sessions module, page by page. Results are stored in the OCPI store. Pulls are incremental from the last sync; set ``full_replace=true`` for a full resync (``date_from`` is then ignored). ``partner_id`` is the roaming partner id (``roaming_partner_id``), not the operation id from ``GET /ocpi/partners``.
|
|
1090
|
+
|
|
1091
|
+
Parameters
|
|
1092
|
+
----------
|
|
1093
|
+
version : PullSessionsSyncRequestVersion
|
|
1094
|
+
OCPI version: ``211`` (2.1.1), ``221`` (2.2.1) or ``230`` (2.3.0).
|
|
1095
|
+
|
|
1096
|
+
partner_id : int
|
|
1097
|
+
Roaming partner to pull from: its ``roaming_partner_id`` from GET /ocpi/partners.
|
|
1098
|
+
|
|
1099
|
+
date_from : typing.Optional[dt.datetime]
|
|
1100
|
+
Only objects changed at or after this time. Default: since the last sync.
|
|
1101
|
+
|
|
1102
|
+
date_to : typing.Optional[dt.datetime]
|
|
1103
|
+
Only objects changed before this time.
|
|
1104
|
+
|
|
1105
|
+
offset : typing.Optional[int]
|
|
1106
|
+
Start at this object in the partner's list.
|
|
1107
|
+
|
|
1108
|
+
limit : typing.Optional[int]
|
|
1109
|
+
Objects to request per page.
|
|
1110
|
+
|
|
1111
|
+
full_replace : typing.Optional[bool]
|
|
1112
|
+
Full pull: ``date_from``/``date_to`` and the stored cursor are ignored. For eMSP locations and tariffs it crawls the whole list and, after a clean last page, soft-deletes this partner's rows no page listed.
|
|
1113
|
+
|
|
1114
|
+
request_options : typing.Optional[RequestOptions]
|
|
1115
|
+
Request-specific configuration.
|
|
1116
|
+
|
|
1117
|
+
Returns
|
|
1118
|
+
-------
|
|
1119
|
+
HttpResponse[SyncPullResponse]
|
|
1120
|
+
Successful Response
|
|
1121
|
+
"""
|
|
1122
|
+
_request_options_with_retries_disabled: typing.Optional[RequestOptions] = (
|
|
1123
|
+
{**request_options, "max_retries": 0} if request_options is not None else {"max_retries": 0}
|
|
1124
|
+
)
|
|
1125
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
1126
|
+
f"ocpi/sync/{encode_path_param(version)}/emsp/sessions/pull",
|
|
1127
|
+
method="POST",
|
|
1128
|
+
params={
|
|
1129
|
+
"partner_id": partner_id,
|
|
1130
|
+
"date_from": serialize_datetime(date_from) if date_from is not None else None,
|
|
1131
|
+
"date_to": serialize_datetime(date_to) if date_to is not None else None,
|
|
1132
|
+
"offset": offset,
|
|
1133
|
+
"limit": limit,
|
|
1134
|
+
"full_replace": full_replace,
|
|
1135
|
+
},
|
|
1136
|
+
request_options=_request_options_with_retries_disabled,
|
|
1137
|
+
)
|
|
1138
|
+
try:
|
|
1139
|
+
if 200 <= _response.status_code < 300:
|
|
1140
|
+
_data = typing.cast(
|
|
1141
|
+
SyncPullResponse,
|
|
1142
|
+
parse_obj_as(
|
|
1143
|
+
type_=SyncPullResponse, # type: ignore
|
|
1144
|
+
object_=_response.json(),
|
|
1145
|
+
),
|
|
1146
|
+
)
|
|
1147
|
+
return HttpResponse(response=_response, data=_data)
|
|
1148
|
+
if _response.status_code == 400:
|
|
1149
|
+
raise BadRequestError(
|
|
1150
|
+
headers=dict(_response.headers),
|
|
1151
|
+
body=typing.cast(
|
|
1152
|
+
HttpErrorResponse,
|
|
1153
|
+
parse_obj_as(
|
|
1154
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1155
|
+
object_=_response.json(),
|
|
1156
|
+
),
|
|
1157
|
+
),
|
|
1158
|
+
)
|
|
1159
|
+
if _response.status_code == 401:
|
|
1160
|
+
raise UnauthorizedError(
|
|
1161
|
+
headers=dict(_response.headers),
|
|
1162
|
+
body=typing.cast(
|
|
1163
|
+
HttpErrorResponse,
|
|
1164
|
+
parse_obj_as(
|
|
1165
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1166
|
+
object_=_response.json(),
|
|
1167
|
+
),
|
|
1168
|
+
),
|
|
1169
|
+
)
|
|
1170
|
+
if _response.status_code == 404:
|
|
1171
|
+
raise NotFoundError(
|
|
1172
|
+
headers=dict(_response.headers),
|
|
1173
|
+
body=typing.cast(
|
|
1174
|
+
HttpErrorResponse,
|
|
1175
|
+
parse_obj_as(
|
|
1176
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1177
|
+
object_=_response.json(),
|
|
1178
|
+
),
|
|
1179
|
+
),
|
|
1180
|
+
)
|
|
1181
|
+
if _response.status_code == 422:
|
|
1182
|
+
raise UnprocessableEntityError(
|
|
1183
|
+
headers=dict(_response.headers),
|
|
1184
|
+
body=typing.cast(
|
|
1185
|
+
HttpValidationError,
|
|
1186
|
+
parse_obj_as(
|
|
1187
|
+
type_=HttpValidationError, # type: ignore
|
|
1188
|
+
object_=_response.json(),
|
|
1189
|
+
),
|
|
1190
|
+
),
|
|
1191
|
+
)
|
|
1192
|
+
if _response.status_code == 429:
|
|
1193
|
+
raise TooManyRequestsError(
|
|
1194
|
+
headers=dict(_response.headers),
|
|
1195
|
+
body=typing.cast(
|
|
1196
|
+
HttpErrorResponse,
|
|
1197
|
+
parse_obj_as(
|
|
1198
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1199
|
+
object_=_response.json(),
|
|
1200
|
+
),
|
|
1201
|
+
),
|
|
1202
|
+
)
|
|
1203
|
+
if _response.status_code == 502:
|
|
1204
|
+
raise BadGatewayError(
|
|
1205
|
+
headers=dict(_response.headers),
|
|
1206
|
+
body=typing.cast(
|
|
1207
|
+
HttpErrorResponse,
|
|
1208
|
+
parse_obj_as(
|
|
1209
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1210
|
+
object_=_response.json(),
|
|
1211
|
+
),
|
|
1212
|
+
),
|
|
1213
|
+
)
|
|
1214
|
+
if _response.status_code == 504:
|
|
1215
|
+
raise GatewayTimeoutError(
|
|
1216
|
+
headers=dict(_response.headers),
|
|
1217
|
+
body=typing.cast(
|
|
1218
|
+
HttpErrorResponse,
|
|
1219
|
+
parse_obj_as(
|
|
1220
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1221
|
+
object_=_response.json(),
|
|
1222
|
+
),
|
|
1223
|
+
),
|
|
1224
|
+
)
|
|
1225
|
+
_response_json = _response.json()
|
|
1226
|
+
except JSONDecodeError:
|
|
1227
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1228
|
+
except ValidationError as e:
|
|
1229
|
+
raise ParsingError(
|
|
1230
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
1231
|
+
)
|
|
1232
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1233
|
+
|
|
1234
|
+
def pull_cdrs(
|
|
1235
|
+
self,
|
|
1236
|
+
version: PullCdrsSyncRequestVersion,
|
|
1237
|
+
*,
|
|
1238
|
+
partner_id: int,
|
|
1239
|
+
date_from: typing.Optional[dt.datetime] = None,
|
|
1240
|
+
date_to: typing.Optional[dt.datetime] = None,
|
|
1241
|
+
offset: typing.Optional[int] = None,
|
|
1242
|
+
limit: typing.Optional[int] = None,
|
|
1243
|
+
full_replace: typing.Optional[bool] = None,
|
|
1244
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1245
|
+
) -> HttpResponse[SyncPullResponse]:
|
|
1246
|
+
"""
|
|
1247
|
+
Fetches CDRs from a partner CPO's CDRs module, page by page. Results are stored in the OCPI store. Pulls are incremental from the last sync; set ``full_replace=true`` for a full resync. ``date_from`` is then ignored. ``partner_id`` is the roaming partner id (``roaming_partner_id``), not the operation id from ``GET /ocpi/partners``.
|
|
1248
|
+
|
|
1249
|
+
Parameters
|
|
1250
|
+
----------
|
|
1251
|
+
version : PullCdrsSyncRequestVersion
|
|
1252
|
+
OCPI version: ``211`` (2.1.1), ``221`` (2.2.1) or ``230`` (2.3.0).
|
|
1253
|
+
|
|
1254
|
+
partner_id : int
|
|
1255
|
+
Roaming partner to pull from: its ``roaming_partner_id`` from GET /ocpi/partners.
|
|
1256
|
+
|
|
1257
|
+
date_from : typing.Optional[dt.datetime]
|
|
1258
|
+
Only objects changed at or after this time. Default: since the last sync.
|
|
1259
|
+
|
|
1260
|
+
date_to : typing.Optional[dt.datetime]
|
|
1261
|
+
Only objects changed before this time.
|
|
1262
|
+
|
|
1263
|
+
offset : typing.Optional[int]
|
|
1264
|
+
Start at this object in the partner's list.
|
|
1265
|
+
|
|
1266
|
+
limit : typing.Optional[int]
|
|
1267
|
+
Objects to request per page.
|
|
1268
|
+
|
|
1269
|
+
full_replace : typing.Optional[bool]
|
|
1270
|
+
Full pull: ``date_from``/``date_to`` and the stored cursor are ignored. For eMSP locations and tariffs it crawls the whole list and, after a clean last page, soft-deletes this partner's rows no page listed.
|
|
1271
|
+
|
|
1272
|
+
request_options : typing.Optional[RequestOptions]
|
|
1273
|
+
Request-specific configuration.
|
|
1274
|
+
|
|
1275
|
+
Returns
|
|
1276
|
+
-------
|
|
1277
|
+
HttpResponse[SyncPullResponse]
|
|
1278
|
+
Successful Response
|
|
1279
|
+
"""
|
|
1280
|
+
_request_options_with_retries_disabled: typing.Optional[RequestOptions] = (
|
|
1281
|
+
{**request_options, "max_retries": 0} if request_options is not None else {"max_retries": 0}
|
|
1282
|
+
)
|
|
1283
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
1284
|
+
f"ocpi/sync/{encode_path_param(version)}/emsp/cdrs/pull",
|
|
1285
|
+
method="POST",
|
|
1286
|
+
params={
|
|
1287
|
+
"partner_id": partner_id,
|
|
1288
|
+
"date_from": serialize_datetime(date_from) if date_from is not None else None,
|
|
1289
|
+
"date_to": serialize_datetime(date_to) if date_to is not None else None,
|
|
1290
|
+
"offset": offset,
|
|
1291
|
+
"limit": limit,
|
|
1292
|
+
"full_replace": full_replace,
|
|
1293
|
+
},
|
|
1294
|
+
request_options=_request_options_with_retries_disabled,
|
|
1295
|
+
)
|
|
1296
|
+
try:
|
|
1297
|
+
if 200 <= _response.status_code < 300:
|
|
1298
|
+
_data = typing.cast(
|
|
1299
|
+
SyncPullResponse,
|
|
1300
|
+
parse_obj_as(
|
|
1301
|
+
type_=SyncPullResponse, # type: ignore
|
|
1302
|
+
object_=_response.json(),
|
|
1303
|
+
),
|
|
1304
|
+
)
|
|
1305
|
+
return HttpResponse(response=_response, data=_data)
|
|
1306
|
+
if _response.status_code == 400:
|
|
1307
|
+
raise BadRequestError(
|
|
1308
|
+
headers=dict(_response.headers),
|
|
1309
|
+
body=typing.cast(
|
|
1310
|
+
HttpErrorResponse,
|
|
1311
|
+
parse_obj_as(
|
|
1312
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1313
|
+
object_=_response.json(),
|
|
1314
|
+
),
|
|
1315
|
+
),
|
|
1316
|
+
)
|
|
1317
|
+
if _response.status_code == 401:
|
|
1318
|
+
raise UnauthorizedError(
|
|
1319
|
+
headers=dict(_response.headers),
|
|
1320
|
+
body=typing.cast(
|
|
1321
|
+
HttpErrorResponse,
|
|
1322
|
+
parse_obj_as(
|
|
1323
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1324
|
+
object_=_response.json(),
|
|
1325
|
+
),
|
|
1326
|
+
),
|
|
1327
|
+
)
|
|
1328
|
+
if _response.status_code == 404:
|
|
1329
|
+
raise NotFoundError(
|
|
1330
|
+
headers=dict(_response.headers),
|
|
1331
|
+
body=typing.cast(
|
|
1332
|
+
HttpErrorResponse,
|
|
1333
|
+
parse_obj_as(
|
|
1334
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1335
|
+
object_=_response.json(),
|
|
1336
|
+
),
|
|
1337
|
+
),
|
|
1338
|
+
)
|
|
1339
|
+
if _response.status_code == 422:
|
|
1340
|
+
raise UnprocessableEntityError(
|
|
1341
|
+
headers=dict(_response.headers),
|
|
1342
|
+
body=typing.cast(
|
|
1343
|
+
HttpValidationError,
|
|
1344
|
+
parse_obj_as(
|
|
1345
|
+
type_=HttpValidationError, # type: ignore
|
|
1346
|
+
object_=_response.json(),
|
|
1347
|
+
),
|
|
1348
|
+
),
|
|
1349
|
+
)
|
|
1350
|
+
if _response.status_code == 429:
|
|
1351
|
+
raise TooManyRequestsError(
|
|
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 == 502:
|
|
1362
|
+
raise BadGatewayError(
|
|
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 == 504:
|
|
1373
|
+
raise GatewayTimeoutError(
|
|
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
|
+
_response_json = _response.json()
|
|
1384
|
+
except JSONDecodeError:
|
|
1385
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1386
|
+
except ValidationError as e:
|
|
1387
|
+
raise ParsingError(
|
|
1388
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
1389
|
+
)
|
|
1390
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1391
|
+
|
|
1392
|
+
def pull_tariffs(
|
|
1393
|
+
self,
|
|
1394
|
+
version: PullTariffsSyncRequestVersion,
|
|
1395
|
+
*,
|
|
1396
|
+
partner_id: int,
|
|
1397
|
+
date_from: typing.Optional[dt.datetime] = None,
|
|
1398
|
+
date_to: typing.Optional[dt.datetime] = None,
|
|
1399
|
+
offset: typing.Optional[int] = None,
|
|
1400
|
+
limit: typing.Optional[int] = None,
|
|
1401
|
+
full_replace: typing.Optional[bool] = None,
|
|
1402
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1403
|
+
) -> HttpResponse[SyncPullResponse]:
|
|
1404
|
+
"""
|
|
1405
|
+
Fetches tariffs from a partner CPO's Tariffs module, page by page. Results are stored in the OCPI store. Pulls are incremental from the last sync; set ``full_replace=true`` for a full resync (``date_from`` is then ignored). ``partner_id`` is the roaming partner id (``roaming_partner_id``), not the operation id from ``GET /ocpi/partners``.
|
|
1406
|
+
|
|
1407
|
+
Parameters
|
|
1408
|
+
----------
|
|
1409
|
+
version : PullTariffsSyncRequestVersion
|
|
1410
|
+
OCPI version: ``211`` (2.1.1), ``221`` (2.2.1) or ``230`` (2.3.0).
|
|
1411
|
+
|
|
1412
|
+
partner_id : int
|
|
1413
|
+
Roaming partner to pull from: its ``roaming_partner_id`` from GET /ocpi/partners.
|
|
1414
|
+
|
|
1415
|
+
date_from : typing.Optional[dt.datetime]
|
|
1416
|
+
Only objects changed at or after this time. Default: since the last sync.
|
|
1417
|
+
|
|
1418
|
+
date_to : typing.Optional[dt.datetime]
|
|
1419
|
+
Only objects changed before this time.
|
|
1420
|
+
|
|
1421
|
+
offset : typing.Optional[int]
|
|
1422
|
+
Start at this object in the partner's list.
|
|
1423
|
+
|
|
1424
|
+
limit : typing.Optional[int]
|
|
1425
|
+
Objects to request per page.
|
|
1426
|
+
|
|
1427
|
+
full_replace : typing.Optional[bool]
|
|
1428
|
+
Full pull: ``date_from``/``date_to`` and the stored cursor are ignored. For eMSP locations and tariffs it crawls the whole list and, after a clean last page, soft-deletes this partner's rows no page listed.
|
|
1429
|
+
|
|
1430
|
+
request_options : typing.Optional[RequestOptions]
|
|
1431
|
+
Request-specific configuration.
|
|
1432
|
+
|
|
1433
|
+
Returns
|
|
1434
|
+
-------
|
|
1435
|
+
HttpResponse[SyncPullResponse]
|
|
1436
|
+
Successful Response
|
|
1437
|
+
"""
|
|
1438
|
+
_request_options_with_retries_disabled: typing.Optional[RequestOptions] = (
|
|
1439
|
+
{**request_options, "max_retries": 0} if request_options is not None else {"max_retries": 0}
|
|
1440
|
+
)
|
|
1441
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
1442
|
+
f"ocpi/sync/{encode_path_param(version)}/emsp/tariffs/pull",
|
|
1443
|
+
method="POST",
|
|
1444
|
+
params={
|
|
1445
|
+
"partner_id": partner_id,
|
|
1446
|
+
"date_from": serialize_datetime(date_from) if date_from is not None else None,
|
|
1447
|
+
"date_to": serialize_datetime(date_to) if date_to is not None else None,
|
|
1448
|
+
"offset": offset,
|
|
1449
|
+
"limit": limit,
|
|
1450
|
+
"full_replace": full_replace,
|
|
1451
|
+
},
|
|
1452
|
+
request_options=_request_options_with_retries_disabled,
|
|
1453
|
+
)
|
|
1454
|
+
try:
|
|
1455
|
+
if 200 <= _response.status_code < 300:
|
|
1456
|
+
_data = typing.cast(
|
|
1457
|
+
SyncPullResponse,
|
|
1458
|
+
parse_obj_as(
|
|
1459
|
+
type_=SyncPullResponse, # type: ignore
|
|
1460
|
+
object_=_response.json(),
|
|
1461
|
+
),
|
|
1462
|
+
)
|
|
1463
|
+
return HttpResponse(response=_response, data=_data)
|
|
1464
|
+
if _response.status_code == 400:
|
|
1465
|
+
raise BadRequestError(
|
|
1466
|
+
headers=dict(_response.headers),
|
|
1467
|
+
body=typing.cast(
|
|
1468
|
+
HttpErrorResponse,
|
|
1469
|
+
parse_obj_as(
|
|
1470
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1471
|
+
object_=_response.json(),
|
|
1472
|
+
),
|
|
1473
|
+
),
|
|
1474
|
+
)
|
|
1475
|
+
if _response.status_code == 401:
|
|
1476
|
+
raise UnauthorizedError(
|
|
1477
|
+
headers=dict(_response.headers),
|
|
1478
|
+
body=typing.cast(
|
|
1479
|
+
HttpErrorResponse,
|
|
1480
|
+
parse_obj_as(
|
|
1481
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1482
|
+
object_=_response.json(),
|
|
1483
|
+
),
|
|
1484
|
+
),
|
|
1485
|
+
)
|
|
1486
|
+
if _response.status_code == 404:
|
|
1487
|
+
raise NotFoundError(
|
|
1488
|
+
headers=dict(_response.headers),
|
|
1489
|
+
body=typing.cast(
|
|
1490
|
+
HttpErrorResponse,
|
|
1491
|
+
parse_obj_as(
|
|
1492
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1493
|
+
object_=_response.json(),
|
|
1494
|
+
),
|
|
1495
|
+
),
|
|
1496
|
+
)
|
|
1497
|
+
if _response.status_code == 422:
|
|
1498
|
+
raise UnprocessableEntityError(
|
|
1499
|
+
headers=dict(_response.headers),
|
|
1500
|
+
body=typing.cast(
|
|
1501
|
+
HttpValidationError,
|
|
1502
|
+
parse_obj_as(
|
|
1503
|
+
type_=HttpValidationError, # type: ignore
|
|
1504
|
+
object_=_response.json(),
|
|
1505
|
+
),
|
|
1506
|
+
),
|
|
1507
|
+
)
|
|
1508
|
+
if _response.status_code == 429:
|
|
1509
|
+
raise TooManyRequestsError(
|
|
1510
|
+
headers=dict(_response.headers),
|
|
1511
|
+
body=typing.cast(
|
|
1512
|
+
HttpErrorResponse,
|
|
1513
|
+
parse_obj_as(
|
|
1514
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1515
|
+
object_=_response.json(),
|
|
1516
|
+
),
|
|
1517
|
+
),
|
|
1518
|
+
)
|
|
1519
|
+
if _response.status_code == 502:
|
|
1520
|
+
raise BadGatewayError(
|
|
1521
|
+
headers=dict(_response.headers),
|
|
1522
|
+
body=typing.cast(
|
|
1523
|
+
HttpErrorResponse,
|
|
1524
|
+
parse_obj_as(
|
|
1525
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1526
|
+
object_=_response.json(),
|
|
1527
|
+
),
|
|
1528
|
+
),
|
|
1529
|
+
)
|
|
1530
|
+
if _response.status_code == 504:
|
|
1531
|
+
raise GatewayTimeoutError(
|
|
1532
|
+
headers=dict(_response.headers),
|
|
1533
|
+
body=typing.cast(
|
|
1534
|
+
HttpErrorResponse,
|
|
1535
|
+
parse_obj_as(
|
|
1536
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1537
|
+
object_=_response.json(),
|
|
1538
|
+
),
|
|
1539
|
+
),
|
|
1540
|
+
)
|
|
1541
|
+
_response_json = _response.json()
|
|
1542
|
+
except JSONDecodeError:
|
|
1543
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1544
|
+
except ValidationError as e:
|
|
1545
|
+
raise ParsingError(
|
|
1546
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
1547
|
+
)
|
|
1548
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1549
|
+
|
|
1550
|
+
def pull_hub_client_info_as_emsp(
|
|
1551
|
+
self,
|
|
1552
|
+
version: PullHubClientInfoAsEmspSyncRequestVersion,
|
|
1553
|
+
*,
|
|
1554
|
+
partner_id: int,
|
|
1555
|
+
date_from: typing.Optional[dt.datetime] = None,
|
|
1556
|
+
date_to: typing.Optional[dt.datetime] = None,
|
|
1557
|
+
offset: typing.Optional[int] = None,
|
|
1558
|
+
limit: typing.Optional[int] = None,
|
|
1559
|
+
full_replace: typing.Optional[bool] = None,
|
|
1560
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1561
|
+
) -> HttpResponse[SyncPullResponse]:
|
|
1562
|
+
"""
|
|
1563
|
+
Fetches a Hub's ClientInfo list (which parties are reachable through it) into our eMSP side. OCPI 2.2.1 and 2.3.0 only. Results are stored in the OCPI store. Pulls are incremental from the last sync; set ``full_replace=true`` for a full resync (``date_from`` is then ignored). ``partner_id`` is the roaming partner id (``roaming_partner_id``), not the operation id from ``GET /ocpi/partners``.
|
|
1564
|
+
|
|
1565
|
+
Parameters
|
|
1566
|
+
----------
|
|
1567
|
+
version : PullHubClientInfoAsEmspSyncRequestVersion
|
|
1568
|
+
OCPI version: ``211`` (2.1.1), ``221`` (2.2.1) or ``230`` (2.3.0).
|
|
1569
|
+
|
|
1570
|
+
partner_id : int
|
|
1571
|
+
Roaming partner to pull from: its ``roaming_partner_id`` from GET /ocpi/partners.
|
|
1572
|
+
|
|
1573
|
+
date_from : typing.Optional[dt.datetime]
|
|
1574
|
+
Only objects changed at or after this time. Default: since the last sync.
|
|
1575
|
+
|
|
1576
|
+
date_to : typing.Optional[dt.datetime]
|
|
1577
|
+
Only objects changed before this time.
|
|
1578
|
+
|
|
1579
|
+
offset : typing.Optional[int]
|
|
1580
|
+
Start at this object in the partner's list.
|
|
1581
|
+
|
|
1582
|
+
limit : typing.Optional[int]
|
|
1583
|
+
Objects to request per page.
|
|
1584
|
+
|
|
1585
|
+
full_replace : typing.Optional[bool]
|
|
1586
|
+
Full pull: ``date_from``/``date_to`` and the stored cursor are ignored. For eMSP locations and tariffs it crawls the whole list and, after a clean last page, soft-deletes this partner's rows no page listed.
|
|
1587
|
+
|
|
1588
|
+
request_options : typing.Optional[RequestOptions]
|
|
1589
|
+
Request-specific configuration.
|
|
1590
|
+
|
|
1591
|
+
Returns
|
|
1592
|
+
-------
|
|
1593
|
+
HttpResponse[SyncPullResponse]
|
|
1594
|
+
Successful Response
|
|
1595
|
+
"""
|
|
1596
|
+
_request_options_with_retries_disabled: typing.Optional[RequestOptions] = (
|
|
1597
|
+
{**request_options, "max_retries": 0} if request_options is not None else {"max_retries": 0}
|
|
1598
|
+
)
|
|
1599
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
1600
|
+
f"ocpi/sync/{encode_path_param(version)}/emsp/hubclientinfo/pull",
|
|
1601
|
+
method="POST",
|
|
1602
|
+
params={
|
|
1603
|
+
"partner_id": partner_id,
|
|
1604
|
+
"date_from": serialize_datetime(date_from) if date_from is not None else None,
|
|
1605
|
+
"date_to": serialize_datetime(date_to) if date_to is not None else None,
|
|
1606
|
+
"offset": offset,
|
|
1607
|
+
"limit": limit,
|
|
1608
|
+
"full_replace": full_replace,
|
|
1609
|
+
},
|
|
1610
|
+
request_options=_request_options_with_retries_disabled,
|
|
1611
|
+
)
|
|
1612
|
+
try:
|
|
1613
|
+
if 200 <= _response.status_code < 300:
|
|
1614
|
+
_data = typing.cast(
|
|
1615
|
+
SyncPullResponse,
|
|
1616
|
+
parse_obj_as(
|
|
1617
|
+
type_=SyncPullResponse, # type: ignore
|
|
1618
|
+
object_=_response.json(),
|
|
1619
|
+
),
|
|
1620
|
+
)
|
|
1621
|
+
return HttpResponse(response=_response, data=_data)
|
|
1622
|
+
if _response.status_code == 400:
|
|
1623
|
+
raise BadRequestError(
|
|
1624
|
+
headers=dict(_response.headers),
|
|
1625
|
+
body=typing.cast(
|
|
1626
|
+
HttpErrorResponse,
|
|
1627
|
+
parse_obj_as(
|
|
1628
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1629
|
+
object_=_response.json(),
|
|
1630
|
+
),
|
|
1631
|
+
),
|
|
1632
|
+
)
|
|
1633
|
+
if _response.status_code == 401:
|
|
1634
|
+
raise UnauthorizedError(
|
|
1635
|
+
headers=dict(_response.headers),
|
|
1636
|
+
body=typing.cast(
|
|
1637
|
+
HttpErrorResponse,
|
|
1638
|
+
parse_obj_as(
|
|
1639
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1640
|
+
object_=_response.json(),
|
|
1641
|
+
),
|
|
1642
|
+
),
|
|
1643
|
+
)
|
|
1644
|
+
if _response.status_code == 404:
|
|
1645
|
+
raise NotFoundError(
|
|
1646
|
+
headers=dict(_response.headers),
|
|
1647
|
+
body=typing.cast(
|
|
1648
|
+
HttpErrorResponse,
|
|
1649
|
+
parse_obj_as(
|
|
1650
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1651
|
+
object_=_response.json(),
|
|
1652
|
+
),
|
|
1653
|
+
),
|
|
1654
|
+
)
|
|
1655
|
+
if _response.status_code == 422:
|
|
1656
|
+
raise UnprocessableEntityError(
|
|
1657
|
+
headers=dict(_response.headers),
|
|
1658
|
+
body=typing.cast(
|
|
1659
|
+
HttpValidationError,
|
|
1660
|
+
parse_obj_as(
|
|
1661
|
+
type_=HttpValidationError, # type: ignore
|
|
1662
|
+
object_=_response.json(),
|
|
1663
|
+
),
|
|
1664
|
+
),
|
|
1665
|
+
)
|
|
1666
|
+
if _response.status_code == 429:
|
|
1667
|
+
raise TooManyRequestsError(
|
|
1668
|
+
headers=dict(_response.headers),
|
|
1669
|
+
body=typing.cast(
|
|
1670
|
+
HttpErrorResponse,
|
|
1671
|
+
parse_obj_as(
|
|
1672
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1673
|
+
object_=_response.json(),
|
|
1674
|
+
),
|
|
1675
|
+
),
|
|
1676
|
+
)
|
|
1677
|
+
if _response.status_code == 502:
|
|
1678
|
+
raise BadGatewayError(
|
|
1679
|
+
headers=dict(_response.headers),
|
|
1680
|
+
body=typing.cast(
|
|
1681
|
+
HttpErrorResponse,
|
|
1682
|
+
parse_obj_as(
|
|
1683
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1684
|
+
object_=_response.json(),
|
|
1685
|
+
),
|
|
1686
|
+
),
|
|
1687
|
+
)
|
|
1688
|
+
if _response.status_code == 504:
|
|
1689
|
+
raise GatewayTimeoutError(
|
|
1690
|
+
headers=dict(_response.headers),
|
|
1691
|
+
body=typing.cast(
|
|
1692
|
+
HttpErrorResponse,
|
|
1693
|
+
parse_obj_as(
|
|
1694
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1695
|
+
object_=_response.json(),
|
|
1696
|
+
),
|
|
1697
|
+
),
|
|
1698
|
+
)
|
|
1699
|
+
_response_json = _response.json()
|
|
1700
|
+
except JSONDecodeError:
|
|
1701
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1702
|
+
except ValidationError as e:
|
|
1703
|
+
raise ParsingError(
|
|
1704
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
1705
|
+
)
|
|
1706
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1707
|
+
|
|
1708
|
+
def pull_hub_client_info_as_cpo(
|
|
1709
|
+
self,
|
|
1710
|
+
version: PullHubClientInfoAsCpoSyncRequestVersion,
|
|
1711
|
+
*,
|
|
1712
|
+
partner_id: int,
|
|
1713
|
+
date_from: typing.Optional[dt.datetime] = None,
|
|
1714
|
+
date_to: typing.Optional[dt.datetime] = None,
|
|
1715
|
+
offset: typing.Optional[int] = None,
|
|
1716
|
+
limit: typing.Optional[int] = None,
|
|
1717
|
+
full_replace: typing.Optional[bool] = None,
|
|
1718
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1719
|
+
) -> HttpResponse[SyncPullResponse]:
|
|
1720
|
+
"""
|
|
1721
|
+
Fetches a Hub's ClientInfo list (which parties are reachable through it) into our CPO side. OCPI 2.2.1 and 2.3.0 only. Results are stored in the OCPI store. Pulls are incremental from the last sync; set ``full_replace=true`` for a full resync (``date_from`` is then ignored). ``partner_id`` is the roaming partner id (``roaming_partner_id``), not the operation id from ``GET /ocpi/partners``.
|
|
1722
|
+
|
|
1723
|
+
Parameters
|
|
1724
|
+
----------
|
|
1725
|
+
version : PullHubClientInfoAsCpoSyncRequestVersion
|
|
1726
|
+
OCPI version: ``211`` (2.1.1), ``221`` (2.2.1) or ``230`` (2.3.0).
|
|
1727
|
+
|
|
1728
|
+
partner_id : int
|
|
1729
|
+
Roaming partner to pull from: its ``roaming_partner_id`` from GET /ocpi/partners.
|
|
1730
|
+
|
|
1731
|
+
date_from : typing.Optional[dt.datetime]
|
|
1732
|
+
Only objects changed at or after this time. Default: since the last sync.
|
|
1733
|
+
|
|
1734
|
+
date_to : typing.Optional[dt.datetime]
|
|
1735
|
+
Only objects changed before this time.
|
|
1736
|
+
|
|
1737
|
+
offset : typing.Optional[int]
|
|
1738
|
+
Start at this object in the partner's list.
|
|
1739
|
+
|
|
1740
|
+
limit : typing.Optional[int]
|
|
1741
|
+
Objects to request per page.
|
|
1742
|
+
|
|
1743
|
+
full_replace : typing.Optional[bool]
|
|
1744
|
+
Full pull: ``date_from``/``date_to`` and the stored cursor are ignored. For eMSP locations and tariffs it crawls the whole list and, after a clean last page, soft-deletes this partner's rows no page listed.
|
|
1745
|
+
|
|
1746
|
+
request_options : typing.Optional[RequestOptions]
|
|
1747
|
+
Request-specific configuration.
|
|
1748
|
+
|
|
1749
|
+
Returns
|
|
1750
|
+
-------
|
|
1751
|
+
HttpResponse[SyncPullResponse]
|
|
1752
|
+
Successful Response
|
|
1753
|
+
"""
|
|
1754
|
+
_request_options_with_retries_disabled: typing.Optional[RequestOptions] = (
|
|
1755
|
+
{**request_options, "max_retries": 0} if request_options is not None else {"max_retries": 0}
|
|
1756
|
+
)
|
|
1757
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
1758
|
+
f"ocpi/sync/{encode_path_param(version)}/cpo/hubclientinfo/pull",
|
|
1759
|
+
method="POST",
|
|
1760
|
+
params={
|
|
1761
|
+
"partner_id": partner_id,
|
|
1762
|
+
"date_from": serialize_datetime(date_from) if date_from is not None else None,
|
|
1763
|
+
"date_to": serialize_datetime(date_to) if date_to is not None else None,
|
|
1764
|
+
"offset": offset,
|
|
1765
|
+
"limit": limit,
|
|
1766
|
+
"full_replace": full_replace,
|
|
1767
|
+
},
|
|
1768
|
+
request_options=_request_options_with_retries_disabled,
|
|
1769
|
+
)
|
|
1770
|
+
try:
|
|
1771
|
+
if 200 <= _response.status_code < 300:
|
|
1772
|
+
_data = typing.cast(
|
|
1773
|
+
SyncPullResponse,
|
|
1774
|
+
parse_obj_as(
|
|
1775
|
+
type_=SyncPullResponse, # type: ignore
|
|
1776
|
+
object_=_response.json(),
|
|
1777
|
+
),
|
|
1778
|
+
)
|
|
1779
|
+
return HttpResponse(response=_response, data=_data)
|
|
1780
|
+
if _response.status_code == 400:
|
|
1781
|
+
raise BadRequestError(
|
|
1782
|
+
headers=dict(_response.headers),
|
|
1783
|
+
body=typing.cast(
|
|
1784
|
+
HttpErrorResponse,
|
|
1785
|
+
parse_obj_as(
|
|
1786
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1787
|
+
object_=_response.json(),
|
|
1788
|
+
),
|
|
1789
|
+
),
|
|
1790
|
+
)
|
|
1791
|
+
if _response.status_code == 401:
|
|
1792
|
+
raise UnauthorizedError(
|
|
1793
|
+
headers=dict(_response.headers),
|
|
1794
|
+
body=typing.cast(
|
|
1795
|
+
HttpErrorResponse,
|
|
1796
|
+
parse_obj_as(
|
|
1797
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1798
|
+
object_=_response.json(),
|
|
1799
|
+
),
|
|
1800
|
+
),
|
|
1801
|
+
)
|
|
1802
|
+
if _response.status_code == 404:
|
|
1803
|
+
raise NotFoundError(
|
|
1804
|
+
headers=dict(_response.headers),
|
|
1805
|
+
body=typing.cast(
|
|
1806
|
+
HttpErrorResponse,
|
|
1807
|
+
parse_obj_as(
|
|
1808
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1809
|
+
object_=_response.json(),
|
|
1810
|
+
),
|
|
1811
|
+
),
|
|
1812
|
+
)
|
|
1813
|
+
if _response.status_code == 422:
|
|
1814
|
+
raise UnprocessableEntityError(
|
|
1815
|
+
headers=dict(_response.headers),
|
|
1816
|
+
body=typing.cast(
|
|
1817
|
+
HttpValidationError,
|
|
1818
|
+
parse_obj_as(
|
|
1819
|
+
type_=HttpValidationError, # type: ignore
|
|
1820
|
+
object_=_response.json(),
|
|
1821
|
+
),
|
|
1822
|
+
),
|
|
1823
|
+
)
|
|
1824
|
+
if _response.status_code == 429:
|
|
1825
|
+
raise TooManyRequestsError(
|
|
1826
|
+
headers=dict(_response.headers),
|
|
1827
|
+
body=typing.cast(
|
|
1828
|
+
HttpErrorResponse,
|
|
1829
|
+
parse_obj_as(
|
|
1830
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1831
|
+
object_=_response.json(),
|
|
1832
|
+
),
|
|
1833
|
+
),
|
|
1834
|
+
)
|
|
1835
|
+
if _response.status_code == 502:
|
|
1836
|
+
raise BadGatewayError(
|
|
1837
|
+
headers=dict(_response.headers),
|
|
1838
|
+
body=typing.cast(
|
|
1839
|
+
HttpErrorResponse,
|
|
1840
|
+
parse_obj_as(
|
|
1841
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1842
|
+
object_=_response.json(),
|
|
1843
|
+
),
|
|
1844
|
+
),
|
|
1845
|
+
)
|
|
1846
|
+
if _response.status_code == 504:
|
|
1847
|
+
raise GatewayTimeoutError(
|
|
1848
|
+
headers=dict(_response.headers),
|
|
1849
|
+
body=typing.cast(
|
|
1850
|
+
HttpErrorResponse,
|
|
1851
|
+
parse_obj_as(
|
|
1852
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1853
|
+
object_=_response.json(),
|
|
1854
|
+
),
|
|
1855
|
+
),
|
|
1856
|
+
)
|
|
1857
|
+
_response_json = _response.json()
|
|
1858
|
+
except JSONDecodeError:
|
|
1859
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1860
|
+
except ValidationError as e:
|
|
1861
|
+
raise ParsingError(
|
|
1862
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
1863
|
+
)
|
|
1864
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1865
|
+
|
|
1866
|
+
|
|
1867
|
+
class AsyncRawSyncClient:
|
|
1868
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
1869
|
+
self._client_wrapper = client_wrapper
|
|
1870
|
+
|
|
1871
|
+
async def push_location(
|
|
1872
|
+
self,
|
|
1873
|
+
version: PushLocationSyncRequestVersion,
|
|
1874
|
+
location_id: str,
|
|
1875
|
+
*,
|
|
1876
|
+
partner_id: int,
|
|
1877
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1878
|
+
) -> AsyncHttpResponse[SyncPushResponse]:
|
|
1879
|
+
"""
|
|
1880
|
+
Sends a stored location to a partner eMSP (PUT to its Locations module). ``partner_id`` is the roaming partner id (``roaming_partner_id``), not the operation id from ``GET /ocpi/partners``.
|
|
1881
|
+
|
|
1882
|
+
Parameters
|
|
1883
|
+
----------
|
|
1884
|
+
version : PushLocationSyncRequestVersion
|
|
1885
|
+
OCPI version: ``211`` (2.1.1), ``221`` (2.2.1) or ``230`` (2.3.0).
|
|
1886
|
+
|
|
1887
|
+
location_id : str
|
|
1888
|
+
OCPI ``id`` of the location.
|
|
1889
|
+
|
|
1890
|
+
partner_id : int
|
|
1891
|
+
Roaming partner to talk to: the ``roaming_partner_id`` from ``GET /ocpi/partners``, not its ``id``.
|
|
1892
|
+
|
|
1893
|
+
request_options : typing.Optional[RequestOptions]
|
|
1894
|
+
Request-specific configuration.
|
|
1895
|
+
|
|
1896
|
+
Returns
|
|
1897
|
+
-------
|
|
1898
|
+
AsyncHttpResponse[SyncPushResponse]
|
|
1899
|
+
Successful Response
|
|
1900
|
+
"""
|
|
1901
|
+
_request_options_with_retries_disabled: typing.Optional[RequestOptions] = (
|
|
1902
|
+
{**request_options, "max_retries": 0} if request_options is not None else {"max_retries": 0}
|
|
1903
|
+
)
|
|
1904
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1905
|
+
f"ocpi/sync/{encode_path_param(version)}/cpo/locations/{encode_path_param(location_id)}/push",
|
|
1906
|
+
method="POST",
|
|
1907
|
+
params={
|
|
1908
|
+
"partner_id": partner_id,
|
|
1909
|
+
},
|
|
1910
|
+
request_options=_request_options_with_retries_disabled,
|
|
1911
|
+
)
|
|
1912
|
+
try:
|
|
1913
|
+
if 200 <= _response.status_code < 300:
|
|
1914
|
+
_data = typing.cast(
|
|
1915
|
+
SyncPushResponse,
|
|
1916
|
+
parse_obj_as(
|
|
1917
|
+
type_=SyncPushResponse, # type: ignore
|
|
1918
|
+
object_=_response.json(),
|
|
1919
|
+
),
|
|
1920
|
+
)
|
|
1921
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1922
|
+
if _response.status_code == 400:
|
|
1923
|
+
raise BadRequestError(
|
|
1924
|
+
headers=dict(_response.headers),
|
|
1925
|
+
body=typing.cast(
|
|
1926
|
+
HttpErrorResponse,
|
|
1927
|
+
parse_obj_as(
|
|
1928
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1929
|
+
object_=_response.json(),
|
|
1930
|
+
),
|
|
1931
|
+
),
|
|
1932
|
+
)
|
|
1933
|
+
if _response.status_code == 401:
|
|
1934
|
+
raise UnauthorizedError(
|
|
1935
|
+
headers=dict(_response.headers),
|
|
1936
|
+
body=typing.cast(
|
|
1937
|
+
HttpErrorResponse,
|
|
1938
|
+
parse_obj_as(
|
|
1939
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1940
|
+
object_=_response.json(),
|
|
1941
|
+
),
|
|
1942
|
+
),
|
|
1943
|
+
)
|
|
1944
|
+
if _response.status_code == 404:
|
|
1945
|
+
raise NotFoundError(
|
|
1946
|
+
headers=dict(_response.headers),
|
|
1947
|
+
body=typing.cast(
|
|
1948
|
+
HttpErrorResponse,
|
|
1949
|
+
parse_obj_as(
|
|
1950
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1951
|
+
object_=_response.json(),
|
|
1952
|
+
),
|
|
1953
|
+
),
|
|
1954
|
+
)
|
|
1955
|
+
if _response.status_code == 422:
|
|
1956
|
+
raise UnprocessableEntityError(
|
|
1957
|
+
headers=dict(_response.headers),
|
|
1958
|
+
body=typing.cast(
|
|
1959
|
+
HttpValidationError,
|
|
1960
|
+
parse_obj_as(
|
|
1961
|
+
type_=HttpValidationError, # type: ignore
|
|
1962
|
+
object_=_response.json(),
|
|
1963
|
+
),
|
|
1964
|
+
),
|
|
1965
|
+
)
|
|
1966
|
+
if _response.status_code == 429:
|
|
1967
|
+
raise TooManyRequestsError(
|
|
1968
|
+
headers=dict(_response.headers),
|
|
1969
|
+
body=typing.cast(
|
|
1970
|
+
HttpErrorResponse,
|
|
1971
|
+
parse_obj_as(
|
|
1972
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1973
|
+
object_=_response.json(),
|
|
1974
|
+
),
|
|
1975
|
+
),
|
|
1976
|
+
)
|
|
1977
|
+
if _response.status_code == 502:
|
|
1978
|
+
raise BadGatewayError(
|
|
1979
|
+
headers=dict(_response.headers),
|
|
1980
|
+
body=typing.cast(
|
|
1981
|
+
HttpErrorResponse,
|
|
1982
|
+
parse_obj_as(
|
|
1983
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1984
|
+
object_=_response.json(),
|
|
1985
|
+
),
|
|
1986
|
+
),
|
|
1987
|
+
)
|
|
1988
|
+
if _response.status_code == 504:
|
|
1989
|
+
raise GatewayTimeoutError(
|
|
1990
|
+
headers=dict(_response.headers),
|
|
1991
|
+
body=typing.cast(
|
|
1992
|
+
HttpErrorResponse,
|
|
1993
|
+
parse_obj_as(
|
|
1994
|
+
type_=HttpErrorResponse, # type: ignore
|
|
1995
|
+
object_=_response.json(),
|
|
1996
|
+
),
|
|
1997
|
+
),
|
|
1998
|
+
)
|
|
1999
|
+
_response_json = _response.json()
|
|
2000
|
+
except JSONDecodeError:
|
|
2001
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
2002
|
+
except ValidationError as e:
|
|
2003
|
+
raise ParsingError(
|
|
2004
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
2005
|
+
)
|
|
2006
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
2007
|
+
|
|
2008
|
+
async def push_cdr(
|
|
2009
|
+
self,
|
|
2010
|
+
version: PushCdrSyncRequestVersion,
|
|
2011
|
+
cdr_id: str,
|
|
2012
|
+
*,
|
|
2013
|
+
partner_id: int,
|
|
2014
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2015
|
+
) -> AsyncHttpResponse[SyncPushResponse]:
|
|
2016
|
+
"""
|
|
2017
|
+
Sends a stored CDR to a partner eMSP (POST to its CDRs module). ``partner_id`` is the roaming partner id (``roaming_partner_id``), not the operation id from ``GET /ocpi/partners``.
|
|
2018
|
+
|
|
2019
|
+
Parameters
|
|
2020
|
+
----------
|
|
2021
|
+
version : PushCdrSyncRequestVersion
|
|
2022
|
+
OCPI version: ``211`` (2.1.1), ``221`` (2.2.1) or ``230`` (2.3.0).
|
|
2023
|
+
|
|
2024
|
+
cdr_id : str
|
|
2025
|
+
OCPI ``id`` of the CDR.
|
|
2026
|
+
|
|
2027
|
+
partner_id : int
|
|
2028
|
+
Roaming partner to talk to: the ``roaming_partner_id`` from ``GET /ocpi/partners``, not its ``id``.
|
|
2029
|
+
|
|
2030
|
+
request_options : typing.Optional[RequestOptions]
|
|
2031
|
+
Request-specific configuration.
|
|
2032
|
+
|
|
2033
|
+
Returns
|
|
2034
|
+
-------
|
|
2035
|
+
AsyncHttpResponse[SyncPushResponse]
|
|
2036
|
+
Successful Response
|
|
2037
|
+
"""
|
|
2038
|
+
_request_options_with_retries_disabled: typing.Optional[RequestOptions] = (
|
|
2039
|
+
{**request_options, "max_retries": 0} if request_options is not None else {"max_retries": 0}
|
|
2040
|
+
)
|
|
2041
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2042
|
+
f"ocpi/sync/{encode_path_param(version)}/cpo/cdrs/{encode_path_param(cdr_id)}/push",
|
|
2043
|
+
method="POST",
|
|
2044
|
+
params={
|
|
2045
|
+
"partner_id": partner_id,
|
|
2046
|
+
},
|
|
2047
|
+
request_options=_request_options_with_retries_disabled,
|
|
2048
|
+
)
|
|
2049
|
+
try:
|
|
2050
|
+
if 200 <= _response.status_code < 300:
|
|
2051
|
+
_data = typing.cast(
|
|
2052
|
+
SyncPushResponse,
|
|
2053
|
+
parse_obj_as(
|
|
2054
|
+
type_=SyncPushResponse, # type: ignore
|
|
2055
|
+
object_=_response.json(),
|
|
2056
|
+
),
|
|
2057
|
+
)
|
|
2058
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
2059
|
+
if _response.status_code == 400:
|
|
2060
|
+
raise BadRequestError(
|
|
2061
|
+
headers=dict(_response.headers),
|
|
2062
|
+
body=typing.cast(
|
|
2063
|
+
HttpErrorResponse,
|
|
2064
|
+
parse_obj_as(
|
|
2065
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2066
|
+
object_=_response.json(),
|
|
2067
|
+
),
|
|
2068
|
+
),
|
|
2069
|
+
)
|
|
2070
|
+
if _response.status_code == 401:
|
|
2071
|
+
raise UnauthorizedError(
|
|
2072
|
+
headers=dict(_response.headers),
|
|
2073
|
+
body=typing.cast(
|
|
2074
|
+
HttpErrorResponse,
|
|
2075
|
+
parse_obj_as(
|
|
2076
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2077
|
+
object_=_response.json(),
|
|
2078
|
+
),
|
|
2079
|
+
),
|
|
2080
|
+
)
|
|
2081
|
+
if _response.status_code == 404:
|
|
2082
|
+
raise NotFoundError(
|
|
2083
|
+
headers=dict(_response.headers),
|
|
2084
|
+
body=typing.cast(
|
|
2085
|
+
HttpErrorResponse,
|
|
2086
|
+
parse_obj_as(
|
|
2087
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2088
|
+
object_=_response.json(),
|
|
2089
|
+
),
|
|
2090
|
+
),
|
|
2091
|
+
)
|
|
2092
|
+
if _response.status_code == 422:
|
|
2093
|
+
raise UnprocessableEntityError(
|
|
2094
|
+
headers=dict(_response.headers),
|
|
2095
|
+
body=typing.cast(
|
|
2096
|
+
HttpValidationError,
|
|
2097
|
+
parse_obj_as(
|
|
2098
|
+
type_=HttpValidationError, # type: ignore
|
|
2099
|
+
object_=_response.json(),
|
|
2100
|
+
),
|
|
2101
|
+
),
|
|
2102
|
+
)
|
|
2103
|
+
if _response.status_code == 429:
|
|
2104
|
+
raise TooManyRequestsError(
|
|
2105
|
+
headers=dict(_response.headers),
|
|
2106
|
+
body=typing.cast(
|
|
2107
|
+
HttpErrorResponse,
|
|
2108
|
+
parse_obj_as(
|
|
2109
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2110
|
+
object_=_response.json(),
|
|
2111
|
+
),
|
|
2112
|
+
),
|
|
2113
|
+
)
|
|
2114
|
+
if _response.status_code == 502:
|
|
2115
|
+
raise BadGatewayError(
|
|
2116
|
+
headers=dict(_response.headers),
|
|
2117
|
+
body=typing.cast(
|
|
2118
|
+
HttpErrorResponse,
|
|
2119
|
+
parse_obj_as(
|
|
2120
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2121
|
+
object_=_response.json(),
|
|
2122
|
+
),
|
|
2123
|
+
),
|
|
2124
|
+
)
|
|
2125
|
+
if _response.status_code == 504:
|
|
2126
|
+
raise GatewayTimeoutError(
|
|
2127
|
+
headers=dict(_response.headers),
|
|
2128
|
+
body=typing.cast(
|
|
2129
|
+
HttpErrorResponse,
|
|
2130
|
+
parse_obj_as(
|
|
2131
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2132
|
+
object_=_response.json(),
|
|
2133
|
+
),
|
|
2134
|
+
),
|
|
2135
|
+
)
|
|
2136
|
+
_response_json = _response.json()
|
|
2137
|
+
except JSONDecodeError:
|
|
2138
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
2139
|
+
except ValidationError as e:
|
|
2140
|
+
raise ParsingError(
|
|
2141
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
2142
|
+
)
|
|
2143
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
2144
|
+
|
|
2145
|
+
async def push_tariff(
|
|
2146
|
+
self,
|
|
2147
|
+
version: PushTariffSyncRequestVersion,
|
|
2148
|
+
tariff_id: str,
|
|
2149
|
+
*,
|
|
2150
|
+
partner_id: int,
|
|
2151
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2152
|
+
) -> AsyncHttpResponse[SyncPushResponse]:
|
|
2153
|
+
"""
|
|
2154
|
+
Sends a stored tariff to a partner eMSP (PUT to its Tariffs module). ``partner_id`` is the roaming partner id (``roaming_partner_id``), not the operation id from ``GET /ocpi/partners``.
|
|
2155
|
+
|
|
2156
|
+
Parameters
|
|
2157
|
+
----------
|
|
2158
|
+
version : PushTariffSyncRequestVersion
|
|
2159
|
+
OCPI version: ``211`` (2.1.1), ``221`` (2.2.1) or ``230`` (2.3.0).
|
|
2160
|
+
|
|
2161
|
+
tariff_id : str
|
|
2162
|
+
OCPI ``id`` of the tariff.
|
|
2163
|
+
|
|
2164
|
+
partner_id : int
|
|
2165
|
+
Roaming partner to talk to: the ``roaming_partner_id`` from ``GET /ocpi/partners``, not its ``id``.
|
|
2166
|
+
|
|
2167
|
+
request_options : typing.Optional[RequestOptions]
|
|
2168
|
+
Request-specific configuration.
|
|
2169
|
+
|
|
2170
|
+
Returns
|
|
2171
|
+
-------
|
|
2172
|
+
AsyncHttpResponse[SyncPushResponse]
|
|
2173
|
+
Successful Response
|
|
2174
|
+
"""
|
|
2175
|
+
_request_options_with_retries_disabled: typing.Optional[RequestOptions] = (
|
|
2176
|
+
{**request_options, "max_retries": 0} if request_options is not None else {"max_retries": 0}
|
|
2177
|
+
)
|
|
2178
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2179
|
+
f"ocpi/sync/{encode_path_param(version)}/cpo/tariffs/{encode_path_param(tariff_id)}/push",
|
|
2180
|
+
method="POST",
|
|
2181
|
+
params={
|
|
2182
|
+
"partner_id": partner_id,
|
|
2183
|
+
},
|
|
2184
|
+
request_options=_request_options_with_retries_disabled,
|
|
2185
|
+
)
|
|
2186
|
+
try:
|
|
2187
|
+
if 200 <= _response.status_code < 300:
|
|
2188
|
+
_data = typing.cast(
|
|
2189
|
+
SyncPushResponse,
|
|
2190
|
+
parse_obj_as(
|
|
2191
|
+
type_=SyncPushResponse, # type: ignore
|
|
2192
|
+
object_=_response.json(),
|
|
2193
|
+
),
|
|
2194
|
+
)
|
|
2195
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
2196
|
+
if _response.status_code == 400:
|
|
2197
|
+
raise BadRequestError(
|
|
2198
|
+
headers=dict(_response.headers),
|
|
2199
|
+
body=typing.cast(
|
|
2200
|
+
HttpErrorResponse,
|
|
2201
|
+
parse_obj_as(
|
|
2202
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2203
|
+
object_=_response.json(),
|
|
2204
|
+
),
|
|
2205
|
+
),
|
|
2206
|
+
)
|
|
2207
|
+
if _response.status_code == 401:
|
|
2208
|
+
raise UnauthorizedError(
|
|
2209
|
+
headers=dict(_response.headers),
|
|
2210
|
+
body=typing.cast(
|
|
2211
|
+
HttpErrorResponse,
|
|
2212
|
+
parse_obj_as(
|
|
2213
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2214
|
+
object_=_response.json(),
|
|
2215
|
+
),
|
|
2216
|
+
),
|
|
2217
|
+
)
|
|
2218
|
+
if _response.status_code == 404:
|
|
2219
|
+
raise NotFoundError(
|
|
2220
|
+
headers=dict(_response.headers),
|
|
2221
|
+
body=typing.cast(
|
|
2222
|
+
HttpErrorResponse,
|
|
2223
|
+
parse_obj_as(
|
|
2224
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2225
|
+
object_=_response.json(),
|
|
2226
|
+
),
|
|
2227
|
+
),
|
|
2228
|
+
)
|
|
2229
|
+
if _response.status_code == 422:
|
|
2230
|
+
raise UnprocessableEntityError(
|
|
2231
|
+
headers=dict(_response.headers),
|
|
2232
|
+
body=typing.cast(
|
|
2233
|
+
HttpValidationError,
|
|
2234
|
+
parse_obj_as(
|
|
2235
|
+
type_=HttpValidationError, # type: ignore
|
|
2236
|
+
object_=_response.json(),
|
|
2237
|
+
),
|
|
2238
|
+
),
|
|
2239
|
+
)
|
|
2240
|
+
if _response.status_code == 429:
|
|
2241
|
+
raise TooManyRequestsError(
|
|
2242
|
+
headers=dict(_response.headers),
|
|
2243
|
+
body=typing.cast(
|
|
2244
|
+
HttpErrorResponse,
|
|
2245
|
+
parse_obj_as(
|
|
2246
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2247
|
+
object_=_response.json(),
|
|
2248
|
+
),
|
|
2249
|
+
),
|
|
2250
|
+
)
|
|
2251
|
+
if _response.status_code == 502:
|
|
2252
|
+
raise BadGatewayError(
|
|
2253
|
+
headers=dict(_response.headers),
|
|
2254
|
+
body=typing.cast(
|
|
2255
|
+
HttpErrorResponse,
|
|
2256
|
+
parse_obj_as(
|
|
2257
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2258
|
+
object_=_response.json(),
|
|
2259
|
+
),
|
|
2260
|
+
),
|
|
2261
|
+
)
|
|
2262
|
+
if _response.status_code == 504:
|
|
2263
|
+
raise GatewayTimeoutError(
|
|
2264
|
+
headers=dict(_response.headers),
|
|
2265
|
+
body=typing.cast(
|
|
2266
|
+
HttpErrorResponse,
|
|
2267
|
+
parse_obj_as(
|
|
2268
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2269
|
+
object_=_response.json(),
|
|
2270
|
+
),
|
|
2271
|
+
),
|
|
2272
|
+
)
|
|
2273
|
+
_response_json = _response.json()
|
|
2274
|
+
except JSONDecodeError:
|
|
2275
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
2276
|
+
except ValidationError as e:
|
|
2277
|
+
raise ParsingError(
|
|
2278
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
2279
|
+
)
|
|
2280
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
2281
|
+
|
|
2282
|
+
async def push_session(
|
|
2283
|
+
self,
|
|
2284
|
+
version: PushSessionSyncRequestVersion,
|
|
2285
|
+
session_id: str,
|
|
2286
|
+
*,
|
|
2287
|
+
partner_id: int,
|
|
2288
|
+
request: typing.Optional[SyncPatchRequest] = None,
|
|
2289
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2290
|
+
) -> AsyncHttpResponse[SyncPushResponse]:
|
|
2291
|
+
"""
|
|
2292
|
+
Sends a stored session to a partner eMSP: the full object, or only ``patch_body`` as a PATCH. ``partner_id`` is the roaming partner id (``roaming_partner_id``), not the operation id from ``GET /ocpi/partners``.
|
|
2293
|
+
|
|
2294
|
+
Parameters
|
|
2295
|
+
----------
|
|
2296
|
+
version : PushSessionSyncRequestVersion
|
|
2297
|
+
OCPI version: ``211`` (2.1.1), ``221`` (2.2.1) or ``230`` (2.3.0).
|
|
2298
|
+
|
|
2299
|
+
session_id : str
|
|
2300
|
+
OCPI ``id`` of the charging session.
|
|
2301
|
+
|
|
2302
|
+
partner_id : int
|
|
2303
|
+
Roaming partner to talk to: the ``roaming_partner_id`` from ``GET /ocpi/partners``, not its ``id``.
|
|
2304
|
+
|
|
2305
|
+
request : typing.Optional[SyncPatchRequest]
|
|
2306
|
+
|
|
2307
|
+
request_options : typing.Optional[RequestOptions]
|
|
2308
|
+
Request-specific configuration.
|
|
2309
|
+
|
|
2310
|
+
Returns
|
|
2311
|
+
-------
|
|
2312
|
+
AsyncHttpResponse[SyncPushResponse]
|
|
2313
|
+
Successful Response
|
|
2314
|
+
"""
|
|
2315
|
+
_request_options_with_retries_disabled: typing.Optional[RequestOptions] = (
|
|
2316
|
+
{**request_options, "max_retries": 0} if request_options is not None else {"max_retries": 0}
|
|
2317
|
+
)
|
|
2318
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2319
|
+
f"ocpi/sync/{encode_path_param(version)}/cpo/sessions/{encode_path_param(session_id)}/push",
|
|
2320
|
+
method="POST",
|
|
2321
|
+
params={
|
|
2322
|
+
"partner_id": partner_id,
|
|
2323
|
+
},
|
|
2324
|
+
json=convert_and_respect_annotation_metadata(
|
|
2325
|
+
object_=request, annotation=typing.Optional[SyncPatchRequest], direction="write"
|
|
2326
|
+
),
|
|
2327
|
+
headers={
|
|
2328
|
+
"content-type": "application/json",
|
|
2329
|
+
},
|
|
2330
|
+
request_options=_request_options_with_retries_disabled,
|
|
2331
|
+
omit=OMIT,
|
|
2332
|
+
)
|
|
2333
|
+
try:
|
|
2334
|
+
if 200 <= _response.status_code < 300:
|
|
2335
|
+
_data = typing.cast(
|
|
2336
|
+
SyncPushResponse,
|
|
2337
|
+
parse_obj_as(
|
|
2338
|
+
type_=SyncPushResponse, # type: ignore
|
|
2339
|
+
object_=_response.json(),
|
|
2340
|
+
),
|
|
2341
|
+
)
|
|
2342
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
2343
|
+
if _response.status_code == 400:
|
|
2344
|
+
raise BadRequestError(
|
|
2345
|
+
headers=dict(_response.headers),
|
|
2346
|
+
body=typing.cast(
|
|
2347
|
+
HttpErrorResponse,
|
|
2348
|
+
parse_obj_as(
|
|
2349
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2350
|
+
object_=_response.json(),
|
|
2351
|
+
),
|
|
2352
|
+
),
|
|
2353
|
+
)
|
|
2354
|
+
if _response.status_code == 401:
|
|
2355
|
+
raise UnauthorizedError(
|
|
2356
|
+
headers=dict(_response.headers),
|
|
2357
|
+
body=typing.cast(
|
|
2358
|
+
HttpErrorResponse,
|
|
2359
|
+
parse_obj_as(
|
|
2360
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2361
|
+
object_=_response.json(),
|
|
2362
|
+
),
|
|
2363
|
+
),
|
|
2364
|
+
)
|
|
2365
|
+
if _response.status_code == 404:
|
|
2366
|
+
raise NotFoundError(
|
|
2367
|
+
headers=dict(_response.headers),
|
|
2368
|
+
body=typing.cast(
|
|
2369
|
+
HttpErrorResponse,
|
|
2370
|
+
parse_obj_as(
|
|
2371
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2372
|
+
object_=_response.json(),
|
|
2373
|
+
),
|
|
2374
|
+
),
|
|
2375
|
+
)
|
|
2376
|
+
if _response.status_code == 422:
|
|
2377
|
+
raise UnprocessableEntityError(
|
|
2378
|
+
headers=dict(_response.headers),
|
|
2379
|
+
body=typing.cast(
|
|
2380
|
+
HttpValidationError,
|
|
2381
|
+
parse_obj_as(
|
|
2382
|
+
type_=HttpValidationError, # type: ignore
|
|
2383
|
+
object_=_response.json(),
|
|
2384
|
+
),
|
|
2385
|
+
),
|
|
2386
|
+
)
|
|
2387
|
+
if _response.status_code == 429:
|
|
2388
|
+
raise TooManyRequestsError(
|
|
2389
|
+
headers=dict(_response.headers),
|
|
2390
|
+
body=typing.cast(
|
|
2391
|
+
HttpErrorResponse,
|
|
2392
|
+
parse_obj_as(
|
|
2393
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2394
|
+
object_=_response.json(),
|
|
2395
|
+
),
|
|
2396
|
+
),
|
|
2397
|
+
)
|
|
2398
|
+
if _response.status_code == 502:
|
|
2399
|
+
raise BadGatewayError(
|
|
2400
|
+
headers=dict(_response.headers),
|
|
2401
|
+
body=typing.cast(
|
|
2402
|
+
HttpErrorResponse,
|
|
2403
|
+
parse_obj_as(
|
|
2404
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2405
|
+
object_=_response.json(),
|
|
2406
|
+
),
|
|
2407
|
+
),
|
|
2408
|
+
)
|
|
2409
|
+
if _response.status_code == 504:
|
|
2410
|
+
raise GatewayTimeoutError(
|
|
2411
|
+
headers=dict(_response.headers),
|
|
2412
|
+
body=typing.cast(
|
|
2413
|
+
HttpErrorResponse,
|
|
2414
|
+
parse_obj_as(
|
|
2415
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2416
|
+
object_=_response.json(),
|
|
2417
|
+
),
|
|
2418
|
+
),
|
|
2419
|
+
)
|
|
2420
|
+
_response_json = _response.json()
|
|
2421
|
+
except JSONDecodeError:
|
|
2422
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
2423
|
+
except ValidationError as e:
|
|
2424
|
+
raise ParsingError(
|
|
2425
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
2426
|
+
)
|
|
2427
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
2428
|
+
|
|
2429
|
+
async def push_token(
|
|
2430
|
+
self,
|
|
2431
|
+
version: PushTokenSyncRequestVersion,
|
|
2432
|
+
token_uid: str,
|
|
2433
|
+
*,
|
|
2434
|
+
partner_id: int,
|
|
2435
|
+
type: typing.Optional[str] = None,
|
|
2436
|
+
request: typing.Optional[SyncPatchRequest] = None,
|
|
2437
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2438
|
+
) -> AsyncHttpResponse[SyncPushResponse]:
|
|
2439
|
+
"""
|
|
2440
|
+
Sends a stored token to a partner CPO: the full object, or only ``patch_body`` as a PATCH. ``partner_id`` is the roaming partner id (``roaming_partner_id``), not the operation id from ``GET /ocpi/partners``.
|
|
2441
|
+
|
|
2442
|
+
Parameters
|
|
2443
|
+
----------
|
|
2444
|
+
version : PushTokenSyncRequestVersion
|
|
2445
|
+
OCPI version: ``211`` (2.1.1), ``221`` (2.2.1) or ``230`` (2.3.0).
|
|
2446
|
+
|
|
2447
|
+
token_uid : str
|
|
2448
|
+
OCPI ``uid`` of the token.
|
|
2449
|
+
|
|
2450
|
+
partner_id : int
|
|
2451
|
+
Roaming partner to talk to: the ``roaming_partner_id`` from ``GET /ocpi/partners``, not its ``id``.
|
|
2452
|
+
|
|
2453
|
+
type : typing.Optional[str]
|
|
2454
|
+
Token type (e.g. ``RFID``, ``APP_USER``), used to find the token when the OCPI body does not carry ``type``.
|
|
2455
|
+
|
|
2456
|
+
request : typing.Optional[SyncPatchRequest]
|
|
2457
|
+
|
|
2458
|
+
request_options : typing.Optional[RequestOptions]
|
|
2459
|
+
Request-specific configuration.
|
|
2460
|
+
|
|
2461
|
+
Returns
|
|
2462
|
+
-------
|
|
2463
|
+
AsyncHttpResponse[SyncPushResponse]
|
|
2464
|
+
Successful Response
|
|
2465
|
+
"""
|
|
2466
|
+
_request_options_with_retries_disabled: typing.Optional[RequestOptions] = (
|
|
2467
|
+
{**request_options, "max_retries": 0} if request_options is not None else {"max_retries": 0}
|
|
2468
|
+
)
|
|
2469
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2470
|
+
f"ocpi/sync/{encode_path_param(version)}/emsp/tokens/{encode_path_param(token_uid)}/push",
|
|
2471
|
+
method="POST",
|
|
2472
|
+
params={
|
|
2473
|
+
"partner_id": partner_id,
|
|
2474
|
+
"type": type,
|
|
2475
|
+
},
|
|
2476
|
+
json=convert_and_respect_annotation_metadata(
|
|
2477
|
+
object_=request, annotation=typing.Optional[SyncPatchRequest], direction="write"
|
|
2478
|
+
),
|
|
2479
|
+
headers={
|
|
2480
|
+
"content-type": "application/json",
|
|
2481
|
+
},
|
|
2482
|
+
request_options=_request_options_with_retries_disabled,
|
|
2483
|
+
omit=OMIT,
|
|
2484
|
+
)
|
|
2485
|
+
try:
|
|
2486
|
+
if 200 <= _response.status_code < 300:
|
|
2487
|
+
_data = typing.cast(
|
|
2488
|
+
SyncPushResponse,
|
|
2489
|
+
parse_obj_as(
|
|
2490
|
+
type_=SyncPushResponse, # type: ignore
|
|
2491
|
+
object_=_response.json(),
|
|
2492
|
+
),
|
|
2493
|
+
)
|
|
2494
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
2495
|
+
if _response.status_code == 400:
|
|
2496
|
+
raise BadRequestError(
|
|
2497
|
+
headers=dict(_response.headers),
|
|
2498
|
+
body=typing.cast(
|
|
2499
|
+
HttpErrorResponse,
|
|
2500
|
+
parse_obj_as(
|
|
2501
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2502
|
+
object_=_response.json(),
|
|
2503
|
+
),
|
|
2504
|
+
),
|
|
2505
|
+
)
|
|
2506
|
+
if _response.status_code == 401:
|
|
2507
|
+
raise UnauthorizedError(
|
|
2508
|
+
headers=dict(_response.headers),
|
|
2509
|
+
body=typing.cast(
|
|
2510
|
+
HttpErrorResponse,
|
|
2511
|
+
parse_obj_as(
|
|
2512
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2513
|
+
object_=_response.json(),
|
|
2514
|
+
),
|
|
2515
|
+
),
|
|
2516
|
+
)
|
|
2517
|
+
if _response.status_code == 404:
|
|
2518
|
+
raise NotFoundError(
|
|
2519
|
+
headers=dict(_response.headers),
|
|
2520
|
+
body=typing.cast(
|
|
2521
|
+
HttpErrorResponse,
|
|
2522
|
+
parse_obj_as(
|
|
2523
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2524
|
+
object_=_response.json(),
|
|
2525
|
+
),
|
|
2526
|
+
),
|
|
2527
|
+
)
|
|
2528
|
+
if _response.status_code == 422:
|
|
2529
|
+
raise UnprocessableEntityError(
|
|
2530
|
+
headers=dict(_response.headers),
|
|
2531
|
+
body=typing.cast(
|
|
2532
|
+
HttpValidationError,
|
|
2533
|
+
parse_obj_as(
|
|
2534
|
+
type_=HttpValidationError, # type: ignore
|
|
2535
|
+
object_=_response.json(),
|
|
2536
|
+
),
|
|
2537
|
+
),
|
|
2538
|
+
)
|
|
2539
|
+
if _response.status_code == 429:
|
|
2540
|
+
raise TooManyRequestsError(
|
|
2541
|
+
headers=dict(_response.headers),
|
|
2542
|
+
body=typing.cast(
|
|
2543
|
+
HttpErrorResponse,
|
|
2544
|
+
parse_obj_as(
|
|
2545
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2546
|
+
object_=_response.json(),
|
|
2547
|
+
),
|
|
2548
|
+
),
|
|
2549
|
+
)
|
|
2550
|
+
if _response.status_code == 502:
|
|
2551
|
+
raise BadGatewayError(
|
|
2552
|
+
headers=dict(_response.headers),
|
|
2553
|
+
body=typing.cast(
|
|
2554
|
+
HttpErrorResponse,
|
|
2555
|
+
parse_obj_as(
|
|
2556
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2557
|
+
object_=_response.json(),
|
|
2558
|
+
),
|
|
2559
|
+
),
|
|
2560
|
+
)
|
|
2561
|
+
if _response.status_code == 504:
|
|
2562
|
+
raise GatewayTimeoutError(
|
|
2563
|
+
headers=dict(_response.headers),
|
|
2564
|
+
body=typing.cast(
|
|
2565
|
+
HttpErrorResponse,
|
|
2566
|
+
parse_obj_as(
|
|
2567
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2568
|
+
object_=_response.json(),
|
|
2569
|
+
),
|
|
2570
|
+
),
|
|
2571
|
+
)
|
|
2572
|
+
_response_json = _response.json()
|
|
2573
|
+
except JSONDecodeError:
|
|
2574
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
2575
|
+
except ValidationError as e:
|
|
2576
|
+
raise ParsingError(
|
|
2577
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
2578
|
+
)
|
|
2579
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
2580
|
+
|
|
2581
|
+
async def pull_tokens(
|
|
2582
|
+
self,
|
|
2583
|
+
version: PullTokensSyncRequestVersion,
|
|
2584
|
+
*,
|
|
2585
|
+
partner_id: int,
|
|
2586
|
+
date_from: typing.Optional[dt.datetime] = None,
|
|
2587
|
+
date_to: typing.Optional[dt.datetime] = None,
|
|
2588
|
+
offset: typing.Optional[int] = None,
|
|
2589
|
+
limit: typing.Optional[int] = None,
|
|
2590
|
+
full_replace: typing.Optional[bool] = None,
|
|
2591
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2592
|
+
) -> AsyncHttpResponse[SyncPullResponse]:
|
|
2593
|
+
"""
|
|
2594
|
+
Fetches tokens from a partner eMSP's Tokens module, page by page. Results are stored in the OCPI store. Pulls are incremental from the last sync; set ``full_replace=true`` for a full resync (``date_from`` is then ignored). ``partner_id`` is the roaming partner id (``roaming_partner_id``), not the operation id from ``GET /ocpi/partners``.
|
|
2595
|
+
|
|
2596
|
+
Parameters
|
|
2597
|
+
----------
|
|
2598
|
+
version : PullTokensSyncRequestVersion
|
|
2599
|
+
OCPI version: ``211`` (2.1.1), ``221`` (2.2.1) or ``230`` (2.3.0).
|
|
2600
|
+
|
|
2601
|
+
partner_id : int
|
|
2602
|
+
Roaming partner to pull from: its ``roaming_partner_id`` from GET /ocpi/partners.
|
|
2603
|
+
|
|
2604
|
+
date_from : typing.Optional[dt.datetime]
|
|
2605
|
+
Only objects changed at or after this time. Default: since the last sync.
|
|
2606
|
+
|
|
2607
|
+
date_to : typing.Optional[dt.datetime]
|
|
2608
|
+
Only objects changed before this time.
|
|
2609
|
+
|
|
2610
|
+
offset : typing.Optional[int]
|
|
2611
|
+
Start at this object in the partner's list.
|
|
2612
|
+
|
|
2613
|
+
limit : typing.Optional[int]
|
|
2614
|
+
Objects to request per page.
|
|
2615
|
+
|
|
2616
|
+
full_replace : typing.Optional[bool]
|
|
2617
|
+
Full pull: ``date_from``/``date_to`` and the stored cursor are ignored. For eMSP locations and tariffs it crawls the whole list and, after a clean last page, soft-deletes this partner's rows no page listed.
|
|
2618
|
+
|
|
2619
|
+
request_options : typing.Optional[RequestOptions]
|
|
2620
|
+
Request-specific configuration.
|
|
2621
|
+
|
|
2622
|
+
Returns
|
|
2623
|
+
-------
|
|
2624
|
+
AsyncHttpResponse[SyncPullResponse]
|
|
2625
|
+
Successful Response
|
|
2626
|
+
"""
|
|
2627
|
+
_request_options_with_retries_disabled: typing.Optional[RequestOptions] = (
|
|
2628
|
+
{**request_options, "max_retries": 0} if request_options is not None else {"max_retries": 0}
|
|
2629
|
+
)
|
|
2630
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2631
|
+
f"ocpi/sync/{encode_path_param(version)}/cpo/tokens/pull",
|
|
2632
|
+
method="POST",
|
|
2633
|
+
params={
|
|
2634
|
+
"partner_id": partner_id,
|
|
2635
|
+
"date_from": serialize_datetime(date_from) if date_from is not None else None,
|
|
2636
|
+
"date_to": serialize_datetime(date_to) if date_to is not None else None,
|
|
2637
|
+
"offset": offset,
|
|
2638
|
+
"limit": limit,
|
|
2639
|
+
"full_replace": full_replace,
|
|
2640
|
+
},
|
|
2641
|
+
request_options=_request_options_with_retries_disabled,
|
|
2642
|
+
)
|
|
2643
|
+
try:
|
|
2644
|
+
if 200 <= _response.status_code < 300:
|
|
2645
|
+
_data = typing.cast(
|
|
2646
|
+
SyncPullResponse,
|
|
2647
|
+
parse_obj_as(
|
|
2648
|
+
type_=SyncPullResponse, # type: ignore
|
|
2649
|
+
object_=_response.json(),
|
|
2650
|
+
),
|
|
2651
|
+
)
|
|
2652
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
2653
|
+
if _response.status_code == 400:
|
|
2654
|
+
raise BadRequestError(
|
|
2655
|
+
headers=dict(_response.headers),
|
|
2656
|
+
body=typing.cast(
|
|
2657
|
+
HttpErrorResponse,
|
|
2658
|
+
parse_obj_as(
|
|
2659
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2660
|
+
object_=_response.json(),
|
|
2661
|
+
),
|
|
2662
|
+
),
|
|
2663
|
+
)
|
|
2664
|
+
if _response.status_code == 401:
|
|
2665
|
+
raise UnauthorizedError(
|
|
2666
|
+
headers=dict(_response.headers),
|
|
2667
|
+
body=typing.cast(
|
|
2668
|
+
HttpErrorResponse,
|
|
2669
|
+
parse_obj_as(
|
|
2670
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2671
|
+
object_=_response.json(),
|
|
2672
|
+
),
|
|
2673
|
+
),
|
|
2674
|
+
)
|
|
2675
|
+
if _response.status_code == 404:
|
|
2676
|
+
raise NotFoundError(
|
|
2677
|
+
headers=dict(_response.headers),
|
|
2678
|
+
body=typing.cast(
|
|
2679
|
+
HttpErrorResponse,
|
|
2680
|
+
parse_obj_as(
|
|
2681
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2682
|
+
object_=_response.json(),
|
|
2683
|
+
),
|
|
2684
|
+
),
|
|
2685
|
+
)
|
|
2686
|
+
if _response.status_code == 422:
|
|
2687
|
+
raise UnprocessableEntityError(
|
|
2688
|
+
headers=dict(_response.headers),
|
|
2689
|
+
body=typing.cast(
|
|
2690
|
+
HttpValidationError,
|
|
2691
|
+
parse_obj_as(
|
|
2692
|
+
type_=HttpValidationError, # type: ignore
|
|
2693
|
+
object_=_response.json(),
|
|
2694
|
+
),
|
|
2695
|
+
),
|
|
2696
|
+
)
|
|
2697
|
+
if _response.status_code == 429:
|
|
2698
|
+
raise TooManyRequestsError(
|
|
2699
|
+
headers=dict(_response.headers),
|
|
2700
|
+
body=typing.cast(
|
|
2701
|
+
HttpErrorResponse,
|
|
2702
|
+
parse_obj_as(
|
|
2703
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2704
|
+
object_=_response.json(),
|
|
2705
|
+
),
|
|
2706
|
+
),
|
|
2707
|
+
)
|
|
2708
|
+
if _response.status_code == 502:
|
|
2709
|
+
raise BadGatewayError(
|
|
2710
|
+
headers=dict(_response.headers),
|
|
2711
|
+
body=typing.cast(
|
|
2712
|
+
HttpErrorResponse,
|
|
2713
|
+
parse_obj_as(
|
|
2714
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2715
|
+
object_=_response.json(),
|
|
2716
|
+
),
|
|
2717
|
+
),
|
|
2718
|
+
)
|
|
2719
|
+
if _response.status_code == 504:
|
|
2720
|
+
raise GatewayTimeoutError(
|
|
2721
|
+
headers=dict(_response.headers),
|
|
2722
|
+
body=typing.cast(
|
|
2723
|
+
HttpErrorResponse,
|
|
2724
|
+
parse_obj_as(
|
|
2725
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2726
|
+
object_=_response.json(),
|
|
2727
|
+
),
|
|
2728
|
+
),
|
|
2729
|
+
)
|
|
2730
|
+
_response_json = _response.json()
|
|
2731
|
+
except JSONDecodeError:
|
|
2732
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
2733
|
+
except ValidationError as e:
|
|
2734
|
+
raise ParsingError(
|
|
2735
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
2736
|
+
)
|
|
2737
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
2738
|
+
|
|
2739
|
+
async def pull_locations(
|
|
2740
|
+
self,
|
|
2741
|
+
version: PullLocationsSyncRequestVersion,
|
|
2742
|
+
*,
|
|
2743
|
+
partner_id: int,
|
|
2744
|
+
date_from: typing.Optional[dt.datetime] = None,
|
|
2745
|
+
date_to: typing.Optional[dt.datetime] = None,
|
|
2746
|
+
offset: typing.Optional[int] = None,
|
|
2747
|
+
limit: typing.Optional[int] = None,
|
|
2748
|
+
full_replace: typing.Optional[bool] = None,
|
|
2749
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2750
|
+
) -> AsyncHttpResponse[SyncPullResponse]:
|
|
2751
|
+
"""
|
|
2752
|
+
Fetches locations from a partner CPO's Locations module, page by page. Results are stored in the OCPI store. Pulls are incremental from the last sync; set ``full_replace=true`` for a full resync (``date_from`` is then ignored). ``partner_id`` is the roaming partner id (``roaming_partner_id``), not the operation id from ``GET /ocpi/partners``.
|
|
2753
|
+
|
|
2754
|
+
Parameters
|
|
2755
|
+
----------
|
|
2756
|
+
version : PullLocationsSyncRequestVersion
|
|
2757
|
+
OCPI version: ``211`` (2.1.1), ``221`` (2.2.1) or ``230`` (2.3.0).
|
|
2758
|
+
|
|
2759
|
+
partner_id : int
|
|
2760
|
+
Roaming partner to pull from: its ``roaming_partner_id`` from GET /ocpi/partners.
|
|
2761
|
+
|
|
2762
|
+
date_from : typing.Optional[dt.datetime]
|
|
2763
|
+
Only objects changed at or after this time. Default: since the last sync.
|
|
2764
|
+
|
|
2765
|
+
date_to : typing.Optional[dt.datetime]
|
|
2766
|
+
Only objects changed before this time.
|
|
2767
|
+
|
|
2768
|
+
offset : typing.Optional[int]
|
|
2769
|
+
Start at this object in the partner's list.
|
|
2770
|
+
|
|
2771
|
+
limit : typing.Optional[int]
|
|
2772
|
+
Objects to request per page.
|
|
2773
|
+
|
|
2774
|
+
full_replace : typing.Optional[bool]
|
|
2775
|
+
Full pull: ``date_from``/``date_to`` and the stored cursor are ignored. For eMSP locations and tariffs it crawls the whole list and, after a clean last page, soft-deletes this partner's rows no page listed.
|
|
2776
|
+
|
|
2777
|
+
request_options : typing.Optional[RequestOptions]
|
|
2778
|
+
Request-specific configuration.
|
|
2779
|
+
|
|
2780
|
+
Returns
|
|
2781
|
+
-------
|
|
2782
|
+
AsyncHttpResponse[SyncPullResponse]
|
|
2783
|
+
Successful Response
|
|
2784
|
+
"""
|
|
2785
|
+
_request_options_with_retries_disabled: typing.Optional[RequestOptions] = (
|
|
2786
|
+
{**request_options, "max_retries": 0} if request_options is not None else {"max_retries": 0}
|
|
2787
|
+
)
|
|
2788
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2789
|
+
f"ocpi/sync/{encode_path_param(version)}/emsp/locations/pull",
|
|
2790
|
+
method="POST",
|
|
2791
|
+
params={
|
|
2792
|
+
"partner_id": partner_id,
|
|
2793
|
+
"date_from": serialize_datetime(date_from) if date_from is not None else None,
|
|
2794
|
+
"date_to": serialize_datetime(date_to) if date_to is not None else None,
|
|
2795
|
+
"offset": offset,
|
|
2796
|
+
"limit": limit,
|
|
2797
|
+
"full_replace": full_replace,
|
|
2798
|
+
},
|
|
2799
|
+
request_options=_request_options_with_retries_disabled,
|
|
2800
|
+
)
|
|
2801
|
+
try:
|
|
2802
|
+
if 200 <= _response.status_code < 300:
|
|
2803
|
+
_data = typing.cast(
|
|
2804
|
+
SyncPullResponse,
|
|
2805
|
+
parse_obj_as(
|
|
2806
|
+
type_=SyncPullResponse, # type: ignore
|
|
2807
|
+
object_=_response.json(),
|
|
2808
|
+
),
|
|
2809
|
+
)
|
|
2810
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
2811
|
+
if _response.status_code == 400:
|
|
2812
|
+
raise BadRequestError(
|
|
2813
|
+
headers=dict(_response.headers),
|
|
2814
|
+
body=typing.cast(
|
|
2815
|
+
HttpErrorResponse,
|
|
2816
|
+
parse_obj_as(
|
|
2817
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2818
|
+
object_=_response.json(),
|
|
2819
|
+
),
|
|
2820
|
+
),
|
|
2821
|
+
)
|
|
2822
|
+
if _response.status_code == 401:
|
|
2823
|
+
raise UnauthorizedError(
|
|
2824
|
+
headers=dict(_response.headers),
|
|
2825
|
+
body=typing.cast(
|
|
2826
|
+
HttpErrorResponse,
|
|
2827
|
+
parse_obj_as(
|
|
2828
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2829
|
+
object_=_response.json(),
|
|
2830
|
+
),
|
|
2831
|
+
),
|
|
2832
|
+
)
|
|
2833
|
+
if _response.status_code == 404:
|
|
2834
|
+
raise NotFoundError(
|
|
2835
|
+
headers=dict(_response.headers),
|
|
2836
|
+
body=typing.cast(
|
|
2837
|
+
HttpErrorResponse,
|
|
2838
|
+
parse_obj_as(
|
|
2839
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2840
|
+
object_=_response.json(),
|
|
2841
|
+
),
|
|
2842
|
+
),
|
|
2843
|
+
)
|
|
2844
|
+
if _response.status_code == 422:
|
|
2845
|
+
raise UnprocessableEntityError(
|
|
2846
|
+
headers=dict(_response.headers),
|
|
2847
|
+
body=typing.cast(
|
|
2848
|
+
HttpValidationError,
|
|
2849
|
+
parse_obj_as(
|
|
2850
|
+
type_=HttpValidationError, # type: ignore
|
|
2851
|
+
object_=_response.json(),
|
|
2852
|
+
),
|
|
2853
|
+
),
|
|
2854
|
+
)
|
|
2855
|
+
if _response.status_code == 429:
|
|
2856
|
+
raise TooManyRequestsError(
|
|
2857
|
+
headers=dict(_response.headers),
|
|
2858
|
+
body=typing.cast(
|
|
2859
|
+
HttpErrorResponse,
|
|
2860
|
+
parse_obj_as(
|
|
2861
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2862
|
+
object_=_response.json(),
|
|
2863
|
+
),
|
|
2864
|
+
),
|
|
2865
|
+
)
|
|
2866
|
+
if _response.status_code == 502:
|
|
2867
|
+
raise BadGatewayError(
|
|
2868
|
+
headers=dict(_response.headers),
|
|
2869
|
+
body=typing.cast(
|
|
2870
|
+
HttpErrorResponse,
|
|
2871
|
+
parse_obj_as(
|
|
2872
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2873
|
+
object_=_response.json(),
|
|
2874
|
+
),
|
|
2875
|
+
),
|
|
2876
|
+
)
|
|
2877
|
+
if _response.status_code == 504:
|
|
2878
|
+
raise GatewayTimeoutError(
|
|
2879
|
+
headers=dict(_response.headers),
|
|
2880
|
+
body=typing.cast(
|
|
2881
|
+
HttpErrorResponse,
|
|
2882
|
+
parse_obj_as(
|
|
2883
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2884
|
+
object_=_response.json(),
|
|
2885
|
+
),
|
|
2886
|
+
),
|
|
2887
|
+
)
|
|
2888
|
+
_response_json = _response.json()
|
|
2889
|
+
except JSONDecodeError:
|
|
2890
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
2891
|
+
except ValidationError as e:
|
|
2892
|
+
raise ParsingError(
|
|
2893
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
2894
|
+
)
|
|
2895
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
2896
|
+
|
|
2897
|
+
async def pull_sessions(
|
|
2898
|
+
self,
|
|
2899
|
+
version: PullSessionsSyncRequestVersion,
|
|
2900
|
+
*,
|
|
2901
|
+
partner_id: int,
|
|
2902
|
+
date_from: typing.Optional[dt.datetime] = None,
|
|
2903
|
+
date_to: typing.Optional[dt.datetime] = None,
|
|
2904
|
+
offset: typing.Optional[int] = None,
|
|
2905
|
+
limit: typing.Optional[int] = None,
|
|
2906
|
+
full_replace: typing.Optional[bool] = None,
|
|
2907
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2908
|
+
) -> AsyncHttpResponse[SyncPullResponse]:
|
|
2909
|
+
"""
|
|
2910
|
+
Fetches sessions from a partner CPO's Sessions module, page by page. Results are stored in the OCPI store. Pulls are incremental from the last sync; set ``full_replace=true`` for a full resync (``date_from`` is then ignored). ``partner_id`` is the roaming partner id (``roaming_partner_id``), not the operation id from ``GET /ocpi/partners``.
|
|
2911
|
+
|
|
2912
|
+
Parameters
|
|
2913
|
+
----------
|
|
2914
|
+
version : PullSessionsSyncRequestVersion
|
|
2915
|
+
OCPI version: ``211`` (2.1.1), ``221`` (2.2.1) or ``230`` (2.3.0).
|
|
2916
|
+
|
|
2917
|
+
partner_id : int
|
|
2918
|
+
Roaming partner to pull from: its ``roaming_partner_id`` from GET /ocpi/partners.
|
|
2919
|
+
|
|
2920
|
+
date_from : typing.Optional[dt.datetime]
|
|
2921
|
+
Only objects changed at or after this time. Default: since the last sync.
|
|
2922
|
+
|
|
2923
|
+
date_to : typing.Optional[dt.datetime]
|
|
2924
|
+
Only objects changed before this time.
|
|
2925
|
+
|
|
2926
|
+
offset : typing.Optional[int]
|
|
2927
|
+
Start at this object in the partner's list.
|
|
2928
|
+
|
|
2929
|
+
limit : typing.Optional[int]
|
|
2930
|
+
Objects to request per page.
|
|
2931
|
+
|
|
2932
|
+
full_replace : typing.Optional[bool]
|
|
2933
|
+
Full pull: ``date_from``/``date_to`` and the stored cursor are ignored. For eMSP locations and tariffs it crawls the whole list and, after a clean last page, soft-deletes this partner's rows no page listed.
|
|
2934
|
+
|
|
2935
|
+
request_options : typing.Optional[RequestOptions]
|
|
2936
|
+
Request-specific configuration.
|
|
2937
|
+
|
|
2938
|
+
Returns
|
|
2939
|
+
-------
|
|
2940
|
+
AsyncHttpResponse[SyncPullResponse]
|
|
2941
|
+
Successful Response
|
|
2942
|
+
"""
|
|
2943
|
+
_request_options_with_retries_disabled: typing.Optional[RequestOptions] = (
|
|
2944
|
+
{**request_options, "max_retries": 0} if request_options is not None else {"max_retries": 0}
|
|
2945
|
+
)
|
|
2946
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2947
|
+
f"ocpi/sync/{encode_path_param(version)}/emsp/sessions/pull",
|
|
2948
|
+
method="POST",
|
|
2949
|
+
params={
|
|
2950
|
+
"partner_id": partner_id,
|
|
2951
|
+
"date_from": serialize_datetime(date_from) if date_from is not None else None,
|
|
2952
|
+
"date_to": serialize_datetime(date_to) if date_to is not None else None,
|
|
2953
|
+
"offset": offset,
|
|
2954
|
+
"limit": limit,
|
|
2955
|
+
"full_replace": full_replace,
|
|
2956
|
+
},
|
|
2957
|
+
request_options=_request_options_with_retries_disabled,
|
|
2958
|
+
)
|
|
2959
|
+
try:
|
|
2960
|
+
if 200 <= _response.status_code < 300:
|
|
2961
|
+
_data = typing.cast(
|
|
2962
|
+
SyncPullResponse,
|
|
2963
|
+
parse_obj_as(
|
|
2964
|
+
type_=SyncPullResponse, # type: ignore
|
|
2965
|
+
object_=_response.json(),
|
|
2966
|
+
),
|
|
2967
|
+
)
|
|
2968
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
2969
|
+
if _response.status_code == 400:
|
|
2970
|
+
raise BadRequestError(
|
|
2971
|
+
headers=dict(_response.headers),
|
|
2972
|
+
body=typing.cast(
|
|
2973
|
+
HttpErrorResponse,
|
|
2974
|
+
parse_obj_as(
|
|
2975
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2976
|
+
object_=_response.json(),
|
|
2977
|
+
),
|
|
2978
|
+
),
|
|
2979
|
+
)
|
|
2980
|
+
if _response.status_code == 401:
|
|
2981
|
+
raise UnauthorizedError(
|
|
2982
|
+
headers=dict(_response.headers),
|
|
2983
|
+
body=typing.cast(
|
|
2984
|
+
HttpErrorResponse,
|
|
2985
|
+
parse_obj_as(
|
|
2986
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2987
|
+
object_=_response.json(),
|
|
2988
|
+
),
|
|
2989
|
+
),
|
|
2990
|
+
)
|
|
2991
|
+
if _response.status_code == 404:
|
|
2992
|
+
raise NotFoundError(
|
|
2993
|
+
headers=dict(_response.headers),
|
|
2994
|
+
body=typing.cast(
|
|
2995
|
+
HttpErrorResponse,
|
|
2996
|
+
parse_obj_as(
|
|
2997
|
+
type_=HttpErrorResponse, # type: ignore
|
|
2998
|
+
object_=_response.json(),
|
|
2999
|
+
),
|
|
3000
|
+
),
|
|
3001
|
+
)
|
|
3002
|
+
if _response.status_code == 422:
|
|
3003
|
+
raise UnprocessableEntityError(
|
|
3004
|
+
headers=dict(_response.headers),
|
|
3005
|
+
body=typing.cast(
|
|
3006
|
+
HttpValidationError,
|
|
3007
|
+
parse_obj_as(
|
|
3008
|
+
type_=HttpValidationError, # type: ignore
|
|
3009
|
+
object_=_response.json(),
|
|
3010
|
+
),
|
|
3011
|
+
),
|
|
3012
|
+
)
|
|
3013
|
+
if _response.status_code == 429:
|
|
3014
|
+
raise TooManyRequestsError(
|
|
3015
|
+
headers=dict(_response.headers),
|
|
3016
|
+
body=typing.cast(
|
|
3017
|
+
HttpErrorResponse,
|
|
3018
|
+
parse_obj_as(
|
|
3019
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3020
|
+
object_=_response.json(),
|
|
3021
|
+
),
|
|
3022
|
+
),
|
|
3023
|
+
)
|
|
3024
|
+
if _response.status_code == 502:
|
|
3025
|
+
raise BadGatewayError(
|
|
3026
|
+
headers=dict(_response.headers),
|
|
3027
|
+
body=typing.cast(
|
|
3028
|
+
HttpErrorResponse,
|
|
3029
|
+
parse_obj_as(
|
|
3030
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3031
|
+
object_=_response.json(),
|
|
3032
|
+
),
|
|
3033
|
+
),
|
|
3034
|
+
)
|
|
3035
|
+
if _response.status_code == 504:
|
|
3036
|
+
raise GatewayTimeoutError(
|
|
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
|
+
_response_json = _response.json()
|
|
3047
|
+
except JSONDecodeError:
|
|
3048
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
3049
|
+
except ValidationError as e:
|
|
3050
|
+
raise ParsingError(
|
|
3051
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
3052
|
+
)
|
|
3053
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
3054
|
+
|
|
3055
|
+
async def pull_cdrs(
|
|
3056
|
+
self,
|
|
3057
|
+
version: PullCdrsSyncRequestVersion,
|
|
3058
|
+
*,
|
|
3059
|
+
partner_id: int,
|
|
3060
|
+
date_from: typing.Optional[dt.datetime] = None,
|
|
3061
|
+
date_to: typing.Optional[dt.datetime] = None,
|
|
3062
|
+
offset: typing.Optional[int] = None,
|
|
3063
|
+
limit: typing.Optional[int] = None,
|
|
3064
|
+
full_replace: typing.Optional[bool] = None,
|
|
3065
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
3066
|
+
) -> AsyncHttpResponse[SyncPullResponse]:
|
|
3067
|
+
"""
|
|
3068
|
+
Fetches CDRs from a partner CPO's CDRs module, page by page. Results are stored in the OCPI store. Pulls are incremental from the last sync; set ``full_replace=true`` for a full resync. ``date_from`` is then ignored. ``partner_id`` is the roaming partner id (``roaming_partner_id``), not the operation id from ``GET /ocpi/partners``.
|
|
3069
|
+
|
|
3070
|
+
Parameters
|
|
3071
|
+
----------
|
|
3072
|
+
version : PullCdrsSyncRequestVersion
|
|
3073
|
+
OCPI version: ``211`` (2.1.1), ``221`` (2.2.1) or ``230`` (2.3.0).
|
|
3074
|
+
|
|
3075
|
+
partner_id : int
|
|
3076
|
+
Roaming partner to pull from: its ``roaming_partner_id`` from GET /ocpi/partners.
|
|
3077
|
+
|
|
3078
|
+
date_from : typing.Optional[dt.datetime]
|
|
3079
|
+
Only objects changed at or after this time. Default: since the last sync.
|
|
3080
|
+
|
|
3081
|
+
date_to : typing.Optional[dt.datetime]
|
|
3082
|
+
Only objects changed before this time.
|
|
3083
|
+
|
|
3084
|
+
offset : typing.Optional[int]
|
|
3085
|
+
Start at this object in the partner's list.
|
|
3086
|
+
|
|
3087
|
+
limit : typing.Optional[int]
|
|
3088
|
+
Objects to request per page.
|
|
3089
|
+
|
|
3090
|
+
full_replace : typing.Optional[bool]
|
|
3091
|
+
Full pull: ``date_from``/``date_to`` and the stored cursor are ignored. For eMSP locations and tariffs it crawls the whole list and, after a clean last page, soft-deletes this partner's rows no page listed.
|
|
3092
|
+
|
|
3093
|
+
request_options : typing.Optional[RequestOptions]
|
|
3094
|
+
Request-specific configuration.
|
|
3095
|
+
|
|
3096
|
+
Returns
|
|
3097
|
+
-------
|
|
3098
|
+
AsyncHttpResponse[SyncPullResponse]
|
|
3099
|
+
Successful Response
|
|
3100
|
+
"""
|
|
3101
|
+
_request_options_with_retries_disabled: typing.Optional[RequestOptions] = (
|
|
3102
|
+
{**request_options, "max_retries": 0} if request_options is not None else {"max_retries": 0}
|
|
3103
|
+
)
|
|
3104
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
3105
|
+
f"ocpi/sync/{encode_path_param(version)}/emsp/cdrs/pull",
|
|
3106
|
+
method="POST",
|
|
3107
|
+
params={
|
|
3108
|
+
"partner_id": partner_id,
|
|
3109
|
+
"date_from": serialize_datetime(date_from) if date_from is not None else None,
|
|
3110
|
+
"date_to": serialize_datetime(date_to) if date_to is not None else None,
|
|
3111
|
+
"offset": offset,
|
|
3112
|
+
"limit": limit,
|
|
3113
|
+
"full_replace": full_replace,
|
|
3114
|
+
},
|
|
3115
|
+
request_options=_request_options_with_retries_disabled,
|
|
3116
|
+
)
|
|
3117
|
+
try:
|
|
3118
|
+
if 200 <= _response.status_code < 300:
|
|
3119
|
+
_data = typing.cast(
|
|
3120
|
+
SyncPullResponse,
|
|
3121
|
+
parse_obj_as(
|
|
3122
|
+
type_=SyncPullResponse, # type: ignore
|
|
3123
|
+
object_=_response.json(),
|
|
3124
|
+
),
|
|
3125
|
+
)
|
|
3126
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
3127
|
+
if _response.status_code == 400:
|
|
3128
|
+
raise BadRequestError(
|
|
3129
|
+
headers=dict(_response.headers),
|
|
3130
|
+
body=typing.cast(
|
|
3131
|
+
HttpErrorResponse,
|
|
3132
|
+
parse_obj_as(
|
|
3133
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3134
|
+
object_=_response.json(),
|
|
3135
|
+
),
|
|
3136
|
+
),
|
|
3137
|
+
)
|
|
3138
|
+
if _response.status_code == 401:
|
|
3139
|
+
raise UnauthorizedError(
|
|
3140
|
+
headers=dict(_response.headers),
|
|
3141
|
+
body=typing.cast(
|
|
3142
|
+
HttpErrorResponse,
|
|
3143
|
+
parse_obj_as(
|
|
3144
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3145
|
+
object_=_response.json(),
|
|
3146
|
+
),
|
|
3147
|
+
),
|
|
3148
|
+
)
|
|
3149
|
+
if _response.status_code == 404:
|
|
3150
|
+
raise NotFoundError(
|
|
3151
|
+
headers=dict(_response.headers),
|
|
3152
|
+
body=typing.cast(
|
|
3153
|
+
HttpErrorResponse,
|
|
3154
|
+
parse_obj_as(
|
|
3155
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3156
|
+
object_=_response.json(),
|
|
3157
|
+
),
|
|
3158
|
+
),
|
|
3159
|
+
)
|
|
3160
|
+
if _response.status_code == 422:
|
|
3161
|
+
raise UnprocessableEntityError(
|
|
3162
|
+
headers=dict(_response.headers),
|
|
3163
|
+
body=typing.cast(
|
|
3164
|
+
HttpValidationError,
|
|
3165
|
+
parse_obj_as(
|
|
3166
|
+
type_=HttpValidationError, # type: ignore
|
|
3167
|
+
object_=_response.json(),
|
|
3168
|
+
),
|
|
3169
|
+
),
|
|
3170
|
+
)
|
|
3171
|
+
if _response.status_code == 429:
|
|
3172
|
+
raise TooManyRequestsError(
|
|
3173
|
+
headers=dict(_response.headers),
|
|
3174
|
+
body=typing.cast(
|
|
3175
|
+
HttpErrorResponse,
|
|
3176
|
+
parse_obj_as(
|
|
3177
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3178
|
+
object_=_response.json(),
|
|
3179
|
+
),
|
|
3180
|
+
),
|
|
3181
|
+
)
|
|
3182
|
+
if _response.status_code == 502:
|
|
3183
|
+
raise BadGatewayError(
|
|
3184
|
+
headers=dict(_response.headers),
|
|
3185
|
+
body=typing.cast(
|
|
3186
|
+
HttpErrorResponse,
|
|
3187
|
+
parse_obj_as(
|
|
3188
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3189
|
+
object_=_response.json(),
|
|
3190
|
+
),
|
|
3191
|
+
),
|
|
3192
|
+
)
|
|
3193
|
+
if _response.status_code == 504:
|
|
3194
|
+
raise GatewayTimeoutError(
|
|
3195
|
+
headers=dict(_response.headers),
|
|
3196
|
+
body=typing.cast(
|
|
3197
|
+
HttpErrorResponse,
|
|
3198
|
+
parse_obj_as(
|
|
3199
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3200
|
+
object_=_response.json(),
|
|
3201
|
+
),
|
|
3202
|
+
),
|
|
3203
|
+
)
|
|
3204
|
+
_response_json = _response.json()
|
|
3205
|
+
except JSONDecodeError:
|
|
3206
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
3207
|
+
except ValidationError as e:
|
|
3208
|
+
raise ParsingError(
|
|
3209
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
3210
|
+
)
|
|
3211
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
3212
|
+
|
|
3213
|
+
async def pull_tariffs(
|
|
3214
|
+
self,
|
|
3215
|
+
version: PullTariffsSyncRequestVersion,
|
|
3216
|
+
*,
|
|
3217
|
+
partner_id: int,
|
|
3218
|
+
date_from: typing.Optional[dt.datetime] = None,
|
|
3219
|
+
date_to: typing.Optional[dt.datetime] = None,
|
|
3220
|
+
offset: typing.Optional[int] = None,
|
|
3221
|
+
limit: typing.Optional[int] = None,
|
|
3222
|
+
full_replace: typing.Optional[bool] = None,
|
|
3223
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
3224
|
+
) -> AsyncHttpResponse[SyncPullResponse]:
|
|
3225
|
+
"""
|
|
3226
|
+
Fetches tariffs from a partner CPO's Tariffs module, page by page. Results are stored in the OCPI store. Pulls are incremental from the last sync; set ``full_replace=true`` for a full resync (``date_from`` is then ignored). ``partner_id`` is the roaming partner id (``roaming_partner_id``), not the operation id from ``GET /ocpi/partners``.
|
|
3227
|
+
|
|
3228
|
+
Parameters
|
|
3229
|
+
----------
|
|
3230
|
+
version : PullTariffsSyncRequestVersion
|
|
3231
|
+
OCPI version: ``211`` (2.1.1), ``221`` (2.2.1) or ``230`` (2.3.0).
|
|
3232
|
+
|
|
3233
|
+
partner_id : int
|
|
3234
|
+
Roaming partner to pull from: its ``roaming_partner_id`` from GET /ocpi/partners.
|
|
3235
|
+
|
|
3236
|
+
date_from : typing.Optional[dt.datetime]
|
|
3237
|
+
Only objects changed at or after this time. Default: since the last sync.
|
|
3238
|
+
|
|
3239
|
+
date_to : typing.Optional[dt.datetime]
|
|
3240
|
+
Only objects changed before this time.
|
|
3241
|
+
|
|
3242
|
+
offset : typing.Optional[int]
|
|
3243
|
+
Start at this object in the partner's list.
|
|
3244
|
+
|
|
3245
|
+
limit : typing.Optional[int]
|
|
3246
|
+
Objects to request per page.
|
|
3247
|
+
|
|
3248
|
+
full_replace : typing.Optional[bool]
|
|
3249
|
+
Full pull: ``date_from``/``date_to`` and the stored cursor are ignored. For eMSP locations and tariffs it crawls the whole list and, after a clean last page, soft-deletes this partner's rows no page listed.
|
|
3250
|
+
|
|
3251
|
+
request_options : typing.Optional[RequestOptions]
|
|
3252
|
+
Request-specific configuration.
|
|
3253
|
+
|
|
3254
|
+
Returns
|
|
3255
|
+
-------
|
|
3256
|
+
AsyncHttpResponse[SyncPullResponse]
|
|
3257
|
+
Successful Response
|
|
3258
|
+
"""
|
|
3259
|
+
_request_options_with_retries_disabled: typing.Optional[RequestOptions] = (
|
|
3260
|
+
{**request_options, "max_retries": 0} if request_options is not None else {"max_retries": 0}
|
|
3261
|
+
)
|
|
3262
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
3263
|
+
f"ocpi/sync/{encode_path_param(version)}/emsp/tariffs/pull",
|
|
3264
|
+
method="POST",
|
|
3265
|
+
params={
|
|
3266
|
+
"partner_id": partner_id,
|
|
3267
|
+
"date_from": serialize_datetime(date_from) if date_from is not None else None,
|
|
3268
|
+
"date_to": serialize_datetime(date_to) if date_to is not None else None,
|
|
3269
|
+
"offset": offset,
|
|
3270
|
+
"limit": limit,
|
|
3271
|
+
"full_replace": full_replace,
|
|
3272
|
+
},
|
|
3273
|
+
request_options=_request_options_with_retries_disabled,
|
|
3274
|
+
)
|
|
3275
|
+
try:
|
|
3276
|
+
if 200 <= _response.status_code < 300:
|
|
3277
|
+
_data = typing.cast(
|
|
3278
|
+
SyncPullResponse,
|
|
3279
|
+
parse_obj_as(
|
|
3280
|
+
type_=SyncPullResponse, # type: ignore
|
|
3281
|
+
object_=_response.json(),
|
|
3282
|
+
),
|
|
3283
|
+
)
|
|
3284
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
3285
|
+
if _response.status_code == 400:
|
|
3286
|
+
raise BadRequestError(
|
|
3287
|
+
headers=dict(_response.headers),
|
|
3288
|
+
body=typing.cast(
|
|
3289
|
+
HttpErrorResponse,
|
|
3290
|
+
parse_obj_as(
|
|
3291
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3292
|
+
object_=_response.json(),
|
|
3293
|
+
),
|
|
3294
|
+
),
|
|
3295
|
+
)
|
|
3296
|
+
if _response.status_code == 401:
|
|
3297
|
+
raise UnauthorizedError(
|
|
3298
|
+
headers=dict(_response.headers),
|
|
3299
|
+
body=typing.cast(
|
|
3300
|
+
HttpErrorResponse,
|
|
3301
|
+
parse_obj_as(
|
|
3302
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3303
|
+
object_=_response.json(),
|
|
3304
|
+
),
|
|
3305
|
+
),
|
|
3306
|
+
)
|
|
3307
|
+
if _response.status_code == 404:
|
|
3308
|
+
raise NotFoundError(
|
|
3309
|
+
headers=dict(_response.headers),
|
|
3310
|
+
body=typing.cast(
|
|
3311
|
+
HttpErrorResponse,
|
|
3312
|
+
parse_obj_as(
|
|
3313
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3314
|
+
object_=_response.json(),
|
|
3315
|
+
),
|
|
3316
|
+
),
|
|
3317
|
+
)
|
|
3318
|
+
if _response.status_code == 422:
|
|
3319
|
+
raise UnprocessableEntityError(
|
|
3320
|
+
headers=dict(_response.headers),
|
|
3321
|
+
body=typing.cast(
|
|
3322
|
+
HttpValidationError,
|
|
3323
|
+
parse_obj_as(
|
|
3324
|
+
type_=HttpValidationError, # type: ignore
|
|
3325
|
+
object_=_response.json(),
|
|
3326
|
+
),
|
|
3327
|
+
),
|
|
3328
|
+
)
|
|
3329
|
+
if _response.status_code == 429:
|
|
3330
|
+
raise TooManyRequestsError(
|
|
3331
|
+
headers=dict(_response.headers),
|
|
3332
|
+
body=typing.cast(
|
|
3333
|
+
HttpErrorResponse,
|
|
3334
|
+
parse_obj_as(
|
|
3335
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3336
|
+
object_=_response.json(),
|
|
3337
|
+
),
|
|
3338
|
+
),
|
|
3339
|
+
)
|
|
3340
|
+
if _response.status_code == 502:
|
|
3341
|
+
raise BadGatewayError(
|
|
3342
|
+
headers=dict(_response.headers),
|
|
3343
|
+
body=typing.cast(
|
|
3344
|
+
HttpErrorResponse,
|
|
3345
|
+
parse_obj_as(
|
|
3346
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3347
|
+
object_=_response.json(),
|
|
3348
|
+
),
|
|
3349
|
+
),
|
|
3350
|
+
)
|
|
3351
|
+
if _response.status_code == 504:
|
|
3352
|
+
raise GatewayTimeoutError(
|
|
3353
|
+
headers=dict(_response.headers),
|
|
3354
|
+
body=typing.cast(
|
|
3355
|
+
HttpErrorResponse,
|
|
3356
|
+
parse_obj_as(
|
|
3357
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3358
|
+
object_=_response.json(),
|
|
3359
|
+
),
|
|
3360
|
+
),
|
|
3361
|
+
)
|
|
3362
|
+
_response_json = _response.json()
|
|
3363
|
+
except JSONDecodeError:
|
|
3364
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
3365
|
+
except ValidationError as e:
|
|
3366
|
+
raise ParsingError(
|
|
3367
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
3368
|
+
)
|
|
3369
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
3370
|
+
|
|
3371
|
+
async def pull_hub_client_info_as_emsp(
|
|
3372
|
+
self,
|
|
3373
|
+
version: PullHubClientInfoAsEmspSyncRequestVersion,
|
|
3374
|
+
*,
|
|
3375
|
+
partner_id: int,
|
|
3376
|
+
date_from: typing.Optional[dt.datetime] = None,
|
|
3377
|
+
date_to: typing.Optional[dt.datetime] = None,
|
|
3378
|
+
offset: typing.Optional[int] = None,
|
|
3379
|
+
limit: typing.Optional[int] = None,
|
|
3380
|
+
full_replace: typing.Optional[bool] = None,
|
|
3381
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
3382
|
+
) -> AsyncHttpResponse[SyncPullResponse]:
|
|
3383
|
+
"""
|
|
3384
|
+
Fetches a Hub's ClientInfo list (which parties are reachable through it) into our eMSP side. OCPI 2.2.1 and 2.3.0 only. Results are stored in the OCPI store. Pulls are incremental from the last sync; set ``full_replace=true`` for a full resync (``date_from`` is then ignored). ``partner_id`` is the roaming partner id (``roaming_partner_id``), not the operation id from ``GET /ocpi/partners``.
|
|
3385
|
+
|
|
3386
|
+
Parameters
|
|
3387
|
+
----------
|
|
3388
|
+
version : PullHubClientInfoAsEmspSyncRequestVersion
|
|
3389
|
+
OCPI version: ``211`` (2.1.1), ``221`` (2.2.1) or ``230`` (2.3.0).
|
|
3390
|
+
|
|
3391
|
+
partner_id : int
|
|
3392
|
+
Roaming partner to pull from: its ``roaming_partner_id`` from GET /ocpi/partners.
|
|
3393
|
+
|
|
3394
|
+
date_from : typing.Optional[dt.datetime]
|
|
3395
|
+
Only objects changed at or after this time. Default: since the last sync.
|
|
3396
|
+
|
|
3397
|
+
date_to : typing.Optional[dt.datetime]
|
|
3398
|
+
Only objects changed before this time.
|
|
3399
|
+
|
|
3400
|
+
offset : typing.Optional[int]
|
|
3401
|
+
Start at this object in the partner's list.
|
|
3402
|
+
|
|
3403
|
+
limit : typing.Optional[int]
|
|
3404
|
+
Objects to request per page.
|
|
3405
|
+
|
|
3406
|
+
full_replace : typing.Optional[bool]
|
|
3407
|
+
Full pull: ``date_from``/``date_to`` and the stored cursor are ignored. For eMSP locations and tariffs it crawls the whole list and, after a clean last page, soft-deletes this partner's rows no page listed.
|
|
3408
|
+
|
|
3409
|
+
request_options : typing.Optional[RequestOptions]
|
|
3410
|
+
Request-specific configuration.
|
|
3411
|
+
|
|
3412
|
+
Returns
|
|
3413
|
+
-------
|
|
3414
|
+
AsyncHttpResponse[SyncPullResponse]
|
|
3415
|
+
Successful Response
|
|
3416
|
+
"""
|
|
3417
|
+
_request_options_with_retries_disabled: typing.Optional[RequestOptions] = (
|
|
3418
|
+
{**request_options, "max_retries": 0} if request_options is not None else {"max_retries": 0}
|
|
3419
|
+
)
|
|
3420
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
3421
|
+
f"ocpi/sync/{encode_path_param(version)}/emsp/hubclientinfo/pull",
|
|
3422
|
+
method="POST",
|
|
3423
|
+
params={
|
|
3424
|
+
"partner_id": partner_id,
|
|
3425
|
+
"date_from": serialize_datetime(date_from) if date_from is not None else None,
|
|
3426
|
+
"date_to": serialize_datetime(date_to) if date_to is not None else None,
|
|
3427
|
+
"offset": offset,
|
|
3428
|
+
"limit": limit,
|
|
3429
|
+
"full_replace": full_replace,
|
|
3430
|
+
},
|
|
3431
|
+
request_options=_request_options_with_retries_disabled,
|
|
3432
|
+
)
|
|
3433
|
+
try:
|
|
3434
|
+
if 200 <= _response.status_code < 300:
|
|
3435
|
+
_data = typing.cast(
|
|
3436
|
+
SyncPullResponse,
|
|
3437
|
+
parse_obj_as(
|
|
3438
|
+
type_=SyncPullResponse, # type: ignore
|
|
3439
|
+
object_=_response.json(),
|
|
3440
|
+
),
|
|
3441
|
+
)
|
|
3442
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
3443
|
+
if _response.status_code == 400:
|
|
3444
|
+
raise BadRequestError(
|
|
3445
|
+
headers=dict(_response.headers),
|
|
3446
|
+
body=typing.cast(
|
|
3447
|
+
HttpErrorResponse,
|
|
3448
|
+
parse_obj_as(
|
|
3449
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3450
|
+
object_=_response.json(),
|
|
3451
|
+
),
|
|
3452
|
+
),
|
|
3453
|
+
)
|
|
3454
|
+
if _response.status_code == 401:
|
|
3455
|
+
raise UnauthorizedError(
|
|
3456
|
+
headers=dict(_response.headers),
|
|
3457
|
+
body=typing.cast(
|
|
3458
|
+
HttpErrorResponse,
|
|
3459
|
+
parse_obj_as(
|
|
3460
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3461
|
+
object_=_response.json(),
|
|
3462
|
+
),
|
|
3463
|
+
),
|
|
3464
|
+
)
|
|
3465
|
+
if _response.status_code == 404:
|
|
3466
|
+
raise NotFoundError(
|
|
3467
|
+
headers=dict(_response.headers),
|
|
3468
|
+
body=typing.cast(
|
|
3469
|
+
HttpErrorResponse,
|
|
3470
|
+
parse_obj_as(
|
|
3471
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3472
|
+
object_=_response.json(),
|
|
3473
|
+
),
|
|
3474
|
+
),
|
|
3475
|
+
)
|
|
3476
|
+
if _response.status_code == 422:
|
|
3477
|
+
raise UnprocessableEntityError(
|
|
3478
|
+
headers=dict(_response.headers),
|
|
3479
|
+
body=typing.cast(
|
|
3480
|
+
HttpValidationError,
|
|
3481
|
+
parse_obj_as(
|
|
3482
|
+
type_=HttpValidationError, # type: ignore
|
|
3483
|
+
object_=_response.json(),
|
|
3484
|
+
),
|
|
3485
|
+
),
|
|
3486
|
+
)
|
|
3487
|
+
if _response.status_code == 429:
|
|
3488
|
+
raise TooManyRequestsError(
|
|
3489
|
+
headers=dict(_response.headers),
|
|
3490
|
+
body=typing.cast(
|
|
3491
|
+
HttpErrorResponse,
|
|
3492
|
+
parse_obj_as(
|
|
3493
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3494
|
+
object_=_response.json(),
|
|
3495
|
+
),
|
|
3496
|
+
),
|
|
3497
|
+
)
|
|
3498
|
+
if _response.status_code == 502:
|
|
3499
|
+
raise BadGatewayError(
|
|
3500
|
+
headers=dict(_response.headers),
|
|
3501
|
+
body=typing.cast(
|
|
3502
|
+
HttpErrorResponse,
|
|
3503
|
+
parse_obj_as(
|
|
3504
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3505
|
+
object_=_response.json(),
|
|
3506
|
+
),
|
|
3507
|
+
),
|
|
3508
|
+
)
|
|
3509
|
+
if _response.status_code == 504:
|
|
3510
|
+
raise GatewayTimeoutError(
|
|
3511
|
+
headers=dict(_response.headers),
|
|
3512
|
+
body=typing.cast(
|
|
3513
|
+
HttpErrorResponse,
|
|
3514
|
+
parse_obj_as(
|
|
3515
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3516
|
+
object_=_response.json(),
|
|
3517
|
+
),
|
|
3518
|
+
),
|
|
3519
|
+
)
|
|
3520
|
+
_response_json = _response.json()
|
|
3521
|
+
except JSONDecodeError:
|
|
3522
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
3523
|
+
except ValidationError as e:
|
|
3524
|
+
raise ParsingError(
|
|
3525
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
3526
|
+
)
|
|
3527
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
3528
|
+
|
|
3529
|
+
async def pull_hub_client_info_as_cpo(
|
|
3530
|
+
self,
|
|
3531
|
+
version: PullHubClientInfoAsCpoSyncRequestVersion,
|
|
3532
|
+
*,
|
|
3533
|
+
partner_id: int,
|
|
3534
|
+
date_from: typing.Optional[dt.datetime] = None,
|
|
3535
|
+
date_to: typing.Optional[dt.datetime] = None,
|
|
3536
|
+
offset: typing.Optional[int] = None,
|
|
3537
|
+
limit: typing.Optional[int] = None,
|
|
3538
|
+
full_replace: typing.Optional[bool] = None,
|
|
3539
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
3540
|
+
) -> AsyncHttpResponse[SyncPullResponse]:
|
|
3541
|
+
"""
|
|
3542
|
+
Fetches a Hub's ClientInfo list (which parties are reachable through it) into our CPO side. OCPI 2.2.1 and 2.3.0 only. Results are stored in the OCPI store. Pulls are incremental from the last sync; set ``full_replace=true`` for a full resync (``date_from`` is then ignored). ``partner_id`` is the roaming partner id (``roaming_partner_id``), not the operation id from ``GET /ocpi/partners``.
|
|
3543
|
+
|
|
3544
|
+
Parameters
|
|
3545
|
+
----------
|
|
3546
|
+
version : PullHubClientInfoAsCpoSyncRequestVersion
|
|
3547
|
+
OCPI version: ``211`` (2.1.1), ``221`` (2.2.1) or ``230`` (2.3.0).
|
|
3548
|
+
|
|
3549
|
+
partner_id : int
|
|
3550
|
+
Roaming partner to pull from: its ``roaming_partner_id`` from GET /ocpi/partners.
|
|
3551
|
+
|
|
3552
|
+
date_from : typing.Optional[dt.datetime]
|
|
3553
|
+
Only objects changed at or after this time. Default: since the last sync.
|
|
3554
|
+
|
|
3555
|
+
date_to : typing.Optional[dt.datetime]
|
|
3556
|
+
Only objects changed before this time.
|
|
3557
|
+
|
|
3558
|
+
offset : typing.Optional[int]
|
|
3559
|
+
Start at this object in the partner's list.
|
|
3560
|
+
|
|
3561
|
+
limit : typing.Optional[int]
|
|
3562
|
+
Objects to request per page.
|
|
3563
|
+
|
|
3564
|
+
full_replace : typing.Optional[bool]
|
|
3565
|
+
Full pull: ``date_from``/``date_to`` and the stored cursor are ignored. For eMSP locations and tariffs it crawls the whole list and, after a clean last page, soft-deletes this partner's rows no page listed.
|
|
3566
|
+
|
|
3567
|
+
request_options : typing.Optional[RequestOptions]
|
|
3568
|
+
Request-specific configuration.
|
|
3569
|
+
|
|
3570
|
+
Returns
|
|
3571
|
+
-------
|
|
3572
|
+
AsyncHttpResponse[SyncPullResponse]
|
|
3573
|
+
Successful Response
|
|
3574
|
+
"""
|
|
3575
|
+
_request_options_with_retries_disabled: typing.Optional[RequestOptions] = (
|
|
3576
|
+
{**request_options, "max_retries": 0} if request_options is not None else {"max_retries": 0}
|
|
3577
|
+
)
|
|
3578
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
3579
|
+
f"ocpi/sync/{encode_path_param(version)}/cpo/hubclientinfo/pull",
|
|
3580
|
+
method="POST",
|
|
3581
|
+
params={
|
|
3582
|
+
"partner_id": partner_id,
|
|
3583
|
+
"date_from": serialize_datetime(date_from) if date_from is not None else None,
|
|
3584
|
+
"date_to": serialize_datetime(date_to) if date_to is not None else None,
|
|
3585
|
+
"offset": offset,
|
|
3586
|
+
"limit": limit,
|
|
3587
|
+
"full_replace": full_replace,
|
|
3588
|
+
},
|
|
3589
|
+
request_options=_request_options_with_retries_disabled,
|
|
3590
|
+
)
|
|
3591
|
+
try:
|
|
3592
|
+
if 200 <= _response.status_code < 300:
|
|
3593
|
+
_data = typing.cast(
|
|
3594
|
+
SyncPullResponse,
|
|
3595
|
+
parse_obj_as(
|
|
3596
|
+
type_=SyncPullResponse, # type: ignore
|
|
3597
|
+
object_=_response.json(),
|
|
3598
|
+
),
|
|
3599
|
+
)
|
|
3600
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
3601
|
+
if _response.status_code == 400:
|
|
3602
|
+
raise BadRequestError(
|
|
3603
|
+
headers=dict(_response.headers),
|
|
3604
|
+
body=typing.cast(
|
|
3605
|
+
HttpErrorResponse,
|
|
3606
|
+
parse_obj_as(
|
|
3607
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3608
|
+
object_=_response.json(),
|
|
3609
|
+
),
|
|
3610
|
+
),
|
|
3611
|
+
)
|
|
3612
|
+
if _response.status_code == 401:
|
|
3613
|
+
raise UnauthorizedError(
|
|
3614
|
+
headers=dict(_response.headers),
|
|
3615
|
+
body=typing.cast(
|
|
3616
|
+
HttpErrorResponse,
|
|
3617
|
+
parse_obj_as(
|
|
3618
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3619
|
+
object_=_response.json(),
|
|
3620
|
+
),
|
|
3621
|
+
),
|
|
3622
|
+
)
|
|
3623
|
+
if _response.status_code == 404:
|
|
3624
|
+
raise NotFoundError(
|
|
3625
|
+
headers=dict(_response.headers),
|
|
3626
|
+
body=typing.cast(
|
|
3627
|
+
HttpErrorResponse,
|
|
3628
|
+
parse_obj_as(
|
|
3629
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3630
|
+
object_=_response.json(),
|
|
3631
|
+
),
|
|
3632
|
+
),
|
|
3633
|
+
)
|
|
3634
|
+
if _response.status_code == 422:
|
|
3635
|
+
raise UnprocessableEntityError(
|
|
3636
|
+
headers=dict(_response.headers),
|
|
3637
|
+
body=typing.cast(
|
|
3638
|
+
HttpValidationError,
|
|
3639
|
+
parse_obj_as(
|
|
3640
|
+
type_=HttpValidationError, # type: ignore
|
|
3641
|
+
object_=_response.json(),
|
|
3642
|
+
),
|
|
3643
|
+
),
|
|
3644
|
+
)
|
|
3645
|
+
if _response.status_code == 429:
|
|
3646
|
+
raise TooManyRequestsError(
|
|
3647
|
+
headers=dict(_response.headers),
|
|
3648
|
+
body=typing.cast(
|
|
3649
|
+
HttpErrorResponse,
|
|
3650
|
+
parse_obj_as(
|
|
3651
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3652
|
+
object_=_response.json(),
|
|
3653
|
+
),
|
|
3654
|
+
),
|
|
3655
|
+
)
|
|
3656
|
+
if _response.status_code == 502:
|
|
3657
|
+
raise BadGatewayError(
|
|
3658
|
+
headers=dict(_response.headers),
|
|
3659
|
+
body=typing.cast(
|
|
3660
|
+
HttpErrorResponse,
|
|
3661
|
+
parse_obj_as(
|
|
3662
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3663
|
+
object_=_response.json(),
|
|
3664
|
+
),
|
|
3665
|
+
),
|
|
3666
|
+
)
|
|
3667
|
+
if _response.status_code == 504:
|
|
3668
|
+
raise GatewayTimeoutError(
|
|
3669
|
+
headers=dict(_response.headers),
|
|
3670
|
+
body=typing.cast(
|
|
3671
|
+
HttpErrorResponse,
|
|
3672
|
+
parse_obj_as(
|
|
3673
|
+
type_=HttpErrorResponse, # type: ignore
|
|
3674
|
+
object_=_response.json(),
|
|
3675
|
+
),
|
|
3676
|
+
),
|
|
3677
|
+
)
|
|
3678
|
+
_response_json = _response.json()
|
|
3679
|
+
except JSONDecodeError:
|
|
3680
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
3681
|
+
except ValidationError as e:
|
|
3682
|
+
raise ParsingError(
|
|
3683
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
3684
|
+
)
|
|
3685
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|