<commit_before>
/**
 * Module dependencies.
 */

var debug = require('debug')('wp-connect:action');

/**
 * Post methods
 *
 * @param {WPCONN} wpconn
 * @api public
 */

function Post(wpconn){
  this.wpconn = wpconn;
}

/**
 * Get site post by the given id
 *
 * @param {String} id
 * @param {Object} params (optional)
 * @param {Function} fn
 * @api public
 */

Post.prototype.get = function(id, params, fn){
  // set endpoint
  var set = {
    site: this.wpconn.site._id,
    post_ID: id
  };

  this.wpconn.req.exec('post', set, params, fn);
};

/**
 * Get site post by the given slug
 *
 * @api public
 */

Post.prototype.getBySlug = function(slug, params, fn){
};

/**
 * Add method
 *
 * @param {Object} data
 * @param {String} rid
 * @param {Object} params
 * @param {Function} fn
 * @api public
 */

Post.prototype.add = function(data, fn){
  // set endpoint
  var set = { site: this.wpconn.site._id };

  var params = {
    method: 'post',
    data: data
  };

  this.wpconn.req.exec('post_add', set, params, fn);
};

/**
 * Expose `Post` module
 */

module.exports = Post;<commit_msg>post: add getPostBySlug() method<commit_after>
/**
 * Module dependencies.
 */

var debug = require('debug')('wp-connect:action');

/**
 * Post methods
 *
 * @param {WPCONN} wpconn
 * @api public
 */

function Post(wpconn){
  this.wpconn = wpconn;
}

/**
 * Get site post by the given id
 *
 * @param {String} id
 * @param {Object} params (optional)
 * @param {Function} fn
 * @api public
 */

Post.prototype.get = function(id, params, fn){
  var set = {
    site: this.wpconn.site._id,
    post_ID: id
  };

  this.wpconn.req.exec('post', set, params, fn);
};

/**
 * Get site post by the given slug
 *
 * @api public
 */

Post.prototype.getBySlug = function(slug, params, fn){
  var set = {
    site: this.wpconn.site._id,
    post_slug: slug
  };

  this.wpconn.req.exec('post_get_by_slug', set, params, fn);
};

/**
 * Add method
 *
 * @param {Object} data
 * @param {String} rid
 * @param {Object} params
 * @param {Function} fn
 * @api public
 */

Post.prototype.add = function(data, fn){
  // set endpoint
  var set = { site: this.wpconn.site._id };

  var params = {
    method: 'post',
    data: data
  };

  this.wpconn.req.exec('post_add', set, params, fn);
};

/**
 * Expose `Post` module
 */

module.exports = Post;
{'fraction_non_alphanumeric': 0.1748492678725237, 'fraction_numerical': 0.0, 'mean_word_length': 2.9982788296041307, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4385123', 'n_tokens_mistral': 849, 'n_tokens_neox': 843, 'n_words': 220}