import { APIResource } from "../core/resource.mjs"; import { APIPromise } from "../core/api-promise.mjs"; import { RequestOptions } from "../internal/request-options.mjs"; /** * External service integrations */ export declare class Connections extends APIResource { /** * Initialize connection and get authorization URL * * @example * ```ts * const connection = await client.connections.create( * 'notion', * ); * ``` */ create(provider: 'notion' | 'google-drive' | 'onedrive' | 'gmail' | 'github' | 'web-crawler' | 's3', body: ConnectionCreateParams, options?: RequestOptions): APIPromise; /** * List all connections * * @example * ```ts * const connections = await client.connections.list(); * ``` */ list(body: ConnectionListParams, options?: RequestOptions): APIPromise; /** * Configure resources for a connection (supported providers: GitHub for now) * * @example * ```ts * const response = await client.connections.configure( * 'connectionId', * { resources: [{ foo: 'bar' }] }, * ); * ``` */ configure(connectionID: string, body: ConnectionConfigureParams, options?: RequestOptions): APIPromise; /** * Delete a specific connection by ID * * @example * ```ts * const response = await client.connections.deleteByID( * 'connectionId', * ); * ``` */ deleteByID(connectionID: string, params?: ConnectionDeleteByIDParams | null | undefined, options?: RequestOptions): APIPromise; /** * Delete connection for a specific provider and container tags * * @example * ```ts * const response = await client.connections.deleteByProvider( * 'notion', * { containerTags: ['user_123', 'project_123'] }, * ); * ``` */ deleteByProvider(provider: 'notion' | 'google-drive' | 'onedrive' | 'gmail' | 'github' | 'web-crawler' | 's3', body: ConnectionDeleteByProviderParams, options?: RequestOptions): APIPromise; /** * Get connection details with id * * @example * ```ts * const response = await client.connections.getByID( * 'connectionId', * ); * ``` */ getByID(connectionID: string, options?: RequestOptions): APIPromise; /** * Get connection details with provider and container tags * * @example * ```ts * const response = await client.connections.getByTag( * 'notion', * { containerTags: ['user_123', 'project_123'] }, * ); * ``` */ getByTag(provider: 'notion' | 'google-drive' | 'onedrive' | 'gmail' | 'github' | 'web-crawler' | 's3', body: ConnectionGetByTagParams, options?: RequestOptions): APIPromise; /** * Initiate a manual sync of connections * * @example * ```ts * const response = await client.connections.import('notion'); * ``` */ import(provider: 'notion' | 'google-drive' | 'onedrive' | 'gmail' | 'github' | 'web-crawler' | 's3', body: ConnectionImportParams, options?: RequestOptions): APIPromise; /** * List documents indexed for a provider and container tags * * @example * ```ts * const response = await client.connections.listDocuments( * 'notion', * ); * ``` */ listDocuments(provider: 'notion' | 'google-drive' | 'onedrive' | 'gmail' | 'github' | 'web-crawler' | 's3', body: ConnectionListDocumentsParams, options?: RequestOptions): APIPromise; /** * Fetch resources for a connection (supported providers: GitHub for now) * * @example * ```ts * const response = await client.connections.resources( * 'connectionId', * ); * ``` */ resources(connectionID: string, query?: ConnectionResourcesParams | null | undefined, options?: RequestOptions): APIPromise; } export interface ConnectionCreateResponse { id: string; authLink: string; expiresIn: string; redirectsTo?: string; } export type ConnectionListResponse = Array; export declare namespace ConnectionListResponse { interface ConnectionListResponseItem { id: string; createdAt: string; provider: string; /** * @deprecated */ containerTags?: Array; documentLimit?: number; email?: string; expiresAt?: string; metadata?: { [key: string]: unknown; }; } } export interface ConnectionConfigureResponse { message: string; success: boolean; webhooksRegistered?: number; } export interface ConnectionDeleteByIDResponse { id: string; provider: string; } export interface ConnectionDeleteByProviderResponse { id: string; provider: string; } export interface ConnectionGetByIDResponse { id: string; createdAt: string; provider: string; /** * @deprecated */ containerTags?: Array; documentLimit?: number; email?: string; expiresAt?: string; metadata?: { [key: string]: unknown; }; } export interface ConnectionGetByTagResponse { id: string; createdAt: string; provider: string; /** * @deprecated */ containerTags?: Array; documentLimit?: number; email?: string; expiresAt?: string; metadata?: { [key: string]: unknown; }; } export type ConnectionImportResponse = string; export type ConnectionListDocumentsResponse = Array; export declare namespace ConnectionListDocumentsResponse { interface ConnectionListDocumentsResponseItem { id: string; createdAt: string; status: string; summary: string | null; title: string | null; type: string; updatedAt: string; } } export interface ConnectionResourcesResponse { resources: Array<{ [key: string]: unknown; }>; total_count?: number; } export interface ConnectionCreateParams { containerTag?: string; containerTags?: Array; documentLimit?: number; metadata?: { [key: string]: string | number | boolean; } | null; redirectUrl?: string; } export interface ConnectionListParams { /** * Optional comma-separated list of container tags to filter documents by */ containerTags?: Array; } export interface ConnectionConfigureParams { resources: Array<{ [key: string]: unknown; }>; } export interface ConnectionDeleteByIDParams { /** * Whether to also delete documents imported by this connection. Defaults to true. */ deleteDocuments?: string; } export interface ConnectionDeleteByProviderParams { /** * Optional comma-separated list of container tags to filter connections by */ containerTags: Array; } export interface ConnectionGetByTagParams { /** * Comma-separated list of container tags to filter connection by */ containerTags: Array; } export interface ConnectionImportParams { /** * Optional comma-separated list of container tags to filter connections by */ containerTags?: Array; } export interface ConnectionListDocumentsParams { /** * Optional comma-separated list of container tags to filter documents by */ containerTags?: Array; } export interface ConnectionResourcesParams { page?: number; parent_id?: string; per_page?: number; } export declare namespace Connections { export { type ConnectionCreateResponse as ConnectionCreateResponse, type ConnectionListResponse as ConnectionListResponse, type ConnectionConfigureResponse as ConnectionConfigureResponse, type ConnectionDeleteByIDResponse as ConnectionDeleteByIDResponse, type ConnectionDeleteByProviderResponse as ConnectionDeleteByProviderResponse, type ConnectionGetByIDResponse as ConnectionGetByIDResponse, type ConnectionGetByTagResponse as ConnectionGetByTagResponse, type ConnectionImportResponse as ConnectionImportResponse, type ConnectionListDocumentsResponse as ConnectionListDocumentsResponse, type ConnectionResourcesResponse as ConnectionResourcesResponse, type ConnectionCreateParams as ConnectionCreateParams, type ConnectionListParams as ConnectionListParams, type ConnectionConfigureParams as ConnectionConfigureParams, type ConnectionDeleteByIDParams as ConnectionDeleteByIDParams, type ConnectionDeleteByProviderParams as ConnectionDeleteByProviderParams, type ConnectionGetByTagParams as ConnectionGetByTagParams, type ConnectionImportParams as ConnectionImportParams, type ConnectionListDocumentsParams as ConnectionListDocumentsParams, type ConnectionResourcesParams as ConnectionResourcesParams, }; } //# sourceMappingURL=connections.d.mts.map