
/**
 * Module dependencies.
 */

var debug = require('debug')('wpcom:commentlike');

/**
 * CommentLike methods
 *
 * @param {String} cid comment id
 * @param {String} sid site id
 * @param {WPCOM} wpcom
 * @api public
 */

function CommentLike(cid, sid, wpcom){
  if (!sid) {
    throw new Error('`side id` is not correctly defined');
  }

  if (!cid) {
    throw new Error('`comment id` is not correctly defined');
  }

  if (!(this instanceof CommentLike)) return new CommentLike(cid, sid, wpcom);

  this.wpcom = wpcom;
  this._cid = cid;
  this._sid = sid;
}

/**
 * Get your Like status for a Comment
 *
 * @param {Object} [query]
 * @param {Function} fn
 * @api public
 */

CommentLike.prototype.state =
CommentLike.prototype.mine = function(query, fn){
  var path = '/sites/' + this._sid + '/comments/' + this._cid + '/likes/mine';
  return this.wpcom.sendRequest(path, query, null, fn);
};

/**
 * Like a comment
 *
 * @param {Object} [query]
 * @param {Function} fn
 * @api public
 */

CommentLike.prototype.add = function(query, fn){
  var path = '/sites/' + this._sid + '/comments/' + this._cid + '/likes/new';
  return this.wpcom.sendRequest({ path: path, method: 'post' }, query, null, fn);
};

/**
 * Remove your Like from a Comment
 *
 * @param {Function} fn
 * @api public
 */

CommentLike.prototype['delete'] =
CommentLike.prototype.del = function(fn){
  var path = '/sites/' + this._sid + '/comments/' + this._cid + '/likes/mine/delete';
  return this.wpcom.sendRequest({ path: path, method: 'post' }, null, null, fn);
};

/**
 * Expose `CommentLike` module
 */

module.exports = CommentLike;

@@ -27,16 +27,57 @@
 s.%0A */%0A%0A
+var request = require('./util/request');%0A
 var debu
@@ -884,39 +884,46 @@
  return 
-this.wpcom.sendRequest(
+request.get(this.wpcom, null, 
 path, qu
@@ -918,38 +918,32 @@
 ll, path, query,
- null,
  fn);%0A%7D;%0A%0A/**%0A *
@@ -1067,32 +1067,38 @@
  function(query,
+ body,
  fn)%7B%0A  var path
@@ -1178,61 +1178,43 @@
 urn 
-this.wpcom.sendRequest(%7B path: path, method: 'post' %7D
+request.post(this.wpcom, null, path
 , qu
@@ -1218,20 +1218,20 @@
  query, 
-null
+body
 , fn);%0A%7D
@@ -1390,16 +1390,23 @@
 unction(
+query, 
 fn)%7B%0A  v
@@ -1501,73 +1501,49 @@
 urn 
-this.wpcom.sendRequest(%7B path: path, method: 'post' %7D, null, null
+request.del(this.wpcom, null, path, query
 , fn

use request module