lib/api/topics.js

Up one level

Topics API

See the disqus-node Topics CLI.

See the Topics API on Disqus.com.

var util = require('../util'); var methods = { follow: { resource: 'topics', name: 'follow', method: 'POST', availableOptions: ['api_secret', 'api_key', 'access_token', 'target'] }, listFollowers: { resource: 'topics', name: 'listFollowers', method: 'GET', availableOptions: ['api_secret', 'api_key', 'access_token', 'topics', 'since_id', 'limit', 'order'] }, unfollow: { resource: 'topics', name: 'unfollow', method: 'POST', availableOptions: ['api_secret', 'api_key', 'access_token', 'target'] } }; module.exports = function Topics(config, logger) {

follow

Follow a topic.

Signature:

Disqus#topics.follow(options[, cb])

Usage:

// Node-style
disqus.topics.follow({
    target: 'targetId'
}, function (err, result) {...})

// Promise-style
disqus.topics.follow({
    target: 'targetId'
})
.then(function (result) {...})
.catch(function (err) {...})
.error(function (err) {...});
this.follow = function (options, cb) { return util.executeAPIMethod(methods.follow, options, config, logger, cb); };

listFollowers

Returns a list of users following a topic.

Signature:

Disqus#topics.listFollowers(options[, cb])

Usage:

// Node-style
disqus.topics.listFollowers({
    topic: 'topicId',
    cursor: null,
    since_id: null,
    limit: 25,
    order: 'asc'
}, function (err, result) {...})

// Promise-style
disqus.topics.listFollowers({
    topic: 'topicId',
    cursor: null,
    since_id: null,
    limit: 25,
    order: 'asc'
})
.then(function (result) {...})
.catch(function (err) {...})
.error(function (err) {...});
this.listFollowers = function (options, cb) { return util.executeAPIMethod(methods.listFollowers, options, config, logger, cb); };

unfollow

Unfollow a topic.

Signature:

Disqus#topics.unfollow(options[, cb])

Usage:

// Node-style
disqus.topics.unfollow({
    target: 'targetId'
}, function (err, result) {...})

// Promise-style
disqus.topics.unfollow({
    target: 'targetId'
})
.then(function (result) {...})
.catch(function (err) {...})
.error(function (err) {...});
this.unfollow = function (options, cb) { return util.executeAPIMethod(methods.unfollow, options, config, logger, cb); }; };