UNPKG

gitlab

Version:

Full NodeJS implementation of the GitLab API. Supports Promises, Async/Await.

1 lines 74.6 kB
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var universalUrl=require("universal-url"),Li=_interopDefault(require("li")),humps=require("humps"),Ky=_interopDefault(require("ky-universal")),FormData=_interopDefault(require("form-data")),queryString=require("query-string"),randomstring=_interopDefault(require("randomstring")),extendStatics=function(e,t){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(e,t)};function __extends(e,t){function o(){this.constructor=e}extendStatics(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}var __assign=function(){return(__assign=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};function __rest(e,t){var o={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&(o[r[n]]=e[r[n]])}return o}function __awaiter(e,t,o,r){return new(o||(o=Promise))(function(n,s){function p(e){try{u(r.next(e))}catch(e){s(e)}}function i(e){try{u(r.throw(e))}catch(e){s(e)}}function u(e){e.done?n(e.value):new o(function(t){t(e.value)}).then(p,i)}u((r=r.apply(e,t||[])).next())})}function __generator(e,t){var o,r,n,s,p={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return s={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function i(s){return function(i){return function(s){if(o)throw new TypeError("Generator is already executing.");for(;p;)try{if(o=1,r&&(n=2&s[0]?r.return:s[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,s[1])).done)return n;switch(r=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return p.label++,{value:s[1],done:!1};case 5:p.label++,r=s[1],s=[0];continue;case 7:s=p.ops.pop(),p.trys.pop();continue;default:if(!(n=(n=p.trys).length>0&&n[n.length-1])&&(6===s[0]||2===s[0])){p=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){p.label=s[1];break}if(6===s[0]&&p.label<n[1]){p.label=n[1],n=s;break}if(n&&p.label<n[2]){p.label=n[2],p.ops.push(s);break}n[2]&&p.ops.pop(),p.trys.pop();continue}s=t.call(e,p)}catch(e){s=[6,e],r=0}finally{o=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,i])}}}function __read(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var r,n,s=o.call(e),p=[];try{for(;(void 0===t||t-- >0)&&!(r=s.next()).done;)p.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}return p}function __spread(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(__read(arguments[t]));return e}function get(e,t,o){return void 0===o&&(o={}),__awaiter(this,void 0,void 0,function(){var r,n,s,p,i,u,c,a,d,l,m,_,h;return __generator(this,function(f){switch(f.label){case 0:return r=o.showPagination,n=o.maxPages,s=o.sudo,p=__rest(o,["showPagination","maxPages","sudo"]),[4,e.requester.get(e,t,{query:p||{},sudo:s})];case 1:return i=f.sent(),u=i.headers,c=i.body,a={total:u["x-total"],next:parseInt(u["x-next-page"],10)||null,current:parseInt(u["x-page"],10)||1,previous:u["x-prev-page"]||null,perPage:u["x-per-page"],totalPages:u["x-total-pages"]},d=!n||a.current<n,e.camelize&&(c=humps.camelizeKeys(c)),!p.page&&d&&a.next?(l=Li.parse(u.link).next,m=e.url.split("/").pop()||"",_=new RegExp(".+/api/v\\d(/"+m+")?/"),[4,get(e,l.replace(_,""),{maxPages:n,sudo:s,showPagination:!0})]):[3,3];case 2:h=f.sent(),a=h.pagination,c=__spread(c,h.data),f.label=3;case 3:return[2,(p.page||c.length>0)&&r?{data:c,pagination:a}:c]}})})}function stream(e,t,o){if(void 0===o&&(o={}),"function"!=typeof e.requester.stream)throw new Error("Stream method is not implementated in requester!");return e.requester.stream(e,t,{query:o})}function post(e,t,o){return void 0===o&&(o={}),__awaiter(this,void 0,void 0,function(){var r,n;return __generator(this,function(s){switch(s.label){case 0:return r=o.sudo,n=__rest(o,["sudo"]),[4,e.requester.post(e,t,{body:n,sudo:r})];case 1:return[2,s.sent().body]}})})}function put(e,t,o){return void 0===o&&(o={}),__awaiter(this,void 0,void 0,function(){var r;return __generator(this,function(n){switch(n.label){case 0:return o.sudo,r=__rest(o,["sudo"]),[4,e.requester.put(e,t,{body:r})];case 1:return[2,n.sent().body]}})})}function del(e,t,o){return void 0===o&&(o={}),__awaiter(this,void 0,void 0,function(){var r,n;return __generator(this,function(s){switch(s.label){case 0:return r=o.sudo,n=__rest(o,["sudo"]),[4,e.requester.delete(e,t,{query:n,sudo:r})];case 1:return[2,s.sent().body]}})})}function bundler(e){return function(t){var o=this;Object.entries(e||{}).forEach(function(e){var r=__read(e,2),n=r[0],s=r[1];o[n]=new s(t)})}}function skipAllCaps(e,t,o){return/^[A-Z0-9_]+$/.test(e)?e:t(e,o)}var methods=["get","post","put","delete","stream"],KyRequester={};function responseHeadersAsObject(e){var t={};return __spread(e.headers.entries()).forEach(function(e){var o=__read(e,2),r=o[0],n=o[1];t[r]=n}),t}function defaultRequest(e,t){var o=t.body,r=t.query,n=t.sudo,s=t.method,p=new Headers(e.headers),i=o;return n&&p.append("sudo",""+n),"object"!=typeof o||o instanceof FormData||(i=JSON.stringify(humps.decamelizeKeys(o,skipAllCaps)),p.append("content-type","application/json")),{timeout:e.requestTimeout,headers:p,method:"stream"===s?"get":s,onProgress:"stream"===s?function(){}:void 0,searchParams:queryString.stringify(humps.decamelizeKeys(r||{}),{arrayFormat:"bracket"}),prefixUrl:e.url,body:i}}function processBody(e){return __awaiter(this,void 0,void 0,function(){var t,o;return __generator(this,function(r){switch(r.label){case 0:return t=e.headers.get("content-type")||"",[4,e.text()];case 1:if(o=r.sent(),t.includes("json"))try{return[2,JSON.parse(o||"{}")]}catch(e){return[2,{}]}return[2,o]}})})}methods.forEach(function(e){KyRequester[e]=function(t,o,r){return __awaiter(this,void 0,void 0,function(){var n,s,p,i,u,c;return __generator(this,function(a){switch(a.label){case 0:n=defaultRequest(t,__assign({},r,{method:e})),a.label=1;case 1:return a.trys.push([1,3,,6]),[4,Ky(o,n)];case 2:return s=a.sent(),[3,6];case 3:return(p=a.sent()).response?[4,p.response.json()]:[3,5];case 4:i=a.sent(),p.description=i.error||i.message,a.label=5;case 5:throw p;case 6:return u=s.status,c=responseHeadersAsObject(s),[4,processBody(s)];case 7:return[2,{body:a.sent(),headers:c,status:u}]}})})}});var BaseService=function(){return function(e){var t=e.token,o=e.jobToken,r=e.oauthToken,n=e.sudo,s=e.host,p=void 0===s?"https://gitlab.com":s,i=e.url,u=void 0===i?"":i,c=e.version,a=void 0===c?"v4":c,d=e.camelize,l=void 0!==d&&d,m=e.rejectUnauthorized,_=void 0===m||m,h=e.requester,f=void 0===h?KyRequester:h,y=e.requestTimeout,g=void 0===y?3e5:y;this.url=[p,"api",a,u].join("/"),this.headers={},this.rejectUnauthorized=_,this.camelize=l,this.requester=f,this.requestTimeout=g,r?this.headers.authorization="Bearer "+r:o?this.headers["job-token"]=o:t&&(this.headers["private-token"]=t),n&&(this.headers.Sudo=""+n)}}(),Groups=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.all=function(e){return get(this,"groups",e)},t.prototype.create=function(e){return post(this,"groups",e)},t.prototype.createLDAPLink=function(e,t,o,r,n){return post(this,"groups/"+encodeURIComponent(e)+"/ldap_group_links",__assign({cn:t,groupAccess:o,provider:r},n))},t.prototype.edit=function(e,t){return put(this,"groups/"+encodeURIComponent(e),t)},t.prototype.remove=function(e,t){return del(this,"groups/"+encodeURIComponent(e),t)},t.prototype.removeLDAPLink=function(e,t,o){void 0===o&&(o={});var r=o.provider,n=__rest(o,["provider"]);return del(this,"groups/"+encodeURIComponent(e)+"/ldap_group_links/"+(r?r+"/"+t:""+t),n)},t.prototype.search=function(e,t){return get(this,"groups",__assign({search:e},t))},t.prototype.show=function(e,t){return get(this,"groups/"+encodeURIComponent(e),t)},t.prototype.subgroups=function(e,t){return get(this,"groups/"+encodeURIComponent(e)+"/subgroups",t)},t.prototype.syncLDAP=function(e,t){return post(this,"groups/"+encodeURIComponent(e)+"/ldap_sync",t)},t}(BaseService),ResourceAccessRequests=function(e){function t(t,o){return e.call(this,__assign({url:t},o))||this}return __extends(t,e),t.prototype.all=function(e){return get(this,encodeURIComponent(e)+"/access_requests")},t.prototype.request=function(e){return post(this,encodeURIComponent(e)+"/access_requests")},t.prototype.approve=function(e,t,o){var r=o.accessLevel,n=__read([e,t].map(encodeURIComponent),2);return post(this,n[0]+"/access_requests/"+n[1]+"/approve",{accessLevel:r})},t.prototype.deny=function(e,t){var o=__read([e,t].map(encodeURIComponent),2);return del(this,o[0]+"/access_requests/"+o[1])},t}(BaseService);function url(e,t,o,r,n){var s=__read([e,o].map(encodeURIComponent),2),p=[s[0],t,s[1]];return n&&p.push("notes",encodeURIComponent(n)),p.push(encodeURIComponent("award_emoji")),r&&p.push(encodeURIComponent(r)),p.join("/")}var ResourceAwardsEmojis=function(e){function t(t,o){var r=e.call(this,__assign({url:"projects"},o))||this;return r.resourceType=t,r}return __extends(t,e),t.prototype.all=function(e,t,o,r){return get(this,url(e,this.resourceType,t,null,o),r)},t.prototype.award=function(e,t,o,r,n){return post(this,url(e,this.resourceType,t,null,r),__assign({name:o},n))},t.prototype.remove=function(e,t,o,r,n){return del(this,url(e,this.resourceType,t,o,r),n)},t.prototype.show=function(e,t,o,r,n){return get(this,url(e,this.resourceType,t,o,r),n)},t}(BaseService),ResourceBadges=function(e){function t(t,o){return e.call(this,__assign({url:t},o))||this}return __extends(t,e),t.prototype.add=function(e,t){return post(this,encodeURIComponent(e)+"/badges",t)},t.prototype.all=function(e,t){return get(this,encodeURIComponent(e)+"/badges",t)},t.prototype.edit=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return put(this,r[0]+"/badges/"+r[1],o)},t.prototype.preview=function(e,t,o,r){return get(this,encodeURIComponent(e)+"/badges/render",__assign({linkUrl:t,imageUrl:o},r))},t.prototype.remove=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return del(this,r[0]+"/badges/"+r[1],o)},t.prototype.show=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return get(this,r[0]+"/badges/"+r[1],o)},t}(BaseService),ResourceCustomAttributes=function(e){function t(t,o){return e.call(this,__assign({url:t},o))||this}return __extends(t,e),t.prototype.all=function(e,t){return get(this,encodeURIComponent(e)+"/custom_attributes",t)},t.prototype.set=function(e,t,o,r){var n=__read([e,t].map(encodeURIComponent),2);return put(this,n[0]+"/custom_attributes/"+n[1],__assign({value:o},r))},t.prototype.remove=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return del(this,r[0]+"/custom_attributes/"+r[1],o)},t.prototype.show=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return get(this,r[0]+"/custom_attributes/"+r[1],o)},t}(BaseService),ResourceDiscussions=function(e){function t(t,o,r){var n=e.call(this,__assign({url:t},r))||this;return n.resource2Type=o,n}return __extends(t,e),t.prototype.addNote=function(e,t,o,r,n,s){if(!n)throw new Error("Missing required content argument");var p=__read([e,t,o,r].map(encodeURIComponent),4),i=p[0],u=p[1],c=p[2],a=p[3];return post(this,i+"/"+this.resource2Type+"/"+u+"/discussions/"+c+"/notes",__assign({body:n,noteId:a},s))},t.prototype.all=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2),n=r[0],s=r[1];return get(this,n+"/"+this.resource2Type+"/"+s+"/discussions",o)},t.prototype.create=function(e,t,o,r){if(!o)throw new Error("Missing required content argument");var n=__read([e,t].map(encodeURIComponent),2),s=n[0],p=n[1];return post(this,s+"/"+this.resource2Type+"/"+p+"/discussions",__assign({body:o},r))},t.prototype.editNote=function(e,t,o,r,n){var s=__read([e,t,o,r].map(encodeURIComponent),4),p=s[0],i=s[1],u=s[2],c=s[3];return put(this,p+"/"+this.resource2Type+"/"+i+"/discussions/"+u+"/notes/"+c,{body:n})},t.prototype.removeNote=function(e,t,o,r,n){var s=__read([e,t,o,r].map(encodeURIComponent),4),p=s[0],i=s[1],u=s[2],c=s[3];return del(this,p+"/"+this.resource2Type+"/"+i+"/discussions/"+u+"/notes/"+c,n)},t.prototype.show=function(e,t,o,r){var n=__read([e,t,o].map(encodeURIComponent),3),s=n[0],p=n[1],i=n[2];return get(this,s+"/"+this.resource2Type+"/"+p+"/discussions/"+i,r)},t}(BaseService),ResourceIssueBoards=function(e){function t(t,o){return e.call(this,__assign({url:t},o))||this}return __extends(t,e),t.prototype.all=function(e,t){return get(this,encodeURIComponent(e)+"/boards",t)},t.prototype.create=function(e,t,o){return post(this,encodeURIComponent(e)+"/boards",__assign({name:t},o))},t.prototype.createList=function(e,t,o,r){var n=__read([e,t].map(encodeURIComponent),2);return post(this,n[0]+"/boards/"+n[1]+"/lists",__assign({labelId:o},r))},t.prototype.edit=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return put(this,r[0]+"/boards/"+r[1],o)},t.prototype.editList=function(e,t,o,r,n){var s=__read([e,t,o].map(encodeURIComponent),3);return put(this,s[0]+"/boards/"+s[1]+"/lists/"+s[2],__assign({position:r},n))},t.prototype.lists=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return get(this,r[0]+"/boards/"+r[1]+"/lists",o)},t.prototype.remove=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return del(this,r[0]+"/boards/"+r[1],o)},t.prototype.removeList=function(e,t,o,r){var n=__read([e,t,o].map(encodeURIComponent),3);return del(this,n[0]+"/boards/"+n[1]+"/lists/"+n[2],r)},t.prototype.show=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return get(this,r[0]+"/boards/"+r[1],o)},t.prototype.showList=function(e,t,o,r){var n=__read([e,t,o].map(encodeURIComponent),3);return get(this,n[0]+"/boards/"+n[1]+"/lists/"+n[2],r)},t}(BaseService),ResourceMembers=function(e){function t(t,o){return e.call(this,__assign({url:t},o))||this}return __extends(t,e),t.prototype.all=function(e,t,o){void 0===t&&(t=!1);var r=[encodeURIComponent(e),"members"];return t&&r.push("all"),get(this,r.join("/"),{options:o})},t.prototype.add=function(e,t,o,r){var n=__read([e,t].map(encodeURIComponent),2),s=n[0],p=n[1];return post(this,s+"/members",__assign({userId:p,accessLevel:o},r))},t.prototype.edit=function(e,t,o,r){var n=__read([e,t].map(encodeURIComponent),2);return put(this,n[0]+"/members/"+n[1],__assign({accessLevel:o},r))},t.prototype.show=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return get(this,r[0]+"/members/"+r[1],o)},t.prototype.remove=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return del(this,r[0]+"/members/"+r[1],o)},t}(BaseService),ResourceMilestones=function(e){function t(t,o){return e.call(this,__assign({url:t},o))||this}return __extends(t,e),t.prototype.all=function(e,t){return get(this,encodeURIComponent(e)+"/milestones",t)},t.prototype.create=function(e,t,o){return post(this,encodeURIComponent(e)+"/milestones",__assign({title:t},o))},t.prototype.edit=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return put(this,r[0]+"/milestones/"+r[1],o)},t.prototype.issues=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return get(this,r[0]+"/milestones/"+r[1]+"/issues",o)},t.prototype.mergeRequests=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return get(this,r[0]+"/milestones/"+r[1]+"/merge_requests",o)},t.prototype.show=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return get(this,r[0]+"/milestones/"+r[1],o)},t}(BaseService),ResourceNotes=function(e){function t(t,o,r){var n=e.call(this,__assign({url:t},r))||this;return n.resource2Type=o,n}return __extends(t,e),t.prototype.all=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2),n=r[0],s=r[1];return get(this,n+"/"+this.resource2Type+"/"+s+"/notes",o)},t.prototype.create=function(e,t,o,r){var n=__read([e,t].map(encodeURIComponent),2),s=n[0],p=n[1];return post(this,s+"/"+this.resource2Type+"/"+p+"/notes",__assign({body:o},r))},t.prototype.edit=function(e,t,o,r,n){var s=__read([e,t,o].map(encodeURIComponent),3),p=s[0],i=s[1],u=s[2];return put(this,p+"/"+this.resource2Type+"/"+i+"/notes/"+u,__assign({body:r},n))},t.prototype.remove=function(e,t,o,r){var n=__read([e,t,o].map(encodeURIComponent),3),s=n[0],p=n[1],i=n[2];return del(this,s+"/"+this.resource2Type+"/"+p+"/notes/"+i,r)},t.prototype.show=function(e,t,o,r){var n=__read([e,t,o].map(encodeURIComponent),3),s=n[0],p=n[1],i=n[2];return get(this,s+"/"+this.resource2Type+"/"+p+"/notes/"+i,r)},t}(BaseService),ResourceTemplates=function(e){function t(t,o){return e.call(this,__assign({url:["templates",t].join("/")},o))||this}return __extends(t,e),t.prototype.all=function(e){return get(this,"",e)},t.prototype.show=function(e,t){return post(this,""+encodeURIComponent(e),t)},t}(BaseService),ResourceVariables=function(e){function t(t,o){return e.call(this,__assign({url:t},o))||this}return __extends(t,e),t.prototype.all=function(e,t){return get(this,encodeURIComponent(e)+"/variables",t)},t.prototype.create=function(e,t){return post(this,encodeURIComponent(e)+"/variables",t)},t.prototype.edit=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return put(this,r[0]+"/variables/"+r[1],o)},t.prototype.show=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return get(this,r[0]+"/variables/"+r[1],o)},t.prototype.remove=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return del(this,r[0]+"/variables/"+r[1],o)},t}(BaseService),GroupAccessRequests=function(e){function t(t){return e.call(this,"groups",t)||this}return __extends(t,e),t}(ResourceAccessRequests),GroupBadges=function(e){function t(t){return e.call(this,"groups",t)||this}return __extends(t,e),t}(ResourceBadges),GroupCustomAttributes=function(e){function t(t){return e.call(this,"groups",t)||this}return __extends(t,e),t}(ResourceCustomAttributes),GroupIssueBoards=function(e){function t(t){return e.call(this,"groups",t)||this}return __extends(t,e),t}(ResourceIssueBoards),GroupMembers=function(e){function t(t){return e.call(this,"groups",t)||this}return __extends(t,e),t}(ResourceMembers),GroupMilestones=function(e){function t(t){return e.call(this,"groups",t)||this}return __extends(t,e),t}(ResourceMilestones),GroupProjects=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.all=function(e,t){return get(this,"groups/"+encodeURIComponent(e)+"/projects",t)},t.prototype.add=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return post(this,"groups/"+r[0]+"/projects/"+r[1],o)},t}(BaseService),GroupVariables=function(e){function t(t){return e.call(this,"groups",t)||this}return __extends(t,e),t}(ResourceVariables),Epics=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.all=function(e,t){return get(this,"groups/"+encodeURIComponent(e)+"/epics",t)},t.prototype.create=function(e,t,o){return post(this,"groups/"+encodeURIComponent(e)+"/epics",__assign({title:t},o))},t.prototype.edit=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return put(this,"groups/"+r[0]+"/epics/"+r[1],o)},t.prototype.remove=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return del(this,"groups/"+r[0]+"/epics/"+r[1],o)},t.prototype.show=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return get(this,"groups/"+r[0]+"/epics/"+r[1],o)},t}(BaseService),EpicIssues=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.all=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return get(this,"groups/"+r[0]+"/epics/"+r[1]+"/issues",o)},t.prototype.assign=function(e,t,o,r){var n=__read([e,t,o].map(encodeURIComponent),3);return put(this,"groups/"+n[0]+"/epics/"+n[1]+"/issues/"+n[2],r)},t.prototype.edit=function(e,t,o,r){var n=__read([e,t,o].map(encodeURIComponent),3);return del(this,"groups/"+n[0]+"/epics/"+n[1]+"/issues/"+n[2],r)},t.prototype.remove=function(e,t,o,r){var n=__read([e,t,o].map(encodeURIComponent),3);return del(this,"groups/"+n[0]+"/epics/"+n[1]+"/issues/"+n[2],r)},t}(BaseService),EpicNotes=function(e){function t(t){return e.call(this,"groups","epics",t)||this}return __extends(t,e),t}(ResourceNotes),EpicDiscussions=function(e){function t(t){return e.call(this,"groups","epics",t)||this}return __extends(t,e),t}(ResourceDiscussions),Users=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.all=function(e){return get(this,"users",e)},t.prototype.activities=function(e){return get(this,"users/activities",e)},t.prototype.projects=function(e,t){return get(this,"users/"+encodeURIComponent(e)+"/projects",t)},t.prototype.block=function(e,t){return post(this,"users/"+encodeURIComponent(e)+"/block",t)},t.prototype.create=function(e){return post(this,"users",e)},t.prototype.current=function(e){return get(this,"user",e)},t.prototype.edit=function(e,t){return put(this,"users/"+encodeURIComponent(e),t)},t.prototype.events=function(e,t){return get(this,"users/"+encodeURIComponent(e)+"/events",t)},t.prototype.session=function(e,t,o){return post(this,"session",__assign({email:e,password:t},o))},t.prototype.search=function(e,t){return get(this,"users",__assign({search:e},t))},t.prototype.show=function(e,t){return get(this,"users/"+encodeURIComponent(e),t)},t.prototype.remove=function(e,t){return del(this,"users/"+encodeURIComponent(e),t)},t.prototype.unblock=function(e,t){return post(this,"users/"+encodeURIComponent(e)+"/unblock",t)},t}(BaseService),UserCustomAttributes=function(e){function t(t){return e.call(this,"users",t)||this}return __extends(t,e),t}(ResourceCustomAttributes),url$1=function(e){return e?"users/"+encodeURIComponent(e)+"/emails":"user/emails"},UserEmails=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.all=function(e){void 0===e&&(e={});var t=e.userId,o=__rest(e,["userId"]);return get(this,url$1(t),o)},t.prototype.add=function(e,t){void 0===t&&(t={});var o=t.userId,r=__rest(t,["userId"]);return post(this,url$1(o),__assign({email:e},r))},t.prototype.show=function(e,t){return get(this,"user/emails/"+encodeURIComponent(e),t)},t.prototype.remove=function(e,t){void 0===t&&(t={});var o=t.userId,r=__rest(t,["userId"]),n=encodeURIComponent(e);return del(this,url$1(o)+"/"+n,r)},t}(BaseService),UserImpersonationTokens=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.all=function(e,t){return get(this,"users/"+encodeURIComponent(e)+"/impersonation_tokens",t)},t.prototype.add=function(e,t,o,r,n){return post(this,"users/"+encodeURIComponent(e)+"/impersonation_tokens",__assign({name:t,expiresAt:r,scopes:o},n))},t.prototype.show=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return get(this,"users/"+r[0]+"/impersonation_tokens/"+r[1],o)},t.prototype.revoke=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return del(this,"users/"+r[0]+"/impersonation_tokens/"+r[1],o)},t}(BaseService),url$2=function(e){return e?"users/"+encodeURIComponent(e)+"/keys":"user/keys"},UserKeys=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.all=function(e){void 0===e&&(e={});var t=e.userId,o=__rest(e,["userId"]);return get(this,url$2(t),o)},t.prototype.create=function(e,t,o){void 0===o&&(o={});var r=o.userId,n=__rest(o,["userId"]);return post(this,url$2(r),__assign({title:e,key:t},n))},t.prototype.show=function(e,t){return get(this,"user/keys/"+encodeURIComponent(e),t)},t.prototype.remove=function(e,t){void 0===t&&(t={});var o=t.userId,r=__rest(t,["userId"]),n=encodeURIComponent(e);return del(this,url$2(o)+"/"+n,r)},t}(BaseService),url$3=function(e){return e?"users/"+encodeURIComponent(e)+"/gpg_keys":"users/gpg_keys"},UserGPGKeys=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.all=function(e){void 0===e&&(e={});var t=e.userId,o=__rest(e,["userId"]);return get(this,url$3(t),o)},t.prototype.add=function(e,t,o){void 0===o&&(o={});var r=o.userId,n=__rest(o,["userId"]);return post(this,url$3(r),__assign({title:e,key:t},n))},t.prototype.show=function(e,t){void 0===t&&(t={});var o=t.userId,r=__rest(t,["userId"]),n=encodeURIComponent(e);return get(this,url$3(o)+"/"+n,r)},t.prototype.remove=function(e,t){void 0===t&&(t={});var o=t.userId,r=__rest(t,["userId"]),n=encodeURIComponent(e);return del(this,url$3(o)+"/"+n,r)},t}(BaseService),Branches=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.all=function(e,t){return get(this,"projects/"+encodeURIComponent(e)+"/repository/branches",t)},t.prototype.create=function(e,t,o,r){return post(this,"projects/"+encodeURIComponent(e)+"/repository/branches",__assign({branch:t,ref:o},r))},t.prototype.protect=function(e,t,o){return post(this,"projects/"+encodeURIComponent(e)+"/protected_branches",__assign({name:t},o))},t.prototype.remove=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return del(this,"projects/"+r[0]+"/repository/branches/"+r[1],o)},t.prototype.show=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return get(this,"projects/"+r[0]+"/repository/branches/"+r[1],o)},t.prototype.unprotect=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return put(this,"projects/"+r[0]+"/repository/branches/"+r[1]+"/unprotect",o)},t}(BaseService),Commits=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.all=function(e,t){return get(this,"projects/"+encodeURIComponent(e)+"/repository/commits",t)},t.prototype.cherryPick=function(e,t,o,r){return post(this,"projects/"+encodeURIComponent(e)+"/repository/commits/"+t+"/cherry_pick",__assign({branch:o},r))},t.prototype.comments=function(e,t,o){return get(this,"projects/"+encodeURIComponent(e)+"/repository/commits/"+t+"/comments",o)},t.prototype.create=function(e,t,o,r,n){return void 0===r&&(r=[]),post(this,"projects/"+encodeURIComponent(e)+"/repository/commits",__assign({branch:t,commitMessage:o,actions:r},n))},t.prototype.createComment=function(e,t,o,r){return post(this,"projects/"+encodeURIComponent(e)+"/repository/commits/"+t+"/comments",__assign({note:o},r))},t.prototype.diff=function(e,t,o){return get(this,"projects/"+encodeURIComponent(e)+"/repository/commits/"+t+"/diff",o)},t.prototype.editStatus=function(e,t,o){return post(this,"projects/"+encodeURIComponent(e)+"/statuses/"+t,o)},t.prototype.references=function(e,t,o){return get(this,"projects/"+encodeURIComponent(e)+"/repository/commits/"+t+"/refs",o)},t.prototype.show=function(e,t,o){return get(this,"projects/"+encodeURIComponent(e)+"/repository/commits/"+t,o)},t.prototype.status=function(e,t,o){return get(this,"projects/"+encodeURIComponent(e)+"/repository/commits/"+t+"/statuses",o)},t.prototype.mergeRequests=function(e,t,o){return get(this,"projects/"+encodeURIComponent(e)+"/repository/commits/"+t+"/merge_requests",o)},t}(BaseService),CommitDiscussions=function(e){function t(t){return e.call(this,"projects","commits",t)||this}return __extends(t,e),t}(ResourceDiscussions),ContainerRegistry=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.repositories=function(e,t){return get(this,"projects/"+encodeURIComponent(e)+"/registry/repositories",t)},t.prototype.tags=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return get(this,"projects/"+r[0]+"/registry/repositories/"+r[1]+"/tags",o)},t.prototype.removeRepository=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return del(this,"projects/"+r[0]+"/registry/repositories/"+r[1],o)},t.prototype.removeTag=function(e,t,o,r){var n=__read([e,t,o].map(encodeURIComponent),3);return del(this,"projects/"+n[0]+"/registry/repositories/"+n[1]+"/tags/"+n[2],r)},t.prototype.removeTags=function(e,t,o,r){var n=__read([e,t].map(encodeURIComponent),2);return del(this,"projects/"+n[0]+"/registry/repositories/"+n[1]+"/tags",__assign({tagNameRegex:o},r))},t.prototype.showTag=function(e,t,o,r){var n=__read([e,t,o].map(encodeURIComponent),3);return get(this,"projects/"+n[0]+"/registry/repositories/"+n[1]+"/tags/"+n[2],r)},t}(BaseService),Deployments=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.all=function(e,t){return get(this,"projects/"+encodeURIComponent(e)+"/deployments",t)},t.prototype.show=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return post(this,"projects/"+r[0]+"/deployments/"+r[1],o)},t}(BaseService),DeployKeys=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.add=function(e,t){return post(this,"projects/"+encodeURIComponent(e)+"/deploy_keys",t)},t.prototype.all=function(e){var t=e.projectId,o=__rest(e,["projectId"]);return get(this,t?"projects/"+encodeURIComponent(t)+"/deploy_keys":"deploy_keys",o)},t.prototype.edit=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return put(this,"projects/"+r[0]+"/deploy_keys/"+r[1],o)},t.prototype.enable=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return post(this,"projects/"+r[0]+"/deploy_keys/"+r[1]+"/enable",o)},t.prototype.remove=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return del(this,"projects/"+r[0]+"/deploy_keys/"+r[1],o)},t.prototype.show=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return get(this,"projects/"+r[0]+"/deploy_keys/"+r[1],o)},t}(BaseService),Environments=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.all=function(e,t){return get(this,"projects/"+encodeURIComponent(e)+"/environments",t)},t.prototype.create=function(e,t){return post(this,"projects/"+encodeURIComponent(e)+"/environments",t)},t.prototype.edit=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return put(this,"projects/"+r[0]+"/environments/"+r[1],o)},t.prototype.remove=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return del(this,"projects/"+r[0]+"/environments/"+r[1],o)},t.prototype.stop=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return post(this,"projects/"+r[0]+"/environments/"+r[1]+"/stop",o)},t}(BaseService),Issues=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.addSpentTime=function(e,t,o,r){var n=__read([e,t].map(encodeURIComponent),2);return post(this,"projects/"+n[0]+"/issues/"+n[1]+"/add_spent_time",__assign({duration:o},r))},t.prototype.addTimeEstimate=function(e,t,o,r){var n=__read([e,t].map(encodeURIComponent),2);return post(this,"projects/"+n[0]+"/issues/"+n[1]+"/time_estimate",__assign({duration:o},r))},t.prototype.all=function(e){void 0===e&&(e={});var t=e.projectId,o=e.groupId,r=__rest(e,["projectId","groupId"]);return get(this,t?"projects/"+encodeURIComponent(t)+"/issues":o?"groups/"+encodeURIComponent(o)+"/issues":"issues",r)},t.prototype.create=function(e,t){return post(this,"projects/"+encodeURIComponent(e)+"/issues",t)},t.prototype.edit=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return put(this,"projects/"+r[0]+"/issues/"+r[1],o)},t.prototype.link=function(e,t,o,r,n){var s=__read([e,t].map(encodeURIComponent),2),p=s[0],i=s[1],u=__read([o,r].map(encodeURIComponent),2),c=u[0],a=u[1];return post(this,"projects/"+p+"/issues/"+i+"/links",__assign({targetProjectId:c,targetIssueId:a},n))},t.prototype.participants=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return get(this,"projects/"+r[0]+"/issues/"+r[1]+"/participants",o)},t.prototype.remove=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return del(this,"projects/"+r[0]+"/issues/"+r[1],o)},t.prototype.resetSpentTime=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return post(this,"projects/"+r[0]+"/issues/"+r[1]+"/reset_spent_time",o)},t.prototype.resetTimeEstimate=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return post(this,"projects/"+r[0]+"/issues/"+r[1]+"/reset_time_estimate",o)},t.prototype.show=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return get(this,"projects/"+r[0]+"/issues/"+r[1],o)},t.prototype.subscribe=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return post(this,"projects/"+r[0]+"/issues/"+r[1]+"/subscribe",o)},t.prototype.timeStats=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return get(this,"projects/"+r[0]+"/issues/"+r[1]+"/time_stats",o)},t.prototype.unsubscribe=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return del(this,"projects/"+r[0]+"/issues/"+r[1]+"/unsubscribe",o)},t}(BaseService),IssueNotes=function(e){function t(t){return e.call(this,"projects","issues",t)||this}return __extends(t,e),t}(ResourceNotes),IssueDiscussions=function(e){function t(t){return e.call(this,"projects","issues",t)||this}return __extends(t,e),t}(ResourceDiscussions),IssueAwardEmojis=function(e){function t(t){return e.call(this,"issues",t)||this}return __extends(t,e),t}(ResourceAwardsEmojis),Jobs=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.all=function(e,t){return get(this,"projects/"+encodeURIComponent(e)+"/jobs",t)},t.prototype.cancel=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return post(this,"projects/"+r[0]+"/jobs/"+r[1]+"/cancel",o)},t.prototype.downloadSingleArtifactFile=function(e,t,o,r){var n=r.stream,s=void 0!==n&&n,p=__rest(r,["stream"]),i=__read([e,t].map(encodeURIComponent),2),u=i[0],c=i[1];return s?stream(this,"projects/"+u+"/jobs/"+c+"/artifacts/"+o,p):get(this,"projects/"+u+"/jobs/"+c+"/artifacts/"+o,p)},t.prototype.downloadLatestArtifactFile=function(e,t,o,r){var n=r.stream,s=void 0!==n&&n,p=__rest(r,["stream"]),i=__read([e,t,o].map(encodeURIComponent),3),u=i[0],c=i[1],a=i[2];return s?stream(this,"projects/"+u+"/jobs/artifacts/"+c+"/download?job="+a,p):get(this,"projects/"+u+"/jobs/artifacts/"+c+"/download?job="+a,p)},t.prototype.downloadTraceFile=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return get(this,"projects/"+r[0]+"/jobs/"+r[1]+"/trace",o)},t.prototype.erase=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return post(this,"projects/"+r[0]+"/jobs/"+r[1]+"/erase",o)},t.prototype.eraseArtifacts=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return del(this,"projects/"+r[0]+"/jobs/"+r[1]+"/artifacts",o)},t.prototype.keepArtifacts=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return post(this,"projects/"+r[0]+"/jobs/"+r[1]+"/artifacts/keep",o)},t.prototype.play=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return post(this,"projects/"+r[0]+"/jobs/"+r[1]+"/play",o)},t.prototype.retry=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return post(this,"projects/"+r[0]+"/jobs/"+r[1]+"/retry",o)},t.prototype.show=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return get(this,"projects/"+r[0]+"/jobs/"+r[1],o)},t.prototype.showPipelineJobs=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return get(this,"projects/"+r[0]+"/pipelines/"+r[1]+"/jobs",o)},t}(BaseService),Labels=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.all=function(e,t){return get(this,"projects/"+encodeURIComponent(e)+"/labels",t)},t.prototype.create=function(e,t){return post(this,"projects/"+encodeURIComponent(e)+"/labels",t)},t.prototype.edit=function(e,t,o){return put(this,"projects/"+encodeURIComponent(e)+"/labels",__assign({name:t},o))},t.prototype.remove=function(e,t,o){return del(this,"projects/"+encodeURIComponent(e)+"/labels",__assign({name:t},o))},t.prototype.subscribe=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return post(this,"projects/"+r[0]+"/issues/"+r[1]+"/subscribe",o)},t.prototype.unsubscribe=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return del(this,"projects/"+r[0]+"/issues/"+r[1]+"/unsubscribe",o)},t}(BaseService),MergeRequests=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.accept=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return put(this,"projects/"+r[0]+"/merge_requests/"+r[1]+"/merge",o)},t.prototype.addSpentTime=function(e,t,o,r){var n=__read([e,t].map(encodeURIComponent),2);return post(this,"projects/"+n[0]+"/merge_requests/"+n[1]+"/add_spent_time",__assign({duration:o},r))},t.prototype.addTimeEstimate=function(e,t,o,r){var n=__read([e,t].map(encodeURIComponent),2);return post(this,"projects/"+n[0]+"/merge_requests/"+n[1]+"/time_estimate",__assign({duration:o},r))},t.prototype.all=function(e){var t=e.projectId,o=e.groupId,r=__rest(e,["projectId","groupId"]);return get(this,t?"projects/"+encodeURIComponent(t)+"/merge_requests":o?"groups/"+encodeURIComponent(o)+"/merge_requests":"merge_requests",r)},t.prototype.approve=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return post(this,"projects/"+r[0]+"/merge_requests/"+r[1]+"/approve",o)},t.prototype.approvals=function(e,t){var o,r=t.mergerequestIId,n=__rest(t,["mergerequestIId"]),s=encodeURIComponent(e);r?o="projects/"+s+"/merge_requests/"+encodeURIComponent(r)+"/approvals":o="projects/"+s+"/approvals";return get(this,o,n)},t.prototype.approvers=function(e,t,o,r){var n,s=r.mergerequestIId,p=__rest(r,["mergerequestIId"]),i=encodeURIComponent(e);s?n="projects/"+i+"/merge_requests/"+encodeURIComponent(s)+"/approvers":n="projects/"+i+"/approvers";return put(this,n,__assign({approverIds:t,approverGroupIds:o},p))},t.prototype.cancelOnPipelineSucess=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return put(this,"projects/"+r[0]+"/merge_requests/"+r[1]+"/cancel_merge_when_pipeline_succeeds",o)},t.prototype.changes=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return get(this,"projects/"+r[0]+"/merge_requests/"+r[1]+"/changes",o)},t.prototype.closesIssues=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return get(this,"projects/"+r[0]+"/merge_requests/"+r[1]+"/closes_issues",o)},t.prototype.commits=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return get(this,"projects/"+r[0]+"/merge_requests/"+r[1]+"/commits",o)},t.prototype.create=function(e,t,o,r,n){var s=encodeURIComponent(e);return post(this,"projects/"+s+"/merge_requests",__assign({id:s,sourceBranch:t,targetBranch:o,title:r},n))},t.prototype.edit=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return put(this,"projects/"+r[0]+"/merge_requests/"+r[1],o)},t.prototype.editApprovals=function(e,t){var o,r=t.mergerequestIId,n=__rest(t,["mergerequestIId"]),s=encodeURIComponent(e);r?o="projects/"+s+"/merge_requests/"+encodeURIComponent(r)+"/approvals":o="projects/"+s+"/approvals";return post(this,o,n)},t.prototype.participants=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return get(this,"projects/"+r[0]+"/merge_requests/"+r[1]+"/participants",o)},t.prototype.pipelines=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return get(this,"projects/"+r[0]+"/merge_requests/"+r[1]+"/pipelines",o)},t.prototype.remove=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return del(this,"projects/"+r[0]+"/merge_requests/"+r[1],o)},t.prototype.resetSpentTime=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return post(this,"projects/"+r[0]+"/merge_requests/"+r[1]+"/reset_spent_time",o)},t.prototype.resetTimeEstimate=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return post(this,"projects/"+r[0]+"/merge_requests/"+r[1]+"/reset_time_estimate",o)},t.prototype.show=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return get(this,"projects/"+r[0]+"/merge_requests/"+r[1],o)},t.prototype.timeStats=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return get(this,"projects/"+r[0]+"/merge_requests/"+r[1]+"/time_stats",o)},t.prototype.version=function(e,t,o,r){var n=__read([e,t,o].map(encodeURIComponent),3);return get(this,"projects/"+n[0]+"/merge_requests/"+n[1]+"/versions/"+n[2],r)},t.prototype.versions=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return get(this,"projects/"+r[0]+"/merge_requests/"+r[1]+"/versions",o)},t.prototype.unapprove=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return post(this,"projects/"+r[0]+"/merge_requests/"+r[1]+"/approve",o)},t.prototype.unsubscribe=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return del(this,"projects/"+r[0]+"/merge_requests/"+r[1]+"/unsubscribe",o)},t}(BaseService),MergeRequestAwardEmojis=function(e){function t(t){return e.call(this,"merge_requests",t)||this}return __extends(t,e),t}(ResourceAwardsEmojis),MergeRequestDiscussions=function(e){function t(t){return e.call(this,"projects","merge_requests",t)||this}return __extends(t,e),t}(ResourceDiscussions),MergeRequestNotes=function(e){function t(t){return e.call(this,"projects","merge_requests",t)||this}return __extends(t,e),t}(ResourceNotes),Pipelines=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.all=function(e,t){return get(this,"projects/"+encodeURIComponent(e)+"/pipelines",t)},t.prototype.create=function(e,t,o){return post(this,"projects/"+encodeURIComponent(e)+"/pipeline",__assign({ref:t},o))},t.prototype.show=function(e,t,o){return get(this,"projects/"+encodeURIComponent(e)+"/pipelines/"+t,o)},t.prototype.retry=function(e,t,o){return post(this,"projects/"+encodeURIComponent(e)+"/pipelines/"+t+"/retry",o)},t.prototype.cancel=function(e,t,o){return post(this,"projects/"+encodeURIComponent(e)+"/pipelines/"+t+"/cancel",o)},t.prototype.showJobs=function(e,t,o){return get(this,"projects/"+encodeURIComponent(e)+"/pipelines/"+t+"/jobs",o)},t}(BaseService),PipelineSchedules=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.all=function(e,t){return get(this,"projects/"+encodeURIComponent(e)+"/pipeline_schedules",t)},t.prototype.create=function(e,t,o,r,n){return post(this,"projects/"+encodeURIComponent(e)+"/pipeline_schedules",__assign({description:t,ref:o,cron:r},n))},t.prototype.edit=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return put(this,"projects/"+r[0]+"/pipeline_schedules/"+r[1],o)},t.prototype.remove=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return del(this,"projects/"+r[0]+"/pipeline_schedules/"+r[1],o)},t.prototype.show=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return get(this,"projects/"+r[0]+"/pipeline_schedules/"+r[1],o)},t.prototype.takeOwnership=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return post(this,"projects/"+r[0]+"/pipeline_schedules/"+r[1]+"/take_ownership",o)},t}(BaseService),PipelineScheduleVariables=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.all=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return get(this,"projects/"+r[0]+"/pipeline_schedules/"+r[1]+"/variables",o)},t.prototype.create=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return post(this,"projects/"+r[0]+"/pipeline_schedules/"+r[1]+"/variables",o)},t.prototype.edit=function(e,t,o,r){var n=__read([e,t,o].map(encodeURIComponent),3);return put(this,"projects/"+n[0]+"/pipeline_schedules/"+n[1]+"/variables/"+n[2],r)},t.prototype.show=function(e,t,o,r){var n=__read([e,t,o].map(encodeURIComponent),3);return get(this,"projects/"+n[0]+"/pipeline_schedules/"+n[1]+"/variables/"+n[2],r)},t.prototype.remove=function(e,t,o,r){var n=__read([e,t,o].map(encodeURIComponent),3);return del(this,"projects/"+n[0]+"/pipeline_schedules/"+n[1]+"/variables/"+n[2],r)},t}(BaseService),Projects=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.all=function(e){return get(this,"projects",e)},t.prototype.archive=function(e,t){return post(this,"projects/"+encodeURIComponent(e)+"/archive",t)},t.prototype.create=function(e){var t=e.userId,o=__rest(e,["userId"]);return post(this,t?"projects/user/"+encodeURIComponent(t):"projects",o)},t.prototype.edit=function(e,t){return put(this,"projects/"+encodeURIComponent(e),t)},t.prototype.events=function(e,t){return get(this,"projects/"+encodeURIComponent(e)+"/events",t)},t.prototype.fork=function(e,t){return post(this,"projects/"+encodeURIComponent(e)+"/fork",t)},t.prototype.forks=function(e,t){return get(this,"projects/"+encodeURIComponent(e)+"/forks",t)},t.prototype.languages=function(e,t){return get(this,"projects/"+encodeURIComponent(e)+"/languages",t)},t.prototype.mirrorPull=function(e,t){return post(this,"projects/"+encodeURIComponent(e)+"/mirror/pull",t)},t.prototype.remove=function(e,t){return del(this,"projects/"+encodeURIComponent(e),t)},t.prototype.removeFork=function(e,t){return del(this,"projects/"+encodeURIComponent(e)+"/fork",t)},t.prototype.search=function(e){return get(this,"projects",{search:e})},t.prototype.share=function(e,t,o,r){return post(this,"projects/"+encodeURIComponent(e)+"/share",__assign({groupId:t,groupAccess:o},r))},t.prototype.show=function(e,t){return get(this,"projects/"+encodeURIComponent(e),t)},t.prototype.star=function(e,t){return post(this,"projects/"+encodeURIComponent(e)+"/star",t)},t.prototype.statuses=function(e,t,o,r){return post(this,"projects/"+encodeURIComponent(e)+"/statuses/"+t,__assign({state:o},r))},t.prototype.transfer=function(e,t){return put(this,"projects/"+encodeURIComponent(e)+"/transfer",{namespace:t})},t.prototype.unarchive=function(e,t){return post(this,"projects/"+encodeURIComponent(e)+"/unarchive",t)},t.prototype.unshare=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return del(this,"projects/"+r[0]+"/share/"+r[1],o)},t.prototype.unstar=function(e,t){return post(this,"projects/"+encodeURIComponent(e)+"/unstar",t)},t.prototype.updatePushRule=function(e,t){return put(this,"projects/"+encodeURIComponent(e)+"/push_rule",t)},t.prototype.upload=function(e,t,o){void 0===o&&(o={});var r=encodeURIComponent(e),n=new FormData,s={filename:randomstring.generate(8),contentType:"application/octet-stream"};return n.append("file",t,Object.assign(s,o)),post(this,"projects/"+r+"/uploads",n)},t}(BaseService),ProjectAccessRequests=function(e){function t(t){return e.call(this,"projects",t)||this}return __extends(t,e),t}(ResourceAccessRequests),ProjectBadges=function(e){function t(t){return e.call(this,"projects",t)||this}return __extends(t,e),t}(ResourceBadges),ProjectCustomAttributes=function(e){function t(t){return e.call(this,"projects",t)||this}return __extends(t,e),t}(ResourceCustomAttributes),ProjectImportExport=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.download=function(e,t){return get(this,"projects/"+encodeURIComponent(e)+"/export/download",t)},t.prototype.exportStatus=function(e,t){return get(this,"projects/"+encodeURIComponent(e)+"/export",t)},t.prototype.import=function(e,t){var o=new FormData;return o.append("file",e,{filename:t,contentType:"application/octet-stream"}),post(this,"projects/import",o)},t.prototype.importStatus=function(e,t){return get(this,"projects/"+encodeURIComponent(e)+"/import",t)},t.prototype.schedule=function(e,t){return post(this,"projects/"+encodeURIComponent(e)+"/export",t)},t}(BaseService),ProjectIssueBoards=function(e){function t(t){return e.call(this,"projects",t)||this}return __extends(t,e),t}(ResourceIssueBoards),ProjectHooks=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.all=function(e,t){return get(this,"projects/"+encodeURIComponent(e)+"/hooks",t)},t.prototype.show=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return get(this,"projects/"+r[0]+"/hooks/"+r[1],o)},t.prototype.add=function(e,t,o){return post(this,"projects/"+encodeURIComponent(e)+"/hooks",__assign({url:t},o))},t.prototype.edit=function(e,t,o,r){var n=__read([e,t].map(encodeURIComponent),2);return put(this,"projects/"+n[0]+"/hooks/"+n[1],__assign({url:o},r))},t.prototype.remove=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return del(this,"projects/"+r[0]+"/hooks/"+r[1],o)},t}(BaseService),ProjectMembers=function(e){function t(t){return e.call(this,"projects",t)||this}return __extends(t,e),t}(ResourceMembers),ProjectMilestones=function(e){function t(t){return e.call(this,"projects",t)||this}return __extends(t,e),t}(ResourceMilestones),ProjectSnippets=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.all=function(e,t){return get(this,"projects/"+encodeURIComponent(e)+"/snippets",t)},t.prototype.content=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return get(this,"projects/"+r[0]+"/snippets/"+r[1]+"/raw",o)},t.prototype.create=function(e,t,o,r,n,s){return post(this,"projects/"+encodeURIComponent(e)+"/snippets",__assign({title:t,fileName:o,code:r,visibility:n},s))},t.prototype.edit=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return put(this,"projects/"+r[0]+"/snippets/"+r[1],o)},t.prototype.remove=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return del(this,"projects/"+r[0]+"/snippets/"+r[1],o)},t.prototype.show=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return get(this,"projects/"+r[0]+"/snippets/"+r[1],o)},t.prototype.userAgentDetails=function(e,t,o){var r=__read([e,t].map(encodeURIComponent),2);return get(this,"projects/"+r[0]+"/snippets/"+r[1]+"/user_agent_detail",