import type { CommonHttpClientFetchRequest, CommonHttpClientFetchResponse } from "api-typescript-generator/openapi-client"; import type { AnyResponse } from "./common"; /** * A product request function compatible with `@forge/api`'s `requestJira`/`requestConfluence`. * * The url parameter uses `any` because `@forge/api` defines an opaque `Route` type that cannot * be represented without importing it. Using `unknown` would fail due to function parameter * contravariance: TypeScript would reject assigning a function that accepts only `Route` to one * that accepts `unknown`, since `unknown` is wider than `Route`. */ type ForgeApiProductRequestFunction = (url: any, init?: Record) => Promise; interface ForgeApiProductRequestMethods { requestJira: ForgeApiProductRequestFunction; requestConfluence: ForgeApiProductRequestFunction; } /** * Minimal type stub for the `@forge/api` namespace. * * `assumeTrustedRoute` returns `any` for the same reason as above: the actual return type is the * opaque `Route` type, and the return value is passed directly to `requestJira`/`requestConfluence`. */ interface ForgeApiNamespace { asApp(): ForgeApiProductRequestMethods; asUser(): ForgeApiProductRequestMethods; assumeTrustedRoute(route: string): any; } /** * The product name of the Atlassian product instance supported by `createForgeApiWithProviderFetch`. */ type ApiClientForgeApiProductName = "jira" | "confluence"; /** * Forge-based API client options. * * @category API Client Constructor Options */ export interface ApiClientForgeApiOptions { /** * Forge API namespace. Can be imported using: import * as forgeApi from `@forge/api`; */ forgeApi: ForgeApiNamespace; /** * Whether to make requests as an app. If not provided, the request will be made on behalf of the user. */ asApp?: boolean; } /** * Creates a fetch function for Forge-based API client. */ export declare function createForgeApiFetch({ forgeApi, asApp }: ApiClientForgeApiOptions, productName: ApiClientForgeApiProductName): (url: URL, request: CommonHttpClientFetchRequest) => Promise; export {};