Crate norris

Crate norris 

Source
Expand description

§Norris

Simple async wrapper for the Chuck Norris Joke API.

§Usage

Example for retrieving a random joke:

use::std::error::Error;
use::norris::get_random_joke;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let joke = get_random_joke().await?.value;
    println!("{}", joke);
    Ok(())
}

§Documentation

Please refer to docs.rs.

Structs§

ChuckNorrisJoke
API response when requesting a joke - reduced to the joke string only
JokeSearchResult
API response when searching by search terms - contains multiple jokes and the total amount of received jokes

Enums§

JokeCategory
Available joke categories to search by

Functions§

get_random_joke
get_random_joke_by_category
search_for_all_available_jokes
Searches for all jokes that contain the search_string
search_for_one_joke
Searches for a joke that contain the search_string