Skip to main content
Deno 2 is finally here 🎉️
Learn more

deno-giphy-api

deno doc

giphy api in deno

import {
    searchGif,
    searchSticker,
    searchTrendingGif,
    searchTrendingSticker,
    translateGif,
    translateSticker,
    randomGif,
    randomSticker,
    randomId,
    getGifById,
    getGifsById,
    getCategories,
    getAutocomplete,
    getSearchSuggestions,
    getTrendingSearchTerm
} from "https://deno.land/x/deno_giphy_api/mod.ts";

or

import {
    searchGif,
    searchSticker,
    searchTrendingGif,
    searchTrendingSticker,
    translateGif,
    translateSticker,
    randomGif,
    randomSticker,
    randomId,
    getGifById,
    getGifsById,
    getCategories,
    getAutocomplete,
    getSearchSuggestions,
    getTrendingSearchTerm
} from "https://denopkg.com/yeukfei02/deno-giphy-api/mod.ts";

searchGif

// key and q are mandatory
const params = {
    api_key: "apiKey",
    q: "dog",
};

// limit and offset are optional, default limit = 25, offset = 0
const params = {
    api_key: "apiKey",
    q: "dog",
    limit: 3,
    offset: 5,
};

const gif = await searchGif(params);

searchSticker

// key and q are mandatory
const params = {
    api_key: "apiKey",
    q: "dog",
};

// limit and offset are optional, default limit = 25, offset = 0
const params = {
    api_key: "apiKey",
    q: "dog",
    limit: 3,
    offset: 5,
};

const sticker = await searchSticker(params);

searchTrendingGif

// key is mandatory
const params = {
    api_key: "apiKey",
};

// limit and offset are optional, default limit = 25, offset = 0
const params = {
    api_key: "apiKey",
    limit: 3,
    offset: 5,
};

const gif = await searchTrendingGif(params);

searchTrendingSticker

// key is mandatory
const params = {
    api_key: "apiKey",
};

// limit and offset are optional, default limit = 25, offset = 0
const params = {
    api_key: "apiKey",
    limit: 3,
    offset: 5,
};

const sticker = await searchTrendingSticker(params);

translateGif

// key and s are mandatory
const params = {
    api_key: "apiKey",
    s: "dog"
};

// weirdness is optional, 0-10
const params = {
    api_key: "apiKey",
    s: "dog",
    weirdness: 10,
};

const gif = await translateGif(params);

translateSticker

// key and s are mandatory
const params = {
    api_key: "apiKey",
    s: "dog"
};

// weirdness is optional, 0-10
const params = {
    api_key: "apiKey",
    s: "dog",
    weirdness: 10,
};

const sticker = await translateSticker(params);

randomGif

// key is mandatory
const params = {
    api_key: "apiKey",
};

// tag is optional
const params = {
    api_key: "apiKey",
    tag: "dog",
};

const gif = await randomGif(params);

randomSticker

// key is mandatory
const params = {
    api_key: "apiKey",
};

// tag is optional
const params = {
    api_key: "apiKey",
    tag: "dog",
};

const sticker = await randomSticker(params);

randomId

// key is mandatory
const params = {
    api_key: "apiKey",
};

const randomId = await randomId(params);

getGifById

// key is mandatory
const params = {
    api_key: "apiKey",
};

const id = "gifId";
const gif = await getGifById(id, params);

getGifsById

// key is mandatory
const params = {
    api_key: "apiKey",
};

const idsList = [
    "xT4uQulxzV39haRFjG",
    "3og0IPxMM0erATueVW",
];
const gifs = await getGifsById(idsList, params);

getCategories

// key is mandatory
const params = {
    api_key: "apiKey",
};

const gifs = await getCategories(params);

getAutocomplete

// key and q are mandatory
const params = {
    api_key: "apiKey",
    q: "dog"
};

const searchTags = await getAutocomplete(params);

getSearchSuggestions

// key is mandatory
const params = {
    api_key: "apiKey",
};
const term = "dog";

const searchSuggestions = await getSearchSuggestions(term, params);

getTrendingSearchTerm

// key is mandatory
const params = {
    api_key: "apiKey",
};

const trendingSearchTerm = await getTrendingSearchTerm(params);