diff --git a/dist/backlog.js b/dist/backlog.js index 57be225..b21497f 100644 --- a/dist/backlog.js +++ b/dist/backlog.js @@ -281,8 +281,8 @@ var Backlog = (function (_super) { Backlog.prototype.unlinkIssueSharedFile = function (issueIdOrKey, id) { return this.delete("issues/" + issueIdOrKey + "/sharedFiles/" + id); }; - Backlog.prototype.getWikis = function (projectIdOrKey) { - return this.get("wikis", { projectIdOrKey: projectIdOrKey }); + Backlog.prototype.getWikis = function (params) { + return this.get("wikis", params); }; Backlog.prototype.getWikisCount = function (projectIdOrKey) { return this.get("wikis/count", { projectIdOrKey: projectIdOrKey }); diff --git a/dist/backlog.min.js b/dist/backlog.min.js index 3402423..06bc10d 100644 --- a/dist/backlog.min.js +++ b/dist/backlog.min.js @@ -1 +1 @@ -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Backlog=f()}})(function(){var define,module,exports;return function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i0}).join("&")};OAuth2.prototype.getAccessToken=function(options){return new request_1.default({host:options.host,timeout:this.timeout}).post("oauth2/token",{grant_type:"authorization_code",code:options.code,client_id:this.credentials.clientId,client_secret:this.credentials.clientSecret,redirect_uri:options.redirectUri})};OAuth2.prototype.refreshAccessToken=function(options){return new request_1.default({host:options.host,timeout:this.timeout}).post("oauth2/token",{grant_type:"refresh_token",client_id:this.credentials.clientId,client_secret:this.credentials.clientSecret,refresh_token:options.refreshToken})};return OAuth2}();exports.default=OAuth2},{"./request":7}],6:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var ActivityType;(function(ActivityType){ActivityType[ActivityType["Undefined"]=-1]="Undefined";ActivityType[ActivityType["IssueCreated"]=1]="IssueCreated";ActivityType[ActivityType["IssueUpdated"]=2]="IssueUpdated";ActivityType[ActivityType["IssueCommented"]=3]="IssueCommented";ActivityType[ActivityType["IssueDeleted"]=4]="IssueDeleted";ActivityType[ActivityType["WikiCreated"]=5]="WikiCreated";ActivityType[ActivityType["WikiUpdated"]=6]="WikiUpdated";ActivityType[ActivityType["WikiDeleted"]=7]="WikiDeleted";ActivityType[ActivityType["FileAdded"]=8]="FileAdded";ActivityType[ActivityType["FileUpdated"]=9]="FileUpdated";ActivityType[ActivityType["FileDeleted"]=10]="FileDeleted";ActivityType[ActivityType["SvnCommitted"]=11]="SvnCommitted";ActivityType[ActivityType["GitPushed"]=12]="GitPushed";ActivityType[ActivityType["GitRepositoryCreated"]=13]="GitRepositoryCreated";ActivityType[ActivityType["IssueMultiUpdated"]=14]="IssueMultiUpdated";ActivityType[ActivityType["ProjectUserAdded"]=15]="ProjectUserAdded";ActivityType[ActivityType["ProjectUserRemoved"]=16]="ProjectUserRemoved";ActivityType[ActivityType["NotifyAdded"]=17]="NotifyAdded";ActivityType[ActivityType["PullRequestAdded"]=18]="PullRequestAdded";ActivityType[ActivityType["PullRequestUpdated"]=19]="PullRequestUpdated";ActivityType[ActivityType["PullRequestCommented"]=20]="PullRequestCommented";ActivityType[ActivityType["PullRequestMerged"]=21]="PullRequestMerged"})(ActivityType=exports.ActivityType||(exports.ActivityType={}));var User;(function(User){var RoleType;(function(RoleType){RoleType[RoleType["Admin"]=1]="Admin";RoleType[RoleType["User"]=2]="User";RoleType[RoleType["Reporter"]=3]="Reporter";RoleType[RoleType["Viewer"]=4]="Viewer";RoleType[RoleType["GuestReporter"]=5]="GuestReporter";RoleType[RoleType["GuestViewer"]=6]="GuestViewer"})(RoleType=User.RoleType||(User.RoleType={}))})(User=exports.User||(exports.User={}));var Project;(function(Project){var FieldType;(function(FieldType){FieldType[FieldType["Text"]=1]="Text";FieldType[FieldType["TextArea"]=2]="TextArea";FieldType[FieldType["Numeric"]=3]="Numeric";FieldType[FieldType["Date"]=4]="Date";FieldType[FieldType["SingleList"]=5]="SingleList";FieldType[FieldType["MultipleList"]=6]="MultipleList";FieldType[FieldType["CheckBox"]=7]="CheckBox";FieldType[FieldType["Radio"]=8]="Radio"})(FieldType=Project.FieldType||(Project.FieldType={}))})(Project=exports.Project||(exports.Project={}));var Issue;(function(Issue){var ParentChildType;(function(ParentChildType){ParentChildType[ParentChildType["All"]=0]="All";ParentChildType[ParentChildType["NotChild"]=1]="NotChild";ParentChildType[ParentChildType["Child"]=2]="Child";ParentChildType[ParentChildType["NotChildNotParent"]=3]="NotChildNotParent";ParentChildType[ParentChildType["Parent"]=4]="Parent"})(ParentChildType=Issue.ParentChildType||(Issue.ParentChildType={}))})(Issue=exports.Issue||(exports.Issue={}))},{}],7:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var Error=require("./error");var qs=require("qs");var Request=function(){function Request(configure){this.configure=configure}Request.prototype.get=function(path,params){return this.request({method:"GET",path:path,params:params}).then(this.parseJSON)};Request.prototype.post=function(path,params){return this.request({method:"POST",path:path,params:params}).then(this.parseJSON)};Request.prototype.put=function(path,params){return this.request({method:"PUT",path:path,params:params}).then(this.parseJSON)};Request.prototype.patch=function(path,params){return this.request({method:"PATCH",path:path,params:params}).then(this.parseJSON)};Request.prototype.delete=function(path,params){return this.request({method:"DELETE",path:path,params:params}).then(this.parseJSON)};Request.prototype.request=function(options){var method=options.method,path=options.path,_a=options.params,params=_a===void 0?{}:_a;var _b=this.configure,apiKey=_b.apiKey,accessToken=_b.accessToken,timeout=_b.timeout;var query=apiKey?{apiKey:apiKey}:{};var init={method:method,headers:{}};if(timeout){init["timeout"]=timeout}if(!apiKey&&accessToken){init.headers["Authorization"]="Bearer "+accessToken}if(typeof window!=="undefined"){init.mode="cors"}if(method!=="GET"){if(params instanceof FormData){init.body=params}else{init.headers["Content-type"]="application/x-www-form-urlencoded";init.body=this.toQueryString(params)}}else{Object.keys(params).forEach(function(key){return query[key]=params[key]})}var queryStr=this.toQueryString(query);var url=this.restBaseURL+"/"+path+(queryStr.length>0?"?"+queryStr:"");return fetch(url,init).then(this.checkStatus)};Request.prototype.checkStatus=function(response){return new Promise(function(resolve,reject){if(200<=response.status&&response.status<300){resolve(response)}else{response.json().then(function(data){if(response.status===401){reject(new Error.BacklogAuthError(response,data))}else{reject(new Error.BacklogApiError(response,data))}}).catch(function(err){return reject(new Error.UnexpectedError(response))})}})};Request.prototype.parseJSON=function(response){return response.json()};Request.prototype.toQueryString=function(params){return qs.stringify(params,{arrayFormat:"brackets"})};Object.defineProperty(Request.prototype,"webAppBaseURL",{get:function(){return"https://"+this.configure.host},enumerable:true,configurable:true});Object.defineProperty(Request.prototype,"restBaseURL",{get:function(){return this.webAppBaseURL+"/api/v2"},enumerable:true,configurable:true});return Request}();exports.default=Request},{"./error":3,qs:9}],8:[function(require,module,exports){"use strict";var replace=String.prototype.replace;var percentTwenties=/%20/g;module.exports={default:"RFC3986",formatters:{RFC1738:function(value){return replace.call(value,percentTwenties,"+")},RFC3986:function(value){return value}},RFC1738:"RFC1738",RFC3986:"RFC3986"}},{}],9:[function(require,module,exports){"use strict";var stringify=require("./stringify");var parse=require("./parse");var formats=require("./formats");module.exports={formats:formats,parse:parse,stringify:stringify}},{"./formats":8,"./parse":10,"./stringify":11}],10:[function(require,module,exports){"use strict";var utils=require("./utils");var has=Object.prototype.hasOwnProperty;var defaults={allowDots:false,allowPrototypes:false,arrayLimit:20,decoder:utils.decode,delimiter:"&",depth:5,parameterLimit:1e3,plainObjects:false,strictNullHandling:false};var parseValues=function parseQueryStringValues(str,options){var obj={};var cleanStr=options.ignoreQueryPrefix?str.replace(/^\?/,""):str;var limit=options.parameterLimit===Infinity?undefined:options.parameterLimit;var parts=cleanStr.split(options.delimiter,limit);for(var i=0;i=0;--i){var obj;var root=chain[i];if(root==="[]"){obj=[];obj=obj.concat(leaf)}else{obj=options.plainObjects?Object.create(null):{};var cleanRoot=root.charAt(0)==="["&&root.charAt(root.length-1)==="]"?root.slice(1,-1):root;var index=parseInt(cleanRoot,10);if(!isNaN(index)&&root!==cleanRoot&&String(index)===cleanRoot&&index>=0&&(options.parseArrays&&index<=options.arrayLimit)){obj=[];obj[index]=leaf}else{obj[cleanRoot]=leaf}}leaf=obj}return leaf};var parseKeys=function parseQueryStringKeys(givenKey,val,options){if(!givenKey){return}var key=options.allowDots?givenKey.replace(/\.([^.[]+)/g,"[$1]"):givenKey;var brackets=/(\[[^[\]]*])/;var child=/(\[[^[\]]*])/g;var segment=brackets.exec(key);var parent=segment?key.slice(0,segment.index):key;var keys=[];if(parent){if(!options.plainObjects&&has.call(Object.prototype,parent)){if(!options.allowPrototypes){return}}keys.push(parent)}var i=0;while((segment=child.exec(key))!==null&&i0?prefix+joined:""}},{"./formats":8,"./utils":12}],12:[function(require,module,exports){"use strict";var has=Object.prototype.hasOwnProperty;var hexTable=function(){var array=[];for(var i=0;i<256;++i){array.push("%"+((i<16?"0":"")+i.toString(16)).toUpperCase())}return array}();var compactQueue=function compactQueue(queue){var obj;while(queue.length){var item=queue.pop();obj=item.obj[item.prop];if(Array.isArray(obj)){var compacted=[];for(var j=0;j=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122){out+=string.charAt(i);continue}if(c<128){out=out+hexTable[c];continue}if(c<2048){out=out+(hexTable[192|c>>6]+hexTable[128|c&63]);continue}if(c<55296||c>=57344){out=out+(hexTable[224|c>>12]+hexTable[128|c>>6&63]+hexTable[128|c&63]);continue}i+=1;c=65536+((c&1023)<<10|string.charCodeAt(i)&1023);out+=hexTable[240|c>>18]+hexTable[128|c>>12&63]+hexTable[128|c>>6&63]+hexTable[128|c&63]}return out};var compact=function compact(value){var queue=[{obj:{o:value},prop:"o"}];var refs=[];for(var i=0;i0}).join("&")};OAuth2.prototype.getAccessToken=function(options){return new request_1.default({host:options.host,timeout:this.timeout}).post("oauth2/token",{grant_type:"authorization_code",code:options.code,client_id:this.credentials.clientId,client_secret:this.credentials.clientSecret,redirect_uri:options.redirectUri})};OAuth2.prototype.refreshAccessToken=function(options){return new request_1.default({host:options.host,timeout:this.timeout}).post("oauth2/token",{grant_type:"refresh_token",client_id:this.credentials.clientId,client_secret:this.credentials.clientSecret,refresh_token:options.refreshToken})};return OAuth2}();exports.default=OAuth2},{"./request":7}],6:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var ActivityType;(function(ActivityType){ActivityType[ActivityType["Undefined"]=-1]="Undefined";ActivityType[ActivityType["IssueCreated"]=1]="IssueCreated";ActivityType[ActivityType["IssueUpdated"]=2]="IssueUpdated";ActivityType[ActivityType["IssueCommented"]=3]="IssueCommented";ActivityType[ActivityType["IssueDeleted"]=4]="IssueDeleted";ActivityType[ActivityType["WikiCreated"]=5]="WikiCreated";ActivityType[ActivityType["WikiUpdated"]=6]="WikiUpdated";ActivityType[ActivityType["WikiDeleted"]=7]="WikiDeleted";ActivityType[ActivityType["FileAdded"]=8]="FileAdded";ActivityType[ActivityType["FileUpdated"]=9]="FileUpdated";ActivityType[ActivityType["FileDeleted"]=10]="FileDeleted";ActivityType[ActivityType["SvnCommitted"]=11]="SvnCommitted";ActivityType[ActivityType["GitPushed"]=12]="GitPushed";ActivityType[ActivityType["GitRepositoryCreated"]=13]="GitRepositoryCreated";ActivityType[ActivityType["IssueMultiUpdated"]=14]="IssueMultiUpdated";ActivityType[ActivityType["ProjectUserAdded"]=15]="ProjectUserAdded";ActivityType[ActivityType["ProjectUserRemoved"]=16]="ProjectUserRemoved";ActivityType[ActivityType["NotifyAdded"]=17]="NotifyAdded";ActivityType[ActivityType["PullRequestAdded"]=18]="PullRequestAdded";ActivityType[ActivityType["PullRequestUpdated"]=19]="PullRequestUpdated";ActivityType[ActivityType["PullRequestCommented"]=20]="PullRequestCommented";ActivityType[ActivityType["PullRequestMerged"]=21]="PullRequestMerged"})(ActivityType=exports.ActivityType||(exports.ActivityType={}));var User;(function(User){var RoleType;(function(RoleType){RoleType[RoleType["Admin"]=1]="Admin";RoleType[RoleType["User"]=2]="User";RoleType[RoleType["Reporter"]=3]="Reporter";RoleType[RoleType["Viewer"]=4]="Viewer";RoleType[RoleType["GuestReporter"]=5]="GuestReporter";RoleType[RoleType["GuestViewer"]=6]="GuestViewer"})(RoleType=User.RoleType||(User.RoleType={}))})(User=exports.User||(exports.User={}));var Project;(function(Project){var FieldType;(function(FieldType){FieldType[FieldType["Text"]=1]="Text";FieldType[FieldType["TextArea"]=2]="TextArea";FieldType[FieldType["Numeric"]=3]="Numeric";FieldType[FieldType["Date"]=4]="Date";FieldType[FieldType["SingleList"]=5]="SingleList";FieldType[FieldType["MultipleList"]=6]="MultipleList";FieldType[FieldType["CheckBox"]=7]="CheckBox";FieldType[FieldType["Radio"]=8]="Radio"})(FieldType=Project.FieldType||(Project.FieldType={}))})(Project=exports.Project||(exports.Project={}));var Issue;(function(Issue){var ParentChildType;(function(ParentChildType){ParentChildType[ParentChildType["All"]=0]="All";ParentChildType[ParentChildType["NotChild"]=1]="NotChild";ParentChildType[ParentChildType["Child"]=2]="Child";ParentChildType[ParentChildType["NotChildNotParent"]=3]="NotChildNotParent";ParentChildType[ParentChildType["Parent"]=4]="Parent"})(ParentChildType=Issue.ParentChildType||(Issue.ParentChildType={}))})(Issue=exports.Issue||(exports.Issue={}))},{}],7:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var Error=require("./error");var qs=require("qs");var Request=function(){function Request(configure){this.configure=configure}Request.prototype.get=function(path,params){return this.request({method:"GET",path:path,params:params}).then(this.parseJSON)};Request.prototype.post=function(path,params){return this.request({method:"POST",path:path,params:params}).then(this.parseJSON)};Request.prototype.put=function(path,params){return this.request({method:"PUT",path:path,params:params}).then(this.parseJSON)};Request.prototype.patch=function(path,params){return this.request({method:"PATCH",path:path,params:params}).then(this.parseJSON)};Request.prototype.delete=function(path,params){return this.request({method:"DELETE",path:path,params:params}).then(this.parseJSON)};Request.prototype.request=function(options){var method=options.method,path=options.path,_a=options.params,params=_a===void 0?{}:_a;var _b=this.configure,apiKey=_b.apiKey,accessToken=_b.accessToken,timeout=_b.timeout;var query=apiKey?{apiKey:apiKey}:{};var init={method:method,headers:{}};if(timeout){init["timeout"]=timeout}if(!apiKey&&accessToken){init.headers["Authorization"]="Bearer "+accessToken}if(typeof window!=="undefined"){init.mode="cors"}if(method!=="GET"){if(params instanceof FormData){init.body=params}else{init.headers["Content-type"]="application/x-www-form-urlencoded";init.body=this.toQueryString(params)}}else{Object.keys(params).forEach(function(key){return query[key]=params[key]})}var queryStr=this.toQueryString(query);var url=this.restBaseURL+"/"+path+(queryStr.length>0?"?"+queryStr:"");return fetch(url,init).then(this.checkStatus)};Request.prototype.checkStatus=function(response){return new Promise(function(resolve,reject){if(200<=response.status&&response.status<300){resolve(response)}else{response.json().then(function(data){if(response.status===401){reject(new Error.BacklogAuthError(response,data))}else{reject(new Error.BacklogApiError(response,data))}}).catch(function(err){return reject(new Error.UnexpectedError(response))})}})};Request.prototype.parseJSON=function(response){return response.json()};Request.prototype.toQueryString=function(params){return qs.stringify(params,{arrayFormat:"brackets"})};Object.defineProperty(Request.prototype,"webAppBaseURL",{get:function(){return"https://"+this.configure.host},enumerable:true,configurable:true});Object.defineProperty(Request.prototype,"restBaseURL",{get:function(){return this.webAppBaseURL+"/api/v2"},enumerable:true,configurable:true});return Request}();exports.default=Request},{"./error":3,qs:9}],8:[function(require,module,exports){"use strict";var replace=String.prototype.replace;var percentTwenties=/%20/g;module.exports={default:"RFC3986",formatters:{RFC1738:function(value){return replace.call(value,percentTwenties,"+")},RFC3986:function(value){return value}},RFC1738:"RFC1738",RFC3986:"RFC3986"}},{}],9:[function(require,module,exports){"use strict";var stringify=require("./stringify");var parse=require("./parse");var formats=require("./formats");module.exports={formats:formats,parse:parse,stringify:stringify}},{"./formats":8,"./parse":10,"./stringify":11}],10:[function(require,module,exports){"use strict";var utils=require("./utils");var has=Object.prototype.hasOwnProperty;var defaults={allowDots:false,allowPrototypes:false,arrayLimit:20,decoder:utils.decode,delimiter:"&",depth:5,parameterLimit:1e3,plainObjects:false,strictNullHandling:false};var parseValues=function parseQueryStringValues(str,options){var obj={};var cleanStr=options.ignoreQueryPrefix?str.replace(/^\?/,""):str;var limit=options.parameterLimit===Infinity?undefined:options.parameterLimit;var parts=cleanStr.split(options.delimiter,limit);for(var i=0;i=0;--i){var obj;var root=chain[i];if(root==="[]"){obj=[];obj=obj.concat(leaf)}else{obj=options.plainObjects?Object.create(null):{};var cleanRoot=root.charAt(0)==="["&&root.charAt(root.length-1)==="]"?root.slice(1,-1):root;var index=parseInt(cleanRoot,10);if(!isNaN(index)&&root!==cleanRoot&&String(index)===cleanRoot&&index>=0&&(options.parseArrays&&index<=options.arrayLimit)){obj=[];obj[index]=leaf}else{obj[cleanRoot]=leaf}}leaf=obj}return leaf};var parseKeys=function parseQueryStringKeys(givenKey,val,options){if(!givenKey){return}var key=options.allowDots?givenKey.replace(/\.([^.[]+)/g,"[$1]"):givenKey;var brackets=/(\[[^[\]]*])/;var child=/(\[[^[\]]*])/g;var segment=brackets.exec(key);var parent=segment?key.slice(0,segment.index):key;var keys=[];if(parent){if(!options.plainObjects&&has.call(Object.prototype,parent)){if(!options.allowPrototypes){return}}keys.push(parent)}var i=0;while((segment=child.exec(key))!==null&&i0?prefix+joined:""}},{"./formats":8,"./utils":12}],12:[function(require,module,exports){"use strict";var has=Object.prototype.hasOwnProperty;var hexTable=function(){var array=[];for(var i=0;i<256;++i){array.push("%"+((i<16?"0":"")+i.toString(16)).toUpperCase())}return array}();var compactQueue=function compactQueue(queue){var obj;while(queue.length){var item=queue.pop();obj=item.obj[item.prop];if(Array.isArray(obj)){var compacted=[];for(var j=0;j=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122){out+=string.charAt(i);continue}if(c<128){out=out+hexTable[c];continue}if(c<2048){out=out+(hexTable[192|c>>6]+hexTable[128|c&63]);continue}if(c<55296||c>=57344){out=out+(hexTable[224|c>>12]+hexTable[128|c>>6&63]+hexTable[128|c&63]);continue}i+=1;c=65536+((c&1023)<<10|string.charCodeAt(i)&1023);out+=hexTable[240|c>>18]+hexTable[128|c>>12&63]+hexTable[128|c>>6&63]+hexTable[128|c&63]}return out};var compact=function compact(value){var queue=[{obj:{o:value},prop:"o"}];var refs=[];for(var i=0;i { - return this.get(`wikis`, { projectIdOrKey }); + public getWikis(params: Option.Wiki.GetWikiParams): Promise { + return this.get(`wikis`, params); } /**