0.1.0 • Published 4 years ago

node-reddit-wrapper v0.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

node-reddit-wrapper

CI License: MIT

A simple node wrapper used by Industrial Parasite to post new releases to it's subreddit.

Installation


npm:

npm install node-reddit-wrapper --save

yarn:

yarn add node-reddit-wrapper

Feature


  • Wrap Reddit's API
  • Use native promise and async functions.
  • Functional design

Usage


  1. Create reddit app.
    a) Click create app located at the bottom of the link above.
    b) Add app info; selecting script as the type and adding any url for about url and redirect uri
  2. Create a credentials object.
const credentials = {
    "appId":  "YOUR_APP_ID",
    "appSecret": "YOUR_APP_SECRET",
    "username": "YOUR_USERNAME",
    "password": "YOUR_PASSWORD"
}
  1. Make a post to your subreddit.
await reddit(
  '/api/submit', // Reddit API PATH
  'POST', // Method (currently only supports POST)
  {
    flair_id: 'bd2aa23a-4159-11ea-8d7e-0ed477f315f3',
    kind: 'link',
    resubmit: true,
    title: 'Ae/Sthetic - Polaris',
    sr: 'IndustrialParasite',
    url: 'https://industrialparasite.ffm.to/ae-sthetic-polaris',
  },
  credentials // The credentials object we created in step 2.
);

To Do


  • Improve response handling
  • Add Get
  • Add Put
  • Add Delete

Meta


Industrial Parasite@IndustrialPara

Distributed under the MIT license. See LICENSE for more information.

https://github.com/Industrial-Parasite/node-reddit-wrapper

Contributing


  1. Fork it
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'feat: THE FEATURE')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request