Crate aghpb

Source
Expand description

AGHPB API wrapper for 🦀Rust.

Copyright (c) 2023-present Goldy


§Examples

§How to search for an anime girl holding a programming book.

use std::error::Error;

use tokio::fs;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
   let books = aghpb::search("tohru".into(), None, None).await?;

   let book_data = &books[0]; // I'm selecting the first book just for this example.

   println!("Name: {}", book_data.name);
   println!("Category: {}", book_data.category);
   println!("Commit Author: {}", book_data.commit_author);
   println!("Commit URL: {}", book_data.commit_url);
   println!("Date Added: {}", book_data.date_added);
   println!("Search ID: {}", book_data.search_id);

   let book = book_data.get_book().await?;

   fs::write("./anime_girl.png", book.raw_bytes).await?;

    Ok(())
}

§How to retrieve a random anime girl holding a programming book.

use tokio::fs;
use std::error::Error;
 
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let book = aghpb::random(None).await?;
 
    let details = book.details;
 
    println!("Name: {}", details.name);
    println!("Category: {}", details.category);
    println!("Date added: {}", details.date_added);
 
    fs::write("./anime_girl.png", book.raw_bytes).await?;
 
    Ok(())
}

§How to retrieve a list of available categories.

use std::error::Error;
 
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let categories = aghpb::categories().await?;
 
    for category in categories {
        println!("{}", category);
    }
 
    Ok(())
}

Re-exports§

pub use book::*;
pub use client::*;

Modules§

book
client

Functions§

categories
Asynchronously grabs list of available categories.
get_id
Allows you to get a specific anime girls holding programming book by search ID.
random
Asynchronously grabs a random anime girl holding a programming book.
search
Allows you to search for anime girls holding programming books.