UNPKG

backlog-js

Version:

Backlog API v2 client for browser and node

1,197 lines (1,191 loc) 141 kB
(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;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ "use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (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 __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var request_1 = require("./request"); var Backlog = /** @class */ (function (_super) { __extends(Backlog, _super); function Backlog(configure) { return _super.call(this, configure) || this; } /** * https://developer.nulab.com/docs/backlog/api/2/get-space/ */ Backlog.prototype.getSpace = function () { return this.get('space'); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-recent-updates/ */ Backlog.prototype.getSpaceActivities = function (params) { return this.get('space/activities', params); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-space-logo/ */ Backlog.prototype.getSpaceIcon = function () { return this.download('space/image'); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-space-notification/ */ Backlog.prototype.getSpaceNotification = function () { return this.get('space/notification'); }; /** * https://developer.nulab.com/docs/backlog/api/2/update-space-notification/ */ Backlog.prototype.putSpaceNotification = function (params) { return this.put('space/notification', params); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-space-disk-usage/ */ Backlog.prototype.getSpaceDiskUsage = function () { return this.get('space/diskUsage'); }; /** * https://developer.nulab.com/docs/backlog/api/2/post-attachment-file/ */ Backlog.prototype.postSpaceAttachment = function (form) { return this.upload("space/attachment", form); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-user-list/ */ Backlog.prototype.getUsers = function () { return this.get("users"); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-user/ */ Backlog.prototype.getUser = function (userId) { return this.get("users/".concat(userId)); }; /** * https://developer.nulab.com/docs/backlog/api/2/add-user/ */ Backlog.prototype.postUser = function (params) { return this.post("users", params); }; /** * https://developer.nulab.com/docs/backlog/api/2/update-user/ */ Backlog.prototype.patchUser = function (userId, params) { return this.patch("users/".concat(userId), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/delete-user/ */ Backlog.prototype.deleteUser = function (userId) { return this.delete("users/".concat(userId)); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-own-user/ */ Backlog.prototype.getMyself = function () { return this.get('users/myself'); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-user-icon/ */ Backlog.prototype.getUserIcon = function (userId) { return this.download("users/".concat(userId, "/icon")); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-user-recent-updates/ */ Backlog.prototype.getUserActivities = function (userId, params) { return this.get("users/".concat(userId, "/activities"), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-received-star-list/ */ Backlog.prototype.getUserStars = function (userId, params) { return this.get("users/".concat(userId, "/stars"), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/count-user-received-stars/ */ Backlog.prototype.getUserStarsCount = function (userId, params) { return this.get("users/".concat(userId, "/stars/count"), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-list-of-recently-viewed-issues/ */ Backlog.prototype.getRecentlyViewedIssues = function (params) { return this.get('users/myself/recentlyViewedIssues', params); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-list-of-recently-viewed-projects/ */ Backlog.prototype.getRecentlyViewedProjects = function (params) { return this.get('users/myself/recentlyViewedProjects', params); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-list-of-recently-viewed-wikis/ */ Backlog.prototype.getRecentlyViewedWikis = function (params) { return this.get('users/myself/recentlyViewedWikis', params); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-status-list-of-project/ */ Backlog.prototype.getProjectStatuses = function (projectIdOrKey) { return this.get("projects/".concat(projectIdOrKey, "/statuses")); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-resolution-list/ */ Backlog.prototype.getResolutions = function () { return this.get('resolutions'); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-priority-list/ */ Backlog.prototype.getPriorities = function () { return this.get('priorities'); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-project-list/ */ Backlog.prototype.getProjects = function (params) { return this.get('projects', params); }; /** * https://developer.nulab.com/docs/backlog/api/2/add-project/ */ Backlog.prototype.postProject = function (params) { return this.post('projects', params); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-project/ */ Backlog.prototype.getProject = function (projectIdOrKey) { return this.get("projects/".concat(projectIdOrKey)); }; /** * https://developer.nulab.com/docs/backlog/api/2/update-project/ */ Backlog.prototype.patchProject = function (projectIdOrKey, params) { return this.patch("projects/".concat(projectIdOrKey), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/delete-project/ */ Backlog.prototype.deleteProject = function (projectIdOrKey) { return this.delete("projects/".concat(projectIdOrKey)); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-project-icon/ */ Backlog.prototype.getProjectIcon = function (projectIdOrKey) { return this.download("projects/".concat(projectIdOrKey, "/image")); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-project-recent-updates/ */ Backlog.prototype.getProjectActivities = function (projectIdOrKey, params) { return this.get("projects/".concat(projectIdOrKey, "/activities"), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/add-project-user/ */ Backlog.prototype.postProjectUser = function (projectIdOrKey, userId) { return this.post("projects/".concat(projectIdOrKey, "/users"), { userId: userId }); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-project-user-list/ */ Backlog.prototype.getProjectUsers = function (projectIdOrKey) { return this.get("projects/".concat(projectIdOrKey, "/users")); }; /** * https://developer.nulab.com/docs/backlog/api/2/delete-project-user/ */ Backlog.prototype.deleteProjectUsers = function (projectIdOrKey, params) { return this.delete("projects/".concat(projectIdOrKey, "/users"), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/add-project-administrator/ */ Backlog.prototype.postProjectAdministrators = function (projectIdOrKey, params) { return this.post("projects/".concat(projectIdOrKey, "/administrators"), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-list-of-project-administrators/ */ Backlog.prototype.getProjectAdministrators = function (projectIdOrKey) { return this.get("projects/".concat(projectIdOrKey, "/administrators")); }; /** * https://developer.nulab.com/docs/backlog/api/2/delete-project-administrator/ */ Backlog.prototype.deleteProjectAdministrators = function (projectIdOrKey, params) { return this.delete("projects/".concat(projectIdOrKey, "/administrators"), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/add-status/ */ Backlog.prototype.postProjectStatus = function (projectIdOrKey, params) { return this.post("projects/".concat(projectIdOrKey, "/statuses"), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/update-status/ */ Backlog.prototype.patchProjectStatus = function (projectIdOrKey, id, params) { return this.patch("projects/".concat(projectIdOrKey, "/statuses/").concat(id), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/delete-status/ */ Backlog.prototype.deleteProjectStatus = function (projectIdOrKey, id, substituteStatusId) { return this.delete("projects/".concat(projectIdOrKey, "/statuses/").concat(id), { substituteStatusId: substituteStatusId }); }; /** * https://developer.nulab.com/docs/backlog/api/2/update-order-of-status/ */ Backlog.prototype.patchProjectStatusOrder = function (projectIdOrKey, statusId) { return this.patch("projects/".concat(projectIdOrKey, "/statuses/updateDisplayOrder"), { statusId: statusId }); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-issue-type-list/ */ Backlog.prototype.getIssueTypes = function (projectIdOrKey) { return this.get("projects/".concat(projectIdOrKey, "/issueTypes")); }; /** * https://developer.nulab.com/docs/backlog/api/2/add-issue-type/ */ Backlog.prototype.postIssueType = function (projectIdOrKey, params) { return this.post("projects/".concat(projectIdOrKey, "/issueTypes"), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/update-issue-type/ */ Backlog.prototype.patchIssueType = function (projectIdOrKey, id, params) { return this.patch("projects/".concat(projectIdOrKey, "/issueTypes/").concat(id), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/delete-issue-type/ */ Backlog.prototype.deleteIssueType = function (projectIdOrKey, id, params) { return this.delete("projects/".concat(projectIdOrKey, "/issueTypes/").concat(id), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-category-list/ */ Backlog.prototype.getCategories = function (projectIdOrKey) { return this.get("projects/".concat(projectIdOrKey, "/categories")); }; /** * https://developer.nulab.com/docs/backlog/api/2/add-category/ */ Backlog.prototype.postCategories = function (projectIdOrKey, params) { return this.post("projects/".concat(projectIdOrKey, "/categories"), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/update-category/ */ Backlog.prototype.patchCategories = function (projectIdOrKey, id, params) { return this.patch("projects/".concat(projectIdOrKey, "/categories/").concat(id), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/delete-category/ */ Backlog.prototype.deleteCategories = function (projectIdOrKey, id) { return this.delete("projects/".concat(projectIdOrKey, "/categories/").concat(id)); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-version-milestone-list/ */ Backlog.prototype.getVersions = function (projectIdOrKey) { return this.get("projects/".concat(projectIdOrKey, "/versions")); }; /** * https://developer.nulab.com/docs/backlog/api/2/add-version-milestone/ */ Backlog.prototype.postVersions = function (projectIdOrKey, params) { return this.post("projects/".concat(projectIdOrKey, "/versions"), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/update-version-milestone/ */ Backlog.prototype.patchVersions = function (projectIdOrKey, id, params) { return this.patch("projects/".concat(projectIdOrKey, "/versions/").concat(id), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/delete-version/ */ Backlog.prototype.deleteVersions = function (projectIdOrKey, id) { return this.delete("projects/".concat(projectIdOrKey, "/versions/").concat(id)); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-custom-field-list/ */ Backlog.prototype.getCustomFields = function (projectIdOrKey) { return this.get("projects/".concat(projectIdOrKey, "/customFields")); }; /** * https://developer.nulab.com/docs/backlog/api/2/add-custom-field/ */ Backlog.prototype.postCustomField = function (projectIdOrKey, params) { return this.post("projects/".concat(projectIdOrKey, "/customFields"), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/update-custom-field/ */ Backlog.prototype.patchCustomField = function (projectIdOrKey, id, params) { return this.patch("projects/".concat(projectIdOrKey, "/customFields/").concat(id), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/delete-custom-field/ */ Backlog.prototype.deleteCustomField = function (projectIdOrKey, id) { return this.delete("projects/".concat(projectIdOrKey, "/customFields/").concat(id)); }; /** * https://developer.nulab.com/docs/backlog/api/2/add-list-item-for-list-type-custom-field/ */ Backlog.prototype.postCustomFieldItem = function (projectIdOrKey, id, params) { return this.post("projects/".concat(projectIdOrKey, "/customFields/").concat(id, "/items"), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/update-list-item-for-list-type-custom-field/ */ Backlog.prototype.patchCustomFieldItem = function (projectIdOrKey, id, itemId, params) { return this.patch("projects/".concat(projectIdOrKey, "/customFields/").concat(id, "/items/").concat(itemId), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/delete-list-item-for-list-type-custom-field/ */ Backlog.prototype.deleteCustomFieldItem = function (projectIdOrKey, id, itemId) { return this.delete("projects/".concat(projectIdOrKey, "/customFields/").concat(id, "/items/").concat(itemId)); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-list-of-shared-files/ */ Backlog.prototype.getSharedFiles = function (projectIdOrKey, path, params) { return this.get("projects/".concat(projectIdOrKey, "/files/metadata/").concat(path), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-file/ */ Backlog.prototype.getSharedFile = function (projectIdOrKey, sharedFileId) { return this.download("projects/".concat(projectIdOrKey, "/files/").concat(sharedFileId)); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-project-disk-usage/ */ Backlog.prototype.getProjectsDiskUsage = function (projectIdOrKey) { return this.get("projects/".concat(projectIdOrKey, "/diskUsage")); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-list-of-webhooks/ */ Backlog.prototype.getWebhooks = function (projectIdOrKey) { return this.get("projects/".concat(projectIdOrKey, "/webhooks")); }; /** * https://developer.nulab.com/docs/backlog/api/2/add-webhook/ */ Backlog.prototype.postWebhook = function (projectIdOrKey, params) { return this.post("projects/".concat(projectIdOrKey, "/webhooks"), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-webhook/ */ Backlog.prototype.getWebhook = function (projectIdOrKey, webhookId) { return this.get("projects/".concat(projectIdOrKey, "/webhooks/").concat(webhookId)); }; /** * https://developer.nulab.com/docs/backlog/api/2/update-webhook/ */ Backlog.prototype.patchWebhook = function (projectIdOrKey, webhookId, params) { return this.patch("projects/".concat(projectIdOrKey, "/webhooks/").concat(webhookId), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/delete-webhook/ */ Backlog.prototype.deleteWebhook = function (projectIdOrKey, webhookId) { return this.delete("projects/".concat(projectIdOrKey, "/webhooks/").concat(webhookId)); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-issue-list/ */ Backlog.prototype.getIssues = function (params) { return this.get('issues', params); }; /** * https://developer.nulab.com/docs/backlog/api/2/count-issue/ */ Backlog.prototype.getIssuesCount = function (params) { return this.get('issues/count', params); }; /** * https://developer.nulab.com/docs/backlog/api/2/add-issue/ */ Backlog.prototype.postIssue = function (params) { return this.post('issues', params); }; /** * https://developer.nulab.com/docs/backlog/api/2/update-issue/ */ Backlog.prototype.patchIssue = function (issueIdOrKey, params) { return this.patch("issues/".concat(issueIdOrKey), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-issue/ */ Backlog.prototype.getIssue = function (issueIdOrKey) { return this.get("issues/".concat(issueIdOrKey)); }; /** * https://developer.nulab.com/docs/backlog/api/2/delete-issue/ */ Backlog.prototype.deleteIssue = function (issueIdOrKey) { return this.delete("issues/".concat(issueIdOrKey)); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-comment-list/ */ Backlog.prototype.getIssueComments = function (issueIdOrKey, params) { return this.get("issues/".concat(issueIdOrKey, "/comments"), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/add-comment/ */ Backlog.prototype.postIssueComments = function (issueIdOrKey, params) { return this.post("issues/".concat(issueIdOrKey, "/comments"), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/count-comment/ */ Backlog.prototype.getIssueCommentsCount = function (issueIdOrKey) { return this.get("issues/".concat(issueIdOrKey, "/comments/count")); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-comment/ */ Backlog.prototype.getIssueComment = function (issueIdOrKey, commentId) { return this.get("issues/".concat(issueIdOrKey, "/comments/").concat(commentId)); }; /** * https://developer.nulab.com/docs/backlog/api/2/delete-comment/ */ Backlog.prototype.deleteIssueComment = function (issueIdOrKey, commentId) { return this.delete("issues/".concat(issueIdOrKey, "/comments/").concat(commentId)); }; /** * https://developer.nulab.com/docs/backlog/api/2/update-comment/ */ Backlog.prototype.patchIssueComment = function (issueIdOrKey, commentId, params) { return this.patch("issues/".concat(issueIdOrKey, "/comments/").concat(commentId), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-list-of-comment-notifications/ */ Backlog.prototype.getIssueCommentNotifications = function (issueIdOrKey, commentId) { return this.get("issues/".concat(issueIdOrKey, "/comments/").concat(commentId, "/notifications")); }; /** * https://developer.nulab.com/docs/backlog/api/2/add-comment-notification/ */ Backlog.prototype.postIssueCommentNotifications = function (issueIdOrKey, commentId, prams) { return this.post("issues/".concat(issueIdOrKey, "/comments/").concat(commentId, "/notifications"), prams); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-list-of-issue-attachments/ */ Backlog.prototype.getIssueAttachments = function (issueIdOrKey) { return this.get("issues/".concat(issueIdOrKey, "/attachments")); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-issue-attachment/ */ Backlog.prototype.getIssueAttachment = function (issueIdOrKey, attachmentId) { return this.download("issues/".concat(issueIdOrKey, "/attachments/").concat(attachmentId)); }; /** * https://developer.nulab.com/docs/backlog/api/2/delete-issue-attachment/ */ Backlog.prototype.deleteIssueAttachment = function (issueIdOrKey, attachmentId) { return this.delete("issues/".concat(issueIdOrKey, "/attachments/").concat(attachmentId)); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-issue-participant-list/ */ Backlog.prototype.getIssueParticipants = function (issueIdOrKey) { return this.get("issues/".concat(issueIdOrKey, "/participants")); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-list-of-linked-shared-files/ */ Backlog.prototype.getIssueSharedFiles = function (issueIdOrKey) { return this.get("issues/".concat(issueIdOrKey, "/sharedFiles")); }; /** * https://developer.nulab.com/docs/backlog/api/2/link-shared-files-to-issue/ */ Backlog.prototype.linkIssueSharedFiles = function (issueIdOrKey, params) { return this.post("issues/".concat(issueIdOrKey, "/sharedFiles"), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/remove-link-to-shared-file-from-issue/ */ Backlog.prototype.unlinkIssueSharedFile = function (issueIdOrKey, id) { return this.delete("issues/".concat(issueIdOrKey, "/sharedFiles/").concat(id)); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-wiki-page-list/ */ Backlog.prototype.getWikis = function (params) { return this.get("wikis", params); }; /** * https://developer.nulab.com/docs/backlog/api/2/count-wiki-page/ */ Backlog.prototype.getWikisCount = function (projectIdOrKey) { return this.get("wikis/count", { projectIdOrKey: projectIdOrKey }); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-wiki-page-tag-list/ */ Backlog.prototype.getWikisTags = function (projectIdOrKey) { return this.get("wikis/tags", { projectIdOrKey: projectIdOrKey }); }; /** * https://developer.nulab.com/docs/backlog/api/2/add-wiki-page/ */ Backlog.prototype.postWiki = function (params) { return this.post("wikis", params); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-wiki-page/ */ Backlog.prototype.getWiki = function (wikiId) { return this.get("wikis/".concat(wikiId)); }; /** * https://developer.nulab.com/docs/backlog/api/2/update-wiki-page/ */ Backlog.prototype.patchWiki = function (wikiId, params) { return this.patch("wikis/".concat(wikiId), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/delete-wiki-page/ */ Backlog.prototype.deleteWiki = function (wikiId, mailNotify) { return this.delete("wikis/".concat(wikiId), { mailNotify: mailNotify }); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-list-of-wiki-attachments/ */ Backlog.prototype.getWikisAttachments = function (wikiId) { return this.get("wikis/".concat(wikiId, "/attachments")); }; /** * https://developer.nulab.com/docs/backlog/api/2/attach-file-to-wiki/ */ Backlog.prototype.postWikisAttachments = function (wikiId, attachmentId) { return this.post("wikis/".concat(wikiId, "/attachments"), { attachmentId: attachmentId }); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-wiki-page-attachment/ */ Backlog.prototype.getWikiAttachment = function (wikiId, attachmentId) { return this.download("wikis/".concat(wikiId, "/attachments/").concat(attachmentId)); }; /** * https://developer.nulab.com/docs/backlog/api/2/remove-wiki-attachment/ */ Backlog.prototype.deleteWikisAttachments = function (wikiId, attachmentId) { return this.delete("wikis/".concat(wikiId, "/attachments/").concat(attachmentId)); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-list-of-shared-files-on-wiki/ */ Backlog.prototype.getWikisSharedFiles = function (wikiId) { return this.get("wikis/".concat(wikiId, "/sharedFiles")); }; /** * https://developer.nulab.com/docs/backlog/api/2/link-shared-files-to-wiki/ */ Backlog.prototype.linkWikisSharedFiles = function (wikiId, fileId) { return this.post("wikis/".concat(wikiId, "/sharedFiles"), { fileId: fileId }); }; /** * https://developer.nulab.com/docs/backlog/api/2/remove-link-to-shared-file-from-wiki/ */ Backlog.prototype.unlinkWikisSharedFiles = function (wikiId, id) { return this.delete("wikis/".concat(wikiId, "/sharedFiles/").concat(id)); }; /** * https://developer.nulab.com/docs/backlog/api/get-document-list/ */ Backlog.prototype.getDocuments = function (params) { return this.get('documents', params); }; /** * https://developer.nulab.com/docs/backlog/api/get-document-tree/ */ Backlog.prototype.getDocumentTree = function (projectIdOrKey) { return this.get("documents/tree", { projectIdOrKey: projectIdOrKey }); }; /** * https://developer.nulab.com/docs/backlog/api/get-document/ */ Backlog.prototype.getDocument = function (documentId) { return this.get("documents/".concat(documentId)); }; /** * https://developer.nulab.com/docs/backlog/api/get-document-attachments/ */ Backlog.prototype.downloadDocumentAttachment = function (documentId, attachmentId) { return this.download("documents/".concat(documentId, "/attachments/").concat(attachmentId)); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-wiki-page-history/ */ Backlog.prototype.getWikisHistory = function (wikiId, params) { return this.get("wikis/".concat(wikiId, "/history"), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-wiki-page-star/ */ Backlog.prototype.getWikisStars = function (wikiId) { return this.get("wikis/".concat(wikiId, "/stars")); }; /** * https://developer.nulab.com/docs/backlog/api/2/add-star/ */ Backlog.prototype.postStar = function (params) { return this.post('stars', params); }; /** * https://developer.nulab.com/docs/backlog/api/2/remove-star/ */ Backlog.prototype.removeStar = function (starId) { var endpoint = "stars/".concat(starId); return this.delete(endpoint); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-notification/ */ Backlog.prototype.getNotifications = function (params) { return this.get('notifications', params); }; /** * https://developer.nulab.com/docs/backlog/api/2/count-notification/ */ Backlog.prototype.getNotificationsCount = function (params) { return this.get('notifications/count', params); }; /** * https://developer.nulab.com/docs/backlog/api/2/reset-unread-notification-count/ */ Backlog.prototype.resetNotificationsMarkAsRead = function () { return this.post('notifications/markAsRead'); }; /** * https://developer.nulab.com/docs/backlog/api/2/read-notification/ */ Backlog.prototype.markAsReadNotification = function (id) { return this.post("notifications/".concat(id, "/markAsRead")); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-list-of-git-repositories/ */ Backlog.prototype.getGitRepositories = function (projectIdOrKey) { return this.get("projects/".concat(projectIdOrKey, "/git/repositories")); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-git-repository/ */ Backlog.prototype.getGitRepository = function (projectIdOrKey, repoIdOrName) { return this.get("projects/".concat(projectIdOrKey, "/git/repositories/").concat(repoIdOrName)); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-pull-request-list/ */ Backlog.prototype.getPullRequests = function (projectIdOrKey, repoIdOrName, params) { return this.get("projects/".concat(projectIdOrKey, "/git/repositories/").concat(repoIdOrName, "/pullRequests"), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-number-of-pull-requests/ */ Backlog.prototype.getPullRequestsCount = function (projectIdOrKey, repoIdOrName, params) { return this.get("projects/".concat(projectIdOrKey, "/git/repositories/").concat(repoIdOrName, "/pullRequests/count"), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/add-pull-request/ */ Backlog.prototype.postPullRequest = function (projectIdOrKey, repoIdOrName, params) { return this.post("projects/".concat(projectIdOrKey, "/git/repositories/").concat(repoIdOrName, "/pullRequests"), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-pull-request/ */ Backlog.prototype.getPullRequest = function (projectIdOrKey, repoIdOrName, number) { return this.get("projects/".concat(projectIdOrKey, "/git/repositories/").concat(repoIdOrName, "/pullRequests/").concat(number)); }; /** * https://developer.nulab.com/docs/backlog/api/2/update-pull-request/ */ Backlog.prototype.patchPullRequest = function (projectIdOrKey, repoIdOrName, number, params) { return this.patch("projects/".concat(projectIdOrKey, "/git/repositories/").concat(repoIdOrName, "/pullRequests/").concat(number), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-pull-request-comment/ */ Backlog.prototype.getPullRequestComments = function (projectIdOrKey, repoIdOrName, number, params) { return this.get("projects/".concat(projectIdOrKey, "/git/repositories/").concat(repoIdOrName, "/pullRequests/").concat(number, "/comments"), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/add-pull-request-comment/ */ Backlog.prototype.postPullRequestComments = function (projectIdOrKey, repoIdOrName, number, params) { return this.post("projects/".concat(projectIdOrKey, "/git/repositories/").concat(repoIdOrName, "/pullRequests/").concat(number, "/comments"), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-number-of-pull-request-comments/ */ Backlog.prototype.getPullRequestCommentsCount = function (projectIdOrKey, repoIdOrName, number) { return this.get("projects/".concat(projectIdOrKey, "/git/repositories/").concat(repoIdOrName, "/pullRequests/").concat(number, "/comments/count")); }; /** * https://developer.nulab.com/docs/backlog/api/2/update-pull-request-comment-information/ */ Backlog.prototype.patchPullRequestComments = function (projectIdOrKey, repoIdOrName, number, commentId, params) { return this.patch("projects/".concat(projectIdOrKey, "/git/repositories/").concat(repoIdOrName, "/pullRequests/").concat(number, "/comments/").concat(commentId), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-list-of-pull-request-attachment/ */ Backlog.prototype.getPullRequestAttachments = function (projectIdOrKey, repoIdOrName, number) { return this.get("projects/".concat(projectIdOrKey, "/git/repositories/").concat(repoIdOrName, "/pullRequests/").concat(number, "/attachments")); }; /** * https://developer.nulab.com/docs/backlog/api/2/download-pull-request-attachment/ */ Backlog.prototype.getPullRequestAttachment = function (projectIdOrKey, repoIdOrName, number, attachmentId) { return this.download("projects/".concat(projectIdOrKey, "/git/repositories/").concat(repoIdOrName, "/pullRequests/").concat(number, "/attachments/").concat(attachmentId)); }; /** * https://developer.nulab.com/docs/backlog/api/2/delete-pull-request-attachments/ */ Backlog.prototype.deletePullRequestAttachment = function (projectIdOrKey, repoIdOrName, number, attachmentId) { return this.get("projects/".concat(projectIdOrKey, "/git/repositories/").concat(repoIdOrName, "/pullRequests/").concat(number, "/attachments/").concat(attachmentId)); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-watching-list */ Backlog.prototype.getWatchingListItems = function (userId, params) { return this.get("users/".concat(userId, "/watchings"), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/count-watching */ Backlog.prototype.getWatchingListCount = function (userId, params) { return this.get("users/".concat(userId, "/watchings/count"), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-watching */ Backlog.prototype.getWatchingListItem = function (watchId) { return this.get("watchings/".concat(watchId)); }; /** * https://developer.nulab.com/docs/backlog/api/2/add-watching */ Backlog.prototype.postWatchingListItem = function (params) { return this.post("watchings", params); }; /** * https://developer.nulab.com/docs/backlog/api/2/update-watching */ Backlog.prototype.patchWatchingListItem = function (watchId, note) { return this.patch("watchings/".concat(watchId), { note: note }); }; /** * https://developer.nulab.com/docs/backlog/api/2/delete-watching */ Backlog.prototype.deletehWatchingListItem = function (watchId) { return this.delete("watchings/".concat(watchId)); }; /** * https://developer.nulab.com/docs/backlog/api/2/mark-watching-as-read */ Backlog.prototype.resetWatchingListItemAsRead = function (watchId) { return this.post("watchings/".concat(watchId, "/markAsRead")); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-licence */ Backlog.prototype.getLicence = function () { return this.get("space/licence"); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-list-of-teams/ */ Backlog.prototype.getTeams = function (params) { return this.get("teams", params); }; /** * https://developer.nulab.com/docs/backlog/api/2/add-team/ */ Backlog.prototype.postTeam = function (members) { return this.post("teams", { members: members }); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-team/ */ Backlog.prototype.getTeam = function (teamId) { return this.get("teams/".concat(teamId)); }; /** * https://developer.nulab.com/docs/backlog/api/2/update-team/ */ Backlog.prototype.patchTeam = function (teamId, params) { return this.patch("teams/".concat(teamId), params); }; /** * https://developer.nulab.com/docs/backlog/api/2/delete-team/ */ Backlog.prototype.deleteTeam = function (teamId) { return this.delete("teams/".concat(teamId)); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-team-icon/ */ Backlog.prototype.getTeamIcon = function (teamId) { return this.download("teams/".concat(teamId, "/icon")); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-project-team-list/ */ Backlog.prototype.getProjectTeams = function (projectIdOrKey) { return this.get("projects/".concat(projectIdOrKey, "/teams")); }; /** * https://developer.nulab.com/docs/backlog/api/2/add-project-team/ */ Backlog.prototype.postProjectTeam = function (projectIdOrKey, teamId) { return this.post("projects/".concat(projectIdOrKey, "/teams"), { teamId: teamId }); }; /** * https://developer.nulab.com/docs/backlog/api/2/delete-project-team/ */ Backlog.prototype.deleteProjectTeam = function (projectIdOrKey, teamId) { return this.delete("projects/".concat(projectIdOrKey, "/teams"), { teamId: teamId }); }; /** * https://developer.nulab.com/docs/backlog/api/2/get-rate-limit/ */ Backlog.prototype.getRateLimit = function () { return this.get("rateLimit"); }; Backlog.prototype.download = function (path) { return this.request({ method: 'GET', path: path }).then(this.parseFileData); }; Backlog.prototype.upload = function (path, params) { return this.request({ method: 'POST', path: path, params: params }).then(this.parseJSON); }; Backlog.prototype.parseFileData = function (response) { return new Promise(function (resolve, reject) { if (typeof window !== 'undefined') { resolve({ body: response.body, url: response.url, blob: function () { return response.blob(); }, }); } else { var disposition = response.headers.get("Content-Disposition"); var filename = disposition ? disposition.substring(disposition.indexOf("''") + 2) : ""; resolve({ body: response.body, url: response.url, filename: filename }); } }); }; return Backlog; }(request_1.default)); exports.default = Backlog; },{"./request":7}],2:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); },{}],3:[function(require,module,exports){ "use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (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 __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.UnexpectedError = exports.BacklogAuthError = exports.BacklogApiError = exports.BacklogError = void 0; var BacklogError = /** @class */ (function (_super) { __extends(BacklogError, _super); function BacklogError(name, response, body) { var _this = _super.call(this, response.statusText) || this; _this._name = name; _this._url = response.url; _this._status = response.status; _this._body = body; _this._response = response; return _this; } Object.defineProperty(BacklogError.prototype, "name", { get: function () { return this._name; }, enumerable: false, configurable: true }); Object.defineProperty(BacklogError.prototype, "url", { get: function () { return this._url; }, enumerable: false, configurable: true }); Object.defineProperty(BacklogError.prototype, "status", { get: function () { return this._status; }, enumerable: false, configurable: true }); Object.defineProperty(BacklogError.prototype, "body", { get: function () { return this._body; }, enumerable: false, configurable: true }); Object.defineProperty(BacklogError.prototype, "response", { get: function () { return this._response; }, enumerable: false, configurable: true }); return BacklogError; }(Error)); exports.BacklogError = BacklogError; var BacklogApiError = /** @class */ (function (_super) { __extends(BacklogApiError, _super); function BacklogApiError(response, body) { return _super.call(this, 'BacklogApiError', response, body) || this; } return BacklogApiError; }(BacklogError)); exports.BacklogApiError = BacklogApiError; var BacklogAuthError = /** @class */ (function (_super) { __extends(BacklogAuthError, _super); function BacklogAuthError(response, body) { return _super.call(this, 'BacklogAuthError', response, body) || this; } return BacklogAuthError; }(BacklogError)); exports.BacklogAuthError = BacklogAuthError; var UnexpectedError = /** @class */ (function (_super) { __extends(UnexpectedError, _super); function UnexpectedError(response) { return _super.call(this, 'UnexpectedError', response) || this; } return UnexpectedError; }(BacklogError)); exports.UnexpectedError = UnexpectedError; },{}],4:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Error = exports.Types = exports.Entity = exports.Option = exports.OAuth2 = exports.Backlog = void 0; var backlog_1 = require("./backlog"); exports.Backlog = backlog_1.default; var oauth2_1 = require("./oauth2"); exports.OAuth2 = oauth2_1.default; var Option = require("./option"); exports.Option = Option; var Entity = require("./entity"); exports.Entity = Entity; var Types = require("./types"); exports.Types = Types; var Error = require("./error"); exports.Error = Error; },{"./backlog":1,"./entity":2,"./error":3,"./oauth2":5,"./option":6,"./types":8}],5:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var request_1 = require("./request"); var OAuth2 = /** @class */ (function () { function OAuth2(credentials, timeout) { this.credentials = credentials; this.timeout = timeout; } OAuth2.prototype.getAuthorizationURL = function (options) { var params = { client_id: this.credentials.clientId, response_type: 'code', redirect_uri: options.redirectUri, state: options.state }; return "https://".concat(options.host, "/OAuth2AccessRequest.action?") + Object.keys(params) .map(function (key) { return params[key] ? "".concat(key, "=").concat(params[key]) : ''; }) .filter(function (x) { return x.length > 0; }) .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 }); exports.Issue = void 0; 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 = Issue = {})); },{}],7:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var Error = require("./error"); var qs = require("qs"); var Request = /** @class */ (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 = "".concat(this.restBaseURL, "/").concat(path) + (queryStr.length > 0 ? "?".concat(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) { if (response.status === 204 || response.headers.get("Content-Length") === "0") { return Promise.resolve(undefined); } return response.json(); }; Request.prototype.toQueryString = function (params) { return qs.stringify(params, { arrayFormat: 'brackets' }); }; Object.defineProperty(Request.prototype, "webAppBaseURL", { get: function () { return "https://".concat(this.configure.host); }, enumerable: false, configurable: true }); Object.definePr