nekosbest

Rust API wrapper for nekos.best.

Usage

toml [dependencies] nekosbest = "0.9"

Example

```rust ,no_run

[tokio::main]

async fn main() -> Result<(), Box> { let imgurl: String = nekosbest::get(nekosbest::Category::Nekos).await?.url; println!("{}", imgurl); Ok(()) } ```

Or with an amount(amount is capped at 20 by the server):

```rust ,no_run

[tokio::main]

async fn main() -> Result<(), Box> { let images = nekosbest::get_amount(nekosbest::Category::Nekos, 20).await?.url; println!("{:?}", images); Ok(()) } ```

Or if you already have a reqwest::Client that you want to use, use get_with_client and get_with_client_amount respectively.

There is another property called details:

For Category::Nekos:

```rust ,no_run

[tokio::main]

async fn main() -> Result<(), Box> { let details = nekosbest::get(nekosbest::Category::Nekos).await?.details.tryintonekos().unwrap(); println!("Source: {}", details.sourceurl); println!("Artist: {}", details.artistname); println!("Artist link: {}", details.artist_href); Ok(()) } ```

For everything else(gif endpoints):

```rust ,no_run

[tokio::main]

async fn main() -> Result<(), Box> { let details = nekosbest::get(nekosbest::Category::Pat).await?.details.tryintogif().unwrap(); println!("Anime name: {}", details.anime_name); Ok(()) } ```

By using the local feature, you can completelly skip requests to the API.

rust ,no_run fn main() { let img_url = nekosbest::local::Nekos.get(); println!("{}", img_url); Ok(()) }

Or if you have your own random number:

rust ,no_run fn main() { let your_random = unimplemented!(); let img_url = nekosbest::local::Nekos.get_random(your_random); println!("{}", img_url); Ok(()) }

Take a look at the build script and src/local.rs if you want to find out how it works.