This repository has been archived on 2024-09-29. You can view files and clone it, but cannot push or open issues or pull requests.
altoku/src/api.rs

29 lines
743 B
Rust
Raw Normal View History

2024-05-28 15:11:07 +01:00
use serde::{Serialize, Deserialize};
use reqwest::Response;
#[derive(Serialize, Deserialize, Debug)]
#[allow(non_snake_case)]
pub struct SearchResults {
pub id: String,
pub title: String,
pub url: String,
pub image: String,
pub releaseDate: String,
pub subOrDub: String,
}
#[derive(Serialize, Deserialize, Debug)]
#[allow(non_snake_case)]
pub struct Search {
pub currentPage: String,
pub hasNextPage: bool,
pub results: Vec<SearchResults>
}
pub async fn query_anime() -> Result<Search, reqwest::Error> {
let resp = reqwest::get("https://altoku-api.vercel.app/anime/gogoanime/mushoku?page=1")
.await.expect("Failed to get from API")
.json::<Search>()
.await;
return resp;
}