1
0

atproto を更新

syui 2024-08-17 10:07:05 +00:00
parent e12f9e36ee
commit 61e4a20773

@ -84,4 +84,44 @@ archlinux
```sh ```sh
$ cat ~/.config/ai/token.toml|dasel -r toml host $ cat ~/.config/ai/token.toml|dasel -r toml host
'syu.is' 'syu.is'
```
## feed
- https://feed.syu.is/xrpc/app.bsky.feed.getFeedSkeleton?feed=at://did:plc:4hqjfn7m6n5hno3doamuhgef/app.bsky.feed.generator/cmd
> feed = at://did:plc:4hqjfn7m6n5hno3doamuhgef/app.bsky.feed.generator/cmd
```rust
// https://docs.bsky.app/docs/api/app-bsky-feed-get-feed
extern crate reqwest;
use crate::data_refresh;
use crate::url;
pub async fn get_request(feed: String) -> String {
let token = data_refresh(&"access");
let url = url(&"feed_get");
let feed = feed.to_string();
let client = reqwest::Client::new();
let res = client
.get(url)
.query(&[("feed", feed)])
.header("Authorization", "Bearer ".to_owned() + &token)
.send()
.await
.unwrap();
let status_ref = res.error_for_status_ref();
match status_ref {
Ok(_) => {
return res.text().await.unwrap();
}
Err(_e) => {
let e = "err".to_string();
return e;
}
}
}
``` ```