Socket
Socket
Sign inDemoInstall

reddit-api-generator

Package Overview
Dependencies
0
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    reddit-api-generator

Converts Reddit's API into structured formats


Version published
0
Maintainers
1
Install size
660 kB
Created
Weekly downloads
 

Readme

Source

reddit-api-generator

Transforms the auto generated Reddit API into structured formats for consumption by anyone looking to write a wrapper for the Reddit API.

The dist folder contains the various outputs that can be consumed.

Data Format

The data format is a flat array of endpoints.

Every endpoint has enough data with it to create a call to the Reddit API. Here is a sample of one endpoint [/r/subreddit]/new:

[
    {
        "path": "/r/$subreddit/new",
        "url": {
            "oauth": "https://oauth.reddit.com/r/$subreddit/new",
            "standard": "http://www.reddit.com/r/$subreddit/new"
        },
        "oauth": [
            "read"
        ],
        "extensions": [
            ".json",
            ".xml"
        ],
        "method": "GET",
        "describe": "This endpoint is a listing.",
        "args": {
            "after": {
                "describe": "fullname of a thing"
            },
            "before": {
                "describe": "fullname of a thing"
            },
            "count": {
                "describe": "a positive integer (default: 0)"
            },
            "limit": {
                "describe": "the maximum number of items desired (default: 25, maximum: 100)"
            },
            "show": {
                "describe": "(optional) the string all"
            }
        }
    },
    {/* another endpoint */},
    {/* and another... */}
]

Url parameters

Sometimes there are parameters in the url. These are represented with a "$" prepending the name of the variable. Given this path, the path in the endpoint will look like:

/api/multi/$multipath/r/$srname

Install

Without a package manager

Pull out the files you need from the dist folder.

npm

npm install reddit-api-generator

bower

bower install reddit-api-generator

Usage

JSON

Raw JSON can be used in any language.

Node.js

var redditApi = require('reddit-api-generator');

AMD

requirejs(['reddit-api-generator'], function(redditApi) {

});

Test

npm test

Building

Run the command bin/buildAll.sh

Keywords

FAQs

Last updated on 27 Nov 2014

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc