'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var FormData = require('form-data');
var li = require('li');
var queryString = require('query-string');
var xcase = require('xcase');
var requesterUtils = require('@gitbeaker/requester-utils');
var Mime = require('mime/lite');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

function _interopNamespace(e) {
    if (e && e.__esModule) return e;
    var n = Object.create(null);
    if (e) {
        Object.keys(e).forEach(function (k) {
            if (k !== 'default') {
                var d = Object.getOwnPropertyDescriptor(e, k);
                Object.defineProperty(n, k, d.get ? d : {
                    enumerable: true,
                    get: function () { return e[k]; }
                });
            }
        });
    }
    n["default"] = e;
    return Object.freeze(n);
}

var FormData__default = /*#__PURE__*/_interopDefaultLegacy(FormData);
var Mime__namespace = /*#__PURE__*/_interopNamespace(Mime);

/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise */

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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
    return extendStatics(d, b);
};

function __extends(d, b) {
    if (typeof b !== "function" && b !== null)
        throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
    extendStatics(d, b);
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}

var __assign = function() {
    __assign = Object.assign || function __assign(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};

function __rest(s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
}

function __awaiter(thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
}

function __generator(thisArg, body) {
    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
    return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
    function verb(n) { return function (v) { return step([n, v]); }; }
    function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while (_) try {
            if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
            if (y = 0, t) op = [op[0] & 2, t.value];
            switch (op[0]) {
                case 0: case 1: t = op; break;
                case 4: _.label++; return { value: op[1], done: false };
                case 5: _.label++; y = op[1]; op = [0]; continue;
                case 7: op = _.ops.pop(); _.trys.pop(); continue;
                default:
                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                    if (t[2]) _.ops.pop();
                    _.trys.pop(); continue;
            }
            op = body.call(thisArg, _);
        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
    }
}

function __read(o, n) {
    var m = typeof Symbol === "function" && o[Symbol.iterator];
    if (!m) return o;
    var i = m.call(o), r, ar = [], e;
    try {
        while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
    }
    catch (error) { e = { error: error }; }
    finally {
        try {
            if (r && !r.done && (m = i["return"])) m.call(i);
        }
        finally { if (e) throw e.error; }
    }
    return ar;
}

function __spreadArray(to, from, pack) {
    if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
        if (ar || !(i in from)) {
            if (!ar) ar = Array.prototype.slice.call(from, 0, i);
            ar[i] = from[i];
        }
    }
    return to.concat(ar || Array.prototype.slice.call(from));
}

function __makeTemplateObject(cooked, raw) {
    if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
    return cooked;
}

function appendFormFromObject(object) {
    /* eslint @typescript-eslint/ban-ts-comment: 0 */
    // @ts-ignore
    var form = new FormData__default["default"]();
    Object.entries(object).forEach(function (_a) {
        var _b = __read(_a, 2), k = _b[0], v = _b[1];
        if (Array.isArray(v))
            form.append(k, v[0], v[1]);
        else
            form.append(k, v);
    });
    return form;
}
function getAPIMap() {
    try {
        // eslint-disable-next-line @typescript-eslint/no-var-requires, global-require, import/no-unresolved
        return require('./map.json');
    }
    catch (e) {
        throw new Error('This function is only available in the distributed code');
    }
}
function endpoint(strings) {
    var values = [];
    for (var _i = 1; _i < arguments.length; _i++) {
        values[_i - 1] = arguments[_i];
    }
    return values.reduce(function (string, value, index) { return string + encodeURIComponent(value) + strings[index + 1]; }, strings[0]);
}

function getHelper(service, endpoint, _a, acc) {
    if (_a === void 0) { _a = {}; }
    if (acc === void 0) { acc = []; }
    var sudo = _a.sudo, showExpanded = _a.showExpanded, maxPages = _a.maxPages, query = __rest(_a, ["sudo", "showExpanded", "maxPages"]);
    return __awaiter(this, void 0, void 0, function () {
        var response, headers, status, body, newAcc, next, _b, qs, withinBounds;
        return __generator(this, function (_c) {
            switch (_c.label) {
                case 0: return [4 /*yield*/, service.requester.get(endpoint, { query: query, sudo: sudo })];
                case 1:
                    response = _c.sent();
                    headers = response.headers, status = response.status;
                    body = response.body;
                    // Camelize response body if specified
                    if (service.camelize)
                        body = xcase.camelizeKeys(body);
                    // Handle object responses
                    if (!Array.isArray(body)) {
                        if (!showExpanded)
                            return [2 /*return*/, body];
                        return [2 /*return*/, {
                                data: body,
                                headers: headers,
                                status: status,
                            }];
                    }
                    newAcc = __spreadArray(__spreadArray([], __read(acc), false), __read(body), false);
                    next = li.parse(headers.link).next;
                    _b = (next
                        ? queryString.parseUrl(next, { parseNumbers: true, arrayFormat: 'bracket' })
                        : {}).query, qs = _b === void 0 ? {} : _b;
                    withinBounds = maxPages
                        ? newAcc.length / (qs.per_page || 20) < maxPages
                        : true;
                    // Recurse through pagination results
                    if (!(query.page && acc.length === 0) && next && withinBounds) {
                        return [2 /*return*/, getHelper(service, endpoint, __assign(__assign({}, qs), { maxPages: maxPages, sudo: sudo }), newAcc)];
                    }
                    if (!showExpanded || query.pagination === 'keyset')
                        return [2 /*return*/, newAcc];
                    return [2 /*return*/, {
                            data: newAcc,
                            paginationInfo: {
                                total: parseInt(headers['x-total'], 10),
                                next: parseInt(headers['x-next-page'], 10) || null,
                                current: parseInt(headers['x-page'], 10) || 1,
                                previous: parseInt(headers['x-prev-page'], 10) || null,
                                perPage: parseInt(headers['x-per-page'], 10),
                                totalPages: parseInt(headers['x-total-pages'], 10),
                            },
                        }];
            }
        });
    });
}
function get() {
    return function (service, endpoint, options) { return getHelper(service, endpoint, options); };
}
function post() {
    var _this = this;
    return function (service, endpoint, _a) {
        if (_a === void 0) { _a = {}; }
        return __awaiter(_this, void 0, void 0, function () {
            var body, r;
            var query = _a.query, isForm = _a.isForm, sudo = _a.sudo, showExpanded = _a.showExpanded, options = __rest(_a, ["query", "isForm", "sudo", "showExpanded"]);
            return __generator(this, function (_b) {
                switch (_b.label) {
                    case 0:
                        body = isForm ? appendFormFromObject(options) : options;
                        return [4 /*yield*/, service.requester.post(endpoint, {
                                query: query,
                                body: body,
                                sudo: sudo,
                            })];
                    case 1:
                        r = _b.sent();
                        return [2 /*return*/, showExpanded
                                ? {
                                    data: r.body,
                                    status: r.status,
                                    headers: r.headers,
                                }
                                : r.body];
                }
            });
        });
    };
}
function put() {
    var _this = this;
    return function (service, endpoint, _a) {
        if (_a === void 0) { _a = {}; }
        return __awaiter(_this, void 0, void 0, function () {
            var body, r;
            var query = _a.query, isForm = _a.isForm, sudo = _a.sudo, showExpanded = _a.showExpanded, options = __rest(_a, ["query", "isForm", "sudo", "showExpanded"]);
            return __generator(this, function (_b) {
                switch (_b.label) {
                    case 0:
                        body = isForm ? appendFormFromObject(options) : options;
                        return [4 /*yield*/, service.requester.put(endpoint, {
                                body: body,
                                query: query,
                                sudo: sudo,
                            })];
                    case 1:
                        r = _b.sent();
                        return [2 /*return*/, showExpanded
                                ? {
                                    data: r.body,
                                    status: r.status,
                                    headers: r.headers,
                                }
                                : r.body];
                }
            });
        });
    };
}
function del() {
    var _this = this;
    return function (service, endpoint, _a) {
        if (_a === void 0) { _a = {}; }
        return __awaiter(_this, void 0, void 0, function () {
            var body, r;
            var sudo = _a.sudo, showExpanded = _a.showExpanded, query = _a.query, options = __rest(_a, ["sudo", "showExpanded", "query"]);
            return __generator(this, function (_b) {
                switch (_b.label) {
                    case 0:
                        body = options;
                        return [4 /*yield*/, service.requester.delete(endpoint, {
                                body: body,
                                query: query,
                                sudo: sudo,
                            })];
                    case 1:
                        r = _b.sent();
                        return [2 /*return*/, showExpanded
                                ? {
                                    data: r.body,
                                    status: r.status,
                                    headers: r.headers,
                                }
                                : r.body];
                }
            });
        });
    };
}
function stream(service, endpoint, options) {
    if (typeof service.requester.stream !== 'function') {
        throw new Error('Stream method is not implementated in requester!');
    }
    return service.requester.stream(endpoint, {
        query: options,
    });
}
var RequestHelper = {
    post: post,
    put: put,
    get: get,
    del: del,
    stream: stream,
};

var Groups = /** @class */ (function (_super) {
    __extends(Groups, _super);
    function Groups() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Groups.prototype.all = function (options) {
        return RequestHelper.get()(this, 'groups', options);
    };
    Groups.prototype.create = function (name, path, options) {
        return RequestHelper.post()(this, 'groups', __assign({ name: name, path: path }, options));
    };
    Groups.prototype.createLDAPLink = function (groupId, cn, groupAccess, provider, options) {
        return RequestHelper.post()(this, endpoint(templateObject_1$V || (templateObject_1$V = __makeTemplateObject(["groups/", "/ldap_group_links"], ["groups/", "/ldap_group_links"])), groupId), __assign({ cn: cn, groupAccess: groupAccess, provider: provider }, options));
    };
    Groups.prototype.edit = function (groupId, options) {
        return RequestHelper.put()(this, endpoint(templateObject_2$N || (templateObject_2$N = __makeTemplateObject(["groups/", ""], ["groups/", ""])), groupId), options);
    };
    Groups.prototype.projects = function (groupId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_3$K || (templateObject_3$K = __makeTemplateObject(["groups/", "/projects"], ["groups/", "/projects"])), groupId), options);
    };
    Groups.prototype.remove = function (groupId, options) {
        return RequestHelper.del()(this, endpoint(templateObject_4$H || (templateObject_4$H = __makeTemplateObject(["groups/", ""], ["groups/", ""])), groupId), options);
    };
    Groups.prototype.removeLDAPLink = function (groupId, cn, _a) {
        if (_a === void 0) { _a = {}; }
        var provider = _a.provider, options = __rest(_a, ["provider"]);
        var gId = encodeURIComponent(groupId);
        var url = provider ? "".concat(provider, "/").concat(cn) : "".concat(cn);
        return RequestHelper.del()(this, "groups/".concat(gId, "/ldap_group_links/").concat(url), options);
    };
    Groups.prototype.search = function (nameOrPath, options) {
        return RequestHelper.get()(this, 'groups', __assign({ search: nameOrPath }, options));
    };
    Groups.prototype.show = function (groupId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_5$x || (templateObject_5$x = __makeTemplateObject(["groups/", ""], ["groups/", ""])), groupId), options);
    };
    Groups.prototype.subgroups = function (groupId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_6$l || (templateObject_6$l = __makeTemplateObject(["groups/", "/subgroups"], ["groups/", "/subgroups"])), groupId), options);
    };
    Groups.prototype.syncLDAP = function (groupId, options) {
        return RequestHelper.post()(this, endpoint(templateObject_7$b || (templateObject_7$b = __makeTemplateObject(["groups/", "/ldap_sync"], ["groups/", "/ldap_sync"])), groupId), options);
    };
    Groups.prototype.transferProject = function (groupId, projectId, options) {
        return RequestHelper.post()(this, endpoint(templateObject_8$8 || (templateObject_8$8 = __makeTemplateObject(["groups/", "/projects/", ""], ["groups/", "/projects/", ""])), groupId, projectId), options);
    };
    return Groups;
}(requesterUtils.BaseResource));
var templateObject_1$V, templateObject_2$N, templateObject_3$K, templateObject_4$H, templateObject_5$x, templateObject_6$l, templateObject_7$b, templateObject_8$8;

var ResourceAccessRequests = /** @class */ (function (_super) {
    __extends(ResourceAccessRequests, _super);
    function ResourceAccessRequests(resourceType, options) {
        return _super.call(this, __assign({ prefixUrl: resourceType }, options)) || this;
    }
    ResourceAccessRequests.prototype.all = function (resourceId) {
        return RequestHelper.get()(this, endpoint(templateObject_1$U || (templateObject_1$U = __makeTemplateObject(["", "/access_requests"], ["", "/access_requests"])), resourceId));
    };
    ResourceAccessRequests.prototype.request = function (resourceId) {
        return RequestHelper.post()(this, endpoint(templateObject_2$M || (templateObject_2$M = __makeTemplateObject(["", "/access_requests"], ["", "/access_requests"])), resourceId));
    };
    ResourceAccessRequests.prototype.approve = function (resourceId, userId, options) {
        return RequestHelper.post()(this, endpoint(templateObject_3$J || (templateObject_3$J = __makeTemplateObject(["", "/access_requests/", "/approve"], ["", "/access_requests/", "/approve"])), resourceId, userId), options);
    };
    ResourceAccessRequests.prototype.deny = function (resourceId, userId) {
        return RequestHelper.del()(this, endpoint(templateObject_4$G || (templateObject_4$G = __makeTemplateObject(["", "/access_requests/", ""], ["", "/access_requests/", ""])), resourceId, userId));
    };
    return ResourceAccessRequests;
}(requesterUtils.BaseResource));
var templateObject_1$U, templateObject_2$M, templateObject_3$J, templateObject_4$G;

function url$4(projectId, resourceType, resourceId, awardId, noteId) {
    var _a = __read([projectId, resourceId].map(encodeURIComponent), 2), pId = _a[0], rId = _a[1];
    var output = [pId, resourceType, rId];
    if (noteId)
        output.push('notes', encodeURIComponent(noteId));
    output.push('award_emoji');
    if (awardId)
        output.push(encodeURIComponent(awardId));
    return output.join('/');
}
var ResourceAwardEmojis = /** @class */ (function (_super) {
    __extends(ResourceAwardEmojis, _super);
    function ResourceAwardEmojis(resourceType, options) {
        var _this = _super.call(this, __assign({ prefixUrl: 'projects' }, options)) || this;
        _this.resourceType = resourceType;
        return _this;
    }
    ResourceAwardEmojis.prototype.all = function (projectId, resourceIId, options) {
        return RequestHelper.get()(this, url$4(projectId, this.resourceType, resourceIId), options);
    };
    ResourceAwardEmojis.prototype.award = function (projectId, resourceIId, name, options) {
        return RequestHelper.post()(this, url$4(projectId, this.resourceType, resourceIId), __assign({ name: name }, options));
    };
    ResourceAwardEmojis.prototype.remove = function (projectId, resourceIId, awardId, options) {
        return RequestHelper.del()(this, url$4(projectId, this.resourceType, resourceIId, awardId), options);
    };
    ResourceAwardEmojis.prototype.show = function (projectId, resourceIId, awardId, options) {
        return RequestHelper.get()(this, url$4(projectId, this.resourceType, resourceIId, awardId), options);
    };
    return ResourceAwardEmojis;
}(requesterUtils.BaseResource));

var ResourceNoteAwardEmojis = /** @class */ (function (_super) {
    __extends(ResourceNoteAwardEmojis, _super);
    function ResourceNoteAwardEmojis(resourceType, options) {
        var _this = _super.call(this, __assign({ prefixUrl: 'projects' }, options)) || this;
        _this.resourceType = resourceType;
        return _this;
    }
    ResourceNoteAwardEmojis.prototype.all = function (projectId, resourceIId, noteId, options) {
        return RequestHelper.get()(this, url$4(projectId, this.resourceType, resourceIId, null, noteId), options);
    };
    ResourceNoteAwardEmojis.prototype.award = function (projectId, resourceIId, noteId, name, options) {
        return RequestHelper.post()(this, url$4(projectId, this.resourceType, resourceIId, null, noteId), __assign({ name: name }, options));
    };
    ResourceNoteAwardEmojis.prototype.remove = function (projectId, resourceIId, noteId, awardId, options) {
        return RequestHelper.del()(this, url$4(projectId, this.resourceType, resourceIId, awardId, noteId), options);
    };
    ResourceNoteAwardEmojis.prototype.show = function (projectId, resourceIId, noteId, awardId, options) {
        return RequestHelper.get()(this, url$4(projectId, this.resourceType, resourceIId, awardId, noteId), options);
    };
    return ResourceNoteAwardEmojis;
}(requesterUtils.BaseResource));

var ResourceBadges = /** @class */ (function (_super) {
    __extends(ResourceBadges, _super);
    function ResourceBadges(resourceType, options) {
        return _super.call(this, __assign({ prefixUrl: resourceType }, options)) || this;
    }
    ResourceBadges.prototype.add = function (resourceId, options) {
        return RequestHelper.post()(this, endpoint(templateObject_1$T || (templateObject_1$T = __makeTemplateObject(["", "/badges"], ["", "/badges"])), resourceId), options);
    };
    ResourceBadges.prototype.all = function (resourceId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_2$L || (templateObject_2$L = __makeTemplateObject(["", "/badges"], ["", "/badges"])), resourceId), options);
    };
    ResourceBadges.prototype.edit = function (resourceId, badgeId, options) {
        return RequestHelper.put()(this, endpoint(templateObject_3$I || (templateObject_3$I = __makeTemplateObject(["", "/badges/", ""], ["", "/badges/", ""])), resourceId, badgeId), options);
    };
    ResourceBadges.prototype.preview = function (resourceId, linkUrl, imageUrl, options) {
        return RequestHelper.get()(this, endpoint(templateObject_4$F || (templateObject_4$F = __makeTemplateObject(["", "/badges/render"], ["", "/badges/render"])), resourceId), __assign({ linkUrl: linkUrl, imageUrl: imageUrl }, options));
    };
    ResourceBadges.prototype.remove = function (resourceId, badgeId, options) {
        return RequestHelper.del()(this, endpoint(templateObject_5$w || (templateObject_5$w = __makeTemplateObject(["", "/badges/", ""], ["", "/badges/", ""])), resourceId, badgeId), options);
    };
    ResourceBadges.prototype.show = function (resourceId, badgeId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_6$k || (templateObject_6$k = __makeTemplateObject(["", "/badges/", ""], ["", "/badges/", ""])), resourceId, badgeId), options);
    };
    return ResourceBadges;
}(requesterUtils.BaseResource));
var templateObject_1$T, templateObject_2$L, templateObject_3$I, templateObject_4$F, templateObject_5$w, templateObject_6$k;

var ResourceCustomAttributes = /** @class */ (function (_super) {
    __extends(ResourceCustomAttributes, _super);
    function ResourceCustomAttributes(resourceType, options) {
        return _super.call(this, __assign({ prefixUrl: resourceType }, options)) || this;
    }
    ResourceCustomAttributes.prototype.all = function (resourceId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_1$S || (templateObject_1$S = __makeTemplateObject(["", "/custom_attributes"], ["", "/custom_attributes"])), resourceId), options);
    };
    ResourceCustomAttributes.prototype.set = function (resourceId, customAttributeId, value, options) {
        return RequestHelper.put()(this, endpoint(templateObject_2$K || (templateObject_2$K = __makeTemplateObject(["", "/custom_attributes/", ""], ["", "/custom_attributes/", ""])), resourceId, customAttributeId), __assign({ value: value }, options));
    };
    ResourceCustomAttributes.prototype.remove = function (resourceId, customAttributeId, options) {
        return RequestHelper.del()(this, endpoint(templateObject_3$H || (templateObject_3$H = __makeTemplateObject(["", "/custom_attributes/", ""], ["", "/custom_attributes/", ""])), resourceId, customAttributeId), options);
    };
    ResourceCustomAttributes.prototype.show = function (resourceId, customAttributeId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_4$E || (templateObject_4$E = __makeTemplateObject(["", "/custom_attributes/", ""], ["", "/custom_attributes/", ""])), resourceId, customAttributeId), options);
    };
    return ResourceCustomAttributes;
}(requesterUtils.BaseResource));
var templateObject_1$S, templateObject_2$K, templateObject_3$H, templateObject_4$E;

// https://docs.gitlab.com/ee/api/deploy_tokens.html
var ResourceDeployTokens = /** @class */ (function (_super) {
    __extends(ResourceDeployTokens, _super);
    function ResourceDeployTokens(resourceType, options) {
        return _super.call(this, __assign({ prefixUrl: resourceType }, options)) || this;
    }
    ResourceDeployTokens.prototype.add = function (resourceId, tokenName, tokenScopes, options) {
        return RequestHelper.post()(this, endpoint(templateObject_1$R || (templateObject_1$R = __makeTemplateObject(["", "/deploy_tokens"], ["", "/deploy_tokens"])), resourceId), __assign({ name: tokenName, scopes: tokenScopes }, options));
    };
    ResourceDeployTokens.prototype.all = function (_a) {
        if (_a === void 0) { _a = {}; }
        var resourceId = _a.resourceId, projectId = _a.projectId, groupId = _a.groupId, options = __rest(_a, ["resourceId", "projectId", "groupId"]);
        var prefix = resourceId || projectId || groupId
            ? endpoint(templateObject_2$J || (templateObject_2$J = __makeTemplateObject(["", "/"], ["", "/"])), (resourceId || projectId || groupId)) : '';
        return RequestHelper.get()(this, "".concat(prefix, "deploy_tokens"), options);
    };
    ResourceDeployTokens.prototype.remove = function (resourceId, tokenId, options) {
        return RequestHelper.del()(this, endpoint(templateObject_3$G || (templateObject_3$G = __makeTemplateObject(["", "/deploy_tokens/", ""], ["", "/deploy_tokens/", ""])), resourceId, tokenId), options);
    };
    return ResourceDeployTokens;
}(requesterUtils.BaseResource));
var templateObject_1$R, templateObject_2$J, templateObject_3$G;

var ResourceDiscussions = /** @class */ (function (_super) {
    __extends(ResourceDiscussions, _super);
    function ResourceDiscussions(resourceType, resource2Type, options) {
        var _this = _super.call(this, __assign({ prefixUrl: resourceType }, options)) || this;
        _this.resource2Type = resource2Type;
        return _this;
    }
    ResourceDiscussions.prototype.addNote = function (resourceId, resource2Id, discussionId, noteId, body, options) {
        return RequestHelper.post()(this, endpoint(templateObject_1$Q || (templateObject_1$Q = __makeTemplateObject(["", "/", "/", "/discussions/", "/notes"], ["", "/", "/", "/discussions/", "/notes"])), resourceId, this.resource2Type, resource2Id, discussionId), __assign({ query: { body: body }, noteId: noteId }, options));
    };
    ResourceDiscussions.prototype.all = function (resourceId, resource2Id, options) {
        return RequestHelper.get()(this, endpoint(templateObject_2$I || (templateObject_2$I = __makeTemplateObject(["", "/", "/", "/discussions"], ["", "/", "/", "/discussions"])), resourceId, this.resource2Type, resource2Id), options);
    };
    ResourceDiscussions.prototype.create = function (resourceId, resource2Id, body, _a) {
        if (_a === void 0) { _a = {}; }
        var position = _a.position, options = __rest(_a, ["position"]);
        var opts = __assign({}, options);
        if (position) {
            var p = xcase.decamelizeKeys(position);
            opts.isForm = true;
            opts.body = body;
            Object.entries(p).forEach(function (_a) {
                var _b = __read(_a, 2), k = _b[0], v = _b[1];
                opts["position[".concat(k, "]")] = v;
            });
        }
        else {
            opts.query = { body: body };
        }
        return RequestHelper.post()(this, endpoint(templateObject_3$F || (templateObject_3$F = __makeTemplateObject(["", "/", "/", "/discussions"], ["", "/", "/", "/discussions"])), resourceId, this.resource2Type, resource2Id), opts);
    };
    ResourceDiscussions.prototype.editNote = function (resourceId, resource2Id, discussionId, noteId, _a) {
        if (_a === void 0) { _a = {}; }
        var body = _a.body, options = __rest(_a, ["body"]);
        return RequestHelper.put()(this, endpoint(templateObject_4$D || (templateObject_4$D = __makeTemplateObject(["", "/", "/", "/discussions/", "/notes/", ""], ["", "/", "/", "/discussions/", "/notes/", ""])), resourceId, this.resource2Type, resource2Id, discussionId, noteId), __assign({ query: { body: body } }, options));
    };
    ResourceDiscussions.prototype.removeNote = function (resourceId, resource2Id, discussionId, noteId, options) {
        return RequestHelper.del()(this, endpoint(templateObject_5$v || (templateObject_5$v = __makeTemplateObject(["", "/", "/", "/discussions/", "/notes/", ""], ["", "/", "/", "/discussions/", "/notes/", ""])), resourceId, this.resource2Type, resource2Id, discussionId, noteId), options);
    };
    ResourceDiscussions.prototype.show = function (resourceId, resource2Id, discussionId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_6$j || (templateObject_6$j = __makeTemplateObject(["", "/", "/", "/discussions/", ""], ["", "/", "/", "/discussions/", ""])), resourceId, this.resource2Type, resource2Id, discussionId), options);
    };
    return ResourceDiscussions;
}(requesterUtils.BaseResource));
var templateObject_1$Q, templateObject_2$I, templateObject_3$F, templateObject_4$D, templateObject_5$v, templateObject_6$j;

var ResourceIssueBoards = /** @class */ (function (_super) {
    __extends(ResourceIssueBoards, _super);
    function ResourceIssueBoards(resourceType, options) {
        return _super.call(this, __assign({ prefixUrl: resourceType }, options)) || this;
    }
    ResourceIssueBoards.prototype.all = function (resourceId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_1$P || (templateObject_1$P = __makeTemplateObject(["", "/boards"], ["", "/boards"])), resourceId), options);
    };
    ResourceIssueBoards.prototype.create = function (resourceId, name, options) {
        return RequestHelper.post()(this, endpoint(templateObject_2$H || (templateObject_2$H = __makeTemplateObject(["", "/boards"], ["", "/boards"])), resourceId), __assign({ name: name }, options));
    };
    ResourceIssueBoards.prototype.createList = function (resourceId, boardId, labelId, options) {
        return RequestHelper.post()(this, endpoint(templateObject_3$E || (templateObject_3$E = __makeTemplateObject(["", "/boards/", "/lists"], ["", "/boards/", "/lists"])), resourceId, boardId), __assign({ labelId: labelId }, options));
    };
    ResourceIssueBoards.prototype.edit = function (resourceId, boardId, options) {
        return RequestHelper.put()(this, endpoint(templateObject_4$C || (templateObject_4$C = __makeTemplateObject(["", "/boards/", ""], ["", "/boards/", ""])), resourceId, boardId), options);
    };
    ResourceIssueBoards.prototype.editList = function (resourceId, boardId, listId, position, options) {
        return RequestHelper.put()(this, endpoint(templateObject_5$u || (templateObject_5$u = __makeTemplateObject(["", "/boards/", "/lists/", ""], ["", "/boards/", "/lists/", ""])), resourceId, boardId, listId), __assign({ position: position }, options));
    };
    ResourceIssueBoards.prototype.lists = function (resourceId, boardId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_6$i || (templateObject_6$i = __makeTemplateObject(["", "/boards/", "/lists"], ["", "/boards/", "/lists"])), resourceId, boardId), options);
    };
    ResourceIssueBoards.prototype.remove = function (resourceId, boardId, options) {
        return RequestHelper.del()(this, endpoint(templateObject_7$a || (templateObject_7$a = __makeTemplateObject(["", "/boards/", ""], ["", "/boards/", ""])), resourceId, boardId), options);
    };
    ResourceIssueBoards.prototype.removeList = function (resourceId, boardId, listId, options) {
        return RequestHelper.del()(this, endpoint(templateObject_8$7 || (templateObject_8$7 = __makeTemplateObject(["", "/boards/", "/lists/", ""], ["", "/boards/", "/lists/", ""])), resourceId, boardId, listId), options);
    };
    ResourceIssueBoards.prototype.show = function (resourceId, boardId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_9$6 || (templateObject_9$6 = __makeTemplateObject(["", "/boards/", ""], ["", "/boards/", ""])), resourceId, boardId), options);
    };
    ResourceIssueBoards.prototype.showList = function (resourceId, boardId, listId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_10$5 || (templateObject_10$5 = __makeTemplateObject(["", "/boards/", "/lists/", ""], ["", "/boards/", "/lists/", ""])), resourceId, boardId, listId), options);
    };
    return ResourceIssueBoards;
}(requesterUtils.BaseResource));
var templateObject_1$P, templateObject_2$H, templateObject_3$E, templateObject_4$C, templateObject_5$u, templateObject_6$i, templateObject_7$a, templateObject_8$7, templateObject_9$6, templateObject_10$5;

var ResourceLabels = /** @class */ (function (_super) {
    __extends(ResourceLabels, _super);
    function ResourceLabels(resourceType, options) {
        return _super.call(this, __assign({ prefixUrl: resourceType }, options)) || this;
    }
    ResourceLabels.prototype.all = function (resourceId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_1$O || (templateObject_1$O = __makeTemplateObject(["", "/labels"], ["", "/labels"])), resourceId), options);
    };
    ResourceLabels.prototype.create = function (resourceId, labelName, color, options) {
        return RequestHelper.post()(this, endpoint(templateObject_2$G || (templateObject_2$G = __makeTemplateObject(["", "/labels"], ["", "/labels"])), resourceId), __assign({ name: labelName, color: color }, options));
    };
    ResourceLabels.prototype.edit = function (resourceId, labelId, options) {
        return RequestHelper.put()(this, endpoint(templateObject_3$D || (templateObject_3$D = __makeTemplateObject(["", "/labels/", ""], ["", "/labels/", ""])), resourceId, labelId), options);
    };
    ResourceLabels.prototype.remove = function (resourceId, labelId, options) {
        return RequestHelper.del()(this, endpoint(templateObject_4$B || (templateObject_4$B = __makeTemplateObject(["", "/labels/", ""], ["", "/labels/", ""])), resourceId, labelId), options);
    };
    ResourceLabels.prototype.subscribe = function (resourceId, labelId, options) {
        return RequestHelper.post()(this, endpoint(templateObject_5$t || (templateObject_5$t = __makeTemplateObject(["", "/issues/", "/subscribe"], ["", "/issues/", "/subscribe"])), resourceId, labelId), options);
    };
    ResourceLabels.prototype.unsubscribe = function (resourceId, labelId, options) {
        return RequestHelper.post()(this, endpoint(templateObject_6$h || (templateObject_6$h = __makeTemplateObject(["", "/issues/", "/unsubscribe"], ["", "/issues/", "/unsubscribe"])), resourceId, labelId), options);
    };
    return ResourceLabels;
}(requesterUtils.BaseResource));
var templateObject_1$O, templateObject_2$G, templateObject_3$D, templateObject_4$B, templateObject_5$t, templateObject_6$h;

var ResourceMembers = /** @class */ (function (_super) {
    __extends(ResourceMembers, _super);
    function ResourceMembers(resourceType, options) {
        return _super.call(this, __assign({ prefixUrl: resourceType }, options)) || this;
    }
    ResourceMembers.prototype.add = function (resourceId, userId, accessLevel, options) {
        return RequestHelper.post()(this, endpoint(templateObject_1$N || (templateObject_1$N = __makeTemplateObject(["", "/members"], ["", "/members"])), resourceId), __assign({ userId: String(userId), accessLevel: accessLevel }, options));
    };
    ResourceMembers.prototype.all = function (resourceId, _a) {
        if (_a === void 0) { _a = {}; }
        var includeInherited = _a.includeInherited, options = __rest(_a, ["includeInherited"]);
        var rId = encodeURIComponent(resourceId);
        var url = [rId, 'members'];
        if (includeInherited)
            url.push('all');
        return RequestHelper.get()(this, url.join('/'), options);
    };
    ResourceMembers.prototype.edit = function (resourceId, userId, accessLevel, options) {
        return RequestHelper.put()(this, endpoint(templateObject_2$F || (templateObject_2$F = __makeTemplateObject(["", "/members/", ""], ["", "/members/", ""])), resourceId, userId), __assign({ accessLevel: accessLevel }, options));
    };
    ResourceMembers.prototype.show = function (resourceId, userId, _a) {
        if (_a === void 0) { _a = {}; }
        var includeInherited = _a.includeInherited, options = __rest(_a, ["includeInherited"]);
        var _b = __read([resourceId, userId].map(encodeURIComponent), 2), rId = _b[0], uId = _b[1];
        var url = [rId, 'members'];
        if (includeInherited)
            url.push('all');
        url.push(uId);
        return RequestHelper.get()(this, url.join('/'), options);
    };
    ResourceMembers.prototype.remove = function (resourceId, userId, options) {
        return RequestHelper.del()(this, endpoint(templateObject_3$C || (templateObject_3$C = __makeTemplateObject(["", "/members/", ""], ["", "/members/", ""])), resourceId, userId), options);
    };
    return ResourceMembers;
}(requesterUtils.BaseResource));
var templateObject_1$N, templateObject_2$F, templateObject_3$C;

var ResourceMilestones = /** @class */ (function (_super) {
    __extends(ResourceMilestones, _super);
    function ResourceMilestones(resourceType, options) {
        return _super.call(this, __assign({ prefixUrl: resourceType }, options)) || this;
    }
    ResourceMilestones.prototype.all = function (resourceId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_1$M || (templateObject_1$M = __makeTemplateObject(["", "/milestones"], ["", "/milestones"])), resourceId), options);
    };
    ResourceMilestones.prototype.create = function (resourceId, title, options) {
        return RequestHelper.post()(this, endpoint(templateObject_2$E || (templateObject_2$E = __makeTemplateObject(["", "/milestones"], ["", "/milestones"])), resourceId), __assign({ title: title }, options));
    };
    ResourceMilestones.prototype.edit = function (resourceId, milestoneId, options) {
        return RequestHelper.put()(this, endpoint(templateObject_3$B || (templateObject_3$B = __makeTemplateObject(["", "/milestones/", ""], ["", "/milestones/", ""])), resourceId, milestoneId), options);
    };
    ResourceMilestones.prototype.issues = function (resourceId, milestoneId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_4$A || (templateObject_4$A = __makeTemplateObject(["", "/milestones/", "/issues"], ["", "/milestones/", "/issues"])), resourceId, milestoneId), options);
    };
    ResourceMilestones.prototype.mergeRequests = function (resourceId, milestoneId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_5$s || (templateObject_5$s = __makeTemplateObject(["", "/milestones/", "/merge_requests"], ["", "/milestones/", "/merge_requests"])), resourceId, milestoneId), options);
    };
    ResourceMilestones.prototype.show = function (resourceId, milestoneId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_6$g || (templateObject_6$g = __makeTemplateObject(["", "/milestones/", ""], ["", "/milestones/", ""])), resourceId, milestoneId), options);
    };
    return ResourceMilestones;
}(requesterUtils.BaseResource));
var templateObject_1$M, templateObject_2$E, templateObject_3$B, templateObject_4$A, templateObject_5$s, templateObject_6$g;

var ResourceNotes = /** @class */ (function (_super) {
    __extends(ResourceNotes, _super);
    function ResourceNotes(resourceType, resource2Type, options) {
        var _this = _super.call(this, __assign({ prefixUrl: resourceType }, options)) || this;
        _this.resource2Type = resource2Type;
        return _this;
    }
    ResourceNotes.prototype.all = function (resourceId, resource2Id, options) {
        return RequestHelper.get()(this, endpoint(templateObject_1$L || (templateObject_1$L = __makeTemplateObject(["", "/", "/", "/notes"], ["", "/", "/", "/notes"])), resourceId, this.resource2Type, resource2Id), options);
    };
    ResourceNotes.prototype.create = function (resourceId, resource2Id, body, options) {
        return RequestHelper.post()(this, endpoint(templateObject_2$D || (templateObject_2$D = __makeTemplateObject(["", "/", "/", "/notes"], ["", "/", "/", "/notes"])), resourceId, this.resource2Type, resource2Id), __assign({ body: body }, options));
    };
    ResourceNotes.prototype.edit = function (resourceId, resource2Id, noteId, body, options) {
        return RequestHelper.put()(this, endpoint(templateObject_3$A || (templateObject_3$A = __makeTemplateObject(["", "/", "/", "/notes/", ""], ["", "/", "/", "/notes/", ""])), resourceId, this.resource2Type, resource2Id, noteId), __assign({ body: body }, options));
    };
    ResourceNotes.prototype.remove = function (resourceId, resource2Id, noteId, options) {
        return RequestHelper.del()(this, endpoint(templateObject_4$z || (templateObject_4$z = __makeTemplateObject(["", "/", "/", "/notes/", ""], ["", "/", "/", "/notes/", ""])), resourceId, this.resource2Type, resource2Id, noteId), options);
    };
    ResourceNotes.prototype.show = function (resourceId, resource2Id, noteId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_5$r || (templateObject_5$r = __makeTemplateObject(["", "/", "/", "/notes/", ""], ["", "/", "/", "/notes/", ""])), resourceId, this.resource2Type, resource2Id, noteId), options);
    };
    return ResourceNotes;
}(requesterUtils.BaseResource));
var templateObject_1$L, templateObject_2$D, templateObject_3$A, templateObject_4$z, templateObject_5$r;

var ResourceTemplates = /** @class */ (function (_super) {
    __extends(ResourceTemplates, _super);
    function ResourceTemplates(resourceType, options) {
        return _super.call(this, __assign({ prefixUrl: ['templates', resourceType].join('/') }, options)) || this;
    }
    ResourceTemplates.prototype.all = function (options) {
        return RequestHelper.get()(this, '', options);
    };
    ResourceTemplates.prototype.show = function (key, options) {
        return RequestHelper.get()(this, encodeURIComponent(key), options);
    };
    return ResourceTemplates;
}(requesterUtils.BaseResource));

var ResourceVariables = /** @class */ (function (_super) {
    __extends(ResourceVariables, _super);
    function ResourceVariables(resourceType, options) {
        return _super.call(this, __assign({ prefixUrl: resourceType }, options)) || this;
    }
    ResourceVariables.prototype.all = function (resourceId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_1$K || (templateObject_1$K = __makeTemplateObject(["", "/variables"], ["", "/variables"])), resourceId), options);
    };
    ResourceVariables.prototype.create = function (resourceId, options) {
        return RequestHelper.post()(this, endpoint(templateObject_2$C || (templateObject_2$C = __makeTemplateObject(["", "/variables"], ["", "/variables"])), resourceId), options);
    };
    ResourceVariables.prototype.edit = function (resourceId, keyId, options) {
        return RequestHelper.put()(this, endpoint(templateObject_3$z || (templateObject_3$z = __makeTemplateObject(["", "/variables/", ""], ["", "/variables/", ""])), resourceId, keyId), options);
    };
    ResourceVariables.prototype.show = function (resourceId, keyId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_4$y || (templateObject_4$y = __makeTemplateObject(["", "/variables/", ""], ["", "/variables/", ""])), resourceId, keyId), options);
    };
    ResourceVariables.prototype.remove = function (resourceId, keyId, options) {
        return RequestHelper.del()(this, endpoint(templateObject_5$q || (templateObject_5$q = __makeTemplateObject(["", "/variables/", ""], ["", "/variables/", ""])), resourceId, keyId), options);
    };
    return ResourceVariables;
}(requesterUtils.BaseResource));
var templateObject_1$K, templateObject_2$C, templateObject_3$z, templateObject_4$y, templateObject_5$q;

var GroupAccessRequests = /** @class */ (function (_super) {
    __extends(GroupAccessRequests, _super);
    function GroupAccessRequests(options) {
        /* istanbul ignore next */
        return _super.call(this, 'groups', options) || this;
    }
    return GroupAccessRequests;
}(ResourceAccessRequests));

var GroupBadges = /** @class */ (function (_super) {
    __extends(GroupBadges, _super);
    function GroupBadges(options) {
        /* istanbul ignore next */
        return _super.call(this, 'groups', options) || this;
    }
    return GroupBadges;
}(ResourceBadges));

var GroupCustomAttributes = /** @class */ (function (_super) {
    __extends(GroupCustomAttributes, _super);
    function GroupCustomAttributes(options) {
        /* istanbul ignore next */
        return _super.call(this, 'groups', options) || this;
    }
    return GroupCustomAttributes;
}(ResourceCustomAttributes));

var GroupIssueBoards = /** @class */ (function (_super) {
    __extends(GroupIssueBoards, _super);
    function GroupIssueBoards(options) {
        /* istanbul ignore next */
        return _super.call(this, 'groups', options) || this;
    }
    return GroupIssueBoards;
}(ResourceIssueBoards));

var GroupMembers = /** @class */ (function (_super) {
    __extends(GroupMembers, _super);
    function GroupMembers(options) {
        /* istanbul ignore next */
        return _super.call(this, 'groups', options) || this;
    }
    return GroupMembers;
}(ResourceMembers));

var GroupMilestones = /** @class */ (function (_super) {
    __extends(GroupMilestones, _super);
    function GroupMilestones(options) {
        /* istanbul ignore next */
        return _super.call(this, 'groups', options) || this;
    }
    return GroupMilestones;
}(ResourceMilestones));

var GroupRunners = /** @class */ (function (_super) {
    __extends(GroupRunners, _super);
    function GroupRunners() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    GroupRunners.prototype.all = function (groupId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_1$J || (templateObject_1$J = __makeTemplateObject(["groups/", "/runners"], ["groups/", "/runners"])), groupId), options);
    };
    return GroupRunners;
}(requesterUtils.BaseResource));
var templateObject_1$J;

var GroupVariables = /** @class */ (function (_super) {
    __extends(GroupVariables, _super);
    function GroupVariables(options) {
        /* istanbul ignore next */
        return _super.call(this, 'groups', options) || this;
    }
    return GroupVariables;
}(ResourceVariables));

var GroupLabels = /** @class */ (function (_super) {
    __extends(GroupLabels, _super);
    function GroupLabels(options) {
        /* istanbul ignore next */
        return _super.call(this, 'groups', options) || this;
    }
    return GroupLabels;
}(ResourceLabels));

var GroupDeployTokens = /** @class */ (function (_super) {
    __extends(GroupDeployTokens, _super);
    function GroupDeployTokens(options) {
        /* istanbul ignore next */
        return _super.call(this, 'groups', options) || this;
    }
    return GroupDeployTokens;
}(ResourceDeployTokens));

var Epics = /** @class */ (function (_super) {
    __extends(Epics, _super);
    function Epics() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Epics.prototype.all = function (groupId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_1$I || (templateObject_1$I = __makeTemplateObject(["groups/", "/epics"], ["groups/", "/epics"])), groupId), options);
    };
    Epics.prototype.create = function (groupId, title, options) {
        return RequestHelper.post()(this, endpoint(templateObject_2$B || (templateObject_2$B = __makeTemplateObject(["groups/", "/epics"], ["groups/", "/epics"])), groupId), __assign({ title: title }, options));
    };
    Epics.prototype.edit = function (groupId, epicId, options) {
        return RequestHelper.put()(this, endpoint(templateObject_3$y || (templateObject_3$y = __makeTemplateObject(["groups/", "/epics/", ""], ["groups/", "/epics/", ""])), groupId, epicId), options);
    };
    Epics.prototype.remove = function (groupId, epicId, options) {
        return RequestHelper.del()(this, endpoint(templateObject_4$x || (templateObject_4$x = __makeTemplateObject(["groups/", "/epics/", ""], ["groups/", "/epics/", ""])), groupId, epicId), options);
    };
    Epics.prototype.show = function (groupId, epicId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_5$p || (templateObject_5$p = __makeTemplateObject(["groups/", "/epics/", ""], ["groups/", "/epics/", ""])), groupId, epicId), options);
    };
    return Epics;
}(requesterUtils.BaseResource));
var templateObject_1$I, templateObject_2$B, templateObject_3$y, templateObject_4$x, templateObject_5$p;

var EpicIssues = /** @class */ (function (_super) {
    __extends(EpicIssues, _super);
    function EpicIssues() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    EpicIssues.prototype.all = function (groupId, epicIId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_1$H || (templateObject_1$H = __makeTemplateObject(["groups/", "/epics/", "/issues"], ["groups/", "/epics/", "/issues"])), groupId, epicIId), options);
    };
    EpicIssues.prototype.assign = function (groupId, epicIId, epicIssueId, options) {
        return RequestHelper.post()(this, endpoint(templateObject_2$A || (templateObject_2$A = __makeTemplateObject(["groups/", "/epics/", "/issues/", ""], ["groups/", "/epics/", "/issues/", ""])), groupId, epicIId, epicIssueId), options);
    };
    EpicIssues.prototype.edit = function (groupId, epicIId, epicIssueId, options) {
        return RequestHelper.put()(this, endpoint(templateObject_3$x || (templateObject_3$x = __makeTemplateObject(["groups/", "/epics/", "/issues/", ""], ["groups/", "/epics/", "/issues/", ""])), groupId, epicIId, epicIssueId), options);
    };
    EpicIssues.prototype.remove = function (groupId, epicIId, epicIssueId, options) {
        return RequestHelper.del()(this, endpoint(templateObject_4$w || (templateObject_4$w = __makeTemplateObject(["groups/", "/epics/", "/issues/", ""], ["groups/", "/epics/", "/issues/", ""])), groupId, epicIId, epicIssueId), options);
    };
    return EpicIssues;
}(requesterUtils.BaseResource));
var templateObject_1$H, templateObject_2$A, templateObject_3$x, templateObject_4$w;

var EpicNotes = /** @class */ (function (_super) {
    __extends(EpicNotes, _super);
    function EpicNotes(options) {
        /* istanbul ignore next */
        return _super.call(this, 'groups', 'epics', options) || this;
    }
    return EpicNotes;
}(ResourceNotes));

var EpicDiscussions = /** @class */ (function (_super) {
    __extends(EpicDiscussions, _super);
    function EpicDiscussions(options) {
        /* istanbul ignore next */
        return _super.call(this, 'groups', 'epics', options) || this;
    }
    return EpicDiscussions;
}(ResourceDiscussions));

var Users = /** @class */ (function (_super) {
    __extends(Users, _super);
    function Users() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Users.prototype.all = function (options) {
        return RequestHelper.get()(this, 'users', options);
    };
    Users.prototype.activities = function (options) {
        return RequestHelper.get()(this, 'users/activities', options);
    };
    Users.prototype.projects = function (userId, options) {
        return RequestHelper.get()(this, "users/".concat(userId, "/projects"), options);
    };
    Users.prototype.block = function (userId, options) {
        return RequestHelper.post()(this, "users/".concat(userId, "/block"), options);
    };
    Users.prototype.create = function (options) {
        return RequestHelper.post()(this, 'users', options);
    };
    Users.prototype.current = function (options) {
        return RequestHelper.get()(this, 'user', options);
    };
    Users.prototype.edit = function (userId, options) {
        return RequestHelper.put()(this, "users/".concat(userId), options);
    };
    Users.prototype.events = function (userId, options) {
        return RequestHelper.get()(this, "users/".concat(userId, "/events"), options);
    };
    Users.prototype.search = function (emailOrUsername, options) {
        return RequestHelper.get()(this, 'users', __assign({ search: emailOrUsername }, options));
    };
    Users.prototype.show = function (userId, options) {
        return RequestHelper.get()(this, "users/".concat(userId), options);
    };
    Users.prototype.remove = function (userId, options) {
        return RequestHelper.del()(this, "users/".concat(userId), options);
    };
    Users.prototype.unblock = function (userId, options) {
        return RequestHelper.post()(this, "users/".concat(userId, "/unblock"), options);
    };
    Users.prototype.username = function (username, options) {
        return RequestHelper.get()(this, 'users', __assign({ username: username }, options));
    };
    return Users;
}(requesterUtils.BaseResource));

var UserCustomAttributes = /** @class */ (function (_super) {
    __extends(UserCustomAttributes, _super);
    function UserCustomAttributes(options) {
        /* istanbul ignore next */
        return _super.call(this, 'users', options) || this;
    }
    return UserCustomAttributes;
}(ResourceCustomAttributes));

var url$3 = function (userId) { return (userId ? "users/".concat(userId, "/emails") : 'user/emails'); };
var UserEmails = /** @class */ (function (_super) {
    __extends(UserEmails, _super);
    function UserEmails() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    UserEmails.prototype.all = function (_a) {
        if (_a === void 0) { _a = {}; }
        var userId = _a.userId, options = __rest(_a, ["userId"]);
        return RequestHelper.get()(this, url$3(userId), options);
    };
    UserEmails.prototype.add = function (email, _a) {
        if (_a === void 0) { _a = {}; }
        var userId = _a.userId, options = __rest(_a, ["userId"]);
        return RequestHelper.post()(this, url$3(userId), __assign({ email: email }, options));
    };
    UserEmails.prototype.show = function (emailId, options) {
        return RequestHelper.get()(this, "user/emails/".concat(emailId), options);
    };
    UserEmails.prototype.remove = function (emailId, _a) {
        if (_a === void 0) { _a = {}; }
        var userId = _a.userId, options = __rest(_a, ["userId"]);
        var eId = encodeURIComponent(emailId);
        return RequestHelper.del()(this, "".concat(url$3(userId), "/").concat(eId), options);
    };
    return UserEmails;
}(requesterUtils.BaseResource));

var UserImpersonationTokens = /** @class */ (function (_super) {
    __extends(UserImpersonationTokens, _super);
    function UserImpersonationTokens() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    UserImpersonationTokens.prototype.all = function (userId, options) {
        return RequestHelper.get()(this, "users/".concat(userId, "/impersonation_tokens"), options);
    };
    // TODO: change required params
    UserImpersonationTokens.prototype.add = function (userId, name, scopes, expiresAt, options) {
        return RequestHelper.post()(this, "users/".concat(userId, "/impersonation_tokens"), __assign({ name: name, expiresAt: expiresAt, scopes: scopes }, options));
    };
    UserImpersonationTokens.prototype.show = function (userId, tokenId, options) {
        return RequestHelper.get()(this, "users/".concat(userId, "/impersonation_tokens/").concat(tokenId), options);
    };
    UserImpersonationTokens.prototype.revoke = function (userId, tokenId, options) {
        return RequestHelper.del()(this, "users/".concat(userId, "/impersonation_tokens/").concat(tokenId), options);
    };
    return UserImpersonationTokens;
}(requesterUtils.BaseResource));

var url$2 = function (userId) { return (userId ? "users/".concat(userId, "/keys") : 'user/keys'); };
var UserSSHKeys = /** @class */ (function (_super) {
    __extends(UserSSHKeys, _super);
    function UserSSHKeys() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    UserSSHKeys.prototype.all = function (_a) {
        if (_a === void 0) { _a = {}; }
        var userId = _a.userId, options = __rest(_a, ["userId"]);
        return RequestHelper.get()(this, url$2(userId), options);
    };
    UserSSHKeys.prototype.create = function (title, key, _a) {
        if (_a === void 0) { _a = {}; }
        var userId = _a.userId, options = __rest(_a, ["userId"]);
        return RequestHelper.post()(this, url$2(userId), __assign({ title: title, key: key }, options));
    };
    UserSSHKeys.prototype.show = function (keyId, _a) {
        if (_a === void 0) { _a = {}; }
        var userId = _a.userId, options = __rest(_a, ["userId"]);
        var kId = encodeURIComponent(keyId);
        return RequestHelper.get()(this, "".concat(url$2(userId), "/").concat(kId), options);
    };
    UserSSHKeys.prototype.remove = function (keyId, _a) {
        if (_a === void 0) { _a = {}; }
        var userId = _a.userId, options = __rest(_a, ["userId"]);
        var kId = encodeURIComponent(keyId);
        return RequestHelper.del()(this, "".concat(url$2(userId), "/").concat(kId), options);
    };
    return UserSSHKeys;
}(requesterUtils.BaseResource));

var url$1 = function (userId) { return (userId ? "users/".concat(userId, "/gpg_keys") : 'user/gpg_keys'); };
var UserGPGKeys = /** @class */ (function (_super) {
    __extends(UserGPGKeys, _super);
    function UserGPGKeys() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    UserGPGKeys.prototype.all = function (_a) {
        if (_a === void 0) { _a = {}; }
        var userId = _a.userId, options = __rest(_a, ["userId"]);
        return RequestHelper.get()(this, url$1(userId), options);
    };
    UserGPGKeys.prototype.add = function (key, _a) {
        if (_a === void 0) { _a = {}; }
        var userId = _a.userId, options = __rest(_a, ["userId"]);
        return RequestHelper.post()(this, url$1(userId), __assign({ key: key }, options));
    };
    UserGPGKeys.prototype.show = function (keyId, _a) {
        if (_a === void 0) { _a = {}; }
        var userId = _a.userId, options = __rest(_a, ["userId"]);
        var kId = encodeURIComponent(keyId);
        return RequestHelper.get()(this, "".concat(url$1(userId), "/").concat(kId), options);
    };
    UserGPGKeys.prototype.remove = function (keyId, _a) {
        if (_a === void 0) { _a = {}; }
        var userId = _a.userId, options = __rest(_a, ["userId"]);
        var kId = encodeURIComponent(keyId);
        return RequestHelper.del()(this, "".concat(url$1(userId), "/").concat(kId), options);
    };
    return UserGPGKeys;
}(requesterUtils.BaseResource));

var Branches = /** @class */ (function (_super) {
    __extends(Branches, _super);
    function Branches() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Branches.prototype.all = function (projectId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_1$G || (templateObject_1$G = __makeTemplateObject(["projects/", "/repository/branches"], ["projects/", "/repository/branches"])), projectId), options);
    };
    Branches.prototype.create = function (projectId, branchName, ref, options) {
        var _a;
        var branchKey = this.url.includes('v3') ? 'branchName' : 'branch';
        return RequestHelper.post()(this, endpoint(templateObject_2$z || (templateObject_2$z = __makeTemplateObject(["projects/", "/repository/branches"], ["projects/", "/repository/branches"])), projectId), __assign((_a = {}, _a[branchKey] = branchName, _a.ref = ref, _a), options));
    };
    Branches.prototype.remove = function (projectId, branchName, options) {
        return RequestHelper.del()(this, endpoint(templateObject_3$w || (templateObject_3$w = __makeTemplateObject(["projects/", "/repository/branches/", ""], ["projects/", "/repository/branches/", ""])), projectId, branchName), options);
    };
    Branches.prototype.show = function (projectId, branchName, options) {
        return RequestHelper.get()(this, endpoint(templateObject_4$v || (templateObject_4$v = __makeTemplateObject(["projects/", "/repository/branches/", ""], ["projects/", "/repository/branches/", ""])), projectId, branchName), options);
    };
    return Branches;
}(requesterUtils.BaseResource));
var templateObject_1$G, templateObject_2$z, templateObject_3$w, templateObject_4$v;

var Commits = /** @class */ (function (_super) {
    __extends(Commits, _super);
    function Commits() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Commits.prototype.all = function (projectId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_1$F || (templateObject_1$F = __makeTemplateObject(["projects/", "/repository/commits"], ["projects/", "/repository/commits"])), projectId), options);
    };
    Commits.prototype.cherryPick = function (projectId, sha, branch, options) {
        return RequestHelper.post()(this, endpoint(templateObject_2$y || (templateObject_2$y = __makeTemplateObject(["projects/", "/repository/commits/", "/cherry_pick"], ["projects/", "/repository/commits/", "/cherry_pick"])), projectId, sha), __assign({ branch: branch }, options));
    };
    Commits.prototype.comments = function (projectId, sha, options) {
        return RequestHelper.get()(this, endpoint(templateObject_3$v || (templateObject_3$v = __makeTemplateObject(["projects/", "/repository/commits/", "/comments"], ["projects/", "/repository/commits/", "/comments"])), projectId, sha), options);
    };
    Commits.prototype.create = function (projectId, branch, message, actions, options) {
        if (actions === void 0) { actions = []; }
        if (options === void 0) { options = {}; }
        return RequestHelper.post()(this, endpoint(templateObject_4$u || (templateObject_4$u = __makeTemplateObject(["projects/", "/repository/commits"], ["projects/", "/repository/commits"])), projectId), __assign({ branch: branch, commitMessage: message, actions: actions }, options));
    };
    Commits.prototype.createComment = function (projectId, sha, note, options) {
        return RequestHelper.post()(this, endpoint(templateObject_5$o || (templateObject_5$o = __makeTemplateObject(["projects/", "/repository/commits/", "/comments"], ["projects/", "/repository/commits/", "/comments"])), projectId, sha), __assign({ note: note }, options));
    };
    Commits.prototype.diff = function (projectId, sha, options) {
        return RequestHelper.get()(this, endpoint(templateObject_6$f || (templateObject_6$f = __makeTemplateObject(["projects/", "/repository/commits/", "/diff"], ["projects/", "/repository/commits/", "/diff"])), projectId, sha), options);
    };
    Commits.prototype.editStatus = function (projectId, sha, options) {
        return RequestHelper.post()(this, endpoint(templateObject_7$9 || (templateObject_7$9 = __makeTemplateObject(["projects/", "/statuses/", ""], ["projects/", "/statuses/", ""])), projectId, sha), options);
    };
    Commits.prototype.references = function (projectId, sha, options) {
        return RequestHelper.get()(this, endpoint(templateObject_8$6 || (templateObject_8$6 = __makeTemplateObject(["projects/", "/repository/commits/", "/refs"], ["projects/", "/repository/commits/", "/refs"])), projectId, sha), options);
    };
    Commits.prototype.revert = function (projectId, sha, options) {
        return RequestHelper.post()(this, endpoint(templateObject_9$5 || (templateObject_9$5 = __makeTemplateObject(["projects/", "/repository/commits/", "/revert"], ["projects/", "/repository/commits/", "/revert"])), projectId, sha), options);
    };
    Commits.prototype.show = function (projectId, sha, options) {
        return RequestHelper.get()(this, endpoint(templateObject_10$4 || (templateObject_10$4 = __makeTemplateObject(["projects/", "/repository/commits/", ""], ["projects/", "/repository/commits/", ""])), projectId, sha), options);
    };
    Commits.prototype.statuses = function (projectId, sha, options) {
        return RequestHelper.get()(this, endpoint(templateObject_11$4 || (templateObject_11$4 = __makeTemplateObject(["projects/", "/repository/commits/", "/statuses"], ["projects/", "/repository/commits/", "/statuses"])), projectId, sha), options);
    };
    Commits.prototype.mergeRequests = function (projectId, sha, options) {
        return RequestHelper.get()(this, endpoint(templateObject_12$4 || (templateObject_12$4 = __makeTemplateObject(["projects/", "/repository/commits/", "/merge_requests"], ["projects/", "/repository/commits/", "/merge_requests"])), projectId, sha), options);
    };
    Commits.prototype.signature = function (projectId, sha, options) {
        return RequestHelper.get()(this, endpoint(templateObject_13$4 || (templateObject_13$4 = __makeTemplateObject(["projects/", "/repository/commits/", "/signature"], ["projects/", "/repository/commits/", "/signature"])), projectId, sha), options);
    };
    return Commits;
}(requesterUtils.BaseResource));
var templateObject_1$F, templateObject_2$y, templateObject_3$v, templateObject_4$u, templateObject_5$o, templateObject_6$f, templateObject_7$9, templateObject_8$6, templateObject_9$5, templateObject_10$4, templateObject_11$4, templateObject_12$4, templateObject_13$4;

var CommitDiscussions = /** @class */ (function (_super) {
    __extends(CommitDiscussions, _super);
    function CommitDiscussions(options) {
        /* istanbul ignore next */
        return _super.call(this, 'projects', 'repository/commits', options) || this;
    }
    return CommitDiscussions;
}(ResourceDiscussions));

var ContainerRegistry = /** @class */ (function (_super) {
    __extends(ContainerRegistry, _super);
    function ContainerRegistry() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    ContainerRegistry.prototype.projectRepositories = function (projectId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_1$E || (templateObject_1$E = __makeTemplateObject(["projects/", "/registry/repositories"], ["projects/", "/registry/repositories"])), projectId), options);
    };
    ContainerRegistry.prototype.groupRepositories = function (projectId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_2$x || (templateObject_2$x = __makeTemplateObject(["groups/", "/registry/repositories"], ["groups/", "/registry/repositories"])), projectId), options);
    };
    ContainerRegistry.prototype.showRepository = function (projectId, repositoryId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_3$u || (templateObject_3$u = __makeTemplateObject(["projects/", "/registry/repositories/", ""], ["projects/", "/registry/repositories/", ""])), projectId, repositoryId), options);
    };
    ContainerRegistry.prototype.tags = function (projectId, repositoryId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_4$t || (templateObject_4$t = __makeTemplateObject(["projects/", "/registry/repositories/", "/tags"], ["projects/", "/registry/repositories/", "/tags"])), projectId, repositoryId), options);
    };
    ContainerRegistry.prototype.removeRepository = function (projectId, repositoryId, options) {
        return RequestHelper.del()(this, endpoint(templateObject_5$n || (templateObject_5$n = __makeTemplateObject(["projects/", "/registry/repositories/", ""], ["projects/", "/registry/repositories/", ""])), projectId, repositoryId), options);
    };
    ContainerRegistry.prototype.removeTag = function (projectId, repositoryId, tagName, options) {
        return RequestHelper.del()(this, endpoint(templateObject_6$e || (templateObject_6$e = __makeTemplateObject(["projects/", "/registry/repositories/", "/tags/", ""], ["projects/", "/registry/repositories/", "/tags/", ""])), projectId, repositoryId, tagName), options);
    };
    ContainerRegistry.prototype.removeTags = function (projectId, repositoryId, nameRegexDelete, options) {
        return RequestHelper.del()(this, endpoint(templateObject_7$8 || (templateObject_7$8 = __makeTemplateObject(["projects/", "/registry/repositories/", "/tags"], ["projects/", "/registry/repositories/", "/tags"])), projectId, repositoryId), __assign({ nameRegexDelete: nameRegexDelete }, options));
    };
    ContainerRegistry.prototype.showTag = function (projectId, repositoryId, tagName, options) {
        return RequestHelper.get()(this, endpoint(templateObject_8$5 || (templateObject_8$5 = __makeTemplateObject(["projects/", "/registry/repositories/", "/tags/", ""], ["projects/", "/registry/repositories/", "/tags/", ""])), projectId, repositoryId, tagName), options);
    };
    return ContainerRegistry;
}(requesterUtils.BaseResource));
var templateObject_1$E, templateObject_2$x, templateObject_3$u, templateObject_4$t, templateObject_5$n, templateObject_6$e, templateObject_7$8, templateObject_8$5;

var Deployments = /** @class */ (function (_super) {
    __extends(Deployments, _super);
    function Deployments() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Deployments.prototype.all = function (projectId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_1$D || (templateObject_1$D = __makeTemplateObject(["projects/", "/deployments"], ["projects/", "/deployments"])), projectId), options);
    };
    Deployments.prototype.create = function (projectId, environment, sha, ref, tag, status, options) {
        return RequestHelper.post()(this, endpoint(templateObject_2$w || (templateObject_2$w = __makeTemplateObject(["projects/", "/deployments"], ["projects/", "/deployments"])), projectId), __assign({ environment: environment, sha: sha, ref: ref, tag: tag, status: status }, options));
    };
    Deployments.prototype.edit = function (projectId, deploymentId, status, options) {
        return RequestHelper.put()(this, endpoint(templateObject_3$t || (templateObject_3$t = __makeTemplateObject(["projects/", "/deployments/", ""], ["projects/", "/deployments/", ""])), projectId, deploymentId), __assign({ status: status }, options));
    };
    Deployments.prototype.show = function (projectId, deploymentId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_4$s || (templateObject_4$s = __makeTemplateObject(["projects/", "/deployments/", ""], ["projects/", "/deployments/", ""])), projectId, deploymentId), options);
    };
    Deployments.prototype.mergeRequests = function (projectId, deploymentId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_5$m || (templateObject_5$m = __makeTemplateObject(["projects/", "/deployments/", "/merge_requests"], ["projects/", "/deployments/", "/merge_requests"])), projectId, deploymentId), options);
    };
    return Deployments;
}(requesterUtils.BaseResource));
var templateObject_1$D, templateObject_2$w, templateObject_3$t, templateObject_4$s, templateObject_5$m;

var DeployKeys = /** @class */ (function (_super) {
    __extends(DeployKeys, _super);
    function DeployKeys() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    DeployKeys.prototype.add = function (projectId, options) {
        return RequestHelper.post()(this, endpoint(templateObject_1$C || (templateObject_1$C = __makeTemplateObject(["projects/", "/deploy_keys"], ["projects/", "/deploy_keys"])), projectId), options);
    };
    DeployKeys.prototype.all = function (_a) {
        if (_a === void 0) { _a = {}; }
        var projectId = _a.projectId, options = __rest(_a, ["projectId"]);
        var url;
        if (projectId) {
            url = endpoint(templateObject_2$v || (templateObject_2$v = __makeTemplateObject(["projects/", "/deploy_keys"], ["projects/", "/deploy_keys"])), projectId);
        }
        else {
            url = 'deploy_keys';
        }
        return RequestHelper.get()(this, url, options);
    };
    DeployKeys.prototype.edit = function (projectId, keyId, options) {
        return RequestHelper.put()(this, endpoint(templateObject_3$s || (templateObject_3$s = __makeTemplateObject(["projects/", "/deploy_keys/", ""], ["projects/", "/deploy_keys/", ""])), projectId, keyId), options);
    };
    DeployKeys.prototype.enable = function (projectId, keyId, options) {
        return RequestHelper.post()(this, endpoint(templateObject_4$r || (templateObject_4$r = __makeTemplateObject(["projects/", "/deploy_keys/", "/enable"], ["projects/", "/deploy_keys/", "/enable"])), projectId, keyId), options);
    };
    DeployKeys.prototype.remove = function (projectId, keyId, options) {
        return RequestHelper.del()(this, endpoint(templateObject_5$l || (templateObject_5$l = __makeTemplateObject(["projects/", "/deploy_keys/", ""], ["projects/", "/deploy_keys/", ""])), projectId, keyId), options);
    };
    DeployKeys.prototype.show = function (projectId, keyId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_6$d || (templateObject_6$d = __makeTemplateObject(["projects/", "/deploy_keys/", ""], ["projects/", "/deploy_keys/", ""])), projectId, keyId), options);
    };
    return DeployKeys;
}(requesterUtils.BaseResource));
var templateObject_1$C, templateObject_2$v, templateObject_3$s, templateObject_4$r, templateObject_5$l, templateObject_6$d;

var Environments = /** @class */ (function (_super) {
    __extends(Environments, _super);
    function Environments() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Environments.prototype.all = function (projectId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_1$B || (templateObject_1$B = __makeTemplateObject(["projects/", "/environments"], ["projects/", "/environments"])), projectId), options);
    };
    Environments.prototype.show = function (projectId, environmentId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_2$u || (templateObject_2$u = __makeTemplateObject(["projects/", "/environments/", ""], ["projects/", "/environments/", ""])), projectId, environmentId), options);
    };
    Environments.prototype.create = function (projectId, options) {
        return RequestHelper.post()(this, endpoint(templateObject_3$r || (templateObject_3$r = __makeTemplateObject(["projects/", "/environments"], ["projects/", "/environments"])), projectId), options);
    };
    Environments.prototype.edit = function (projectId, environmentId, options) {
        return RequestHelper.put()(this, endpoint(templateObject_4$q || (templateObject_4$q = __makeTemplateObject(["projects/", "/environments/", ""], ["projects/", "/environments/", ""])), projectId, environmentId), options);
    };
    Environments.prototype.remove = function (projectId, environmentId, options) {
        return RequestHelper.del()(this, endpoint(templateObject_5$k || (templateObject_5$k = __makeTemplateObject(["projects/", "/environments/", ""], ["projects/", "/environments/", ""])), projectId, environmentId), options);
    };
    Environments.prototype.stop = function (projectId, environmentId, options) {
        return RequestHelper.post()(this, endpoint(templateObject_6$c || (templateObject_6$c = __makeTemplateObject(["projects/", "/environments/", "/stop"], ["projects/", "/environments/", "/stop"])), projectId, environmentId), options);
    };
    return Environments;
}(requesterUtils.BaseResource));
var templateObject_1$B, templateObject_2$u, templateObject_3$r, templateObject_4$q, templateObject_5$k, templateObject_6$c;

var FreezePeriods = /** @class */ (function (_super) {
    __extends(FreezePeriods, _super);
    function FreezePeriods() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    FreezePeriods.prototype.all = function (projectId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_1$A || (templateObject_1$A = __makeTemplateObject(["projects/", "/freeze_periods"], ["projects/", "/freeze_periods"])), projectId), options);
    };
    FreezePeriods.prototype.show = function (projectId, freezePeriodId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_2$t || (templateObject_2$t = __makeTemplateObject(["projects/", "/freeze_periods/", ""], ["projects/", "/freeze_periods/", ""])), projectId, freezePeriodId), options);
    };
    FreezePeriods.prototype.create = function (projectId, freezeStart, freezeEnd, options) {
        return RequestHelper.post()(this, endpoint(templateObject_3$q || (templateObject_3$q = __makeTemplateObject(["projects/", "/freeze_periods"], ["projects/", "/freeze_periods"])), projectId), __assign({ freezeStart: freezeStart, freezeEnd: freezeEnd }, options));
    };
    FreezePeriods.prototype.edit = function (projectId, freezePeriodId, options) {
        return RequestHelper.put()(this, endpoint(templateObject_4$p || (templateObject_4$p = __makeTemplateObject(["projects/", "/freeze_periods/", ""], ["projects/", "/freeze_periods/", ""])), projectId, freezePeriodId), options);
    };
    FreezePeriods.prototype.delete = function (projectId, freezePeriodId, options) {
        return RequestHelper.del()(this, endpoint(templateObject_5$j || (templateObject_5$j = __makeTemplateObject(["projects/", "/freeze_periods/", ""], ["projects/", "/freeze_periods/", ""])), projectId, freezePeriodId), options);
    };
    return FreezePeriods;
}(requesterUtils.BaseResource));
var templateObject_1$A, templateObject_2$t, templateObject_3$q, templateObject_4$p, templateObject_5$j;

var Issues = /** @class */ (function (_super) {
    __extends(Issues, _super);
    function Issues() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Issues.prototype.addSpentTime = function (projectId, issueIid, duration, options) {
        return RequestHelper.post()(this, endpoint(templateObject_1$z || (templateObject_1$z = __makeTemplateObject(["projects/", "/issues/", "/add_spent_time"], ["projects/", "/issues/", "/add_spent_time"])), projectId, issueIid), __assign({ duration: duration }, options));
    };
    Issues.prototype.addTimeEstimate = function (projectId, issueIid, duration, options) {
        return RequestHelper.post()(this, endpoint(templateObject_2$s || (templateObject_2$s = __makeTemplateObject(["projects/", "/issues/", "/time_estimate"], ["projects/", "/issues/", "/time_estimate"])), projectId, issueIid), __assign({ duration: duration }, options));
    };
    Issues.prototype.all = function (_a) {
        if (_a === void 0) { _a = {}; }
        var projectId = _a.projectId, groupId = _a.groupId, options = __rest(_a, ["projectId", "groupId"]);
        var url;
        if (projectId) {
            url = endpoint(templateObject_3$p || (templateObject_3$p = __makeTemplateObject(["projects/", "/issues"], ["projects/", "/issues"])), projectId);
        }
        else if (groupId) {
            url = endpoint(templateObject_4$o || (templateObject_4$o = __makeTemplateObject(["groups/", "/issues"], ["groups/", "/issues"])), groupId);
        }
        else {
            url = 'issues';
        }
        return RequestHelper.get()(this, url, options);
    };
    Issues.prototype.create = function (projectId, options) {
        return RequestHelper.post()(this, endpoint(templateObject_5$i || (templateObject_5$i = __makeTemplateObject(["projects/", "/issues"], ["projects/", "/issues"])), projectId), options);
    };
    Issues.prototype.closedBy = function (projectId, issueIid, options) {
        return RequestHelper.get()(this, endpoint(templateObject_6$b || (templateObject_6$b = __makeTemplateObject(["projects/", "/issues/", "/closed_by"], ["projects/", "/issues/", "/closed_by"])), projectId, issueIid), options);
    };
    Issues.prototype.edit = function (projectId, issueIid, options) {
        return RequestHelper.put()(this, endpoint(templateObject_7$7 || (templateObject_7$7 = __makeTemplateObject(["projects/", "/issues/", ""], ["projects/", "/issues/", ""])), projectId, issueIid), options);
    };
    // TODO move
    Issues.prototype.link = function (projectId, issueIId, targetProjectId, targetIssueIId, options) {
        var _a = __read([targetProjectId, targetIssueIId].map(encodeURIComponent), 2), targetPId = _a[0], targetIId = _a[1];
        return RequestHelper.post()(this, endpoint(templateObject_8$4 || (templateObject_8$4 = __makeTemplateObject(["projects/", "/issues/", "/links"], ["projects/", "/issues/", "/links"])), projectId, issueIId), __assign({ targetProjectId: targetPId, targetIssueIid: targetIId }, options));
    };
    // TODO move
    Issues.prototype.links = function (projectId, issueIid) {
        return RequestHelper.get()(this, endpoint(templateObject_9$4 || (templateObject_9$4 = __makeTemplateObject(["projects/", "/issues/", "/links"], ["projects/", "/issues/", "/links"])), projectId, issueIid));
    };
    Issues.prototype.participants = function (projectId, issueIid, options) {
        return RequestHelper.get()(this, endpoint(templateObject_10$3 || (templateObject_10$3 = __makeTemplateObject(["projects/", "/issues/", "/participants"], ["projects/", "/issues/", "/participants"])), projectId, issueIid), options);
    };
    Issues.prototype.relatedMergeRequests = function (projectId, issueIid, options) {
        return RequestHelper.get()(this, endpoint(templateObject_11$3 || (templateObject_11$3 = __makeTemplateObject(["projects/", "/issues/", "/related_merge_requests"], ["projects/", "/issues/", "/related_merge_requests"])), projectId, issueIid), options);
    };
    // TODO move
    Issues.prototype.removeLink = function (projectId, issueIid, issueLinkId, options) {
        return RequestHelper.del()(this, endpoint(templateObject_12$3 || (templateObject_12$3 = __makeTemplateObject(["projects/", "/issues/", "/links/", ""], ["projects/", "/issues/", "/links/", ""])), projectId, issueIid, issueLinkId), options);
    };
    Issues.prototype.remove = function (projectId, issueIid, options) {
        return RequestHelper.del()(this, endpoint(templateObject_13$3 || (templateObject_13$3 = __makeTemplateObject(["projects/", "/issues/", ""], ["projects/", "/issues/", ""])), projectId, issueIid), options);
    };
    Issues.prototype.resetSpentTime = function (projectId, issueIid, options) {
        return RequestHelper.post()(this, endpoint(templateObject_14$3 || (templateObject_14$3 = __makeTemplateObject(["projects/", "/issues/", "/reset_spent_time"], ["projects/", "/issues/", "/reset_spent_time"])), projectId, issueIid), options);
    };
    Issues.prototype.resetTimeEstimate = function (projectId, issueIid, options) {
        return RequestHelper.post()(this, endpoint(templateObject_15$3 || (templateObject_15$3 = __makeTemplateObject(["projects/", "/issues/", "/reset_time_estimate"], ["projects/", "/issues/", "/reset_time_estimate"])), projectId, issueIid), options);
    };
    Issues.prototype.show = function (projectId, issueIid, options) {
        return RequestHelper.get()(this, endpoint(templateObject_16$3 || (templateObject_16$3 = __makeTemplateObject(["projects/", "/issues/", ""], ["projects/", "/issues/", ""])), projectId, issueIid), options);
    };
    Issues.prototype.subscribe = function (projectId, issueIid, options) {
        return RequestHelper.post()(this, endpoint(templateObject_17$1 || (templateObject_17$1 = __makeTemplateObject(["projects/", "/issues/", "/subscribe"], ["projects/", "/issues/", "/subscribe"])), projectId, issueIid), options);
    };
    Issues.prototype.timeStats = function (projectId, issueIid, options) {
        return RequestHelper.get()(this, endpoint(templateObject_18$1 || (templateObject_18$1 = __makeTemplateObject(["projects/", "/issues/", "/time_stats"], ["projects/", "/issues/", "/time_stats"])), projectId, issueIid), options);
    };
    Issues.prototype.unsubscribe = function (projectId, issueIid, options) {
        return RequestHelper.post()(this, endpoint(templateObject_19$1 || (templateObject_19$1 = __makeTemplateObject(["projects/", "/issues/", "/unsubscribe"], ["projects/", "/issues/", "/unsubscribe"])), projectId, issueIid), options);
    };
    return Issues;
}(requesterUtils.BaseResource));
var templateObject_1$z, templateObject_2$s, templateObject_3$p, templateObject_4$o, templateObject_5$i, templateObject_6$b, templateObject_7$7, templateObject_8$4, templateObject_9$4, templateObject_10$3, templateObject_11$3, templateObject_12$3, templateObject_13$3, templateObject_14$3, templateObject_15$3, templateObject_16$3, templateObject_17$1, templateObject_18$1, templateObject_19$1;

var IssuesStatistics = /** @class */ (function (_super) {
    __extends(IssuesStatistics, _super);
    function IssuesStatistics() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    IssuesStatistics.prototype.all = function (_a) {
        if (_a === void 0) { _a = {}; }
        var projectId = _a.projectId, groupId = _a.groupId, options = __rest(_a, ["projectId", "groupId"]);
        var url;
        if (projectId) {
            url = endpoint(templateObject_1$y || (templateObject_1$y = __makeTemplateObject(["projects/", "/issues_statistics"], ["projects/", "/issues_statistics"])), projectId);
        }
        else if (groupId) {
            url = endpoint(templateObject_2$r || (templateObject_2$r = __makeTemplateObject(["groups/", "/issues_statistics"], ["groups/", "/issues_statistics"])), groupId);
        }
        else {
            url = 'issues_statistics';
        }
        return RequestHelper.get()(this, url, options);
    };
    return IssuesStatistics;
}(requesterUtils.BaseResource));
var templateObject_1$y, templateObject_2$r;

var IssueNotes = /** @class */ (function (_super) {
    __extends(IssueNotes, _super);
    function IssueNotes(options) {
        /* istanbul ignore next */
        return _super.call(this, 'projects', 'issues', options) || this;
    }
    return IssueNotes;
}(ResourceNotes));

var IssueNoteAwardEmojis = /** @class */ (function (_super) {
    __extends(IssueNoteAwardEmojis, _super);
    function IssueNoteAwardEmojis(options) {
        /* istanbul ignore next */
        return _super.call(this, 'issues', options) || this;
    }
    return IssueNoteAwardEmojis;
}(ResourceNoteAwardEmojis));

var IssueDiscussions = /** @class */ (function (_super) {
    __extends(IssueDiscussions, _super);
    function IssueDiscussions(options) {
        /* istanbul ignore next */
        return _super.call(this, 'projects', 'issues', options) || this;
    }
    return IssueDiscussions;
}(ResourceDiscussions));

var IssueAwardEmojis = /** @class */ (function (_super) {
    __extends(IssueAwardEmojis, _super);
    function IssueAwardEmojis(options) {
        /* istanbul ignore next */
        return _super.call(this, 'issues', options) || this;
    }
    return IssueAwardEmojis;
}(ResourceAwardEmojis));

var Jobs = /** @class */ (function (_super) {
    __extends(Jobs, _super);
    function Jobs() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Jobs.prototype.all = function (projectId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_1$x || (templateObject_1$x = __makeTemplateObject(["projects/", "/jobs"], ["projects/", "/jobs"])), projectId), options);
    };
    Jobs.prototype.cancel = function (projectId, jobId, options) {
        return RequestHelper.post()(this, endpoint(templateObject_2$q || (templateObject_2$q = __makeTemplateObject(["projects/", "/jobs/", "/cancel"], ["projects/", "/jobs/", "/cancel"])), projectId, jobId), options);
    };
    // TODO move
    Jobs.prototype.downloadSingleArtifactFile = function (projectId, jobId, artifactPath, _a) {
        if (_a === void 0) { _a = {}; }
        var _b = _a.stream, stream = _b === void 0 ? false : _b, options = __rest(_a, ["stream"]);
        var _c = __read([projectId, jobId].map(encodeURIComponent), 2), pId = _c[0], jId = _c[1];
        var url = "projects/".concat(pId, "/jobs/").concat(jId, "/artifacts/").concat(artifactPath);
        if (stream) {
            return RequestHelper.stream(this, url, options);
        }
        return RequestHelper.get()(this, url, options);
    };
    // TODO move
    Jobs.prototype.downloadSingleArtifactFileFromRef = function (projectId, ref, artifactPath, jobName, _a) {
        if (_a === void 0) { _a = {}; }
        var _b = _a.stream, stream = _b === void 0 ? false : _b, options = __rest(_a, ["stream"]);
        var _c = __read([projectId, ref, jobName].map(encodeURIComponent), 3), pId = _c[0], rId = _c[1], name = _c[2];
        var url = "projects/".concat(pId, "/jobs/artifacts/").concat(rId, "/raw/").concat(artifactPath, "?job=").concat(name);
        if (stream) {
            return RequestHelper.stream(this, url, options);
        }
        return RequestHelper.get()(this, url, options);
    };
    // TODO move
    Jobs.prototype.downloadLatestArtifactFile = function (projectId, ref, jobName, _a) {
        if (_a === void 0) { _a = {}; }
        var _b = _a.stream, stream = _b === void 0 ? false : _b, options = __rest(_a, ["stream"]);
        var _c = __read([projectId, ref, jobName].map(encodeURIComponent), 3), pId = _c[0], rId = _c[1], name = _c[2];
        var url = "projects/".concat(pId, "/jobs/artifacts/").concat(rId, "/download?job=").concat(name);
        if (stream) {
            return RequestHelper.stream(this, url, options);
        }
        return RequestHelper.get()(this, url, options);
    };
    Jobs.prototype.downloadTraceFile = function (projectId, jobId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_3$o || (templateObject_3$o = __makeTemplateObject(["projects/", "/jobs/", "/trace"], ["projects/", "/jobs/", "/trace"])), projectId, jobId), options);
    };
    Jobs.prototype.erase = function (projectId, jobId, options) {
        return RequestHelper.post()(this, endpoint(templateObject_4$n || (templateObject_4$n = __makeTemplateObject(["projects/", "/jobs/", "/erase"], ["projects/", "/jobs/", "/erase"])), projectId, jobId), options);
    };
    // TODO move
    Jobs.prototype.eraseArtifacts = function (projectId, jobId, options) {
        var _a = __read([projectId, jobId].map(encodeURIComponent), 2), pId = _a[0], jId = _a[1];
        return RequestHelper.del()(this, "projects/".concat(pId, "/jobs/").concat(jId, "/artifacts"), options);
    };
    // TODO move
    Jobs.prototype.keepArtifacts = function (projectId, jobId, options) {
        var _a = __read([projectId, jobId].map(encodeURIComponent), 2), pId = _a[0], jId = _a[1];
        return RequestHelper.post()(this, "projects/".concat(pId, "/jobs/").concat(jId, "/artifacts/keep"), options);
    };
    Jobs.prototype.play = function (projectId, jobId, options) {
        return RequestHelper.post()(this, endpoint(templateObject_5$h || (templateObject_5$h = __makeTemplateObject(["projects/", "/jobs/", "/play"], ["projects/", "/jobs/", "/play"])), projectId, jobId), options);
    };
    Jobs.prototype.retry = function (projectId, jobId, options) {
        return RequestHelper.post()(this, endpoint(templateObject_6$a || (templateObject_6$a = __makeTemplateObject(["projects/", "/jobs/", "/retry"], ["projects/", "/jobs/", "/retry"])), projectId, jobId), options);
    };
    Jobs.prototype.show = function (projectId, jobId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_7$6 || (templateObject_7$6 = __makeTemplateObject(["projects/", "/jobs/", ""], ["projects/", "/jobs/", ""])), projectId, jobId), options);
    };
    Jobs.prototype.showPipelineJobs = function (projectId, pipelineId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_8$3 || (templateObject_8$3 = __makeTemplateObject(["projects/", "/pipelines/", "/jobs"], ["projects/", "/pipelines/", "/jobs"])), projectId, pipelineId), options);
    };
    Jobs.prototype.showPipelineBridges = function (projectId, pipelineId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_9$3 || (templateObject_9$3 = __makeTemplateObject(["projects/", "/pipelines/", "/bridges"], ["projects/", "/pipelines/", "/bridges"])), projectId, pipelineId), options);
    };
    return Jobs;
}(requesterUtils.BaseResource));
var templateObject_1$x, templateObject_2$q, templateObject_3$o, templateObject_4$n, templateObject_5$h, templateObject_6$a, templateObject_7$6, templateObject_8$3, templateObject_9$3;

var Labels = /** @class */ (function (_super) {
    __extends(Labels, _super);
    function Labels(options) {
        /* istanbul ignore next */
        return _super.call(this, 'projects', options) || this;
    }
    return Labels;
}(ResourceLabels));

var MergeRequests = /** @class */ (function (_super) {
    __extends(MergeRequests, _super);
    function MergeRequests() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    MergeRequests.prototype.accept = function (projectId, mergerequestIid, options) {
        return RequestHelper.put()(this, endpoint(templateObject_1$w || (templateObject_1$w = __makeTemplateObject(["projects/", "/merge_requests/", "/merge"], ["projects/", "/merge_requests/", "/merge"])), projectId, mergerequestIid), options);
    };
    MergeRequests.prototype.addSpentTime = function (projectId, mergerequestIid, duration, options) {
        return RequestHelper.post()(this, endpoint(templateObject_2$p || (templateObject_2$p = __makeTemplateObject(["projects/", "/merge_requests/", "/add_spent_time"], ["projects/", "/merge_requests/", "/add_spent_time"])), projectId, mergerequestIid), __assign({ duration: duration }, options));
    };
    MergeRequests.prototype.addTimeEstimate = function (projectId, mergerequestIid, duration, options) {
        return RequestHelper.post()(this, endpoint(templateObject_3$n || (templateObject_3$n = __makeTemplateObject(["projects/", "/merge_requests/", "/time_estimate"], ["projects/", "/merge_requests/", "/time_estimate"])), projectId, mergerequestIid), __assign({ duration: duration }, options));
    };
    MergeRequests.prototype.all = function (_a) {
        if (_a === void 0) { _a = {}; }
        var projectId = _a.projectId, groupId = _a.groupId, options = __rest(_a, ["projectId", "groupId"]);
        var url;
        if (projectId) {
            url = endpoint(templateObject_4$m || (templateObject_4$m = __makeTemplateObject(["projects/", "/merge_requests"], ["projects/", "/merge_requests"])), projectId);
        }
        else if (groupId) {
            url = endpoint(templateObject_5$g || (templateObject_5$g = __makeTemplateObject(["groups/", "/merge_requests"], ["groups/", "/merge_requests"])), groupId);
        }
        else {
            url = 'merge_requests';
        }
        return RequestHelper.get()(this, url, options);
    };
    MergeRequests.prototype.cancelOnPipelineSucess = function (projectId, mergerequestIid, options) {
        return RequestHelper.put()(this, endpoint(templateObject_6$9 || (templateObject_6$9 = __makeTemplateObject(["projects/", "/merge_requests/", "/cancel_merge_when_pipeline_succeeds"], ["projects/", "/merge_requests/", "/cancel_merge_when_pipeline_succeeds"])), projectId, mergerequestIid), options);
    };
    MergeRequests.prototype.changes = function (projectId, mergerequestIid, options) {
        return RequestHelper.get()(this, endpoint(templateObject_7$5 || (templateObject_7$5 = __makeTemplateObject(["projects/", "/merge_requests/", "/changes"], ["projects/", "/merge_requests/", "/changes"])), projectId, mergerequestIid), options);
    };
    MergeRequests.prototype.closesIssues = function (projectId, mergerequestIid, options) {
        return RequestHelper.get()(this, endpoint(templateObject_8$2 || (templateObject_8$2 = __makeTemplateObject(["projects/", "/merge_requests/", "/closes_issues"], ["projects/", "/merge_requests/", "/closes_issues"])), projectId, mergerequestIid), options);
    };
    MergeRequests.prototype.commits = function (projectId, mergerequestIid, options) {
        return RequestHelper.get()(this, endpoint(templateObject_9$2 || (templateObject_9$2 = __makeTemplateObject(["projects/", "/merge_requests/", "/commits"], ["projects/", "/merge_requests/", "/commits"])), projectId, mergerequestIid), options);
    };
    MergeRequests.prototype.create = function (projectId, sourceBranch, targetBranch, title, options) {
        return RequestHelper.post()(this, endpoint(templateObject_10$2 || (templateObject_10$2 = __makeTemplateObject(["projects/", "/merge_requests"], ["projects/", "/merge_requests"])), projectId), __assign({ sourceBranch: sourceBranch, targetBranch: targetBranch, title: title }, options));
    };
    MergeRequests.prototype.edit = function (projectId, mergerequestIid, options) {
        return RequestHelper.put()(this, endpoint(templateObject_11$2 || (templateObject_11$2 = __makeTemplateObject(["projects/", "/merge_requests/", ""], ["projects/", "/merge_requests/", ""])), projectId, mergerequestIid), options);
    };
    MergeRequests.prototype.participants = function (projectId, mergerequestIid, options) {
        return RequestHelper.get()(this, endpoint(templateObject_12$2 || (templateObject_12$2 = __makeTemplateObject(["projects/", "/merge_requests/", "/participants"], ["projects/", "/merge_requests/", "/participants"])), projectId, mergerequestIid), options);
    };
    MergeRequests.prototype.pipelines = function (projectId, mergerequestIid, options) {
        return RequestHelper.get()(this, endpoint(templateObject_13$2 || (templateObject_13$2 = __makeTemplateObject(["projects/", "/merge_requests/", "/pipelines"], ["projects/", "/merge_requests/", "/pipelines"])), projectId, mergerequestIid), options);
    };
    MergeRequests.prototype.rebase = function (projectId, mergerequestIid, options) {
        return RequestHelper.put()(this, endpoint(templateObject_14$2 || (templateObject_14$2 = __makeTemplateObject(["projects/", "/merge_requests/", "/rebase"], ["projects/", "/merge_requests/", "/rebase"])), projectId, mergerequestIid), options);
    };
    MergeRequests.prototype.remove = function (projectId, mergerequestIid, options) {
        return RequestHelper.del()(this, endpoint(templateObject_15$2 || (templateObject_15$2 = __makeTemplateObject(["projects/", "/merge_requests/", ""], ["projects/", "/merge_requests/", ""])), projectId, mergerequestIid), options);
    };
    MergeRequests.prototype.resetSpentTime = function (projectId, mergerequestIid, options) {
        return RequestHelper.post()(this, endpoint(templateObject_16$2 || (templateObject_16$2 = __makeTemplateObject(["projects/", "/merge_requests/", "/reset_spent_time"], ["projects/", "/merge_requests/", "/reset_spent_time"])), projectId, mergerequestIid), options);
    };
    MergeRequests.prototype.resetTimeEstimate = function (projectId, mergerequestIid, options) {
        return RequestHelper.post()(this, endpoint(templateObject_17 || (templateObject_17 = __makeTemplateObject(["projects/", "/merge_requests/", "/reset_time_estimate"], ["projects/", "/merge_requests/", "/reset_time_estimate"])), projectId, mergerequestIid), options);
    };
    MergeRequests.prototype.show = function (projectId, mergerequestIid, options) {
        return RequestHelper.get()(this, endpoint(templateObject_18 || (templateObject_18 = __makeTemplateObject(["projects/", "/merge_requests/", ""], ["projects/", "/merge_requests/", ""])), projectId, mergerequestIid), options);
    };
    MergeRequests.prototype.subscribe = function (projectId, mergerequestIid, options) {
        return RequestHelper.post()(this, endpoint(templateObject_19 || (templateObject_19 = __makeTemplateObject(["projects/", "/merge_requests/", "/subscribe"], ["projects/", "/merge_requests/", "/subscribe"])), projectId, mergerequestIid), options);
    };
    MergeRequests.prototype.timeStats = function (projectId, mergerequestIid, options) {
        return RequestHelper.get()(this, endpoint(templateObject_20 || (templateObject_20 = __makeTemplateObject(["projects/", "/merge_requests/", "/time_stats"], ["projects/", "/merge_requests/", "/time_stats"])), projectId, mergerequestIid), options);
    };
    MergeRequests.prototype.version = function (projectId, mergerequestIid, versionId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_21 || (templateObject_21 = __makeTemplateObject(["projects/", "/merge_requests/", "/versions/", ""], ["projects/", "/merge_requests/", "/versions/", ""])), projectId, mergerequestIid, versionId), options);
    };
    MergeRequests.prototype.versions = function (projectId, mergerequestIid, options) {
        return RequestHelper.get()(this, endpoint(templateObject_22 || (templateObject_22 = __makeTemplateObject(["projects/", "/merge_requests/", "/versions"], ["projects/", "/merge_requests/", "/versions"])), projectId, mergerequestIid), options);
    };
    MergeRequests.prototype.unsubscribe = function (projectId, mergerequestIid, options) {
        return RequestHelper.post()(this, endpoint(templateObject_23 || (templateObject_23 = __makeTemplateObject(["projects/", "/merge_requests/", "/unsubscribe"], ["projects/", "/merge_requests/", "/unsubscribe"])), projectId, mergerequestIid), options);
    };
    return MergeRequests;
}(requesterUtils.BaseResource));
var templateObject_1$w, templateObject_2$p, templateObject_3$n, templateObject_4$m, templateObject_5$g, templateObject_6$9, templateObject_7$5, templateObject_8$2, templateObject_9$2, templateObject_10$2, templateObject_11$2, templateObject_12$2, templateObject_13$2, templateObject_14$2, templateObject_15$2, templateObject_16$2, templateObject_17, templateObject_18, templateObject_19, templateObject_20, templateObject_21, templateObject_22, templateObject_23;

var MergeRequestApprovals = /** @class */ (function (_super) {
    __extends(MergeRequestApprovals, _super);
    function MergeRequestApprovals() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    MergeRequestApprovals.prototype.configuration = function (projectId, _a) {
        if (_a === void 0) { _a = {}; }
        var mergerequestIid = _a.mergerequestIid, options = __rest(_a, ["mergerequestIid"]);
        var url;
        if (mergerequestIid) {
            url = endpoint(templateObject_1$v || (templateObject_1$v = __makeTemplateObject(["projects/", "/merge_requests/", "/approvals"], ["projects/", "/merge_requests/", "/approvals"])), projectId, mergerequestIid);
        }
        else {
            url = endpoint(templateObject_2$o || (templateObject_2$o = __makeTemplateObject(["projects/", "/approvals"], ["projects/", "/approvals"])), projectId);
        }
        return RequestHelper.get()(this, url, options);
    };
    MergeRequestApprovals.prototype.editConfiguration = function (projectId, _a) {
        if (_a === void 0) { _a = {}; }
        var mergerequestIid = _a.mergerequestIid, options = __rest(_a, ["mergerequestIid"]);
        var url;
        if (mergerequestIid) {
            url = endpoint(templateObject_3$m || (templateObject_3$m = __makeTemplateObject(["projects/", "/merge_requests/", "/approvals"], ["projects/", "/merge_requests/", "/approvals"])), projectId, mergerequestIid);
        }
        else {
            url = endpoint(templateObject_4$l || (templateObject_4$l = __makeTemplateObject(["projects/", "/approvals"], ["projects/", "/approvals"])), projectId);
        }
        return RequestHelper.post()(this, url, options);
    };
    MergeRequestApprovals.prototype.approvalRule = function (projectId, approvalRuleId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_5$f || (templateObject_5$f = __makeTemplateObject(["projects/", "/approval_rules/", ""], ["projects/", "/approval_rules/", ""])), projectId, approvalRuleId), options);
    };
    MergeRequestApprovals.prototype.approvalRules = function (projectId, _a) {
        if (_a === void 0) { _a = {}; }
        var mergerequestIid = _a.mergerequestIid, options = __rest(_a, ["mergerequestIid"]);
        var url;
        if (mergerequestIid) {
            url = endpoint(templateObject_6$8 || (templateObject_6$8 = __makeTemplateObject(["projects/", "/merge_requests/", "/approval_rules"], ["projects/", "/merge_requests/", "/approval_rules"])), projectId, mergerequestIid);
        }
        else {
            url = endpoint(templateObject_7$4 || (templateObject_7$4 = __makeTemplateObject(["projects/", "/approval_rules"], ["projects/", "/approval_rules"])), projectId);
        }
        return RequestHelper.get()(this, url, options);
    };
    MergeRequestApprovals.prototype.addApprovalRule = function (projectId, name, approvalsRequired, _a) {
        if (_a === void 0) { _a = {}; }
        var mergerequestIid = _a.mergerequestIid, options = __rest(_a, ["mergerequestIid"]);
        var url;
        if (mergerequestIid) {
            url = endpoint(templateObject_8$1 || (templateObject_8$1 = __makeTemplateObject(["projects/", "/merge_requests/", "/approval_rules"], ["projects/", "/merge_requests/", "/approval_rules"])), projectId, mergerequestIid);
        }
        else {
            url = endpoint(templateObject_9$1 || (templateObject_9$1 = __makeTemplateObject(["projects/", "/approval_rules"], ["projects/", "/approval_rules"])), projectId);
        }
        return RequestHelper.post()(this, url, __assign({ name: name, approvalsRequired: approvalsRequired }, options));
    };
    MergeRequestApprovals.prototype.approvalState = function (projectId, mergerequestIid, options) {
        return RequestHelper.get()(this, endpoint(templateObject_10$1 || (templateObject_10$1 = __makeTemplateObject(["projects/", "/merge_requests/", "/approval_state"], ["projects/", "/merge_requests/", "/approval_state"])), projectId, mergerequestIid), options);
    };
    MergeRequestApprovals.prototype.editApprovalRule = function (projectId, approvalRuleId, name, approvalsRequired, _a) {
        if (_a === void 0) { _a = {}; }
        var mergerequestIid = _a.mergerequestIid, options = __rest(_a, ["mergerequestIid"]);
        var url;
        if (mergerequestIid) {
            url = endpoint(templateObject_11$1 || (templateObject_11$1 = __makeTemplateObject(["projects/", "/merge_requests/", "/approval_rules/", ""], ["projects/", "/merge_requests/", "/approval_rules/", ""])), projectId, mergerequestIid, approvalRuleId);
        }
        else {
            url = endpoint(templateObject_12$1 || (templateObject_12$1 = __makeTemplateObject(["projects/", "/approval_rules/", ""], ["projects/", "/approval_rules/", ""])), projectId, approvalRuleId);
        }
        return RequestHelper.put()(this, url, __assign({ name: name, approvalsRequired: approvalsRequired }, options));
    };
    MergeRequestApprovals.prototype.removeApprovalRule = function (projectId, approvalRuleId, _a) {
        if (_a === void 0) { _a = {}; }
        var mergerequestIid = _a.mergerequestIid, options = __rest(_a, ["mergerequestIid"]);
        var url;
        if (mergerequestIid) {
            url = endpoint(templateObject_13$1 || (templateObject_13$1 = __makeTemplateObject(["projects/", "/merge_requests/", "/approval_rules/", ""], ["projects/", "/merge_requests/", "/approval_rules/", ""])), projectId, mergerequestIid, approvalRuleId);
        }
        else {
            url = endpoint(templateObject_14$1 || (templateObject_14$1 = __makeTemplateObject(["projects/", "/approval_rules/", ""], ["projects/", "/approval_rules/", ""])), projectId, approvalRuleId);
        }
        return RequestHelper.del()(this, url, __assign({}, options));
    };
    MergeRequestApprovals.prototype.approve = function (projectId, mergerequestIid, options) {
        return RequestHelper.post()(this, endpoint(templateObject_15$1 || (templateObject_15$1 = __makeTemplateObject(["projects/", "/merge_requests/", "/approve"], ["projects/", "/merge_requests/", "/approve"])), projectId, mergerequestIid), options);
    };
    MergeRequestApprovals.prototype.unapprove = function (projectId, mergerequestIid, options) {
        return RequestHelper.post()(this, endpoint(templateObject_16$1 || (templateObject_16$1 = __makeTemplateObject(["projects/", "/merge_requests/", "/unapprove"], ["projects/", "/merge_requests/", "/unapprove"])), projectId, mergerequestIid), options);
    };
    return MergeRequestApprovals;
}(requesterUtils.BaseResource));
var templateObject_1$v, templateObject_2$o, templateObject_3$m, templateObject_4$l, templateObject_5$f, templateObject_6$8, templateObject_7$4, templateObject_8$1, templateObject_9$1, templateObject_10$1, templateObject_11$1, templateObject_12$1, templateObject_13$1, templateObject_14$1, templateObject_15$1, templateObject_16$1;

var MergeRequestAwardEmojis = /** @class */ (function (_super) {
    __extends(MergeRequestAwardEmojis, _super);
    function MergeRequestAwardEmojis(options) {
        /* istanbul ignore next */
        return _super.call(this, 'merge_requests', options) || this;
    }
    return MergeRequestAwardEmojis;
}(ResourceAwardEmojis));

var MergeRequestDiscussions = /** @class */ (function (_super) {
    __extends(MergeRequestDiscussions, _super);
    function MergeRequestDiscussions(options) {
        /* istanbul ignore next */
        return _super.call(this, 'projects', 'merge_requests', options) || this;
    }
    MergeRequestDiscussions.prototype.resolve = function (projectId, mergerequestId, discussionId, resolved) {
        return RequestHelper.put()(this, endpoint(templateObject_1$u || (templateObject_1$u = __makeTemplateObject(["", "/", "/", "/discussions/", ""], ["", "/", "/", "/discussions/", ""])), projectId, this.resource2Type, mergerequestId, discussionId), {
            resolved: resolved,
        });
    };
    return MergeRequestDiscussions;
}(ResourceDiscussions));
var templateObject_1$u;

var MergeRequestNotes = /** @class */ (function (_super) {
    __extends(MergeRequestNotes, _super);
    function MergeRequestNotes(options) {
        /* istanbul ignore next */
        return _super.call(this, 'projects', 'merge_requests', options) || this;
    }
    return MergeRequestNotes;
}(ResourceNotes));

var Packages = /** @class */ (function (_super) {
    __extends(Packages, _super);
    function Packages() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Packages.prototype.all = function (_a) {
        if (_a === void 0) { _a = {}; }
        var projectId = _a.projectId, groupId = _a.groupId, options = __rest(_a, ["projectId", "groupId"]);
        var url;
        if (projectId) {
            url = endpoint(templateObject_1$t || (templateObject_1$t = __makeTemplateObject(["projects/", "/packages"], ["projects/", "/packages"])), projectId);
        }
        else if (groupId) {
            url = endpoint(templateObject_2$n || (templateObject_2$n = __makeTemplateObject(["groups/", "/packages"], ["groups/", "/packages"])), groupId);
        }
        else {
            throw new Error('projectId or groupId must be passed');
        }
        return RequestHelper.get()(this, url, options);
    };
    Packages.prototype.remove = function (projectId, packageId, options) {
        return RequestHelper.del()(this, endpoint(templateObject_3$l || (templateObject_3$l = __makeTemplateObject(["projects/", "/packages/", ""], ["projects/", "/packages/", ""])), projectId, packageId), options);
    };
    Packages.prototype.removeFile = function (projectId, packageId, projectFileId, options) {
        return RequestHelper.del()(this, endpoint(templateObject_4$k || (templateObject_4$k = __makeTemplateObject(["projects/", "/packages/", "/package_files/", ""], ["projects/", "/packages/", "/package_files/", ""])), projectId, packageId, projectFileId), options);
    };
    Packages.prototype.show = function (projectId, packageId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_5$e || (templateObject_5$e = __makeTemplateObject(["projects/", "/packages/", ""], ["projects/", "/packages/", ""])), projectId, packageId), options);
    };
    Packages.prototype.showFiles = function (projectId, packageId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_6$7 || (templateObject_6$7 = __makeTemplateObject(["projects/", "/packages/", "/package_files"], ["projects/", "/packages/", "/package_files"])), projectId, packageId), options);
    };
    return Packages;
}(requesterUtils.BaseResource));
var templateObject_1$t, templateObject_2$n, templateObject_3$l, templateObject_4$k, templateObject_5$e, templateObject_6$7;

var PackageRegistry = /** @class */ (function (_super) {
    __extends(PackageRegistry, _super);
    function PackageRegistry() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    PackageRegistry.prototype.publish = function (projectId, packageName, packageVersion, filename, content, _a) {
        if (_a === void 0) { _a = {}; }
        var contentType = _a.contentType, options = __rest(_a, ["contentType"]);
        var pId = encodeURIComponent(projectId);
        var meta = { filename: filename, contentType: contentType };
        if (!meta.contentType)
            meta.contentType = Mime__namespace.getType(meta.filename) || undefined;
        return RequestHelper.put()(this, "projects/".concat(pId, "/packages/generic/").concat(packageName, "/").concat(packageVersion, "/").concat(filename), __assign({ isForm: true, file: [content, meta] }, options));
    };
    PackageRegistry.prototype.download = function (projectId, packageName, packageVersion, filename, options) {
        var pId = encodeURIComponent(projectId);
        return RequestHelper.get()(this, "projects/".concat(pId, "/packages/generic/").concat(packageName, "/").concat(packageVersion, "/").concat(filename), options);
    };
    return PackageRegistry;
}(requesterUtils.BaseResource));

// TODO: Add missing function
var Pipelines = /** @class */ (function (_super) {
    __extends(Pipelines, _super);
    function Pipelines() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Pipelines.prototype.all = function (projectId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_1$s || (templateObject_1$s = __makeTemplateObject(["projects/", "/pipelines"], ["projects/", "/pipelines"])), projectId), options);
    };
    Pipelines.prototype.create = function (projectId, ref, options) {
        return RequestHelper.post()(this, endpoint(templateObject_2$m || (templateObject_2$m = __makeTemplateObject(["projects/", "/pipeline"], ["projects/", "/pipeline"])), projectId), __assign({ ref: ref }, options));
    };
    Pipelines.prototype.delete = function (projectId, pipelineId, options) {
        return RequestHelper.del()(this, endpoint(templateObject_3$k || (templateObject_3$k = __makeTemplateObject(["projects/", "/pipelines/", ""], ["projects/", "/pipelines/", ""])), projectId, pipelineId), options);
    };
    Pipelines.prototype.show = function (projectId, pipelineId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_4$j || (templateObject_4$j = __makeTemplateObject(["projects/", "/pipelines/", ""], ["projects/", "/pipelines/", ""])), projectId, pipelineId), options);
    };
    Pipelines.prototype.retry = function (projectId, pipelineId, options) {
        return RequestHelper.post()(this, endpoint(templateObject_5$d || (templateObject_5$d = __makeTemplateObject(["projects/", "/pipelines/", "/retry"], ["projects/", "/pipelines/", "/retry"])), projectId, pipelineId), options);
    };
    Pipelines.prototype.cancel = function (projectId, pipelineId, options) {
        return RequestHelper.post()(this, endpoint(templateObject_6$6 || (templateObject_6$6 = __makeTemplateObject(["projects/", "/pipelines/", "/cancel"], ["projects/", "/pipelines/", "/cancel"])), projectId, pipelineId), options);
    };
    Pipelines.prototype.allVariables = function (projectId, pipelineId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_7$3 || (templateObject_7$3 = __makeTemplateObject(["projects/", "/pipelines/", "/variables"], ["projects/", "/pipelines/", "/variables"])), projectId, pipelineId), options);
    };
    return Pipelines;
}(requesterUtils.BaseResource));
var templateObject_1$s, templateObject_2$m, templateObject_3$k, templateObject_4$j, templateObject_5$d, templateObject_6$6, templateObject_7$3;

var PipelineSchedules = /** @class */ (function (_super) {
    __extends(PipelineSchedules, _super);
    function PipelineSchedules() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    PipelineSchedules.prototype.all = function (projectId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_1$r || (templateObject_1$r = __makeTemplateObject(["projects/", "/pipeline_schedules"], ["projects/", "/pipeline_schedules"])), projectId), options);
    };
    PipelineSchedules.prototype.create = function (projectId, description, ref, cron, options) {
        return RequestHelper.post()(this, endpoint(templateObject_2$l || (templateObject_2$l = __makeTemplateObject(["projects/", "/pipeline_schedules"], ["projects/", "/pipeline_schedules"])), projectId), __assign({ description: description, ref: ref, cron: cron }, options));
    };
    PipelineSchedules.prototype.edit = function (projectId, scheduleId, options) {
        return RequestHelper.put()(this, endpoint(templateObject_3$j || (templateObject_3$j = __makeTemplateObject(["projects/", "/pipeline_schedules/", ""], ["projects/", "/pipeline_schedules/", ""])), projectId, scheduleId), options);
    };
    PipelineSchedules.prototype.remove = function (projectId, scheduleId, options) {
        return RequestHelper.del()(this, endpoint(templateObject_4$i || (templateObject_4$i = __makeTemplateObject(["projects/", "/pipeline_schedules/", ""], ["projects/", "/pipeline_schedules/", ""])), projectId, scheduleId), options);
    };
    PipelineSchedules.prototype.show = function (projectId, scheduleId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_5$c || (templateObject_5$c = __makeTemplateObject(["projects/", "/pipeline_schedules/", ""], ["projects/", "/pipeline_schedules/", ""])), projectId, scheduleId), options);
    };
    PipelineSchedules.prototype.takeOwnership = function (projectId, scheduleId, options) {
        return RequestHelper.post()(this, endpoint(templateObject_6$5 || (templateObject_6$5 = __makeTemplateObject(["projects/", "/pipeline_schedules/", "/take_ownership"], ["projects/", "/pipeline_schedules/", "/take_ownership"])), projectId, scheduleId), options);
    };
    return PipelineSchedules;
}(requesterUtils.BaseResource));
var templateObject_1$r, templateObject_2$l, templateObject_3$j, templateObject_4$i, templateObject_5$c, templateObject_6$5;

var PipelineScheduleVariables = /** @class */ (function (_super) {
    __extends(PipelineScheduleVariables, _super);
    function PipelineScheduleVariables() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    PipelineScheduleVariables.prototype.all = function (projectId, pipelineScheduleId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_1$q || (templateObject_1$q = __makeTemplateObject(["projects/", "/pipeline_schedules/", "/variables"], ["projects/", "/pipeline_schedules/", "/variables"])), projectId, pipelineScheduleId), options);
    };
    PipelineScheduleVariables.prototype.create = function (projectId, pipelineScheduleId, options) {
        return RequestHelper.post()(this, endpoint(templateObject_2$k || (templateObject_2$k = __makeTemplateObject(["projects/", "/pipeline_schedules/", "/variables"], ["projects/", "/pipeline_schedules/", "/variables"])), projectId, pipelineScheduleId), options);
    };
    PipelineScheduleVariables.prototype.edit = function (projectId, pipelineScheduleId, keyId, options) {
        return RequestHelper.put()(this, endpoint(templateObject_3$i || (templateObject_3$i = __makeTemplateObject(["projects/", "/pipeline_schedules/", "/variables/", ""], ["projects/", "/pipeline_schedules/", "/variables/", ""])), projectId, pipelineScheduleId, keyId), options);
    };
    PipelineScheduleVariables.prototype.show = function (projectId, pipelineScheduleId, keyId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_4$h || (templateObject_4$h = __makeTemplateObject(["projects/", "/pipeline_schedules/", "/variables/", ""], ["projects/", "/pipeline_schedules/", "/variables/", ""])), projectId, pipelineScheduleId, keyId), options);
    };
    PipelineScheduleVariables.prototype.remove = function (projectId, pipelineScheduleId, keyId, options) {
        return RequestHelper.del()(this, endpoint(templateObject_5$b || (templateObject_5$b = __makeTemplateObject(["projects/", "/pipeline_schedules/", "/variables/", ""], ["projects/", "/pipeline_schedules/", "/variables/", ""])), projectId, pipelineScheduleId, keyId), options);
    };
    return PipelineScheduleVariables;
}(requesterUtils.BaseResource));
var templateObject_1$q, templateObject_2$k, templateObject_3$i, templateObject_4$h, templateObject_5$b;

var defaultMetadata = {
    filename: "".concat(Date.now().toString(), ".tar.gz"),
};
var ProjectImportExport = /** @class */ (function (_super) {
    __extends(ProjectImportExport, _super);
    function ProjectImportExport() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    ProjectImportExport.prototype.download = function (projectId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_1$p || (templateObject_1$p = __makeTemplateObject(["projects/", "/export/download"], ["projects/", "/export/download"])), projectId), options);
    };
    ProjectImportExport.prototype.exportStatus = function (projectId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_2$j || (templateObject_2$j = __makeTemplateObject(["projects/", "/export"], ["projects/", "/export"])), projectId), options);
    };
    ProjectImportExport.prototype.import = function (content, path, _a) {
        if (_a === void 0) { _a = {}; }
        var metadata = _a.metadata, options = __rest(_a, ["metadata"]);
        var meta = __assign(__assign({}, defaultMetadata), metadata);
        if (!meta.contentType)
            meta.contentType = Mime__namespace.getType(meta.filename) || undefined;
        return RequestHelper.post()(this, 'projects/import', __assign(__assign({ isForm: true }, options), { file: [content, meta], path: path }));
    };
    ProjectImportExport.prototype.importStatus = function (projectId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_3$h || (templateObject_3$h = __makeTemplateObject(["projects/", "/import"], ["projects/", "/import"])), projectId), options);
    };
    ProjectImportExport.prototype.schedule = function (projectId, options) {
        return RequestHelper.post()(this, endpoint(templateObject_4$g || (templateObject_4$g = __makeTemplateObject(["projects/", "/export"], ["projects/", "/export"])), projectId), options);
    };
    return ProjectImportExport;
}(requesterUtils.BaseResource));
var templateObject_1$p, templateObject_2$j, templateObject_3$h, templateObject_4$g;

var Projects = /** @class */ (function (_super) {
    __extends(Projects, _super);
    function Projects() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Projects.prototype.all = function (options) {
        return RequestHelper.get()(this, 'projects', options);
    };
    Projects.prototype.archive = function (projectId, options) {
        return RequestHelper.post()(this, endpoint(templateObject_1$o || (templateObject_1$o = __makeTemplateObject(["projects/", "/archive"], ["projects/", "/archive"])), projectId), options);
    };
    Projects.prototype.create = function (_a) {
        var userId = _a.userId, options = __rest(_a, ["userId"]);
        var url = userId ? "projects/user/".concat(userId) : 'projects';
        return RequestHelper.post()(this, url, options);
    };
    Projects.prototype.edit = function (projectId, options) {
        return RequestHelper.put()(this, endpoint(templateObject_2$i || (templateObject_2$i = __makeTemplateObject(["projects/", ""], ["projects/", ""])), projectId), options);
    };
    Projects.prototype.fork = function (projectId, _a) {
        if (_a === void 0) { _a = {}; }
        var forkedFromId = _a.forkedFromId, options = __rest(_a, ["forkedFromId"]);
        var url = endpoint(templateObject_3$g || (templateObject_3$g = __makeTemplateObject(["projects/", "/fork"], ["projects/", "/fork"])), projectId);
        if (forkedFromId)
            url += "/".concat(encodeURIComponent(forkedFromId));
        return RequestHelper.post()(this, url, options);
    };
    Projects.prototype.forks = function (projectId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_4$f || (templateObject_4$f = __makeTemplateObject(["projects/", "/forks"], ["projects/", "/forks"])), projectId), options);
    };
    Projects.prototype.languages = function (projectId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_5$a || (templateObject_5$a = __makeTemplateObject(["projects/", "/languages"], ["projects/", "/languages"])), projectId), options);
    };
    Projects.prototype.mirrorPull = function (projectId, options) {
        return RequestHelper.post()(this, endpoint(templateObject_6$4 || (templateObject_6$4 = __makeTemplateObject(["projects/", "/mirror/pull"], ["projects/", "/mirror/pull"])), projectId), options);
    };
    Projects.prototype.remove = function (projectId, options) {
        return RequestHelper.del()(this, endpoint(templateObject_7$2 || (templateObject_7$2 = __makeTemplateObject(["projects/", ""], ["projects/", ""])), projectId), options);
    };
    Projects.prototype.removeFork = function (projectId, options) {
        return RequestHelper.del()(this, endpoint(templateObject_8 || (templateObject_8 = __makeTemplateObject(["projects/", "/fork"], ["projects/", "/fork"])), projectId), options);
    };
    Projects.prototype.search = function (projectName, options) {
        return RequestHelper.get()(this, 'projects', __assign({ search: projectName }, options));
    };
    Projects.prototype.share = function (projectId, groupId, groupAccess, options) {
        return RequestHelper.post()(this, endpoint(templateObject_9 || (templateObject_9 = __makeTemplateObject(["projects/", "/share"], ["projects/", "/share"])), projectId), __assign({ groupId: groupId, groupAccess: groupAccess }, options));
    };
    Projects.prototype.show = function (projectId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_10 || (templateObject_10 = __makeTemplateObject(["projects/", ""], ["projects/", ""])), projectId), options);
    };
    Projects.prototype.star = function (projectId, options) {
        return RequestHelper.post()(this, endpoint(templateObject_11 || (templateObject_11 = __makeTemplateObject(["projects/", "/star"], ["projects/", "/star"])), projectId), options);
    };
    Projects.prototype.transfer = function (projectId, namespaceId) {
        return RequestHelper.put()(this, endpoint(templateObject_12 || (templateObject_12 = __makeTemplateObject(["projects/", "/transfer"], ["projects/", "/transfer"])), projectId), {
            namespace: namespaceId,
        });
    };
    Projects.prototype.unarchive = function (projectId, options) {
        return RequestHelper.post()(this, endpoint(templateObject_13 || (templateObject_13 = __makeTemplateObject(["projects/", "/unarchive"], ["projects/", "/unarchive"])), projectId), options);
    };
    Projects.prototype.unshare = function (projectId, groupId, options) {
        return RequestHelper.del()(this, endpoint(templateObject_14 || (templateObject_14 = __makeTemplateObject(["projects/", "/share/", ""], ["projects/", "/share/", ""])), projectId, groupId), options);
    };
    Projects.prototype.unstar = function (projectId, options) {
        return RequestHelper.post()(this, endpoint(templateObject_15 || (templateObject_15 = __makeTemplateObject(["projects/", "/unstar"], ["projects/", "/unstar"])), projectId), options);
    };
    Projects.prototype.upload = function (projectId, content, _a) {
        if (_a === void 0) { _a = {}; }
        var metadata = _a.metadata, options = __rest(_a, ["metadata"]);
        var meta = __assign(__assign({}, defaultMetadata), metadata);
        if (!meta.contentType)
            meta.contentType = Mime__namespace.getType(meta.filename) || undefined;
        return RequestHelper.post()(this, endpoint(templateObject_16 || (templateObject_16 = __makeTemplateObject(["projects/", "/uploads"], ["projects/", "/uploads"])), projectId), __assign({ isForm: true, file: [content, meta] }, options));
    };
    return Projects;
}(requesterUtils.BaseResource));
var templateObject_1$o, templateObject_2$i, templateObject_3$g, templateObject_4$f, templateObject_5$a, templateObject_6$4, templateObject_7$2, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16;

var ProjectAccessRequests = /** @class */ (function (_super) {
    __extends(ProjectAccessRequests, _super);
    function ProjectAccessRequests(options) {
        /* istanbul ignore next */
        return _super.call(this, 'projects', options) || this;
    }
    return ProjectAccessRequests;
}(ResourceAccessRequests));

var ProjectBadges = /** @class */ (function (_super) {
    __extends(ProjectBadges, _super);
    function ProjectBadges(options) {
        /* istanbul ignore next */
        return _super.call(this, 'projects', options) || this;
    }
    return ProjectBadges;
}(ResourceBadges));

var ProjectCustomAttributes = /** @class */ (function (_super) {
    __extends(ProjectCustomAttributes, _super);
    function ProjectCustomAttributes(options) {
        /* istanbul ignore next */
        return _super.call(this, 'projects', options) || this;
    }
    return ProjectCustomAttributes;
}(ResourceCustomAttributes));

var ProjectIssueBoards = /** @class */ (function (_super) {
    __extends(ProjectIssueBoards, _super);
    function ProjectIssueBoards(options) {
        /* istanbul ignore next */
        return _super.call(this, 'projects', options) || this;
    }
    return ProjectIssueBoards;
}(ResourceIssueBoards));

var ProjectHooks = /** @class */ (function (_super) {
    __extends(ProjectHooks, _super);
    function ProjectHooks() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    ProjectHooks.prototype.all = function (projectId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_1$n || (templateObject_1$n = __makeTemplateObject(["projects/", "/hooks"], ["projects/", "/hooks"])), projectId), options);
    };
    ProjectHooks.prototype.show = function (projectId, hookId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_2$h || (templateObject_2$h = __makeTemplateObject(["projects/", "/hooks/", ""], ["projects/", "/hooks/", ""])), projectId, hookId), options);
    };
    ProjectHooks.prototype.add = function (projectId, url, options) {
        return RequestHelper.post()(this, endpoint(templateObject_3$f || (templateObject_3$f = __makeTemplateObject(["projects/", "/hooks"], ["projects/", "/hooks"])), projectId), __assign({ url: url }, options));
    };
    ProjectHooks.prototype.edit = function (projectId, hookId, url, options) {
        return RequestHelper.put()(this, endpoint(templateObject_4$e || (templateObject_4$e = __makeTemplateObject(["projects/", "/hooks/", ""], ["projects/", "/hooks/", ""])), projectId, hookId), __assign({ url: url }, options));
    };
    ProjectHooks.prototype.remove = function (projectId, hookId, options) {
        return RequestHelper.del()(this, endpoint(templateObject_5$9 || (templateObject_5$9 = __makeTemplateObject(["projects/", "/hooks/", ""], ["projects/", "/hooks/", ""])), projectId, hookId), options);
    };
    return ProjectHooks;
}(requesterUtils.BaseResource));
var templateObject_1$n, templateObject_2$h, templateObject_3$f, templateObject_4$e, templateObject_5$9;

var ProjectMembers = /** @class */ (function (_super) {
    __extends(ProjectMembers, _super);
    function ProjectMembers(options) {
        /* istanbul ignore next */
        return _super.call(this, 'projects', options) || this;
    }
    return ProjectMembers;
}(ResourceMembers));

var ProjectMilestones = /** @class */ (function (_super) {
    __extends(ProjectMilestones, _super);
    function ProjectMilestones(options) {
        /* istanbul ignore next */
        return _super.call(this, 'projects', options) || this;
    }
    return ProjectMilestones;
}(ResourceMilestones));

var ProjectSnippets = /** @class */ (function (_super) {
    __extends(ProjectSnippets, _super);
    function ProjectSnippets() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    ProjectSnippets.prototype.all = function (projectId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_1$m || (templateObject_1$m = __makeTemplateObject(["projects/", "/snippets"], ["projects/", "/snippets"])), projectId), options);
    };
    ProjectSnippets.prototype.content = function (projectId, snippetId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_2$g || (templateObject_2$g = __makeTemplateObject(["projects/", "/snippets/", "/raw"], ["projects/", "/snippets/", "/raw"])), projectId, snippetId), options);
    };
    ProjectSnippets.prototype.create = function (projectId, title, fileName, code, visibility, options) {
        return RequestHelper.post()(this, endpoint(templateObject_3$e || (templateObject_3$e = __makeTemplateObject(["projects/", "/snippets"], ["projects/", "/snippets"])), projectId), __assign({ title: title, fileName: fileName, code: code, visibility: visibility }, options));
    };
    ProjectSnippets.prototype.edit = function (projectId, snippetId, options) {
        return RequestHelper.put()(this, endpoint(templateObject_4$d || (templateObject_4$d = __makeTemplateObject(["projects/", "/snippets/", ""], ["projects/", "/snippets/", ""])), projectId, snippetId), options);
    };
    ProjectSnippets.prototype.remove = function (projectId, snippetId, options) {
        return RequestHelper.del()(this, endpoint(templateObject_5$8 || (templateObject_5$8 = __makeTemplateObject(["projects/", "/snippets/", ""], ["projects/", "/snippets/", ""])), projectId, snippetId), options);
    };
    ProjectSnippets.prototype.show = function (projectId, snippetId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_6$3 || (templateObject_6$3 = __makeTemplateObject(["projects/", "/snippets/", ""], ["projects/", "/snippets/", ""])), projectId, snippetId), options);
    };
    ProjectSnippets.prototype.userAgentDetails = function (projectId, snippetId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_7$1 || (templateObject_7$1 = __makeTemplateObject(["projects/", "/snippets/", "/user_agent_detail"], ["projects/", "/snippets/", "/user_agent_detail"])), projectId, snippetId), options);
    };
    return ProjectSnippets;
}(requesterUtils.BaseResource));
var templateObject_1$m, templateObject_2$g, templateObject_3$e, templateObject_4$d, templateObject_5$8, templateObject_6$3, templateObject_7$1;

var ProjectSnippetNotes = /** @class */ (function (_super) {
    __extends(ProjectSnippetNotes, _super);
    function ProjectSnippetNotes(options) {
        /* istanbul ignore next */
        return _super.call(this, 'projects', 'snippets', options) || this;
    }
    return ProjectSnippetNotes;
}(ResourceNotes));

var ProjectSnippetDiscussions = /** @class */ (function (_super) {
    __extends(ProjectSnippetDiscussions, _super);
    function ProjectSnippetDiscussions(options) {
        /* istanbul ignore next */
        return _super.call(this, 'projects', 'snippets', options) || this;
    }
    return ProjectSnippetDiscussions;
}(ResourceDiscussions));

var ProjectSnippetAwardEmojis = /** @class */ (function (_super) {
    __extends(ProjectSnippetAwardEmojis, _super);
    function ProjectSnippetAwardEmojis(options) {
        /* istanbul ignore next */
        return _super.call(this, 'snippets', options) || this;
    }
    return ProjectSnippetAwardEmojis;
}(ResourceAwardEmojis));

var ProtectedBranches = /** @class */ (function (_super) {
    __extends(ProtectedBranches, _super);
    function ProtectedBranches() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    ProtectedBranches.prototype.all = function (projectId, options) {
        if (options === void 0) { options = {}; }
        return RequestHelper.get()(this, endpoint(templateObject_1$l || (templateObject_1$l = __makeTemplateObject(["projects/", "/protected_branches"], ["projects/", "/protected_branches"])), projectId), options);
    };
    ProtectedBranches.prototype.protect = function (projectId, branchName, options) {
        return RequestHelper.post()(this, endpoint(templateObject_2$f || (templateObject_2$f = __makeTemplateObject(["projects/", "/protected_branches"], ["projects/", "/protected_branches"])), projectId), {
            query: __assign({ name: branchName }, options),
        });
    };
    ProtectedBranches.prototype.show = function (projectId, branchName, options) {
        return RequestHelper.get()(this, endpoint(templateObject_3$d || (templateObject_3$d = __makeTemplateObject(["projects/", "/protected_branches/", ""], ["projects/", "/protected_branches/", ""])), projectId, branchName), options);
    };
    ProtectedBranches.prototype.unprotect = function (projectId, branchName, options) {
        return RequestHelper.del()(this, endpoint(templateObject_4$c || (templateObject_4$c = __makeTemplateObject(["projects/", "/protected_branches/", ""], ["projects/", "/protected_branches/", ""])), projectId, branchName), options);
    };
    return ProtectedBranches;
}(requesterUtils.BaseResource));
var templateObject_1$l, templateObject_2$f, templateObject_3$d, templateObject_4$c;

var ProtectedTags = /** @class */ (function (_super) {
    __extends(ProtectedTags, _super);
    function ProtectedTags() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    ProtectedTags.prototype.all = function (projectId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_1$k || (templateObject_1$k = __makeTemplateObject(["projects/", "/protected_tags"], ["projects/", "/protected_tags"])), projectId), options);
    };
    ProtectedTags.prototype.protect = function (projectId, tagName, options) {
        return RequestHelper.post()(this, endpoint(templateObject_2$e || (templateObject_2$e = __makeTemplateObject(["projects/", "/protected_tags"], ["projects/", "/protected_tags"])), projectId), __assign({ name: tagName }, options));
    };
    ProtectedTags.prototype.show = function (projectId, tagName, options) {
        return RequestHelper.get()(this, endpoint(templateObject_3$c || (templateObject_3$c = __makeTemplateObject(["projects/", "/protected_tags/", ""], ["projects/", "/protected_tags/", ""])), projectId, tagName), options);
    };
    ProtectedTags.prototype.unprotect = function (projectId, tagName, options) {
        return RequestHelper.del()(this, endpoint(templateObject_4$b || (templateObject_4$b = __makeTemplateObject(["projects/", "/protected_tags/", ""], ["projects/", "/protected_tags/", ""])), projectId, tagName), options);
    };
    return ProtectedTags;
}(requesterUtils.BaseResource));
var templateObject_1$k, templateObject_2$e, templateObject_3$c, templateObject_4$b;

var ProjectVariables = /** @class */ (function (_super) {
    __extends(ProjectVariables, _super);
    function ProjectVariables(options) {
        /* istanbul ignore next */
        return _super.call(this, 'projects', options) || this;
    }
    return ProjectVariables;
}(ResourceVariables));

var ProjectDeployTokens = /** @class */ (function (_super) {
    __extends(ProjectDeployTokens, _super);
    function ProjectDeployTokens(options) {
        /* istanbul ignore next */
        return _super.call(this, 'projects', options) || this;
    }
    return ProjectDeployTokens;
}(ResourceDeployTokens));

var PushRules = /** @class */ (function (_super) {
    __extends(PushRules, _super);
    function PushRules() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    PushRules.prototype.create = function (projectId, options) {
        return RequestHelper.post()(this, endpoint(templateObject_1$j || (templateObject_1$j = __makeTemplateObject(["projects/", "/push_rule"], ["projects/", "/push_rule"])), projectId), options);
    };
    PushRules.prototype.edit = function (projectId, options) {
        return RequestHelper.put()(this, endpoint(templateObject_2$d || (templateObject_2$d = __makeTemplateObject(["projects/", "/push_rule"], ["projects/", "/push_rule"])), projectId), options);
    };
    PushRules.prototype.remove = function (projectId, options) {
        return RequestHelper.del()(this, endpoint(templateObject_3$b || (templateObject_3$b = __makeTemplateObject(["projects/", "/push_rule"], ["projects/", "/push_rule"])), projectId), options);
    };
    PushRules.prototype.show = function (projectId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_4$a || (templateObject_4$a = __makeTemplateObject(["projects/", "/push_rule"], ["projects/", "/push_rule"])), projectId), options);
    };
    return PushRules;
}(requesterUtils.BaseResource));
var templateObject_1$j, templateObject_2$d, templateObject_3$b, templateObject_4$a;

// TODO: Add missing functions
var Releases = /** @class */ (function (_super) {
    __extends(Releases, _super);
    function Releases() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Releases.prototype.all = function (projectId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_1$i || (templateObject_1$i = __makeTemplateObject(["projects/", "/releases"], ["projects/", "/releases"])), projectId), options);
    };
    Releases.prototype.create = function (projectId, options) {
        return RequestHelper.post()(this, endpoint(templateObject_2$c || (templateObject_2$c = __makeTemplateObject(["projects/", "/releases"], ["projects/", "/releases"])), projectId), options);
    };
    Releases.prototype.edit = function (projectId, tagName, options) {
        return RequestHelper.put()(this, endpoint(templateObject_3$a || (templateObject_3$a = __makeTemplateObject(["projects/", "/releases/", ""], ["projects/", "/releases/", ""])), projectId, tagName), options);
    };
    Releases.prototype.remove = function (projectId, tagName, options) {
        return RequestHelper.del()(this, endpoint(templateObject_4$9 || (templateObject_4$9 = __makeTemplateObject(["projects/", "/releases/", ""], ["projects/", "/releases/", ""])), projectId, tagName), options);
    };
    Releases.prototype.show = function (projectId, tagName, options) {
        return RequestHelper.get()(this, endpoint(templateObject_5$7 || (templateObject_5$7 = __makeTemplateObject(["projects/", "/releases/", ""], ["projects/", "/releases/", ""])), projectId, tagName), options);
    };
    return Releases;
}(requesterUtils.BaseResource));
var templateObject_1$i, templateObject_2$c, templateObject_3$a, templateObject_4$9, templateObject_5$7;

var ReleaseLinks = /** @class */ (function (_super) {
    __extends(ReleaseLinks, _super);
    function ReleaseLinks() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    ReleaseLinks.prototype.all = function (projectId, tagName, options) {
        return RequestHelper.get()(this, endpoint(templateObject_1$h || (templateObject_1$h = __makeTemplateObject(["projects/", "/releases/", "/assets/links"], ["projects/", "/releases/", "/assets/links"])), projectId, tagName), options);
    };
    ReleaseLinks.prototype.create = function (projectId, tagName, name, url, options) {
        return RequestHelper.post()(this, endpoint(templateObject_2$b || (templateObject_2$b = __makeTemplateObject(["projects/", "/releases/", "/assets/links"], ["projects/", "/releases/", "/assets/links"])), projectId, tagName), __assign({ name: name, url: url }, options));
    };
    ReleaseLinks.prototype.edit = function (projectId, tagName, linkId, options) {
        return RequestHelper.put()(this, endpoint(templateObject_3$9 || (templateObject_3$9 = __makeTemplateObject(["projects/", "/releases/", "/assets/links/", ""], ["projects/", "/releases/", "/assets/links/", ""])), projectId, tagName, linkId), options);
    };
    ReleaseLinks.prototype.remove = function (projectId, tagName, linkId, options) {
        return RequestHelper.del()(this, endpoint(templateObject_4$8 || (templateObject_4$8 = __makeTemplateObject(["projects/", "/releases/", "/assets/links/", ""], ["projects/", "/releases/", "/assets/links/", ""])), projectId, tagName, linkId), options);
    };
    ReleaseLinks.prototype.show = function (projectId, tagName, linkId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_5$6 || (templateObject_5$6 = __makeTemplateObject(["projects/", "/releases/", "/assets/links/", ""], ["projects/", "/releases/", "/assets/links/", ""])), projectId, tagName, linkId), options);
    };
    return ReleaseLinks;
}(requesterUtils.BaseResource));
var templateObject_1$h, templateObject_2$b, templateObject_3$9, templateObject_4$8, templateObject_5$6;

var Repositories = /** @class */ (function (_super) {
    __extends(Repositories, _super);
    function Repositories() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Repositories.prototype.compare = function (projectId, from, to, options) {
        return RequestHelper.get()(this, endpoint(templateObject_1$g || (templateObject_1$g = __makeTemplateObject(["projects/", "/repository/compare"], ["projects/", "/repository/compare"])), projectId), __assign({ from: from, to: to }, options));
    };
    Repositories.prototype.contributors = function (projectId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_2$a || (templateObject_2$a = __makeTemplateObject(["projects/", "/repository/contributors"], ["projects/", "/repository/contributors"])), projectId), options);
    };
    Repositories.prototype.mergeBase = function (projectId, refs, options) {
        return RequestHelper.get()(this, endpoint(templateObject_3$8 || (templateObject_3$8 = __makeTemplateObject(["projects/", "/repository/merge_base"], ["projects/", "/repository/merge_base"])), projectId), __assign({ refs: refs }, options));
    };
    Repositories.prototype.showArchive = function (projectId, _a) {
        if (_a === void 0) { _a = {}; }
        var _b = _a.fileType, fileType = _b === void 0 ? 'tar.gz' : _b, options = __rest(_a, ["fileType"]);
        return RequestHelper.get()(this, endpoint(templateObject_4$7 || (templateObject_4$7 = __makeTemplateObject(["projects/", "/repository/archive.", ""], ["projects/", "/repository/archive.", ""])), projectId, fileType), options);
    };
    Repositories.prototype.showBlob = function (projectId, sha, options) {
        return RequestHelper.get()(this, endpoint(templateObject_5$5 || (templateObject_5$5 = __makeTemplateObject(["projects/", "/repository/blobs/", ""], ["projects/", "/repository/blobs/", ""])), projectId, sha), options);
    };
    Repositories.prototype.showBlobRaw = function (projectId, sha, options) {
        return RequestHelper.get()(this, endpoint(templateObject_6$2 || (templateObject_6$2 = __makeTemplateObject(["projects/", "/repository/blobs/", "/raw"], ["projects/", "/repository/blobs/", "/raw"])), projectId, sha), options);
    };
    Repositories.prototype.tree = function (projectId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_7 || (templateObject_7 = __makeTemplateObject(["projects/", "/repository/tree"], ["projects/", "/repository/tree"])), projectId), options);
    };
    return Repositories;
}(requesterUtils.BaseResource));
var templateObject_1$g, templateObject_2$a, templateObject_3$8, templateObject_4$7, templateObject_5$5, templateObject_6$2, templateObject_7;

var RepositoryFiles = /** @class */ (function (_super) {
    __extends(RepositoryFiles, _super);
    function RepositoryFiles() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    RepositoryFiles.prototype.create = function (projectId, filePath, branch, content, commitMessage, options) {
        return RequestHelper.post()(this, endpoint(templateObject_1$f || (templateObject_1$f = __makeTemplateObject(["projects/", "/repository/files/", ""], ["projects/", "/repository/files/", ""])), projectId, filePath), __assign({ branch: branch, content: content, commitMessage: commitMessage }, options));
    };
    RepositoryFiles.prototype.edit = function (projectId, filePath, branch, content, commitMessage, options) {
        return RequestHelper.put()(this, endpoint(templateObject_2$9 || (templateObject_2$9 = __makeTemplateObject(["projects/", "/repository/files/", ""], ["projects/", "/repository/files/", ""])), projectId, filePath), __assign({ branch: branch, content: content, commitMessage: commitMessage }, options));
    };
    RepositoryFiles.prototype.remove = function (projectId, filePath, branch, commitMessage, options) {
        return RequestHelper.del()(this, endpoint(templateObject_3$7 || (templateObject_3$7 = __makeTemplateObject(["projects/", "/repository/files/", ""], ["projects/", "/repository/files/", ""])), projectId, filePath), __assign({ branch: branch, commitMessage: commitMessage }, options));
    };
    RepositoryFiles.prototype.show = function (projectId, filePath, ref, options) {
        return RequestHelper.get()(this, endpoint(templateObject_4$6 || (templateObject_4$6 = __makeTemplateObject(["projects/", "/repository/files/", ""], ["projects/", "/repository/files/", ""])), projectId, filePath), __assign({ ref: ref }, options));
    };
    RepositoryFiles.prototype.showBlame = function (projectId, filePath, options) {
        return RequestHelper.get()(this, endpoint(templateObject_5$4 || (templateObject_5$4 = __makeTemplateObject(["projects/", "/repository/files/", "/blame"], ["projects/", "/repository/files/", "/blame"])), projectId, filePath), options);
    };
    RepositoryFiles.prototype.showRaw = function (projectId, filePath, options) {
        return RequestHelper.get()(this, endpoint(templateObject_6$1 || (templateObject_6$1 = __makeTemplateObject(["projects/", "/repository/files/", "/raw"], ["projects/", "/repository/files/", "/raw"])), projectId, filePath), options);
    };
    return RepositoryFiles;
}(requesterUtils.BaseResource));
var templateObject_1$f, templateObject_2$9, templateObject_3$7, templateObject_4$6, templateObject_5$4, templateObject_6$1;

var RepositorySubmodules = /** @class */ (function (_super) {
    __extends(RepositorySubmodules, _super);
    function RepositorySubmodules() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    RepositorySubmodules.prototype.edit = function (projectId, submodule, branch, commit_sha, options) {
        return RequestHelper.put()(this, endpoint(templateObject_1$e || (templateObject_1$e = __makeTemplateObject(["projects/", "/repository/submodules/", ""], ["projects/", "/repository/submodules/", ""])), projectId, submodule), __assign({ branch: branch, commit_sha: commit_sha }, options));
    };
    return RepositorySubmodules;
}(requesterUtils.BaseResource));
var templateObject_1$e;

var Runners = /** @class */ (function (_super) {
    __extends(Runners, _super);
    function Runners() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Runners.prototype.all = function (_a) {
        if (_a === void 0) { _a = {}; }
        var projectId = _a.projectId, options = __rest(_a, ["projectId"]);
        var url = projectId ? endpoint(templateObject_1$d || (templateObject_1$d = __makeTemplateObject(["projects/", "/runners"], ["projects/", "/runners"])), projectId) : 'runners/all';
        return RequestHelper.get()(this, url, options);
    };
    Runners.prototype.allOwned = function (options) {
        return RequestHelper.get()(this, 'runners', options);
    };
    Runners.prototype.edit = function (runnerId, options) {
        return RequestHelper.put()(this, "runners/".concat(runnerId), options);
    };
    Runners.prototype.enable = function (projectId, runnerId, options) {
        return RequestHelper.post()(this, endpoint(templateObject_2$8 || (templateObject_2$8 = __makeTemplateObject(["projects/", "/runners"], ["projects/", "/runners"])), projectId), __assign({ runnerId: runnerId }, options));
    };
    Runners.prototype.disable = function (projectId, runnerId, options) {
        return RequestHelper.del()(this, endpoint(templateObject_3$6 || (templateObject_3$6 = __makeTemplateObject(["projects/", "/runners/", ""], ["projects/", "/runners/", ""])), projectId, runnerId), options);
    };
    Runners.prototype.jobs = function (runnerId, options) {
        return RequestHelper.get()(this, "runners/".concat(runnerId, "/jobs"), options);
    };
    Runners.prototype.remove = function (runnerId, options) {
        return RequestHelper.del()(this, "runners/".concat(runnerId), options);
    };
    Runners.prototype.show = function (runnerId, options) {
        return RequestHelper.get()(this, "runners/".concat(runnerId), options);
    };
    return Runners;
}(requesterUtils.BaseResource));
var templateObject_1$d, templateObject_2$8, templateObject_3$6;

var Services = /** @class */ (function (_super) {
    __extends(Services, _super);
    function Services() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Services.prototype.all = function (projectId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_1$c || (templateObject_1$c = __makeTemplateObject(["projects/", "/services"], ["projects/", "/services"])), projectId), options);
    };
    Services.prototype.edit = function (projectId, serviceName, options) {
        return RequestHelper.put()(this, endpoint(templateObject_2$7 || (templateObject_2$7 = __makeTemplateObject(["projects/", "/services/", ""], ["projects/", "/services/", ""])), projectId, serviceName), options);
    };
    Services.prototype.remove = function (projectId, serviceName, options) {
        return RequestHelper.del()(this, endpoint(templateObject_3$5 || (templateObject_3$5 = __makeTemplateObject(["projects/", "/services/", ""], ["projects/", "/services/", ""])), projectId, serviceName), options);
    };
    Services.prototype.show = function (projectId, serviceName, options) {
        return RequestHelper.get()(this, endpoint(templateObject_4$5 || (templateObject_4$5 = __makeTemplateObject(["projects/", "/services/", ""], ["projects/", "/services/", ""])), projectId, serviceName), options);
    };
    return Services;
}(requesterUtils.BaseResource));
var templateObject_1$c, templateObject_2$7, templateObject_3$5, templateObject_4$5;

var Tags = /** @class */ (function (_super) {
    __extends(Tags, _super);
    function Tags() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Tags.prototype.all = function (projectId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_1$b || (templateObject_1$b = __makeTemplateObject(["projects/", "/repository/tags"], ["projects/", "/repository/tags"])), projectId), options);
    };
    Tags.prototype.create = function (projectId, tagName, ref, options) {
        return RequestHelper.post()(this, endpoint(templateObject_2$6 || (templateObject_2$6 = __makeTemplateObject(["projects/", "/repository/tags"], ["projects/", "/repository/tags"])), projectId), __assign({ query: {
                tagName: tagName,
                ref: ref,
            } }, options));
    };
    Tags.prototype.remove = function (projectId, tagName, options) {
        return RequestHelper.del()(this, endpoint(templateObject_3$4 || (templateObject_3$4 = __makeTemplateObject(["projects/", "/repository/tags/", ""], ["projects/", "/repository/tags/", ""])), projectId, tagName), options);
    };
    Tags.prototype.show = function (projectId, tagName, options) {
        return RequestHelper.get()(this, endpoint(templateObject_4$4 || (templateObject_4$4 = __makeTemplateObject(["projects/", "/repository/tags/", ""], ["projects/", "/repository/tags/", ""])), projectId, tagName), options);
    };
    return Tags;
}(requesterUtils.BaseResource));
var templateObject_1$b, templateObject_2$6, templateObject_3$4, templateObject_4$4;

var Todos = /** @class */ (function (_super) {
    __extends(Todos, _super);
    function Todos() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Todos.prototype.all = function (options) {
        return RequestHelper.get()(this, 'todos', options);
    };
    Todos.prototype.create = function (projectId, resourceId, resourceName, options) {
        var resourceAPI = resourceName === 'issue' ? 'issues' : 'merge_requests';
        return RequestHelper.post()(this, endpoint(templateObject_1$a || (templateObject_1$a = __makeTemplateObject(["projects/", "/", "/", "/todo"], ["projects/", "/", "/", "/todo"])), projectId, resourceAPI, resourceId), options);
    };
    Todos.prototype.done = function (_a) {
        if (_a === void 0) { _a = {}; }
        var todoId = _a.todoId, options = __rest(_a, ["todoId"]);
        var url = ['todos'];
        if (todoId)
            url.push(todoId.toString());
        url.push('mark_as_done');
        // Fixme: Rewrite this to make better use of proper typing
        if (todoId) {
            return RequestHelper.post()(this, url.join('/'), options);
        }
        return RequestHelper.post()(this, url.join('/'), options);
    };
    return Todos;
}(requesterUtils.BaseResource));
var templateObject_1$a;

// TODO: Rename PipelineTriggers
var Triggers = /** @class */ (function (_super) {
    __extends(Triggers, _super);
    function Triggers() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Triggers.prototype.add = function (projectId, options) {
        return RequestHelper.post()(this, endpoint(templateObject_1$9 || (templateObject_1$9 = __makeTemplateObject(["projects/", "/triggers"], ["projects/", "/triggers"])), projectId), options);
    };
    Triggers.prototype.all = function (projectId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_2$5 || (templateObject_2$5 = __makeTemplateObject(["projects/", "/triggers"], ["projects/", "/triggers"])), projectId), options);
    };
    Triggers.prototype.edit = function (projectId, triggerId, options) {
        return RequestHelper.put()(this, endpoint(templateObject_3$3 || (templateObject_3$3 = __makeTemplateObject(["projects/", "/triggers/", ""], ["projects/", "/triggers/", ""])), projectId, triggerId), options);
    };
    Triggers.prototype.pipeline = function (projectId, ref, token, _a) {
        var _b = _a === void 0 ? {} : _a, variables = _b.variables;
        var hapiVariables = {};
        if (variables) {
            Object.entries(variables).forEach(function (_a) {
                var _b = __read(_a, 2), k = _b[0], v = _b[1];
                hapiVariables["variables[".concat(k, "]")] = v;
            });
        }
        return RequestHelper.post()(this, endpoint(templateObject_4$3 || (templateObject_4$3 = __makeTemplateObject(["projects/", "/trigger/pipeline"], ["projects/", "/trigger/pipeline"])), projectId), __assign({ isForm: true, ref: ref, token: token }, hapiVariables));
    };
    Triggers.prototype.remove = function (projectId, triggerId, options) {
        return RequestHelper.del()(this, endpoint(templateObject_5$3 || (templateObject_5$3 = __makeTemplateObject(["projects/", "/triggers/", ""], ["projects/", "/triggers/", ""])), projectId, triggerId), options);
    };
    Triggers.prototype.show = function (projectId, triggerId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_6 || (templateObject_6 = __makeTemplateObject(["projects/", "/triggers/", ""], ["projects/", "/triggers/", ""])), projectId, triggerId), options);
    };
    return Triggers;
}(requesterUtils.BaseResource));
var templateObject_1$9, templateObject_2$5, templateObject_3$3, templateObject_4$3, templateObject_5$3, templateObject_6;

var VulnerabilityFindings = /** @class */ (function (_super) {
    __extends(VulnerabilityFindings, _super);
    function VulnerabilityFindings() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    VulnerabilityFindings.prototype.all = function (projectId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_1$8 || (templateObject_1$8 = __makeTemplateObject(["projects/", "/vulnerability_findings"], ["projects/", "/vulnerability_findings"])), projectId), options);
    };
    return VulnerabilityFindings;
}(requesterUtils.BaseResource));
var templateObject_1$8;

var ApplicationSettings = /** @class */ (function (_super) {
    __extends(ApplicationSettings, _super);
    function ApplicationSettings() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    ApplicationSettings.prototype.all = function (options) {
        return RequestHelper.get()(this, 'application/settings', options);
    };
    ApplicationSettings.prototype.edit = function (options) {
        return RequestHelper.put()(this, 'application/settings', options);
    };
    return ApplicationSettings;
}(requesterUtils.BaseResource));

var BroadcastMessages = /** @class */ (function (_super) {
    __extends(BroadcastMessages, _super);
    function BroadcastMessages() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    BroadcastMessages.prototype.all = function (options) {
        return RequestHelper.get()(this, 'broadcast_messages', options);
    };
    BroadcastMessages.prototype.create = function (options) {
        return RequestHelper.post()(this, 'broadcast_messages', options);
    };
    BroadcastMessages.prototype.edit = function (broadcastMessageId, options) {
        return RequestHelper.put()(this, "broadcast_messages/".concat(broadcastMessageId), options);
    };
    BroadcastMessages.prototype.remove = function (broadcastMessageId, options) {
        return RequestHelper.del()(this, "broadcast_messages/".concat(broadcastMessageId), options);
    };
    BroadcastMessages.prototype.show = function (broadcastMessageId, options) {
        return RequestHelper.get()(this, "broadcast_messages/".concat(broadcastMessageId), options);
    };
    return BroadcastMessages;
}(requesterUtils.BaseResource));

var Events = /** @class */ (function (_super) {
    __extends(Events, _super);
    function Events() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Events.prototype.all = function (_a) {
        if (_a === void 0) { _a = {}; }
        var projectId = _a.projectId, options = __rest(_a, ["projectId"]);
        var url;
        if (projectId) {
            url = endpoint(templateObject_1$7 || (templateObject_1$7 = __makeTemplateObject(["projects/", "/events"], ["projects/", "/events"])), projectId);
        }
        else {
            url = 'events';
        }
        return RequestHelper.get()(this, url, options);
    };
    return Events;
}(requesterUtils.BaseResource));
var templateObject_1$7;

var FeatureFlags = /** @class */ (function (_super) {
    __extends(FeatureFlags, _super);
    function FeatureFlags() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    FeatureFlags.prototype.all = function (projectId, options) {
        if (options === void 0) { options = {}; }
        return RequestHelper.get()(this, endpoint(templateObject_1$6 || (templateObject_1$6 = __makeTemplateObject(["projects/", "/feature_flags"], ["projects/", "/feature_flags"])), projectId), options);
    };
    FeatureFlags.prototype.create = function (projectId, flagName, version, options) {
        return RequestHelper.post()(this, endpoint(templateObject_2$4 || (templateObject_2$4 = __makeTemplateObject(["projects/", "/feature_flags"], ["projects/", "/feature_flags"])), projectId), __assign({ name: flagName, version: version }, options));
    };
    FeatureFlags.prototype.edit = function (projectId, flagName, options) {
        return RequestHelper.put()(this, endpoint(templateObject_3$2 || (templateObject_3$2 = __makeTemplateObject(["projects/", "/feature_flags/", ""], ["projects/", "/feature_flags/", ""])), projectId, flagName), options);
    };
    FeatureFlags.prototype.remove = function (projectId, flagName, options) {
        return RequestHelper.del()(this, endpoint(templateObject_4$2 || (templateObject_4$2 = __makeTemplateObject(["projects/", "/feature_flags/", ""], ["projects/", "/feature_flags/", ""])), projectId, flagName), options);
    };
    FeatureFlags.prototype.show = function (projectId, flagName, options) {
        return RequestHelper.get()(this, endpoint(templateObject_5$2 || (templateObject_5$2 = __makeTemplateObject(["projects/", "/feature_flags/", ""], ["projects/", "/feature_flags/", ""])), projectId, flagName), options);
    };
    return FeatureFlags;
}(requesterUtils.BaseResource));
var templateObject_1$6, templateObject_2$4, templateObject_3$2, templateObject_4$2, templateObject_5$2;

var GeoNodes = /** @class */ (function (_super) {
    __extends(GeoNodes, _super);
    function GeoNodes() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    GeoNodes.prototype.all = function (options) {
        return RequestHelper.get()(this, 'geo_nodes', options);
    };
    GeoNodes.prototype.create = function (geonodeId, options) {
        return RequestHelper.post()(this, "geo_nodes/".concat(geonodeId), options);
    };
    GeoNodes.prototype.edit = function (geonodeId, options) {
        return RequestHelper.put()(this, "geo_nodes/".concat(geonodeId), options);
    };
    GeoNodes.prototype.failures = function (options) {
        return RequestHelper.get()(this, 'geo_nodes/current/failures', options);
    };
    GeoNodes.prototype.repair = function (geonodeId, options) {
        return RequestHelper.post()(this, "geo_nodes/".concat(geonodeId, "/repair"), options);
    };
    GeoNodes.prototype.remove = function (geonodeId, options) {
        return RequestHelper.del()(this, "geo_nodes/".concat(geonodeId), options);
    };
    GeoNodes.prototype.show = function (geonodeId, options) {
        return RequestHelper.get()(this, "geo_nodes/".concat(geonodeId), options);
    };
    GeoNodes.prototype.status = function (geonodeId, options) {
        return RequestHelper.get()(this, "geo_nodes/".concat(geonodeId, "/status"), options);
    };
    GeoNodes.prototype.statuses = function (options) {
        return RequestHelper.get()(this, 'geo_nodes/statuses', options);
    };
    return GeoNodes;
}(requesterUtils.BaseResource));

var GitignoreTemplates = /** @class */ (function (_super) {
    __extends(GitignoreTemplates, _super);
    function GitignoreTemplates(options) {
        /* istanbul ignore next */
        return _super.call(this, 'gitignores', options) || this;
    }
    return GitignoreTemplates;
}(ResourceTemplates));

var GitLabCIYMLTemplates = /** @class */ (function (_super) {
    __extends(GitLabCIYMLTemplates, _super);
    function GitLabCIYMLTemplates(options) {
        /* istanbul ignore next */
        return _super.call(this, 'gitlab_ci_ymls', options) || this;
    }
    return GitLabCIYMLTemplates;
}(ResourceTemplates));

var Keys = /** @class */ (function (_super) {
    __extends(Keys, _super);
    function Keys() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Keys.prototype.show = function (keyId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_1$5 || (templateObject_1$5 = __makeTemplateObject(["keys/", ""], ["keys/", ""])), keyId), options);
    };
    return Keys;
}(requesterUtils.BaseResource));
var templateObject_1$5;

var License = /** @class */ (function (_super) {
    __extends(License, _super);
    function License() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    License.prototype.add = function (license, options) {
        return RequestHelper.post()(this, 'license', __assign({ license: license }, options));
    };
    License.prototype.all = function (options) {
        return RequestHelper.get()(this, 'licenses', options);
    };
    License.prototype.show = function (options) {
        return RequestHelper.get()(this, 'license', options);
    };
    License.prototype.remove = function (licenceId, options) {
        return RequestHelper.del()(this, "license/".concat(licenceId), options);
    };
    return License;
}(requesterUtils.BaseResource));

var LicenseTemplates = /** @class */ (function (_super) {
    __extends(LicenseTemplates, _super);
    function LicenseTemplates(options) {
        /* istanbul ignore next */
        return _super.call(this, 'Licenses', options) || this;
    }
    return LicenseTemplates;
}(ResourceTemplates));

var Lint = /** @class */ (function (_super) {
    __extends(Lint, _super);
    function Lint() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Lint.prototype.lint = function (content, options) {
        // Perform CI file linting without context.
        // See https://docs.gitlab.com/ee/api/lint.html#validate-the-ci-yaml-configuration
        // This API doesn't work for CI files that contain `local` includes. Use `lintWithNamespace` instead.
        return RequestHelper.post()(this, 'ci/lint', __assign({ content: content }, options));
    };
    // TODO: Figure out a better way of writing this to not be limited by the typing.
    Lint.prototype.lintWithNamespace = function (projectId, content, options) {
        // Perform CI file linting in the context of a specific project namespace.
        // See https://docs.gitlab.com/ee/api/lint.html#validate-a-ci-yaml-configuration-with-a-namespace
        // This API is useful when the CI file being linted has `local` includes, which requires project
        // context to be understood.
        return RequestHelper.post()(this, "projects/".concat(projectId, "/ci/lint"), __assign({ content: content }, options));
    };
    return Lint;
}(requesterUtils.BaseResource));

// TODO: Add missing functions
var Namespaces = /** @class */ (function (_super) {
    __extends(Namespaces, _super);
    function Namespaces() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Namespaces.prototype.all = function (options) {
        return RequestHelper.get()(this, 'namespaces', options);
    };
    Namespaces.prototype.show = function (namespaceId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_1$4 || (templateObject_1$4 = __makeTemplateObject(["namespaces/", ""], ["namespaces/", ""])), namespaceId), options);
    };
    return Namespaces;
}(requesterUtils.BaseResource));
var templateObject_1$4;

function url(_a) {
    var projectId = _a.projectId, groupId = _a.groupId;
    var uri;
    if (projectId) {
        uri = endpoint(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["projects/", "/"], ["projects/", "/"])), projectId);
    }
    else if (groupId) {
        uri = endpoint(templateObject_2$3 || (templateObject_2$3 = __makeTemplateObject(["groups/", "/"], ["groups/", "/"])), groupId);
    }
    else {
        uri = '';
    }
    return "".concat(uri, "notification_settings");
}
var NotificationSettings = /** @class */ (function (_super) {
    __extends(NotificationSettings, _super);
    function NotificationSettings() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    NotificationSettings.prototype.all = function (_a) {
        if (_a === void 0) { _a = {}; }
        var projectId = _a.projectId, groupId = _a.groupId, options = __rest(_a, ["projectId", "groupId"]);
        return RequestHelper.get()(this, url({ groupId: groupId, projectId: projectId }), options);
    };
    NotificationSettings.prototype.edit = function (_a) {
        if (_a === void 0) { _a = {}; }
        var projectId = _a.projectId, groupId = _a.groupId, options = __rest(_a, ["projectId", "groupId"]);
        return RequestHelper.put()(this, url({ groupId: groupId, projectId: projectId }), options);
    };
    return NotificationSettings;
}(requesterUtils.BaseResource));
var templateObject_1$3, templateObject_2$3;

var Markdown = /** @class */ (function (_super) {
    __extends(Markdown, _super);
    function Markdown() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Markdown.prototype.render = function (text, options) {
        return RequestHelper.post()(this, 'markdown', __assign({ text: text }, options));
    };
    return Markdown;
}(requesterUtils.BaseResource));

// TODO: Add missing functions
var PagesDomains = /** @class */ (function (_super) {
    __extends(PagesDomains, _super);
    function PagesDomains() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    PagesDomains.prototype.all = function (_a) {
        if (_a === void 0) { _a = {}; }
        var projectId = _a.projectId, options = __rest(_a, ["projectId"]);
        var url = projectId ? endpoint(templateObject_1$2 || (templateObject_1$2 = __makeTemplateObject(["projects/", "/"], ["projects/", "/"])), projectId) : '';
        return RequestHelper.get()(this, "".concat(url, "pages/domains"), options);
    };
    PagesDomains.prototype.create = function (projectId, domain, options) {
        return RequestHelper.post()(this, endpoint(templateObject_2$2 || (templateObject_2$2 = __makeTemplateObject(["projects/", "/pages/domains"], ["projects/", "/pages/domains"])), projectId), __assign({ domain: domain }, options));
    };
    PagesDomains.prototype.edit = function (projectId, domain, options) {
        return RequestHelper.put()(this, endpoint(templateObject_3$1 || (templateObject_3$1 = __makeTemplateObject(["projects/", "/pages/domains/", ""], ["projects/", "/pages/domains/", ""])), projectId, domain), options);
    };
    PagesDomains.prototype.show = function (projectId, domain, options) {
        return RequestHelper.get()(this, endpoint(templateObject_4$1 || (templateObject_4$1 = __makeTemplateObject(["projects/", "/pages/domains/", ""], ["projects/", "/pages/domains/", ""])), projectId, domain), options);
    };
    PagesDomains.prototype.remove = function (projectId, domain, options) {
        return RequestHelper.del()(this, endpoint(templateObject_5$1 || (templateObject_5$1 = __makeTemplateObject(["projects/", "/pages/domains/", ""], ["projects/", "/pages/domains/", ""])), projectId, domain), options);
    };
    return PagesDomains;
}(requesterUtils.BaseResource));
var templateObject_1$2, templateObject_2$2, templateObject_3$1, templateObject_4$1, templateObject_5$1;

var Search = /** @class */ (function (_super) {
    __extends(Search, _super);
    function Search() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Search.prototype.all = function (scope, search, _a) {
        if (_a === void 0) { _a = {}; }
        var projectId = _a.projectId, groupId = _a.groupId, options = __rest(_a, ["projectId", "groupId"]);
        var url;
        if (projectId) {
            url = endpoint(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["projects/", "/"], ["projects/", "/"])), projectId);
        }
        else if (groupId) {
            url = endpoint(templateObject_2$1 || (templateObject_2$1 = __makeTemplateObject(["groups/", "/"], ["groups/", "/"])), groupId);
        }
        else {
            url = '';
        }
        return RequestHelper.get()(this, "".concat(url, "search"), __assign({ scope: scope, search: search }, options));
    };
    return Search;
}(requesterUtils.BaseResource));
var templateObject_1$1, templateObject_2$1;

var SidekiqMetrics = /** @class */ (function (_super) {
    __extends(SidekiqMetrics, _super);
    function SidekiqMetrics() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    SidekiqMetrics.prototype.queueMetrics = function () {
        return RequestHelper.get()(this, 'sidekiq/queue_metrics');
    };
    SidekiqMetrics.prototype.processMetrics = function () {
        return RequestHelper.get()(this, 'sidekiq/process_metrics');
    };
    SidekiqMetrics.prototype.jobStats = function () {
        return RequestHelper.get()(this, 'sidekiq/job_stats');
    };
    SidekiqMetrics.prototype.compoundMetrics = function () {
        return RequestHelper.get()(this, 'sidekiq/compound_metrics');
    };
    return SidekiqMetrics;
}(requesterUtils.BaseResource));

var Snippets = /** @class */ (function (_super) {
    __extends(Snippets, _super);
    function Snippets() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Snippets.prototype.all = function (_a) {
        if (_a === void 0) { _a = {}; }
        var p = _a.public, options = __rest(_a, ["public"]);
        var url = p ? 'snippets/public' : 'snippets';
        return RequestHelper.get()(this, url, options);
    };
    Snippets.prototype.content = function (snippetId, options) {
        return RequestHelper.get()(this, "snippets/".concat(snippetId, "/raw"), options);
    };
    Snippets.prototype.create = function (title, fileName, content, visibility, options) {
        return RequestHelper.post()(this, 'snippets', __assign({ title: title, fileName: fileName, content: content, visibility: visibility }, options));
    };
    Snippets.prototype.edit = function (snippetId, options) {
        return RequestHelper.put()(this, "snippets/".concat(snippetId), options);
    };
    Snippets.prototype.remove = function (snippetId, options) {
        return RequestHelper.del()(this, "snippets/".concat(snippetId), options);
    };
    Snippets.prototype.show = function (snippetId, options) {
        return RequestHelper.get()(this, "snippets/".concat(snippetId), options);
    };
    Snippets.prototype.userAgentDetails = function (snippetId, options) {
        return RequestHelper.get()(this, "snippets/".concat(snippetId, "/user_agent_detail"), options);
    };
    return Snippets;
}(requesterUtils.BaseResource));

var SystemHooks = /** @class */ (function (_super) {
    __extends(SystemHooks, _super);
    function SystemHooks() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    SystemHooks.prototype.add = function (url, options) {
        return RequestHelper.post()(this, 'hooks', __assign({ url: url }, options));
    };
    SystemHooks.prototype.all = function (options) {
        return RequestHelper.get()(this, 'hooks', options);
    };
    SystemHooks.prototype.edit = function (hookId, url, options) {
        return RequestHelper.put()(this, "hooks/".concat(hookId), __assign({ url: url }, options));
    };
    SystemHooks.prototype.remove = function (hookId, options) {
        return RequestHelper.del()(this, "hooks/".concat(hookId), options);
    };
    return SystemHooks;
}(requesterUtils.BaseResource));

var Version = /** @class */ (function (_super) {
    __extends(Version, _super);
    function Version() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Version.prototype.show = function (options) {
        return RequestHelper.get()(this, 'version', options);
    };
    return Version;
}(requesterUtils.BaseResource));

var Wikis = /** @class */ (function (_super) {
    __extends(Wikis, _super);
    function Wikis() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Wikis.prototype.all = function (projectId, options) {
        return RequestHelper.get()(this, endpoint(templateObject_1 || (templateObject_1 = __makeTemplateObject(["projects/", "/wikis"], ["projects/", "/wikis"])), projectId), options);
    };
    Wikis.prototype.create = function (projectId, options) {
        return RequestHelper.post()(this, endpoint(templateObject_2 || (templateObject_2 = __makeTemplateObject(["projects/", "/wikis"], ["projects/", "/wikis"])), projectId), options);
    };
    Wikis.prototype.edit = function (projectId, slug, options) {
        return RequestHelper.put()(this, endpoint(templateObject_3 || (templateObject_3 = __makeTemplateObject(["projects/", "/wikis/", ""], ["projects/", "/wikis/", ""])), projectId, slug), options);
    };
    Wikis.prototype.show = function (projectId, slug, options) {
        return RequestHelper.get()(this, endpoint(templateObject_4 || (templateObject_4 = __makeTemplateObject(["projects/", "/wikis/", ""], ["projects/", "/wikis/", ""])), projectId, slug), options);
    };
    Wikis.prototype.remove = function (projectId, slug, options) {
        return RequestHelper.del()(this, endpoint(templateObject_5 || (templateObject_5 = __makeTemplateObject(["projects/", "/wikis/", ""], ["projects/", "/wikis/", ""])), projectId, slug), options);
    };
    return Wikis;
}(requesterUtils.BaseResource));
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;

/* eslint-disable  max-classes-per-file */
var resources = {
    Groups: Groups,
    GroupAccessRequests: GroupAccessRequests,
    GroupBadges: GroupBadges,
    GroupCustomAttributes: GroupCustomAttributes,
    GroupIssueBoards: GroupIssueBoards,
    GroupMembers: GroupMembers,
    GroupMilestones: GroupMilestones,
    GroupRunners: GroupRunners,
    GroupVariables: GroupVariables,
    GroupLabels: GroupLabels,
    GroupDeployTokens: GroupDeployTokens,
    Epics: Epics,
    EpicIssues: EpicIssues,
    EpicNotes: EpicNotes,
    EpicDiscussions: EpicDiscussions,
    Users: Users,
    UserCustomAttributes: UserCustomAttributes,
    UserEmails: UserEmails,
    UserImpersonationTokens: UserImpersonationTokens,
    UserSSHKeys: UserSSHKeys,
    UserGPGKeys: UserGPGKeys,
    Branches: Branches,
    Commits: Commits,
    CommitDiscussions: CommitDiscussions,
    ContainerRegistry: ContainerRegistry,
    Deployments: Deployments,
    DeployKeys: DeployKeys,
    Environments: Environments,
    FreezePeriods: FreezePeriods,
    Issues: Issues,
    IssuesStatistics: IssuesStatistics,
    IssueNotes: IssueNotes,
    IssueNoteAwardEmojis: IssueNoteAwardEmojis,
    IssueDiscussions: IssueDiscussions,
    IssueAwardEmojis: IssueAwardEmojis,
    Jobs: Jobs,
    Labels: Labels,
    MergeRequests: MergeRequests,
    MergeRequestApprovals: MergeRequestApprovals,
    MergeRequestAwardEmojis: MergeRequestAwardEmojis,
    MergeRequestDiscussions: MergeRequestDiscussions,
    MergeRequestNotes: MergeRequestNotes,
    Packages: Packages,
    PackageRegistry: PackageRegistry,
    Pipelines: Pipelines,
    PipelineSchedules: PipelineSchedules,
    PipelineScheduleVariables: PipelineScheduleVariables,
    Projects: Projects,
    ProjectAccessRequests: ProjectAccessRequests,
    ProjectBadges: ProjectBadges,
    ProjectCustomAttributes: ProjectCustomAttributes,
    ProjectImportExport: ProjectImportExport,
    ProjectIssueBoards: ProjectIssueBoards,
    ProjectHooks: ProjectHooks,
    ProjectMembers: ProjectMembers,
    ProjectMilestones: ProjectMilestones,
    ProjectSnippets: ProjectSnippets,
    ProjectSnippetNotes: ProjectSnippetNotes,
    ProjectSnippetDiscussions: ProjectSnippetDiscussions,
    ProjectSnippetAwardEmojis: ProjectSnippetAwardEmojis,
    ProtectedBranches: ProtectedBranches,
    ProtectedTags: ProtectedTags,
    ProjectVariables: ProjectVariables,
    ProjectDeployTokens: ProjectDeployTokens,
    PushRules: PushRules,
    Releases: Releases,
    ReleaseLinks: ReleaseLinks,
    Repositories: Repositories,
    RepositoryFiles: RepositoryFiles,
    RepositorySubmodules: RepositorySubmodules,
    Runners: Runners,
    Services: Services,
    Tags: Tags,
    Todos: Todos,
    Triggers: Triggers,
    VulnerabilityFindings: VulnerabilityFindings,
    ApplicationSettings: ApplicationSettings,
    BroadcastMessages: BroadcastMessages,
    Events: Events,
    FeatureFlags: FeatureFlags,
    GeoNodes: GeoNodes,
    GitignoreTemplates: GitignoreTemplates,
    GitLabCIYMLTemplates: GitLabCIYMLTemplates,
    Keys: Keys,
    License: License,
    LicenseTemplates: LicenseTemplates,
    Lint: Lint,
    Namespaces: Namespaces,
    NotificationSettings: NotificationSettings,
    Markdown: Markdown,
    PagesDomains: PagesDomains,
    Search: Search,
    SidekiqMetrics: SidekiqMetrics,
    Snippets: Snippets,
    SystemHooks: SystemHooks,
    Version: Version,
    Wikis: Wikis,
};
var Gitlab = /** @class */ (function (_super) {
    __extends(Gitlab, _super);
    function Gitlab(options) {
        var _this = _super.call(this) || this;
        Object.keys(resources).forEach(function (s) {
            _this[s] = new resources[s](options);
        });
        return _this;
    }
    return Gitlab;
}(/** @class */ (function () {
    function class_1() {
    }
    return class_1;
}())));

// Groups

var index = /*#__PURE__*/Object.freeze({
    __proto__: null,
    Groups: Groups,
    GroupAccessRequests: GroupAccessRequests,
    GroupBadges: GroupBadges,
    GroupCustomAttributes: GroupCustomAttributes,
    GroupIssueBoards: GroupIssueBoards,
    GroupMembers: GroupMembers,
    GroupMilestones: GroupMilestones,
    GroupRunners: GroupRunners,
    GroupVariables: GroupVariables,
    GroupLabels: GroupLabels,
    GroupDeployTokens: GroupDeployTokens,
    Epics: Epics,
    EpicIssues: EpicIssues,
    EpicNotes: EpicNotes,
    EpicDiscussions: EpicDiscussions,
    Users: Users,
    UserCustomAttributes: UserCustomAttributes,
    UserEmails: UserEmails,
    UserImpersonationTokens: UserImpersonationTokens,
    UserSSHKeys: UserSSHKeys,
    UserGPGKeys: UserGPGKeys,
    Branches: Branches,
    Commits: Commits,
    CommitDiscussions: CommitDiscussions,
    ContainerRegistry: ContainerRegistry,
    Deployments: Deployments,
    DeployKeys: DeployKeys,
    Environments: Environments,
    FreezePeriods: FreezePeriods,
    Issues: Issues,
    IssuesStatistics: IssuesStatistics,
    IssueNotes: IssueNotes,
    IssueNoteAwardEmojis: IssueNoteAwardEmojis,
    IssueDiscussions: IssueDiscussions,
    IssueAwardEmojis: IssueAwardEmojis,
    Jobs: Jobs,
    Labels: Labels,
    MergeRequests: MergeRequests,
    MergeRequestApprovals: MergeRequestApprovals,
    MergeRequestAwardEmojis: MergeRequestAwardEmojis,
    MergeRequestDiscussions: MergeRequestDiscussions,
    MergeRequestNotes: MergeRequestNotes,
    Packages: Packages,
    PackageRegistry: PackageRegistry,
    Pipelines: Pipelines,
    PipelineSchedules: PipelineSchedules,
    PipelineScheduleVariables: PipelineScheduleVariables,
    Projects: Projects,
    ProjectAccessRequests: ProjectAccessRequests,
    ProjectBadges: ProjectBadges,
    ProjectCustomAttributes: ProjectCustomAttributes,
    ProjectImportExport: ProjectImportExport,
    ProjectIssueBoards: ProjectIssueBoards,
    ProjectHooks: ProjectHooks,
    ProjectMembers: ProjectMembers,
    ProjectMilestones: ProjectMilestones,
    ProjectSnippets: ProjectSnippets,
    ProjectSnippetNotes: ProjectSnippetNotes,
    ProjectSnippetDiscussions: ProjectSnippetDiscussions,
    ProjectSnippetAwardEmojis: ProjectSnippetAwardEmojis,
    ProtectedBranches: ProtectedBranches,
    ProtectedTags: ProtectedTags,
    ProjectVariables: ProjectVariables,
    ProjectDeployTokens: ProjectDeployTokens,
    PushRules: PushRules,
    Releases: Releases,
    ReleaseLinks: ReleaseLinks,
    Repositories: Repositories,
    RepositoryFiles: RepositoryFiles,
    RepositorySubmodules: RepositorySubmodules,
    Runners: Runners,
    Services: Services,
    Tags: Tags,
    Todos: Todos,
    Triggers: Triggers,
    VulnerabilityFindings: VulnerabilityFindings,
    ApplicationSettings: ApplicationSettings,
    BroadcastMessages: BroadcastMessages,
    Events: Events,
    FeatureFlags: FeatureFlags,
    GeoNodes: GeoNodes,
    GitignoreTemplates: GitignoreTemplates,
    GitLabCIYMLTemplates: GitLabCIYMLTemplates,
    Keys: Keys,
    License: License,
    LicenseTemplates: LicenseTemplates,
    Lint: Lint,
    Namespaces: Namespaces,
    NotificationSettings: NotificationSettings,
    Markdown: Markdown,
    PagesDomains: PagesDomains,
    Search: Search,
    SidekiqMetrics: SidekiqMetrics,
    Snippets: Snippets,
    SystemHooks: SystemHooks,
    Version: Version,
    Wikis: Wikis,
    Gitlab: Gitlab
});

var types = /*#__PURE__*/Object.freeze({
    __proto__: null
});

exports.ApplicationSettings = ApplicationSettings;
exports.Branches = Branches;
exports.BroadcastMessages = BroadcastMessages;
exports.CommitDiscussions = CommitDiscussions;
exports.Commits = Commits;
exports.ContainerRegistry = ContainerRegistry;
exports.DeployKeys = DeployKeys;
exports.Deployments = Deployments;
exports.Environments = Environments;
exports.EpicDiscussions = EpicDiscussions;
exports.EpicIssues = EpicIssues;
exports.EpicNotes = EpicNotes;
exports.Epics = Epics;
exports.Events = Events;
exports.FeatureFlags = FeatureFlags;
exports.FreezePeriods = FreezePeriods;
exports.GeoNodes = GeoNodes;
exports.GitLabCIYMLTemplates = GitLabCIYMLTemplates;
exports.GitignoreTemplates = GitignoreTemplates;
exports.Gitlab = Gitlab;
exports.GroupAccessRequests = GroupAccessRequests;
exports.GroupBadges = GroupBadges;
exports.GroupCustomAttributes = GroupCustomAttributes;
exports.GroupDeployTokens = GroupDeployTokens;
exports.GroupIssueBoards = GroupIssueBoards;
exports.GroupLabels = GroupLabels;
exports.GroupMembers = GroupMembers;
exports.GroupMilestones = GroupMilestones;
exports.GroupRunners = GroupRunners;
exports.GroupVariables = GroupVariables;
exports.Groups = Groups;
exports.IssueAwardEmojis = IssueAwardEmojis;
exports.IssueDiscussions = IssueDiscussions;
exports.IssueNoteAwardEmojis = IssueNoteAwardEmojis;
exports.IssueNotes = IssueNotes;
exports.Issues = Issues;
exports.IssuesStatistics = IssuesStatistics;
exports.Jobs = Jobs;
exports.Keys = Keys;
exports.Labels = Labels;
exports.License = License;
exports.LicenseTemplates = LicenseTemplates;
exports.Lint = Lint;
exports.Markdown = Markdown;
exports.MergeRequestApprovals = MergeRequestApprovals;
exports.MergeRequestAwardEmojis = MergeRequestAwardEmojis;
exports.MergeRequestDiscussions = MergeRequestDiscussions;
exports.MergeRequestNotes = MergeRequestNotes;
exports.MergeRequests = MergeRequests;
exports.Namespaces = Namespaces;
exports.NotificationSettings = NotificationSettings;
exports.PackageRegistry = PackageRegistry;
exports.Packages = Packages;
exports.PagesDomains = PagesDomains;
exports.PipelineScheduleVariables = PipelineScheduleVariables;
exports.PipelineSchedules = PipelineSchedules;
exports.Pipelines = Pipelines;
exports.ProjectAccessRequests = ProjectAccessRequests;
exports.ProjectBadges = ProjectBadges;
exports.ProjectCustomAttributes = ProjectCustomAttributes;
exports.ProjectDeployTokens = ProjectDeployTokens;
exports.ProjectHooks = ProjectHooks;
exports.ProjectImportExport = ProjectImportExport;
exports.ProjectIssueBoards = ProjectIssueBoards;
exports.ProjectMembers = ProjectMembers;
exports.ProjectMilestones = ProjectMilestones;
exports.ProjectSnippetAwardEmojis = ProjectSnippetAwardEmojis;
exports.ProjectSnippetDiscussions = ProjectSnippetDiscussions;
exports.ProjectSnippetNotes = ProjectSnippetNotes;
exports.ProjectSnippets = ProjectSnippets;
exports.ProjectVariables = ProjectVariables;
exports.Projects = Projects;
exports.ProtectedBranches = ProtectedBranches;
exports.ProtectedTags = ProtectedTags;
exports.PushRules = PushRules;
exports.ReleaseLinks = ReleaseLinks;
exports.Releases = Releases;
exports.Repositories = Repositories;
exports.RepositoryFiles = RepositoryFiles;
exports.RepositorySubmodules = RepositorySubmodules;
exports.Resources = index;
exports.Runners = Runners;
exports.Search = Search;
exports.Services = Services;
exports.SidekiqMetrics = SidekiqMetrics;
exports.Snippets = Snippets;
exports.SystemHooks = SystemHooks;
exports.Tags = Tags;
exports.Todos = Todos;
exports.Triggers = Triggers;
exports.Types = types;
exports.UserCustomAttributes = UserCustomAttributes;
exports.UserEmails = UserEmails;
exports.UserGPGKeys = UserGPGKeys;
exports.UserImpersonationTokens = UserImpersonationTokens;
exports.UserSSHKeys = UserSSHKeys;
exports.Users = Users;
exports.Version = Version;
exports.VulnerabilityFindings = VulnerabilityFindings;
exports.Wikis = Wikis;
exports.getAPIMap = getAPIMap;
//# sourceMappingURL=index.js.map
