use aimux_core::AiMuxError;
use crate::http::{HttpBody, HttpMethod, HttpRequest};
use crate::response_handler::{ResponseHandler, ResponseHandlerOutput};
pub async fn get_from_api<T>(
request: HttpRequest,
successful_response_handler: ResponseHandler<T>,
failed_response_handler: ResponseHandler<AiMuxError>,
) -> Result<ResponseHandlerOutput<T>, AiMuxError> {
crate::post_to_api::call_to_api(
request.prepare(HttpMethod::Get, HttpBody::Empty),
serde_json::json!({}),
successful_response_handler,
failed_response_handler,
)
.await
}