1
0
bot/src/delete_record.rs
syui 840320d0d2
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 5s
add bot custom feed
2024-04-22 22:30:43 +09:00

34 lines
757 B
Rust

extern crate reqwest;
use crate::data_toml;
use crate::data_refresh;
use crate::url;
use serde_json::json;
pub async fn post_request(rkey: String, col: String) -> String {
let token = data_refresh(&"access");
//let did = data_toml(&"did");
let handle = data_toml(&"handle");
let url = url(&"record_delete");
let post = Some(json!({
"repo": handle.to_string(),
"rkey": rkey.to_string(),
"collection": col.to_string()
}));
let client = reqwest::Client::new();
let res = client
.post(url)
.json(&post)
.header("Authorization", "Bearer ".to_owned() + &token)
.send()
.await
.unwrap()
.text()
.await
.unwrap();
return res;
}