How to use the papi.Client function in papi

To help you get started, we’ve selected a few papi 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 silas / node-consul / lib / consul.js View on Github external
if (!opts.baseUrl) {
    opts.baseUrl = (opts.secure ? 'https:' : 'http:') + '//' +
      (opts.host || '127.0.0.1') + ':' +
      (opts.port || 8500) + '/v1';
  }
  opts.name = 'consul';
  opts.type = 'json';

  if (opts.defaults) {
    var defaults = utils.defaultCommonOptions(opts.defaults);
    if (defaults) this._defaults = defaults;
  }
  delete opts.defaults;

  papi.Client.call(this, opts);

  this.acl = new Consul.Acl(this);
  this.agent = new Consul.Agent(this);
  this.catalog = new Consul.Catalog(this);
  this.event = new Consul.Event(this);
  this.health = new Consul.Health(this);
  this.kv = new Consul.Kv(this);
  this.query = new Consul.Query(this);
  this.session = new Consul.Session(this);
  this.status = new Consul.Status(this);

  try {
    if (opts.promisify) {
      if (typeof opts.promisify === 'function') {
        papi.tools.promisify(this, opts.promisify);
      } else {
github silas / node-consul / lib / consul.js View on Github external
try {
    if (opts.promisify) {
      if (typeof opts.promisify === 'function') {
        papi.tools.promisify(this, opts.promisify);
      } else {
        papi.tools.promisify(this);
      }
    }
  } catch (err) {
    err.message = 'promisify: ' + err.message;
    throw err;
  }
}

util.inherits(Consul, papi.Client);

Consul.Acl = Acl;
Consul.Agent = Agent;
Consul.Catalog = Catalog;
Consul.Event = Event;
Consul.Health = Health;
Consul.Kv = Kv;
Consul.Lock = Lock;
Consul.Query = Query;
Consul.Session = Session;
Consul.Status = Status;
Consul.Watch = Watch;

/**
 * Object meta
 */
github silas / node-jenkins / lib / jenkins.js View on Github external
try {
    if (opts.promisify) {
      if (typeof opts.promisify === 'function') {
        papi.tools.promisify(this, opts.promisify);
      } else {
        papi.tools.promisify(this);
      }
    }
  } catch (err) {
    err.message = 'promisify: ' + err.message;
    throw err;
  }
}

util.inherits(Jenkins, papi.Client);

Jenkins.Build = Build;
Jenkins.CrumbIssuer = CrumbIssuer;
Jenkins.Job = Job;
Jenkins.Label = Label;
Jenkins.Node = Node;
Jenkins.Queue = Queue;
Jenkins.View = View;

/**
 * Object meta
 */

Jenkins.meta = {};

/**
github silas / node-jenkins / lib / jenkins.js View on Github external
if (typeof opts.crumbIssuer === 'function') {
    this._crumbIssuer = opts.crumbIssuer;
    delete opts.crumbIssuer;
  } else if (opts.crumbIssuer === true) {
    this._crumbIssuer = utils.crumbIssuer;
  }

  if (opts.formData) {
    if (typeof opts.formData !== 'function' || opts.formData.name !== 'FormData') {
      throw new Error('formData is invalid');
    }
    this._formData = opts.formData;
    delete opts.formData;
  }

  papi.Client.call(this, opts);

  this._ext('onCreate', this._onCreate);
  this._ext('onResponse', this._onResponse);

  this.build = new Jenkins.Build(this);
  this.crumbIssuer = new Jenkins.CrumbIssuer(this);
  this.job = new Jenkins.Job(this);
  this.label = new Jenkins.Label(this);
  this.node = new Jenkins.Node(this);
  this.queue = new Jenkins.Queue(this);
  this.view = new Jenkins.View(this);

  try {
    if (opts.promisify) {
      if (typeof opts.promisify === 'function') {
        papi.tools.promisify(this, opts.promisify);