DadJokes-io / DadJokes-npm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DadJokes

Coverage Status Release semantic-release TypeScript

What is this?

This is an npm wrapper for the popular dadjokes api. This wrapper makes it easy to use the dadjokes api with full typecript support

Installing


Using npm:

npm install @dadjokes-io/dad-jokes

Using yarn:

yarn add @dadjokes-io/dad-jokes

Example


Initialize dadjokes

Note : you must have a rapid-api-key to use this package and you must subscriped to the api

import DadJokes from '@dadjokes-io/dad-jokes';

const dadjokes = new DadJokes('raid-api-key');

Random Joke

Note: all functions from dadjokes are asynchronous

Optional Params -- count

const jokes = await dadjokes.randomJokes(count?:number)

Joke By ID

Required Params -- _id

const jokes = await dadjokes.jokeById(_id:string)

Joke By Type

Required Params -- type Optional Params -- limit

const jokes = await dadjokes.jokeByType(type:string, limit?:number)

Search Joke

Required Params -- term

const jokes = await dadjokes.searchJoke(term:string)

About


Languages

Language:TypeScript 100.0%