Delete random_quote directory

This commit is contained in:
Dom Sec 2023-03-23 20:53:46 -04:00 committed by GitHub
parent 31173018f3
commit 764cbfdf48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 0 additions and 1148 deletions

1114
random_quote/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +0,0 @@
[package]
name = "random_quote"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
json = "0.12.4"
serde_json = "1.0.94"
reqwest = { version = "0.11", features = ["json", "blocking"] }
tokio = { version = "1", features = ["full"] }
serde = { version = "1.0.130", features = ["derive"] }

View File

@ -1,21 +0,0 @@
use serde::{Deserialize, Serialize};
use reqwest::blocking::get;
pub type Response = Vec<Quote>;
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Quote {
pub q: String,
pub a: String,
pub h: String,
}
fn main() {
let res = get("https://zenquotes.io/api/random").unwrap();
let quotes = res.json::<Response>().unwrap();
for quote in quotes {
println!("Author: {}", quote.a);
println!("Quote: {}", quote.q);
}
}