use crate::handlers::admin::shared::AdminTypedObjectPatch; use aether_admin::provider::endpoints as admin_provider_endpoints_pure; use aether_data_contracts::repository::provider_catalog::{ StoredProviderCatalogEndpoint, StoredProviderCatalogKey, }; use serde::Deserialize; pub(super) fn key_api_formats_without_entry( key: &StoredProviderCatalogKey, api_format: &str, ) -> Option> { admin_provider_endpoints_pure::key_api_formats_without_entry(key, api_format) } pub(super) fn endpoint_key_counts_by_format( provider_type: &str, endpoints: &[StoredProviderCatalogEndpoint], keys: &[StoredProviderCatalogKey], ) -> ( std::collections::BTreeMap, std::collections::BTreeMap, ) { admin_provider_endpoints_pure::endpoint_key_counts_by_format(provider_type, endpoints, keys) } pub(super) fn normalize_endpoint_api_format(api_format: &str) -> String { admin_provider_endpoints_pure::normalize_endpoint_api_format(api_format) } pub(super) fn build_admin_provider_endpoint_response( endpoint: &StoredProviderCatalogEndpoint, provider_name: &str, total_keys: usize, active_keys: usize, now_unix_secs: u64, ) -> serde_json::Value { admin_provider_endpoints_pure::build_admin_provider_endpoint_response( endpoint, provider_name, total_keys, active_keys, now_unix_secs, ) } fn default_admin_endpoint_max_retries() -> i32 { 2 } #[derive(Debug, Deserialize)] pub(crate) struct AdminProviderEndpointCreateRequest { pub(crate) provider_id: String, pub(crate) api_format: String, pub(crate) base_url: String, #[serde(default)] pub(crate) custom_path: Option, #[serde(default)] pub(crate) header_rules: Option, #[serde(default)] pub(crate) body_rules: Option, #[serde(default = "default_admin_endpoint_max_retries")] pub(crate) max_retries: i32, #[serde(default)] pub(crate) config: Option, #[serde(default)] pub(crate) proxy: Option, #[serde(default)] pub(crate) format_acceptance_config: Option, } #[derive(Debug, Deserialize)] pub(crate) struct AdminProviderEndpointUpdateRequest { #[serde(default)] pub(crate) base_url: Option, #[serde(default)] pub(crate) custom_path: Option, #[serde(default)] pub(crate) header_rules: Option, #[serde(default)] pub(crate) body_rules: Option, #[serde(default)] pub(crate) max_retries: Option, #[serde(default)] pub(crate) is_active: Option, #[serde(default)] pub(crate) config: Option, #[serde(default)] pub(crate) proxy: Option, #[serde(default)] pub(crate) format_acceptance_config: Option, } pub(crate) type AdminProviderEndpointUpdatePatch = AdminTypedObjectPatch;