|
| 1 | +/** |
| 2 | + * Integration Service — Connector models |
| 3 | + * |
| 4 | + * Connectors are read-only catalog entries — no bound entity methods are |
| 5 | + * attached (no `update`, `cancel`, etc. operate on a connector). |
| 6 | + */ |
| 7 | + |
| 8 | +import { |
| 9 | + RawConnectorGetResponse, |
| 10 | + ConnectorGetAllOptions, |
| 11 | + ConnectorGetDefaultConnectionOptions, |
| 12 | + ConnectorGetConnectionsOptions, |
| 13 | +} from './connectors.types'; |
| 14 | +import { ConnectionGetResponse } from './connections.models'; |
| 15 | + |
| 16 | +/** |
| 17 | + * A connector catalog entry from the Integration Service. |
| 18 | + */ |
| 19 | +export type ConnectorGetResponse = RawConnectorGetResponse; |
| 20 | + |
| 21 | +/** |
| 22 | + * Service for inspecting UiPath Integration Service connectors. |
| 23 | + * |
| 24 | + * Connectors are the catalog of integrations available on a tenant (Slack, |
| 25 | + * Microsoft 365, Salesforce, custom connectors, ...). Use this service to |
| 26 | + * discover connectors, fetch their metadata, and list / locate the connection |
| 27 | + * instances built on top of them. |
| 28 | + * |
| 29 | + * ### Usage |
| 30 | + * |
| 31 | + * Prerequisites: Initialize the SDK first - see [Getting Started](/uipath-typescript/getting-started/#import-initialize) |
| 32 | + * |
| 33 | + * ```typescript |
| 34 | + * import { Connectors } from '@uipath/uipath-typescript/is-connectors'; |
| 35 | + * |
| 36 | + * const connectors = new Connectors(sdk); |
| 37 | + * const allConnectors = await connectors.getAll(); |
| 38 | + * ``` |
| 39 | + */ |
| 40 | +export interface ConnectorsServiceModel { |
| 41 | + /** |
| 42 | + * List all connectors available on this tenant. |
| 43 | + * |
| 44 | + * Returns a plain array — the Integration Service does not paginate this endpoint. |
| 45 | + * |
| 46 | + * @param options - Optional filter (e.g. limit to connectors exposing HTTP Request activities) |
| 47 | + * @returns Promise resolving to an array of {@link ConnectorGetResponse} |
| 48 | + * @example |
| 49 | + * ```typescript |
| 50 | + * import { Connectors } from '@uipath/uipath-typescript/is-connectors'; |
| 51 | + * |
| 52 | + * const connectors = new Connectors(sdk); |
| 53 | + * |
| 54 | + * const all = await connectors.getAll(); |
| 55 | + * for (const connector of all) { |
| 56 | + * console.log(`${connector.key} — ${connector.name} (${connector.lifeCycleStage})`); |
| 57 | + * } |
| 58 | + * ``` |
| 59 | + * |
| 60 | + * @example |
| 61 | + * ```typescript |
| 62 | + * // Only connectors that expose an HTTP Request activity |
| 63 | + * const httpEnabled = await connectors.getAll({ hasHttpRequest: true }); |
| 64 | + * ``` |
| 65 | + */ |
| 66 | + getAll(options?: ConnectorGetAllOptions): Promise<ConnectorGetResponse[]>; |
| 67 | + |
| 68 | + /** |
| 69 | + * Get a single connector by key or numeric ID. |
| 70 | + * |
| 71 | + * @param keyOrId - Connector key (e.g. `uipath-slack`) or numeric ID as a string |
| 72 | + * @returns Promise resolving to a {@link ConnectorGetResponse} |
| 73 | + * @example |
| 74 | + * ```typescript |
| 75 | + * import { Connectors } from '@uipath/uipath-typescript/is-connectors'; |
| 76 | + * |
| 77 | + * const connectors = new Connectors(sdk); |
| 78 | + * |
| 79 | + * const slack = await connectors.getById('uipath-slack'); |
| 80 | + * console.log(slack.name, slack.authentication?.type); |
| 81 | + * ``` |
| 82 | + */ |
| 83 | + getById(keyOrId: string): Promise<ConnectorGetResponse>; |
| 84 | + |
| 85 | + /** |
| 86 | + * Get the default connection for a connector in the current folder. |
| 87 | + * |
| 88 | + * Each connector may have a single connection marked as default per folder; |
| 89 | + * use this to resolve "which connection should I use for Slack?" without |
| 90 | + * paging through the full list. |
| 91 | + * |
| 92 | + * @param keyOrId - Connector key or numeric ID as a string |
| 93 | + * @param options - Folder scoping options |
| 94 | + * @returns Promise resolving to a {@link ConnectionGetResponse} |
| 95 | + * @example |
| 96 | + * ```typescript |
| 97 | + * import { Connectors } from '@uipath/uipath-typescript/is-connectors'; |
| 98 | + * |
| 99 | + * const connectors = new Connectors(sdk); |
| 100 | + * |
| 101 | + * const defaultSlack = await connectors.getDefaultConnection('uipath-slack', { |
| 102 | + * folderKey: '<folderKey>', |
| 103 | + * }); |
| 104 | + * |
| 105 | + * // Use bound methods directly on the entity |
| 106 | + * const status = await defaultSlack.ping(); |
| 107 | + * console.log(status.status); |
| 108 | + * ``` |
| 109 | + */ |
| 110 | + getDefaultConnection( |
| 111 | + keyOrId: string, |
| 112 | + options?: ConnectorGetDefaultConnectionOptions, |
| 113 | + ): Promise<ConnectionGetResponse>; |
| 114 | + |
| 115 | + /** |
| 116 | + * List all connections for a connector. |
| 117 | + * |
| 118 | + * Returns a plain array — the Integration Service uses page-indexed |
| 119 | + * pagination (no continuation cursor). Increment `pageIndex` to walk pages. |
| 120 | + * |
| 121 | + * @param keyOrId - Connector key or numeric ID as a string |
| 122 | + * @param options - Folder scoping, paging, and sorting options |
| 123 | + * @returns Promise resolving to an array of {@link ConnectionGetResponse} |
| 124 | + * @example |
| 125 | + * ```typescript |
| 126 | + * import { Connectors } from '@uipath/uipath-typescript/is-connectors'; |
| 127 | + * |
| 128 | + * const connectors = new Connectors(sdk); |
| 129 | + * |
| 130 | + * // First page of Slack connections in a folder |
| 131 | + * const slackConnections = await connectors.getConnections('uipath-slack', { |
| 132 | + * folderKey: '<folderKey>', |
| 133 | + * pageSize: 25, |
| 134 | + * }); |
| 135 | + * |
| 136 | + * for (const conn of slackConnections) { |
| 137 | + * const status = await conn.ping(); |
| 138 | + * console.log(`${conn.name}: ${status.status}`); |
| 139 | + * } |
| 140 | + * ``` |
| 141 | + * |
| 142 | + * @example |
| 143 | + * ```typescript |
| 144 | + * // Walk subsequent pages |
| 145 | + * const page2 = await connectors.getConnections('uipath-slack', { |
| 146 | + * folderKey: '<folderKey>', |
| 147 | + * pageSize: 25, |
| 148 | + * pageIndex: 2, |
| 149 | + * }); |
| 150 | + * ``` |
| 151 | + */ |
| 152 | + getConnections( |
| 153 | + keyOrId: string, |
| 154 | + options?: ConnectorGetConnectionsOptions, |
| 155 | + ): Promise<ConnectionGetResponse[]>; |
| 156 | +} |
0 commit comments