UNPKG

lunni-api

Version:

A simple api wrapper for the lunni api (https://lunni.xyz/api)!

63 lines (62 loc) 1.93 kB
const fetch = require('node-fetch') module.exports = { kiss() { fetch("https://lunni.xyz/api/gif/kiss", {method: "GET"}) .then((res) => res.json()) .then((json) => { return json; }) }, hug() { fetch("https://lunni.xyz/api/gif/hug", {method: "GET"}) .then((res) => res.json()) .then((json) => { return json; }) }, smile() { fetch("https://lunni.xyz/api/gif/smile", {method: "GET"}) .then((res) => res.json()) .then((json) => { return json; }) }, sleep() { fetch("https://lunni.xyz/api/gif/sleep", {method: "GET"}) .then((res) => res.json()) .then((json) => { return json; }) }, yawn() { fetch("https://lunni.xyz/api/gif/yawn", {method: "GET"}) .then((res) => res.json()) .then((json) => { return json; }) }, gifSearch(query) { if(!query) throw new TypeError("Please supply a search query!") fetch(`https://lunni.xyz/api/gif/search/${query}`, {method: "GET"}) .then((res) => res.json()) .then((json) => { return json; }) }, youtubeSearch(query) { if(!query) throw new TypeError("Please supply a search query!") fetch(`https://lunni.xyz/api/youtube/${query}`, {method: "GET"}) .then((res) => res.json()) .then((json) => { return json; }) }, urbanDefine(query) { if(!query) throw new TypeError("Please supply a search query!") fetch(`https://lunni.xyz/api/define /${query}`, {method: "GET"}) .then((res) => res.json()) .then((json) => { return json; }) }, }