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 = ;
AMD
;
Test
npm test
Building
Run the command bin/buildAll.sh