Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
restful-client
Advanced tools
Readme
RESTFul api client base object. Usually use by some api client implementation.
Example: gitlab
$ npm install restful-client --save
var restful = require('restful-client');
var util = require('util');
function Project(client) {
restful.RESTFulResource.call(this, client, '/projects', 'id');
}
util.inherits(Project, restful.RESTFulResource);
function Gitlab(options) {
options = options || {};
options.api = options.api || 'https://gitlab.com/api/v3';
restful.RESTFulClient.call(this, options);
this.token = options.token;
this.addResources({
projects: Project
});
}
util.inherits(Gitlab, restful.RESTFulClient);
Gitlab.prototype.setAuthentication = function (req) {
req.params.data.private_token = req.params.data.private_token || this.token;
return req;
};
var gitlab = new Gitlab({token: 'your token', requestTimeout: 5000});
gitlab.projects.list({page: 1}, function (err, result) {
console.log(arguments);
});
Every RESTFulResource instance has these methods:
/**
* RESTFul Resource base class.
*
* @param {Client} client RESTful api client instance.
* @param {String} resourcePath resource url path, e.g.: '/issues'
* @param {String} idName id name for get one entry, e.g.: 'id', 'name'
* @param {String} [updateMethod] update http method, default is 'put'
*/
function RESTFulResource(client, resourcePath, idName, updateMethod);
function Project(client) {
this.constructor.super_.call(this, client, '/projects', 'id');
}
util.inherits(Project, restful.RESTFulResource);
(The MIT License)
Copyright (c) 2013 - 2014 fengmk2 <fengmk2@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
RESTFul api client base object. Usually use by some api client implementation.
The npm package restful-client receives a total of 323 weekly downloads. As such, restful-client popularity was classified as not popular.
We found that restful-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.