imoji-node

    0.2.1 • Public • Published

    NPM

    logo

    A Node JS wrapper implementation for the Imoij REST API. Full documentaion on the REST API can be found at developer.imoji.io

    Setup

    Get your free developer keys at developer.imoji.io

    Install the NPM module:

    npm install imoji-node
    

    Setup the client connection

    var Imoji = require('imoji-node'),
        imojiClient = new Imoji({
            apiKey: 'apiKey',
            apiSecret: 'apiSecret'
    });
    

    Begin integrating!

    imojiClient.search({
            query: 'cats'
        })
        .then(function(results) {
            if (results.results.length > 0) {
               res.redirect(results.results[0].urls.png.thumbImageUrl);
            } else {} // oh no!
        });
    

    API Documentation

    Search

    Performs a standard search of the Imoji database.

    Parameters

    • query
    • locale (ex: in the format es_ES or fr-FR)
    • limit - number of results to grab, maximum of 100
    • offset - Used for pagination to fetch the next n results starting from the offset

    Results

    Returns an array of hits with image urls for PNG and WebP formats in thumbnail and full size resolutions.

    imojiClient.search({
            query: 'cats'
        })
        .then(function(searchResults) {
            searchResults.results.forEach(function(result) {
                console.log("Cat found %s", result.images.bordered.png.150.url);
            });
        });
    

    Featured

    Fetches popular Imoji images from the database

    Parameters

    • numResults - number of results to grab, maximum of 100

    Results

    Returns an array of hits with image urls for PNG and WebP formats in thumbnail and full size resolutions.

    imojiClient.featured()
        .then(function(searchResults) {
            searchResults.results.forEach(function(result) {
                console.log("Random featured imoji %s", result.images.bordered.png.150.url);
            });
        });
    

    Categories

    Fetches the categories of Imojis. Categories can be either or trending (ex: popular events) or generic (ex: emotions).

    • classification [either generic or trending]
    imojiClient.categories()
        .then(function(categories) {
            categories.forEach(function(category) {
                console.log("Hurray a category! %s", JSON.stringify(category));
            });
        });
    

    Response Objects

    Check out the full documentation at developer.imoji.io for information on the response object format.

    Install

    npm i imoji-node

    DownloadsWeekly Downloads

    1

    Version

    0.2.1

    License

    MIT

    Last publish

    Collaborators

    • imojinima