Giter VIP home page Giter VIP logo

yohoho's Introduction

yohoho

A wrapper around the official Yo API, for both the browser and Node.js. Arr!

NPM

Browser Usage

Unfortunately, Yo has decided to not make their API routes CORS compatible right now. So, to use this in the browser, you'll need to use a CORS proxy. To do this, I've made it so you can set your own host. Take a look in the usage section below.

Installation

Node.js:

npm install yohoho

Browser:

I personally recommend using Browserify on the npm module. However, you can also include dist/yohoho.js, which exposes itself as yohoho on the window.

Usage

Every function calls a callback function (err, body) {}. err is any error in the request, and body is the response from the server, or a boolean for a request that just indicates success.

var yohoho = require('yohoho'); // if you're using node/browserify

// grab an API token from http://dev.justyo.co/, if you don't have one
var yo = yohoho('API_TOKEN');

// if you're using this in the browser, you'll need to set the host to a CORS proxy. example:
var yo = yohoho('API_TOKEN', { host: 'http://www.corsproxy.com/api.justyo.co' });

// send a yo to an individual username from your API account
yo.yo('USERNAME', function (err, success) {
    // returns `true` when successful
});

// sends a yo to all of your subscribers from your API account
yo.yoAll(function (err, success) {
    // returns `true` when successful
});

// returns the amount of subscribers your API account has
yo.countSubscribers(function (err, subscribers) {
    // returns the number of subscribers
});

yohoho's People

Contributors

remixz avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.