gitlab
Version:
Full NodeJS implementation of the GitLab API. Supports Promises, Async/Await.
56 lines (55 loc) • 3.15 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
}
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var url_join_1 = __importDefault(require("url-join"));
var infrastructure_1 = require("../infrastructure");
var ResourceNotes = /** @class */ (function (_super) {
__extends(ResourceNotes, _super);
function ResourceNotes(resourceType, resource2Type, baseParams) {
var _this = _super.call(this, baseParams) || this;
_this.url = url_join_1.default(_this.url, resourceType);
_this.resource2Type = resource2Type;
return _this;
}
ResourceNotes.prototype.all = function (resourceId, resource2Id, options) {
var _a = [resourceId, resource2Id].map(encodeURIComponent), rId = _a[0], r2Id = _a[1];
return infrastructure_1.RequestHelper.get(this, rId + "/" + this.resource2Type + "/" + r2Id + "/notes", options);
};
ResourceNotes.prototype.create = function (resourceId, resource2Id, options) {
if (!options.body)
throw new Error('Missing required property: body');
var _a = [resourceId, resource2Id].map(encodeURIComponent), rId = _a[0], r2Id = _a[1];
return infrastructure_1.RequestHelper.post(this, rId + "/" + this.resource2Type + "/" + r2Id + "/notes", options);
};
ResourceNotes.prototype.edit = function (resourceId, resource2Id, noteId, options) {
if (!options.body)
throw new Error('Missing required property: body');
var _a = [resourceId, resource2Id, noteId].map(encodeURIComponent), rId = _a[0], r2Id = _a[1], nId = _a[2];
return infrastructure_1.RequestHelper.put(this, rId + "/" + this.resource2Type + "/" + r2Id + "/notes/" + nId, options);
};
ResourceNotes.prototype.remove = function (resourceId, resource2Id, noteId) {
var _a = [resourceId, resource2Id, noteId].map(encodeURIComponent), rId = _a[0], r2Id = _a[1], nId = _a[2];
return infrastructure_1.RequestHelper.delete(this, rId + "/" + this.resource2Type + "/" + r2Id + "/notes/" + nId);
};
ResourceNotes.prototype.show = function (resourceId, resource2Id, noteId) {
var _a = [resourceId, resource2Id, noteId].map(encodeURIComponent), rId = _a[0], r2Id = _a[1], nId = _a[2];
return infrastructure_1.RequestHelper.get(this, rId + "/" + this.resource2Type + "/" + r2Id + "/notes/" + nId);
};
return ResourceNotes;
}(infrastructure_1.BaseService));
exports.default = ResourceNotes;