afIcndbExt

Internet Chuck Norris Database (ICNDB) functions for Axon
afIcndbExt

Registered users on StackHub may elect to receive email notifications whenever new package versions are released.

v0.0.2

Axon functions

afIcndbCategories
afIcndbCategories()

Returns a list of joke categories ( Str ) available on the ICNDB. These may be used in limitTo and exclude options when retrieving a joke.

categories : afIcndbCategories()  // --> ["explicit", "nerdy"]

joke : afIcndbGet({
  "limitTo" : ["nerdy"]
})

joke : afIcndbGet({
  "exclude" : ["explicit"]
})

See http://www.icndb.com/api/ for details.

Fantom signature:
@Axon const static Str[] afIcndbCategories()
afIcndbGet
afIcndbGet(jokeId: null, options: null)

Returns a joke ( Dict ) from the Internet Chuck Norris Database (ICNDB).

jokeId should be an Number, but if null then a random joke is returned.

options is a Dict of options. If jokeId is null, then options can also be passed as the first argument. Valid options are:

  • firstName (Str) - a replacement for the name Chuck
  • lastName (Str) - a replacement the name Norris
  • limitTo (Str[]) - a list of categories to limit the jokes to
  • exclude (Str[]) - a list of categories to exclude

The returned Dict contains the keys id (Number), joke (Str), and categories (Str[]). Example:

joke : afIcndbGet(461)["joke"]  // --> "Chuck Norris finished World of Warcraft."

joke : afIcndbGet()["joke"]     // --> "Love does not hurt. Chuck Norris does."

joke : afIcndbGet({
  "firstName" : "Emma",
  "lastName"  : "Statham",
  "limitTo"   : ["nerdy"]
})["joke"]                      // --> "Emma Statham can install a 64 bit OS on 32 bit machines."

See http://www.icndb.com/api/ for details.

Fantom signature:
@Axon const static Dict afIcndbGet(Obj? jokeId := null, Dict? options := null)
afIcndbNoOfJokes
afIcndbNoOfJokes()

Returns the number of jokes on the ICNDB.

noOfJokes : afIcndbNoOfJokes()  // --> 546

See http://www.icndb.com/api/ for details.

Fantom signature:
@Axon const static Number afIcndbNoOfJokes()
Published by Fantom Factory

Products & Services by Fantom Factory

Packages by Fantom Factory

Commercial packages

Free packages