npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

yoplait

v0.5.0

Published

A wrapper around the "unofficial" Yo API.

Downloads

31

Readme

#yoplait A simple wrapper around the unofficial Yo API, allowing you to sign up new accounts, log in as existing users, block and unblock users, and, of course, send yos.

NPM

NPM

##Notes for usage yoplait is best used as a module for creating bots that occupy single (or a limited number of) Yo accounts, so as not to pollute the limited Yo namespace. If you plan to use yoplait for sending messages from a large number of accounts, or using account names as messages, I would recommend utilizing yofor.me instead. It's simpler to setup and use, and it keeps the limited namespace available for others!

Usage

var yoplait = require('yoplait')

var udid = yoplait.genUdid()
  , username = 'yoplait ' + Date.now()

console.log('signing up \'' + username + '\' with udid ' + udid)
yoplait.signUp(username, udid, udid, function(err, yo) {
  if (err) {
    return console.log('sign up failed!: ', err)
  }

  console.log('yoing TEC27')
  yo.sendYo('TEC27', function(err) {
    if (err) {
      console.log('yoing failed yo :(')
      console.dir(err)
    } else {
      console.log('YO TEC27')
    }
  })
})

API

var yoplait = require('yoplait')

####yoplait#signUp(username, password, udid, cb) Sign up a new Yo account with the specified username and udid (device ID). Callback is in the form of cb(err, yoplaitUser). NOTE: As of around August 1st, 2014, Yo will no longer let accounts that don't follow their username format send Yo's (with one exception, underscores are allowed for some reason). The username format is all caps, alphanumeric, first character must be a letter.

####yoplait#logIn(username, password, udid, cb) Log in as an existing Yo user. Callback is in the form of cb(err, yoplaitUser).

####yoplait#useExistingSession(udid, sessionToken, objectId, cb) Create a YoplaitUser from a existing session information. Yo sessions are long-lived, and so are safe to store the details of e.g. on disk for later retrieval/usage. Callback is in the form of cb(err, yoplaitUser).

####yoplait#lookupUdid(udid, cb) Look up a udid and see if it has an attached Yo account. Callback is in the form of cb(err, username). If username is null, the udid does not have a Yo account associated with it.

####yoplait#lookupUsername(username, cb) Look up a username to see if it exists as a Yo account. Callback is in the form of cb(err, username. If username is null, the username is not registered.

####yoplait#genUdid() Helper method that generates a new, properly-formatted udid. Use this if you don't have a device ID in mind, ideally creating unique device ID's per account.

YoplaitUser

Get a user object by calling yoplait#newUser or yoplait#existingUser.

####user#sendYo(to, cb) Sends a yo to the username specified by to. Callback is in the form of cb(err).

####user#block(target, cb) Blocks the username specified by target. Callback is in the form of cb(err).

####user#unblock(target, cb) Unblocks the username specified by target. Callback is in the form of cb(err).

####user#updateCallbackUrl(url, cb) Updates the callback URL for an account, which will be sent a GET request whenever this user is Yo'd. (The query string will contain the username, e.g. ?username=OHSUP). Callback is in the form of cb(err, result).

####user#getApiAccounts(cb) Returns a list of API accounts associated with this user (e.g. ones that have it set as their parentUser). Callback is in the form of cb(err, results).

####user#updateParentUser(parentUser, cb) Sets the parentUser of this user (marking this account as an API account owned by parentUser). Callback is in the form of cb(err, result).

####user#udid The UDID of this YoplaitUser.

####user#sessionToken The sessionToken for this Yo user's current session. Fairly long lived and safe to store for later usage.

####user#objectId The objectId corresponding to this Yo user's User object. Used for updating attributes, like the password. This value lives as long as User object does, and is thus safe to store.

Note for Yo accounts created pre-0.4.0

Yo accounts created before yoplait 0.4.0 don't have a password, and are now blocked by the Yo API. If you receive an error with code 141 with the message RESTART APP AND TRY AGAIN!!! or ERROR 41, this means your user account must set a password before being usable again. Unfortunately, Yo uses GCM (or the iOS equivalent) to give out password change tokens, so this library is unable to properly update their passwords and make the accounts usable again.

Thus, any accounts created before 0.4.0 are broken permanently (unless we find a way around this). My recommendation would be to create an account with the same name, but with a space added (or similar). Sorry for your loss :(

Installation

npm install yoplait

License

MIT

Yo

Yo