Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 8x 8x 8x 7x 7x 7x 7x 7x 7x 2x | import { ConnectedAccounts } from './models/connectedAccounts'; import { Apps } from './models/apps'; import { Actions } from './models/actions'; import { Triggers } from './models/triggers'; import { Integrations } from './models/integrations'; import { ActiveTriggers } from './models/activeTriggers'; import { getEnvVariable } from '../utils/shared'; import { COMPOSIO_BASE_URL } from './client/core/OpenAPI'; import { BackendClient } from './models/backendClient'; import { Entity } from './models/Entity'; export class Composio { /** * The Composio class serves as the main entry point for interacting with the Composio SDK. * It provides access to various models that allow for operations on connected accounts, apps, * actions, triggers, integrations, and active triggers. */ backendClient: BackendClient; connectedAccounts: ConnectedAccounts; apps: Apps; actions: Actions; triggers: Triggers; integrations: Integrations; activeTriggers: ActiveTriggers; /** * Initializes a new instance of the Composio class. * * @param {string} [apiKey] - The API key for authenticating with the Composio backend. Can also be set locally in an environment variable. * @param {string} [baseUrl] - The base URL for the Composio backend. By default, it is set to the production URL. * @param {string} [runtime] - The runtime environment for the SDK. */ constructor(apiKey?: string, baseUrl?: string, runtime?: string) { // Parse the base URL and API key, falling back to environment variables or defaults if not provided. const baseURLParsed = baseUrl || getEnvVariable("COMPOSIO_BASE_URL", COMPOSIO_BASE_URL) || "https://backend.composio.dev"; const apiKeyParsed = apiKey || getEnvVariable("COMPOSIO_API_KEY") || ''; // Initialize the BackendClient with the parsed API key and base URL. this.backendClient = new BackendClient(apiKeyParsed, baseURLParsed, runtime); // Instantiate models with dependencies as needed. this.connectedAccounts = new ConnectedAccounts(this.backendClient); this.triggers = new Triggers(this.backendClient); this.apps = new Apps(this.backendClient); this.actions = new Actions(this.backendClient); this.integrations = new Integrations(this.backendClient); this.activeTriggers = new ActiveTriggers(this.backendClient); } /** * Retrieves an Entity instance associated with a given ID. * * @param {string} [id='default'] - The ID of the entity to retrieve. * @returns {Entity} An instance of the Entity class. */ getEntity(id: string = 'default'): Entity { return new Entity(this.backendClient, id); } } |