lib/api/blacklists.js

Up one level

Blacklists API

See the disqus-node Blacklists CLI.

See the Blacklists API on Disqus.com.

var util = require('../util'); var methods = { add: { resource: 'blacklists', name: 'add', method: 'POST', requiredOptions: ['api_secret', 'access_token', 'forum'], availableOptions: ['domain', 'word', 'retroactive', 'notes', 'ip', 'user', 'email'] }, list: { resource: 'blacklists', name: 'list', method: 'GET', requiredOptions: ['api_secret', 'access_token', 'forum'], availableOptions: ['since', 'related', 'cursor', 'limit', 'since_id', 'query', 'type', 'order'] }, remove: { resource: 'blacklists', name: 'remove', method: 'POST', requiredOptions: ['api_secret', 'access_token', 'forum'], availableOptions: ['domain', 'word', 'ip', 'user', 'email'] } }; module.exports = function Blacklists(config, logger) {

add

Adds an entry to the blacklist.

Signature:

Disqus#blacklists.add(options[, cb])

Usage:

// Node-style
disqus.blacklists.add({
    forum: '',
    // defaults shown
    domain: [],
    word: [],
    retroactive: false,
    notes: '',
    ip: [],
    user: [],
    email: []
}, function (err, result) {...})

// Promise-style
disqus.blacklists.add({
    forum: '',
    api_secret: 'asdfghkj' // can be set globally
    access_token: '12345678' // can be set globally
    // defaults shown
    domain: [],
    word: [],
    retroactive: false,
    notes: '',
    ip: [],
    user: [],
    email: []
})
.then(function (result) {...})
.catch(function (err) {...})
.error(function (err) {...});
this.add = function (options, cb) { return util.executeAPIMethod(methods.add, options, config, logger, cb); };

list

Returns a list of all blacklist entries.

Signature:

Disqus#blacklists.list(options[, cb])

Usage:

// Node-style
disqus.blacklists.list({
    forum: '', // required
    // defaults shown
    since: null,
    related: [],
    cursor: null,
    limit: 25,
    since_id: null,
    query: null,
    type: null,
    order: 'asc'
}, function (err, result) {...})

// Promise-style
disqus.blacklists.list({
    forum: '', // required
    api_secret: 'asdfghkj' // can be set globally
    access_token: '12345678' // can be set globally
    // defaults shown
    since: null,
    related: [],
    cursor: null,
    limit: 25,
    since_id: null,
    query: null,
    type: null,
    order: 'asc'
})
.then(function (result) {...})
.catch(function (err) {...})
.error(function (err) {...});
this.list = function (options, cb) { return util.executeAPIMethod(methods.list, options, config, logger, cb); };

remove

Removes an entry from the blacklist.

Signature:

Disqus#blacklists.remove(options[, cb])

Usage:

// Node-style
disqus.blacklists.remove({
    forum: '', // required
    api_secret: 'asdfghkj' // can be set globally
    access_token: '12345678' // can be set globally
    // defaults shown
    domain: [],
    word: [],
    ip: [],
    user: [],
    email: []
}, function (err, result) {...})

// Promise-style
disqus.blacklists.remove({
    forum: '', // required
    // defaults shown
    domain: [],
    word: [],
    ip: [],
    user: [],
    email: []
})
.then(function (result) {...})
.catch(function (err) {...})
.error(function (err) {...});
this.remove = function (options, cb) { return util.executeAPIMethod(methods.remove, options, config, logger, cb); }; };