import type { RequestInit, RequestInfo } from "./internal/builtin-types.js"; import type { PromiseOrValue, MergedRequestInit, FinalizedRequestInit } from "./internal/types.js"; export type { Logger, LogLevel } from "./internal/utils/log.js"; import * as Opts from "./internal/request-options.js"; import * as Errors from "./core/error.js"; import * as Uploads from "./core/uploads.js"; import * as API from "./resources/index.js"; import { APIPromise } from "./core/api-promise.js"; import { type Fetch } from "./internal/builtin-types.js"; import { HeadersLike, NullableHeaders } from "./internal/headers.js"; import { FinalRequestOptions, RequestOptions } from "./internal/request-options.js"; import { AuthConfigCreateParams, AuthConfigCreateResponse, AuthConfigDeleteResponse, AuthConfigListParams, AuthConfigListResponse, AuthConfigRetrieveResponse, AuthConfigUpdateParams, AuthConfigUpdateResponse, AuthConfigUpdateStatusParams, AuthConfigUpdateStatusResponse, AuthConfigs } from "./resources/auth-configs.js"; import { Cli, CliCreateSessionResponse, CliGetSessionParams, CliGetSessionResponse } from "./resources/cli.js"; import { ConnectedAccountCreateParams, ConnectedAccountCreateResponse, ConnectedAccountDeleteResponse, ConnectedAccountListParams, ConnectedAccountListResponse, ConnectedAccountRefreshParams, ConnectedAccountRefreshResponse, ConnectedAccountRetrieveResponse, ConnectedAccountUpdateStatusParams, ConnectedAccountUpdateStatusResponse, ConnectedAccounts } from "./resources/connected-accounts.js"; import { FileCreatePresignedURLParams, FileCreatePresignedURLResponse, FileListParams, FileListResponse, Files } from "./resources/files.js"; import { Link, LinkCreateParams, LinkCreateResponse } from "./resources/link.js"; import { Migration, MigrationRetrieveNanoidParams, MigrationRetrieveNanoidResponse } from "./resources/migration.js"; import { ToolkitListParams, ToolkitListResponse, ToolkitRetrieveCategoriesResponse, ToolkitRetrieveParams, ToolkitRetrieveResponse, Toolkits } from "./resources/toolkits.js"; import { ToolExecuteParams, ToolExecuteResponse, ToolGetInputParams, ToolGetInputResponse, ToolListParams, ToolListResponse, ToolProxyParams, ToolProxyResponse, ToolRetrieveEnumResponse, ToolRetrieveParams, ToolRetrieveResponse, Tools } from "./resources/tools.js"; import { TriggersTypeListParams, TriggersTypeListResponse, TriggersTypeRetrieveEnumResponse, TriggersTypeRetrieveParams, TriggersTypeRetrieveResponse, TriggersTypes } from "./resources/triggers-types.js"; import { type LogLevel, type Logger } from "./internal/utils/log.js"; import { Mcp, McpCreateParams, McpCreateResponse, McpDeleteResponse, McpListParams, McpListResponse, McpRetrieveAppParams, McpRetrieveAppResponse, McpRetrieveResponse, McpUpdateParams, McpUpdateResponse } from "./resources/mcp/mcp.js"; import { ToolRouter, ToolRouterCreateSessionParams, ToolRouterCreateSessionResponse } from "./resources/tool-router/tool-router.js"; import { TriggerInstanceListActiveParams, TriggerInstanceListActiveResponse, TriggerInstanceUpsertParams, TriggerInstanceUpsertResponse, TriggerInstances } from "./resources/trigger-instances/trigger-instances.js"; declare const environments: { production: string; staging: string; local: string; }; type Environment = keyof typeof environments; export interface ClientOptions { /** * API key authentication */ apiKey?: string | null | undefined; /** * Specifies the environment to use for the API. * * Each environment maps to a different base URL: * - `production` corresponds to `https://backend.composio.dev` * - `staging` corresponds to `https://staging-backend.composio.dev` * - `local` corresponds to `http://localhost:9900` */ environment?: Environment | undefined; /** * Override the default base URL for the API, e.g., "https://api.example.com/v2/" * * Defaults to process.env['COMPOSIO_BASE_URL']. */ baseURL?: string | null | undefined; /** * The maximum amount of time (in milliseconds) that the client should wait for a response * from the server before timing out a single request. * * Note that request timeouts are retried by default, so in a worst-case scenario you may wait * much longer than this timeout before the promise succeeds or fails. * * @unit milliseconds */ timeout?: number | undefined; /** * Additional `RequestInit` options to be passed to `fetch` calls. * Properties will be overridden by per-request `fetchOptions`. */ fetchOptions?: MergedRequestInit | undefined; /** * Specify a custom `fetch` function implementation. * * If not provided, we expect that `fetch` is defined globally. */ fetch?: Fetch | undefined; /** * The maximum number of times that the client will retry a request in case of a * temporary failure, like a network error or a 5XX error from the server. * * @default 2 */ maxRetries?: number | undefined; /** * Default headers to include with every request to the API. * * These can be removed in individual requests by explicitly setting the * header to `null` in request options. */ defaultHeaders?: HeadersLike | undefined; /** * Default query parameters to include with every request to the API. * * These can be removed in individual requests by explicitly setting the * param to `undefined` in request options. */ defaultQuery?: Record | undefined; /** * Set the log level. * * Defaults to process.env['COMPOSIO_LOG'] or 'warn' if it isn't set. */ logLevel?: LogLevel | undefined; /** * Set the logger. * * Defaults to globalThis.console. */ logger?: Logger | undefined; } /** * API Client for interfacing with the Composio API. */ export declare class Composio { #private; apiKey: string | null; baseURL: string; maxRetries: number; timeout: number; logger: Logger; logLevel: LogLevel | undefined; fetchOptions: MergedRequestInit | undefined; private fetch; protected idempotencyHeader?: string; private _options; /** * API Client for interfacing with the Composio API. * * @param {string | null | undefined} [opts.apiKey=process.env['COMPOSIO_API_KEY'] ?? null] * @param {Environment} [opts.environment=production] - Specifies the environment URL to use for the API. * @param {string} [opts.baseURL=process.env['COMPOSIO_BASE_URL'] ?? https://backend.composio.dev] - Override the default base URL for the API. * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out. * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls. * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation. * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request. * @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API. * @param {Record} opts.defaultQuery - Default query parameters to include with every request to the API. */ constructor({ baseURL, apiKey, ...opts }?: ClientOptions); /** * Create a new client instance re-using the same options given to the current client with optional overriding. */ withOptions(options: Partial): this; protected defaultQuery(): Record | undefined; protected validateHeaders({ values, nulls }: NullableHeaders): void; protected authHeaders(opts: FinalRequestOptions): Promise; protected stringifyQuery(query: Record): string; private getUserAgent; protected defaultIdempotencyKey(): string; protected makeStatusError(status: number, error: Object, message: string | undefined, headers: Headers): Errors.APIError; buildURL(path: string, query: Record | null | undefined, defaultBaseURL?: string | undefined): string; /** * Used as a callback for mutating the given `FinalRequestOptions` object. */ protected prepareOptions(options: FinalRequestOptions): Promise; /** * Used as a callback for mutating the given `RequestInit` object. * * This is useful for cases where you want to add certain headers based off of * the request properties, e.g. `method` or `url`. */ protected prepareRequest(request: RequestInit, { url, options }: { url: string; options: FinalRequestOptions; }): Promise; get(path: string, opts?: PromiseOrValue): APIPromise; post(path: string, opts?: PromiseOrValue): APIPromise; patch(path: string, opts?: PromiseOrValue): APIPromise; put(path: string, opts?: PromiseOrValue): APIPromise; delete(path: string, opts?: PromiseOrValue): APIPromise; private methodRequest; request(options: PromiseOrValue, remainingRetries?: number | null): APIPromise; private makeRequest; fetchWithTimeout(url: RequestInfo, init: RequestInit | undefined, ms: number, controller: AbortController): Promise; private shouldRetry; private retryRequest; private calculateDefaultRetryTimeoutMillis; buildRequest(inputOptions: FinalRequestOptions, { retryCount }?: { retryCount?: number; }): Promise<{ req: FinalizedRequestInit; url: string; timeout: number; }>; private buildHeaders; private buildBody; static Composio: typeof Composio; static DEFAULT_TIMEOUT: number; static ComposioError: typeof Errors.ComposioError; static APIError: typeof Errors.APIError; static APIConnectionError: typeof Errors.APIConnectionError; static APIConnectionTimeoutError: typeof Errors.APIConnectionTimeoutError; static APIUserAbortError: typeof Errors.APIUserAbortError; static NotFoundError: typeof Errors.NotFoundError; static ConflictError: typeof Errors.ConflictError; static RateLimitError: typeof Errors.RateLimitError; static BadRequestError: typeof Errors.BadRequestError; static AuthenticationError: typeof Errors.AuthenticationError; static InternalServerError: typeof Errors.InternalServerError; static PermissionDeniedError: typeof Errors.PermissionDeniedError; static UnprocessableEntityError: typeof Errors.UnprocessableEntityError; static toFile: typeof Uploads.toFile; authConfigs: API.AuthConfigs; connectedAccounts: API.ConnectedAccounts; link: API.Link; toolkits: API.Toolkits; tools: API.Tools; triggerInstances: API.TriggerInstances; triggersTypes: API.TriggersTypes; mcp: API.Mcp; files: API.Files; migration: API.Migration; cli: API.Cli; toolRouter: API.ToolRouter; } export declare namespace Composio { export type RequestOptions = Opts.RequestOptions; export { AuthConfigs as AuthConfigs, type AuthConfigCreateResponse as AuthConfigCreateResponse, type AuthConfigRetrieveResponse as AuthConfigRetrieveResponse, type AuthConfigUpdateResponse as AuthConfigUpdateResponse, type AuthConfigListResponse as AuthConfigListResponse, type AuthConfigDeleteResponse as AuthConfigDeleteResponse, type AuthConfigUpdateStatusResponse as AuthConfigUpdateStatusResponse, type AuthConfigCreateParams as AuthConfigCreateParams, type AuthConfigUpdateParams as AuthConfigUpdateParams, type AuthConfigListParams as AuthConfigListParams, type AuthConfigUpdateStatusParams as AuthConfigUpdateStatusParams, }; export { ConnectedAccounts as ConnectedAccounts, type ConnectedAccountCreateResponse as ConnectedAccountCreateResponse, type ConnectedAccountRetrieveResponse as ConnectedAccountRetrieveResponse, type ConnectedAccountListResponse as ConnectedAccountListResponse, type ConnectedAccountDeleteResponse as ConnectedAccountDeleteResponse, type ConnectedAccountRefreshResponse as ConnectedAccountRefreshResponse, type ConnectedAccountUpdateStatusResponse as ConnectedAccountUpdateStatusResponse, type ConnectedAccountCreateParams as ConnectedAccountCreateParams, type ConnectedAccountListParams as ConnectedAccountListParams, type ConnectedAccountRefreshParams as ConnectedAccountRefreshParams, type ConnectedAccountUpdateStatusParams as ConnectedAccountUpdateStatusParams, }; export { Link as Link, type LinkCreateResponse as LinkCreateResponse, type LinkCreateParams as LinkCreateParams, }; export { Toolkits as Toolkits, type ToolkitRetrieveResponse as ToolkitRetrieveResponse, type ToolkitListResponse as ToolkitListResponse, type ToolkitRetrieveCategoriesResponse as ToolkitRetrieveCategoriesResponse, type ToolkitRetrieveParams as ToolkitRetrieveParams, type ToolkitListParams as ToolkitListParams, }; export { Tools as Tools, type ToolRetrieveResponse as ToolRetrieveResponse, type ToolListResponse as ToolListResponse, type ToolExecuteResponse as ToolExecuteResponse, type ToolGetInputResponse as ToolGetInputResponse, type ToolProxyResponse as ToolProxyResponse, type ToolRetrieveEnumResponse as ToolRetrieveEnumResponse, type ToolRetrieveParams as ToolRetrieveParams, type ToolListParams as ToolListParams, type ToolExecuteParams as ToolExecuteParams, type ToolGetInputParams as ToolGetInputParams, type ToolProxyParams as ToolProxyParams, }; export { TriggerInstances as TriggerInstances, type TriggerInstanceListActiveResponse as TriggerInstanceListActiveResponse, type TriggerInstanceUpsertResponse as TriggerInstanceUpsertResponse, type TriggerInstanceListActiveParams as TriggerInstanceListActiveParams, type TriggerInstanceUpsertParams as TriggerInstanceUpsertParams, }; export { TriggersTypes as TriggersTypes, type TriggersTypeRetrieveResponse as TriggersTypeRetrieveResponse, type TriggersTypeListResponse as TriggersTypeListResponse, type TriggersTypeRetrieveEnumResponse as TriggersTypeRetrieveEnumResponse, type TriggersTypeRetrieveParams as TriggersTypeRetrieveParams, type TriggersTypeListParams as TriggersTypeListParams, }; export { Mcp as Mcp, type McpCreateResponse as McpCreateResponse, type McpRetrieveResponse as McpRetrieveResponse, type McpUpdateResponse as McpUpdateResponse, type McpListResponse as McpListResponse, type McpDeleteResponse as McpDeleteResponse, type McpRetrieveAppResponse as McpRetrieveAppResponse, type McpCreateParams as McpCreateParams, type McpUpdateParams as McpUpdateParams, type McpListParams as McpListParams, type McpRetrieveAppParams as McpRetrieveAppParams, }; export { Files as Files, type FileListResponse as FileListResponse, type FileCreatePresignedURLResponse as FileCreatePresignedURLResponse, type FileListParams as FileListParams, type FileCreatePresignedURLParams as FileCreatePresignedURLParams, }; export { Migration as Migration, type MigrationRetrieveNanoidResponse as MigrationRetrieveNanoidResponse, type MigrationRetrieveNanoidParams as MigrationRetrieveNanoidParams, }; export { Cli as Cli, type CliCreateSessionResponse as CliCreateSessionResponse, type CliGetSessionResponse as CliGetSessionResponse, type CliGetSessionParams as CliGetSessionParams, }; export { ToolRouter as ToolRouter, type ToolRouterCreateSessionResponse as ToolRouterCreateSessionResponse, type ToolRouterCreateSessionParams as ToolRouterCreateSessionParams, }; } //# sourceMappingURL=client.d.ts.map