/** * Standardized Jira Client Factory * * Single source of truth for all Jira API calls. * Defaults to DB-backed OAuth for web/API routes. * PAT fallback only for CLI/superadmin with explicit opt-in. */ export interface JiraAuthContext { accountId?: string; userId?: string | null; usePatFallback?: boolean; cloudId?: string; } export interface JiraClient { /** * Make a GET request to Jira API */ get(path: string, params?: URLSearchParams): Promise; /** * Make a POST request to Jira API */ post(path: string, body: unknown): Promise; /** * Make a PUT request to Jira API */ put(path: string, body: unknown): Promise; /** * Make a DELETE request to Jira API */ delete(path: string): Promise; /** * Get the base URL for this client */ getBaseUrl(): string; /** * Get auth headers for this client */ getAuthHeaders(): Record; /** * Get the auth mode (OAUTH or PAT) */ getAuthMode(): "OAUTH" | "PAT"; /** * Get the cloud ID if available */ getCloudId(): string | undefined; /** * Upload a file to Jira * Requires FormData and sets X-Atlassian-Token: no-check */ upload(path: string, formData: FormData): Promise; } /** * Create Jira client from OAuth token */ export declare function createJiraOAuthClient({ baseUrl, accessToken, siteUrl, }: { baseUrl: string; accessToken: string; siteUrl?: string | null; }): JiraClient; /** * Create Jira client from PAT (Basic Auth) */ export declare function createJiraPatClient({ baseUrl, email, apiToken, }: { baseUrl: string; email: string; apiToken: string; }): JiraClient; /** * Get Jira client - single entry point for all Jira API calls * * Priority: * 1. JiraCredential OAuth (per-user, one credential per user) * 2. PAT fallback (only if usePatFallback=true and superadmin/dev) * * @throws JiraCredentialMissingError if no OAuth credentials found and PAT not allowed * @throws JiraOAuthRevokedError if OAuth token is revoked * @throws JiraTokenExpiredError if token expired and refresh failed */ /** * Get Jira client - single entry point for all Jira API calls * Cached per-request to ensure idempotency */ export declare const getJiraClient: (ctx: JiraAuthContext) => Promise; /** * Extract Cloud ID and Site URL from Atlassian OAuth accessible-resources */ export declare function extractCloudId(accessToken: string): Promise<{ id: string; url: string; } | null>; //# sourceMappingURL=jiraClient.d.ts.map