use crate::http_client::HttpClient;
use crate::data_toml;
use crate::url;
use serde_json::json;

pub async fn post_request(rkey: String, col: String) -> String {
    let handle = data_toml(&"handle");
    let url = url(&"record_delete");
    let client = HttpClient::new();

    let post = json!({
        "repo": handle.to_string(),
        "rkey": rkey.to_string(),
        "collection": col.to_string()
    });

    match client.post_json_with_auth(&url, &post).await {
        Ok(response) => response,
        Err(e) => format!("Error: {}", e),
    }
}
