@sitranv/confluence-rest-api-client
v1.0.0
Published
The Confluence Cloud REST API v2
Readme
@sitranv/confluence-rest-api-client
Typed client for the Confluence Cloud REST API v2, generated from the OpenAPI spec
with typescript-fetch and wrapped in Forge-aware backend/frontend clients.
Same shape as @sitranv/jira-rest-api-client.
Backend (Forge resolver — @forge/api)
import { backendClient } from "@sitranv/confluence-rest-api-client";
// as the app
const pages = await backendClient.asApp().getPageApi().getPages({ limit: 25 });
// as the calling user
const page = await backendClient.asUser().getPageApi().getPageById({ id: 12345 });Frontend (Custom UI — @forge/bridge)
import { frontendClient } from "@sitranv/confluence-rest-api-client";
const spaces = await frontendClient.getSpaceApi().getSpaces({});Regenerating
npm run generate # regenerates src/apis, src/models, src/runtime.ts from openapi.json
npm run buildsrc/clients/** and src/index.ts are listed in .openapi-generator-ignore, so the
hand-written Forge layer survives regeneration.
Note on the base path
The v2 spec carries the /wiki/api/v2 prefix on its server URL, not on each path, so
generated operations produce paths like /pages. Forge's requestConfluence expects the
full site-relative route, so both clients set basePath to /wiki/api/v2
(see src/clients/basePath.ts). This differs from the Jira client, which can use
basePath: "" because /rest/api/3 is baked into each generated path.
