parent
cdaf8bd130
commit
5fe2d9b599
@ -1,3 +1,27 @@
|
|||||||
fn main() {
|
use serde::{Deserialize, Serialize};
|
||||||
println!("Hello, world!");
|
use reqwest::blocking::Client;
|
||||||
|
|
||||||
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
let client = Client::new();
|
||||||
|
let res = client
|
||||||
|
.get("https://username:password@files.nickiel.net/index.php/apps/notes/api/v1/notes")
|
||||||
|
.header("Accept", "application/json")
|
||||||
|
.send()?
|
||||||
|
.json::<Vec<Note>>()?;
|
||||||
|
|
||||||
|
println!("{:#?}", res);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
|
struct Note {
|
||||||
|
id: usize,
|
||||||
|
etag: String,
|
||||||
|
readonly: bool,
|
||||||
|
modified: u64,
|
||||||
|
title: String,
|
||||||
|
category: String,
|
||||||
|
content: String,
|
||||||
|
favorite: bool
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in new issue