disqus-node
v0.13.0
Published
Disqus API bindings and CLI for NodeJS http://disqus.com/api/
Downloads
22
Readme
disqus-node
Disqus API bindings and CLI for NodeJS. disqus-node documentation.
Copyright © 2014 Jason Dobry
Status
Documentation
var Disqus = require('disqus-node');
var disqus = new Disqus({
// required
api_secret: 'abcdefgh',
// required when authentication is required
access_token: '12345678',
// defaults shown
logLevel: 'info',
https: true
});
// promise-style
disqus.forums.listPosts({
forum: 'pseudobry',
limit: 3
}).then(function (response) {
response; // {
"cursor": {...},
"code": 0,
"response": [
{...},
{...},
{...}
]
}
});
// node-style
disqus.forums.listPosts({
forum: 'pseudobry',
limit: 3
}, function (err, response) {
response; // {
"cursor": {...},
"code": 0,
"response": [
{...},
{...},
{...}
]
}
});
$ npm install -g disqus-node
CLI available as disqus
. disqus
has a number of available resources:
$ disqus -h
Usage: disqus <cmd> <subCmd> [options]
Commands:
applications <cmd> [options] Execute command for the Applications resource.
blacklists <cmd> [options] Execute command for the Blacklists resource.
categories <cmd> [options] Execute command for the Categories resource.
exports <cmd> [options] Execute command for the Exports resource.
forums <cmd> [options] Execute command for the Forums resource.
imports <cmd> [options] Execute command for the Imports resource.
posts <cmd> [options] Execute command for the Posts resource.
topics <cmd> [options] Execute command for the Topics resource.
trends <cmd> [options] Execute command for the Trends resource.
whitelists <cmd> [options] Execute command for the Whitelists resource.
Options:
-h, --help output usage information
-V, --version output the version number
Each resource has available commands:
$ disqus forums -h
Usage: disqus forums <cmd> [options]
Commands:
addModerator [options] Adds a moderator to a forum.
create [options] Creates a new forum.
details [options] Returns forum details.
follow [options] Follow a forum.
installed [options] Returns true if forum has one or more views.
listCategories [options] Returns a list of categories within a forum.
listFollowers [options] Returns a list of users following a forum.
listModerators [options] Returns a list of all moderators on a forum.
listMostActiveUsers [options] Returns a list of users active within a forum ordered by most comments made.
listMostLikedUsers [options] Returns a list of users active within a forum ordered by most likes received.
listPosts [options] Returns a list of posts within a forum.
listThreads [options] Returns a list of threads within a forum sorted by the date created.
listUsers [options] Returns a list of users active within a forum.
removeModerator [options] Removes a moderator from a forum.
unfollow [options] Unfollow a forum.
Options:
-h, --help output usage information
$ disqus forums listPosts -h
Usage: listPosts [options]
Options:
-h, --help output usage information
-c, --cursor [cursor] Defaults to null,
-f, --forum <string> Looks up a forum by ID (aka short name).
-H, --https [boolean] Whether to use https. Defaults to true.
-i, --include [array] Defaults to ["approved"]. Choices: unapproved, approved, spam, deleted, flagged, highlighted.
-l, --limit [number] Maximum number of posts to return. Maximum value of 100. Defaults to 25.
-L, --logLevel [string] Output log level. Choices: debug, info, notice, warning, error, critical, alert, emergency.
-o, --order [string] Choices: asc, desc. Defaults to "desc".
-q, --query [string] Defaults to null.
-r, --related [array] You may specify relations to include with your response. Choices: thread.
-s, --since [string] Unix timestamp (or ISO datetime standard).
-S, --api_secret <string> Your application's api_secret.
$ disqus forums listPosts -f pseudobry -S '1234abcd' -l 3
{
"cursor": {...},
"code": 0,
"response": [
{...},
{...},
{...}
]
}