Add gateway-first pattern: when AGILITON_API_KEY is set, route all external API calls through the gateway with X-API-Key auth. Falls back to direct API access when gateway is unavailable. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
71 lines
2.3 KiB
TypeScript
71 lines
2.3 KiB
TypeScript
/**
|
|
* Confluence Cloud REST API v2 client — routes through AgilitonAPI gateway.
|
|
* Falls back to direct Confluence access if AGILITON_API_KEY is not set.
|
|
*
|
|
* Gateway: AGILITON_API_KEY + AGILITON_API_URL
|
|
* Direct: CONFLUENCE_USER/JIRA_USER + CONFLUENCE_API_TOKEN/JIRA_API_TOKEN
|
|
*/
|
|
export interface Space {
|
|
id: string;
|
|
key: string;
|
|
name: string;
|
|
type: string;
|
|
status: string;
|
|
description?: string;
|
|
}
|
|
export interface Page {
|
|
id: string;
|
|
status: string;
|
|
title: string;
|
|
spaceId: string;
|
|
parentId?: string;
|
|
authorId: string;
|
|
createdAt: string;
|
|
version: {
|
|
number: number;
|
|
message?: string;
|
|
createdAt: string;
|
|
authorId?: string;
|
|
};
|
|
body?: {
|
|
storage?: {
|
|
representation: string;
|
|
value: string;
|
|
};
|
|
atlas_doc_format?: {
|
|
representation: string;
|
|
value: string;
|
|
};
|
|
};
|
|
_links?: {
|
|
webui?: string;
|
|
editui?: string;
|
|
};
|
|
}
|
|
export interface Comment {
|
|
id: string;
|
|
status: string;
|
|
title: string;
|
|
body?: {
|
|
storage?: {
|
|
representation: string;
|
|
value: string;
|
|
};
|
|
};
|
|
version: {
|
|
number: number;
|
|
createdAt: string;
|
|
};
|
|
}
|
|
export declare function listSpaces(limit?: number): Promise<Space[]>;
|
|
export declare function getSpace(spaceIdOrKey: string): Promise<Space>;
|
|
export declare function createSpace(key: string, name: string, description?: string): Promise<Space>;
|
|
export declare function searchPages(query: string, spaceId?: string, limit?: number): Promise<Page[]>;
|
|
export declare function getPage(pageId: string, includeBody?: boolean): Promise<Page>;
|
|
export declare function getPageByTitle(spaceId: string, title: string): Promise<Page | null>;
|
|
export declare function createPage(spaceId: string, title: string, body: string, parentId?: string): Promise<Page>;
|
|
export declare function updatePage(pageId: string, title: string, body: string, versionNumber: number, versionMessage?: string): Promise<Page>;
|
|
export declare function getPageComments(pageId: string, limit?: number): Promise<Comment[]>;
|
|
export declare function addPageComment(pageId: string, body: string): Promise<Comment>;
|
|
export declare function getWebUrl(page: Page): string;
|