jira-client-oauth2
Version:
Jira client class with OAuth2.0 support.
100 lines • 3.28 kB
TypeScript
import { JiraOAuth2Config, CreateIssueRequest, CreateIssueResponse, JiraIssue, JiraSearchResponse, IssueLinkRequest, JiraProject, JiraUser, RefreshTokensResponse, GetIssuesOptions } from './types.js';
export default class JiraOAuth2Client {
private jiraClient;
private agileClient;
private atlassianClient;
private logger;
constructor(config: JiraOAuth2Config);
/**
* Updates the access token for all subsequent requests.
* Useful for handling OAuth2 token refreshes.
*/
setAccessToken(newAccessToken: string): void;
/**
* Gets a new refresh and access token.
*/
refreshAccessToken(clientId: string, clientSecret: string, refreshToken: string): Promise<RefreshTokensResponse>;
/**
* Generic private method to make API calls to a specific client instance.
*/
private makeRequest;
/**
* Creates a new issue.
* (Previously addNewIssue)
*/
createIssue(issueData: CreateIssueRequest): Promise<CreateIssueResponse>;
/**
* Retrieves an issue by its key.
* (Previously findIssue)
*/
getIssue(issueKey: string, options?: {
expand?: string[];
fields?: string[];
}): Promise<JiraIssue>;
/**
* Updates an existing issue.
*/
updateIssue(issueKey: string, updateData: {
fields?: Record<string, any>;
update?: Record<string, any>;
}): Promise<void>;
/**
* Updates the assignee of an issue.
*/
updateAssignee(issueKey: string, accountId: string | null): Promise<void>;
/**
* Searches for issues using JQL.
*/
searchIssues(jql: string, options?: {
fields?: string[];
expand?: string[];
maxResults?: number;
startAt?: number;
}): Promise<JiraSearchResponse>;
/**
* Searches for all Epics for a given project.
*/
getEpics(projectKey: string): Promise<JiraIssue[]>;
/**
* Creates a link between two issues.
*/
linkIssues(linkRequest: IssueLinkRequest): Promise<void>;
/**
* Retrieves the available transitions for an issue.
* (Previously listTransitions)
*/
getTransitions(issueKey: string): Promise<{
expand: string;
transitions: any[];
}>;
/**
* Transitions an issue to a new status.
*/
transitionIssue(issueKey: string, transitionId: string, fields?: Record<string, any>, comment?: string): Promise<void>;
/**
* Retrieves all projects visible to the user.
*/
getProjects(): Promise<JiraProject[]>;
/**
* Retrieves a single project by its key or ID.
*/
getProject(projectKeyOrId: string): Promise<JiraProject>;
/**
* Creates a new project. Note: Requires admin permissions.
*/
createProject(projectData: Record<string, any>): Promise<JiraProject>;
/**
* Searches for all Issues for a given project.
*/
getIssuesForProject(projectKey: string, options?: GetIssuesOptions): Promise<JiraIssue[]>;
/**
* Retrieves the profile of the current user.
*/
getCurrentUser(): Promise<JiraUser>;
/**
* Deletes an issue.
* Note: This is a permanent action.
*/
deleteIssue(issueKey: string): Promise<void>;
}
//# sourceMappingURL=JiraOAuth2Client.d.ts.map