wordfilter.js 959 B

123456789101112131415161718192021222324252627282930
  1. var apis = require( './apis' );
  2. var rongrequest = require( './rongrequest' );
  3. exports.add = function( word, format, callback ) {
  4. if( word === '' || word === null || word === undefined ) {
  5. return callback( 'Empty word' );
  6. }
  7. var params = { word : word };
  8. rongrequest.request( apis['wordfilter']['add'], params, format, function( err, result ) {
  9. return callback( err, result );
  10. } );
  11. }
  12. exports.delete = function( word, format, callback ) {
  13. if( word === '' || word === null || word === undefined ) {
  14. return callback( 'Empty word' );
  15. }
  16. var params = { word : word };
  17. rongrequest.request( apis['wordfilter']['delete'], params, format, function( err, result ) {
  18. return callback( err, result );
  19. } );
  20. }
  21. exports.list = function( format, callback ) {
  22. rongrequest.request( apis['wordfilter']['list'], {}, format, function( err, result ) {
  23. return callback( err, result );
  24. } );
  25. }