Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

snoode

Package Overview
Dependencies
Maintainers
5
Versions
140
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

snoode

node and browser reddit api library

  • 1.23.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-66.67%
Maintainers
5
Weekly downloads
 
Created
Source

snoode

Build Status

Someday, it will be a reddit API library.

For now, it handles only a few resources. Building in parallel with reddit-mobile.

Works both client-side and server-side.

Example

// Require snoode.
import { v1 } from 'snoode';
const api = new v1();

// Example call to get links for /r/homebrewing.
api.links.get({
  subredditName: 'homebrewing',
}).then(function(data) {
  console.log(data.body);
});

// Example call to get all comments for this particular listing.
api.comments.get({
  linkId: 't3_ib4bk'
}).then(function(data) {
  console.log(data.body);
});

// Example with auth.
// Pass in an oauth token and new origin to `withConfig`, which returns
// a new instance that inherits the config from the existing api instance
// merged with the new config.

const myOauthToken = 'abcdef1234567890';
const authedAPI = api.withConfig({
  token: myOauthToken,
  origin: 'https://oauth.reddit.com'
});

authedAPI.subscriptions.get().then(function(data) {
  console.log(data.body)
});

Development / Testing

If you chmod +x ./repl, you can start up a repl for testing (and for general use!) An api instance is created in the global scope (api), from which you can call any of the API methods. Use help in the repl to learn more.

Mancy

If you install Mancy you can have a nicer version of using the repl. To set it up, open mancy, and go to Preferences. Under Add node modules path add your local install of Snoode. Then under Startup script add mancyStart.js. You can edit mancyStart.js to include your token and you can then either use api or authed as you'd expect. Mancy supports lots of inspecting and autocomplete tools out of the box.

Example mancyStart.js:

var api = require('mancyLoader.js')
var authed = api.withConfig({
    token: "<YOUR_TOKEN_HERE>",
    origin: "https://oauth.reddit.com"})

Caveats

  • Uses ES7. At reddit, we use babel to run and build ES6+.

Keywords

FAQs

Package last updated on 19 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc