/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { connectionsCreateConnection } from "../funcs/connectionsCreateConnection.js"; import { connectionsCreateOAuthRedirectUrl } from "../funcs/connectionsCreateOAuthRedirectUrl.js"; import { connectionsDelete } from "../funcs/connectionsDelete.js"; import { connectionsGet } from "../funcs/connectionsGet.js"; import { connectionsGetStats } from "../funcs/connectionsGetStats.js"; import { connectionsList } from "../funcs/connectionsList.js"; import { connectionsListConnectionSourceTypes } from "../funcs/connectionsListConnectionSourceTypes.js"; import { connectionsSetEnabled } from "../funcs/connectionsSetEnabled.js"; import { connectionsSetLimits } from "../funcs/connectionsSetLimits.js"; import { connectionsSync } from "../funcs/connectionsSync.js"; import { connectionsUpdate } from "../funcs/connectionsUpdate.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as components from "../models/components/index.js"; import * as operations from "../models/operations/index.js"; import { unwrapAsync } from "../types/fp.js"; import { PageIterator, unwrapResultIterator } from "../types/operations.js"; export class Connections extends ClientSDK { /** * Create Connection * * @remarks * Create a connection. This is only for non-oauth connections such as S3 compatible connections, Freshdesk, and Zendesk. */ async createConnection( request: components.PublicCreateConnection, options?: RequestOptions, ): Promise { return unwrapAsync(connectionsCreateConnection( this, request, options, )); } /** * List Connections * * @remarks * List all connections sorted by created_at in descending order. Results are paginated with a max limit of 100. When more documents are available, a `cursor` will be provided. Use the `cursor` parameter to retrieve the subsequent page. */ async list( request?: operations.ListConnectionsConnectionsGetRequest | undefined, options?: RequestOptions, ): Promise< PageIterator< operations.ListConnectionsConnectionsGetResponse, { cursor: string } > > { return unwrapResultIterator(connectionsList( this, request, options, )); } /** * Create Oauth Redirect Url * * @remarks * Creates a redirect url to redirect the user to when initializing an embedded connector. */ async createOAuthRedirectUrl( request: components.OAuthUrlCreate, options?: RequestOptions, ): Promise { return unwrapAsync(connectionsCreateOAuthRedirectUrl( this, request, options, )); } /** * List Connection Source Types * * @remarks * List available connection source types like 'google_drive' and 'notion' along with their metadata */ async listConnectionSourceTypes( options?: RequestOptions, ): Promise { return unwrapAsync(connectionsListConnectionSourceTypes( this, options, )); } /** * Set Connection Enabled * * @remarks * Enable or disable the connection. A disabled connection won't sync. */ async setEnabled( request: operations.SetConnectionEnabledConnectionsConnectionIdEnabledPutRequest, options?: RequestOptions, ): Promise { return unwrapAsync(connectionsSetEnabled( this, request, options, )); } /** * Update Connection * * @remarks * Updates a connections metadata or mode. These changes will be seen after the next sync. */ async update( request: operations.UpdateConnectionConnectionsConnectionIdPutRequest, options?: RequestOptions, ): Promise { return unwrapAsync(connectionsUpdate( this, request, options, )); } /** * Get Connection * * @remarks * Get a connection. */ async get( request: operations.GetConnectionConnectionsConnectionIdGetRequest, options?: RequestOptions, ): Promise { return unwrapAsync(connectionsGet( this, request, options, )); } /** * Get Connection Stats * * @remarks * Lists connection stats: total documents active documents, total active pages. */ async getStats( request: operations.GetConnectionStatsConnectionsConnectionIdStatsGetRequest, options?: RequestOptions, ): Promise { return unwrapAsync(connectionsGetStats( this, request, options, )); } /** * Set Connection Limits * * @remarks * Sets limits on a connection. Limits can be set on the total number of pages a connection can sync. When the limit is reached, the connection will be disabled. Limit may be removed by setting it to `null`. */ async setLimits( request: operations.SetConnectionLimitsConnectionsConnectionIdLimitPutRequest, options?: RequestOptions, ): Promise { return unwrapAsync(connectionsSetLimits( this, request, options, )); } /** * Delete Connection * * @remarks * Schedules a connection to be deleted. You can choose to keep the files from the connection or delete them all. If you keep the files, they will no longer be associated to the connection. Deleting can take some time, so you will still see files for a bit after this is called. */ async delete( request: operations.DeleteConnectionConnectionsConnectionIdDeletePostRequest, options?: RequestOptions, ): Promise<{ [k: string]: string }> { return unwrapAsync(connectionsDelete( this, request, options, )); } /** * Sync Connection * * @remarks * Schedules a connector to sync as soon as possible. */ async sync( request: operations.SyncConnectionRequest, options?: RequestOptions, ): Promise { return unwrapAsync(connectionsSync( this, request, options, )); } }