Animals is an API wrapper that can make customizable HTTP requests to the URL specified making it fully modular!
If you would like to integrate animals
into your project, you have to import it.
import Animals from "https://deno.land/x/animals/mod.ts";
After you import the file, you can call functions like this:
Animals.getAnimals(); // [ ]
Animals.get(); // <string>
Functions:
getAnimals();
registerAnimal();
get();
request();
Usage:
/**
* Animals.getAnimals() returns an Array containing every `name` of the animals
* available for you to call `get()` on.
*/
Animals.getAnimals();
/**
* Animal.registerAnimal() returns a Boolean if the animal was succesfully registered.
*
* Takes in 4 parameters `name, method, url, key` (all 4 must be set)
* This registers an animal for you to call `get()` on later
*/
Animals.registerAnimal(name, method, url, key);
/**
* Animal.get() returns a String if the animal was succesfully requsted.
*
* Takes in a singular `name` parameter, if not set, it will be randomised
* for a list of valid options for `name`, call `getAnimals()`
*
* Throws an error if you provide an invalid name
*/
Animals.get();
/**
* Don't use this.
*/
Animal.request();
If you would like more use case, please see example.ts