#joke #api-client #api #sv443

joketeller

Simple API client for sv443's jokeapi

3 unstable releases

0.2.1 Jun 8, 2022
0.2.0 Jun 8, 2022
0.1.0 Jun 6, 2022

#35 in #joke

MIT license

22KB
377 lines

JokeTeller - an API client for Sv443's JokeAPI

Current Version: 0.2.1

[dependencies]
joketeller = "0.2.1"

View the Sv443 API here.

This crate is in active development, there is full support for getting jokes, but all other API features are being added with time.

Basic Usage

use joketeller::{
    Joker, Category, BlacklistFlag,
}

let mut joker_instance: Joker = Joker::new();

// Chainable API
joker_instance
    .add_categories(&mut vec![Category::Programming, Category::Pun])
    .add_blacklist_flags(&mut vec![BlacklistFlag::Explicit]);

// get JSON joke
let joke = joker_instance.get_joke().unwrap();

// get https url to make your own request
let built_api_url = joker_instance.build_url().unwrap();

Documentation

The docs are always being updated, current docs can be found here.


lib.rs:

joketeller

joketeller is a simple lib to make requests to the jokeapi written by sv443.

A simple use case may to get a random joke from the API with no filters or cases

use joketeller::Joker;

let mut joker_client: Joker = Joker::new();

let joke = joker_client.get_joke().unwrap();

Get started with the client.

Dependencies

~6.5MB
~117K SLoC