@bs-plugins/jira
Version:
Bamboo Shell plugin for JIRA
87 lines (84 loc) • 3.48 kB
TypeScript
import { BSPlugin, ReqRes } from '@bs-core/shell';
type AuthDetails = {
username: string;
password: string;
};
type JiraConfig = {
server: string;
user: string;
password: string;
sessionRefreshPeriod?: number;
};
type FieldDict = {
byName: Record<string, {
id: string;
type: string;
itemType: string;
}>;
byId: Record<string, {
name: string;
type: string;
itemType: string;
}>;
};
type DashboardsOject = {
name: string;
values: [number, string][];
};
type FiltersOject = {
name: string;
values: [number, string][];
};
type JqlResults = {
startAt: number;
maxResults: number;
total: number;
issues: {
key: string;
}[];
};
declare const JiraResources: Record<string, string>;
declare class Jira extends BSPlugin {
private _server;
private _user;
private _password;
private _sessionId;
private _sessionRefreshPeriod;
private _timeout?;
private _fieldDict;
private _sessionHeader;
private _basicAuthHeader;
constructor(name: string, jiraConfig: JiraConfig);
login(auth?: AuthDetails): Promise<void>;
logout(): Promise<void>;
getFieldDict(useCurrent?: boolean): Promise<FieldDict>;
getAllowedFieldValues(projectKey: string, issueType: string, fieldName: string): Promise<string[]>;
getComponents(projectKey: string): Promise<{
[key: string]: string;
}>;
getProjects(component?: string): Promise<any[]>;
updateProject(project: string, body: Record<string, string>): Promise<void>;
updateProjectLead(project: string, lead: string): Promise<void>;
createIssue(projectKey: string, issueType: string, component: string, fields: Record<string, any>): Promise<string>;
updateIssue(key: string, fields: Record<string, any>, notifyUsers?: boolean): Promise<string>;
getIssue(idOrKey: string): Promise<any>;
issueReporter(key: string, reporter: string, notifyUsers?: boolean): Promise<void>;
assignIssue(key: string, assignee: string, notifyUsers?: boolean): Promise<void>;
updateLabels(key: string, action: "add" | "remove", labels: string[], notifyUsers?: boolean): Promise<string>;
addComment(idOrKey: string, comment: string): Promise<void>;
addWatcher(idOrKey: string, watcher: string): Promise<void>;
removeWatcher(idOrKey: string, watcher: string): Promise<void>;
getTransitions(idOrKey: string): Promise<Record<string, string>>;
doTransition(idOrKey: string, transitionIdOrName: string, fields?: string[], comment?: string): Promise<void>;
runJql(jql: string): Promise<string[]>;
getUserDashboardIds(userId: string): Promise<number[]>;
getUserFilterIds(userId: string): Promise<string[]>;
migrateDashboards(fromUserId: string, toUserId: string, dashboardIds: number[]): Promise<void>;
migrateFilters(fromUserId: string, toUserId: string, filterIds: string[]): Promise<void>;
getUser(user: string, byKey: boolean, includeGroups?: boolean): Promise<any>;
addUserToGroup(user: string, group: string): Promise<Object>;
getUserGroups(user: string): Promise<string[]>;
addUserToApplication(user: string, applicationKey: string): Promise<void>;
restApiCall(method: "GET" | "PUT" | "POST" | "DELETE" | "PATCH", path: string, body: any): Promise<ReqRes>;
}
export { type AuthDetails, type DashboardsOject, type FieldDict, type FiltersOject, Jira, type JiraConfig, JiraResources, type JqlResults };