import * as generated from '../codegen/api'; import type { CancelablePromise } from '../codegen/api/core/CancelablePromise'; declare const OpenAPI: generated.OpenAPIConfig; export { OpenAPI }; interface Token { clientId?: string; companyId?: string; internalUserId?: string; workspaceId: string; notificationId?: string; baseUrl?: string; tokenId?: string; } type Generated = typeof generated; type ServiceKeys = { [K in keyof Generated]: K extends `${string}Service` ? K : never; }[keyof Generated]; type UnionToIntersection = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never; type AggregatedServices = UnionToIntersection; export type AssemblyAPI = AggregatedServices & { getTokenPayload?: () => Promise; sendWebhook: (event: string, payload: T) => CancelablePromise; fetch: (path: string, init?: RequestInit) => Promise; }; /** @deprecated Use `AssemblyAPI` instead. Will be removed in v5.0.0. */ export type CopilotAPI = AssemblyAPI; export declare function processToken(token: string): Token | null; /** * Creates a request-scoped Assembly SDK client. * * Since v4 this function is async and **must be awaited** before calling any * SDK methods. Each call returns an isolated client scoped to the supplied * credentials — do not share the returned object across requests. * * @param apiKey Your Assembly workspace API key. Required unless a `bearer` is * supplied — a bearer is a complete credential on its own. * @param token Encrypted client token supplied by the Assembly portal for * marketplace apps. Omit for custom (non-marketplace) apps. * @param bearer Short-lived bearer token obtained from the platform API * (`/v1/session` exchange or `/v1/token`). When supplied, every request — * generated service methods and `fetch` alike — carries * `Authorization: Bearer`, which the platform API checks before the API key. * @param baseUrl Trusted override for the API origin, from a source the caller * controls (e.g. a server-side env var) — NOT from a token claim. Needed for * bearer-only calls whose issuing stack differs from the SDK's env default * (e.g. a per-dev private stack); prod and shared staging resolve correctly * without it. A bearer's own `base_url` is deliberately never trusted here, * since the SDK cannot verify the bearer's signature. * * @example * // Custom app * const assembly = await assemblyApi({ apiKey: process.env.ASSEMBLY_API_KEY! }); * * @example * // Marketplace app * const assembly = await assemblyApi({ apiKey, token: searchParams.token }); * * @example * // Bearer-only (post-exchange) * const assembly = await assemblyApi({ bearer }); */ export declare function assemblyApi({ apiKey, token: tokenString, bearer, baseUrl, }: { apiKey?: string; token?: string; bearer?: string; baseUrl?: string; }): Promise; /** @deprecated Use `assemblyApi` instead. Will be removed in v5.0.0. */ export declare const copilotApi: typeof assemblyApi;