.config
.gitea/workflows
.gitignore.gitmodules.ssh
Cargo.tomlDockerfileMakefile.tomlREADME.mdcompose.ymldocs
icon
k8s
src
ascii.rsbot.rsdata.rsdescribe.rsfollow.rsfollowers.rsfollows.rsimg.rsimg_reply.rsimg_upload.rslike.rsmain.rsmention.rsnotify.rsnotify_read.rsopenai.rspost.rspost_link.rsprofile.rsrefresh.rsreply.rsreply_link.rsreply_og.rsrepost.rssession.rstimeline_author.rstoken.rs
test
27
src/notify_read.rs
Normal file
27
src/notify_read.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
extern crate reqwest;
|
||||
use crate::data_refresh;
|
||||
use crate::url;
|
||||
use serde_json::json;
|
||||
|
||||
pub async fn post_request(time: String) -> String {
|
||||
let token = data_refresh(&"access");
|
||||
let url = url(&"notify_update");
|
||||
|
||||
let post = Some(json!({
|
||||
"seenAt": time.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;
|
||||
}
|
Reference in New Issue
Block a user