How to use the wpcom-xhr-request.put function in wpcom-xhr-request

To help you get started, we’ve selected a few wpcom-xhr-request examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Automattic / wpcom.js / app.js View on Github external
Comment.prototype.update = function (query, body, fn) {
  if ('function' === typeof body) {
    fn = body;
    body = query;
    query = {};
  }

  body = 'string' === typeof body ? { content: body } : body;

  var path = '/sites/' + this._sid + '/comments/' + this._cid;
  return request.put(this.wpcom, null, path, query, body, fn);
};
github Automattic / wpcom.js / app.js View on Github external
Media.prototype.update = function (query, body, fn) {
  var path = '/sites/' + this._sid + '/media/' + this._id;
  return request.put(this.wpcom, def, path, query, body, fn);
};
github Automattic / wpcom.js / app.js View on Github external
Follow.prototype.add = function (query, fn) {
  var path = '/sites/' + this._sid + '/follows/new';
  return request.put(this.wpcom, null, path, query, null, fn);
};
github Automattic / wpcom.js / app.js View on Github external
Post.prototype.update = function (query, body, fn) {
  var path = '/sites/' + this._sid + '/posts/' + this._id;
  return request.put(this.wpcom, null, path, query, body, fn);
};

wpcom-xhr-request

REST API requests to WordPress.com via XMLHttpRequest (and CORS)

MIT
Latest version published 3 years ago

Package Health Score

51 / 100
Full package analysis