Created
July 12, 2023 12:21
-
-
Save albert-tomanek/e3a739454ec9656affbe03499a00c93b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// autocxx | |
extern crate tokio; | |
use lemmy_api_common::post; | |
use reqwest::{Client}; | |
#[tokio::main] | |
async fn main() { | |
println!("Hello, world!"); | |
let params = post::GetPosts { | |
community_name: Some("asklemmy".to_string()), | |
..Default::default() | |
}; | |
let client = Client::new(); | |
let response = client | |
.get("https://lemmy.ml/api/v3/post/list") | |
// .query(¶ms) | |
.send() | |
.await; | |
let json = response.expect("").text().await.unwrap(); | |
// let json = response.expect("").json::<post::GetPostsResponse>().await.unwrap(); | |
print!("{:?}", &json); | |
} | |
// prints: "<html>\r\n<head><title>403 Forbidden</title></head>\r\n<body>\r\n<center><h1>403 Forbidden</h1></center>\r\n<hr><center>nginx</center>\r\n</body>\r\n</html>\r\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment