/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as operations from "../models/operations/index.js"; import { APIPromise } from "../types/async.js"; import { unwrapAsync } from "../types/fp.js"; let vaultConnectionsList$module: | Promise | undefined; const vaultConnectionsList = (( ...args: Parameters< typeof import("../funcs/vaultConnectionsList.js").vaultConnectionsList > ) => new APIPromise( (vaultConnectionsList$module ??= import( "../funcs/vaultConnectionsList.js" ).catch((error: unknown) => { vaultConnectionsList$module = undefined; throw error; })).then((module) => module.vaultConnectionsList(...args).$inspect()), )) as typeof import("../funcs/vaultConnectionsList.js").vaultConnectionsList; let vaultConnectionsGet$module: | Promise | undefined; const vaultConnectionsGet = (( ...args: Parameters< typeof import("../funcs/vaultConnectionsGet.js").vaultConnectionsGet > ) => new APIPromise( (vaultConnectionsGet$module ??= import("../funcs/vaultConnectionsGet.js") .catch((error: unknown) => { vaultConnectionsGet$module = undefined; throw error; })).then((module) => module.vaultConnectionsGet(...args).$inspect()), )) as typeof import("../funcs/vaultConnectionsGet.js").vaultConnectionsGet; let vaultConnectionsUpdate$module: | Promise | undefined; const vaultConnectionsUpdate = (( ...args: Parameters< typeof import("../funcs/vaultConnectionsUpdate.js").vaultConnectionsUpdate > ) => new APIPromise( (vaultConnectionsUpdate$module ??= import( "../funcs/vaultConnectionsUpdate.js" ).catch((error: unknown) => { vaultConnectionsUpdate$module = undefined; throw error; })).then((module) => module.vaultConnectionsUpdate(...args).$inspect()), )) as typeof import("../funcs/vaultConnectionsUpdate.js").vaultConnectionsUpdate; let vaultConnectionsDelete$module: | Promise | undefined; const vaultConnectionsDelete = (( ...args: Parameters< typeof import("../funcs/vaultConnectionsDelete.js").vaultConnectionsDelete > ) => new APIPromise( (vaultConnectionsDelete$module ??= import( "../funcs/vaultConnectionsDelete.js" ).catch((error: unknown) => { vaultConnectionsDelete$module = undefined; throw error; })).then((module) => module.vaultConnectionsDelete(...args).$inspect()), )) as typeof import("../funcs/vaultConnectionsDelete.js").vaultConnectionsDelete; let vaultConnectionsImports$module: | Promise | undefined; const vaultConnectionsImports = (( ...args: Parameters< typeof import("../funcs/vaultConnectionsImports.js").vaultConnectionsImports > ) => new APIPromise( (vaultConnectionsImports$module ??= import( "../funcs/vaultConnectionsImports.js" ).catch((error: unknown) => { vaultConnectionsImports$module = undefined; throw error; })).then((module) => module.vaultConnectionsImports(...args).$inspect()), )) as typeof import("../funcs/vaultConnectionsImports.js").vaultConnectionsImports; let vaultConnectionsMigrate$module: | Promise | undefined; const vaultConnectionsMigrate = (( ...args: Parameters< typeof import("../funcs/vaultConnectionsMigrate.js").vaultConnectionsMigrate > ) => new APIPromise( (vaultConnectionsMigrate$module ??= import( "../funcs/vaultConnectionsMigrate.js" ).catch((error: unknown) => { vaultConnectionsMigrate$module = undefined; throw error; })).then((module) => module.vaultConnectionsMigrate(...args).$inspect()), )) as typeof import("../funcs/vaultConnectionsMigrate.js").vaultConnectionsMigrate; let vaultConnectionsToken$module: | Promise | undefined; const vaultConnectionsToken = (( ...args: Parameters< typeof import("../funcs/vaultConnectionsToken.js").vaultConnectionsToken > ) => new APIPromise( (vaultConnectionsToken$module ??= import( "../funcs/vaultConnectionsToken.js" ).catch((error: unknown) => { vaultConnectionsToken$module = undefined; throw error; })).then((module) => module.vaultConnectionsToken(...args).$inspect()), )) as typeof import("../funcs/vaultConnectionsToken.js").vaultConnectionsToken; let vaultConnectionsConfirm$module: | Promise | undefined; const vaultConnectionsConfirm = (( ...args: Parameters< typeof import("../funcs/vaultConnectionsConfirm.js").vaultConnectionsConfirm > ) => new APIPromise( (vaultConnectionsConfirm$module ??= import( "../funcs/vaultConnectionsConfirm.js" ).catch((error: unknown) => { vaultConnectionsConfirm$module = undefined; throw error; })).then((module) => module.vaultConnectionsConfirm(...args).$inspect()), )) as typeof import("../funcs/vaultConnectionsConfirm.js").vaultConnectionsConfirm; export class Connections extends ClientSDK { /** * Get all connections * * @remarks * This endpoint includes all the configured integrations and contains the required assets * to build an integrations page where your users can install integrations. * OAuth2 supported integrations will contain authorize and revoke links to handle the authentication flows. */ async list( request: operations.VaultConnectionsAllRequest, options?: RequestOptions, ): Promise { return unwrapAsync(vaultConnectionsList( this, request, options, )); } /** * Get connection * * @remarks * Get a connection */ async get( request: operations.VaultConnectionsOneRequest, options?: RequestOptions, ): Promise { return unwrapAsync(vaultConnectionsGet( this, request, options, )); } /** * Update connection * * @remarks * Update a connection */ async update( request: operations.VaultConnectionsUpdateRequest, options?: RequestOptions, ): Promise { return unwrapAsync(vaultConnectionsUpdate( this, request, options, )); } /** * Deletes a connection * * @remarks * Deletes a connection */ async delete( request: operations.VaultConnectionsDeleteRequest, options?: RequestOptions, ): Promise { return unwrapAsync(vaultConnectionsDelete( this, request, options, )); } /** * Import connection * * @remarks * Import an authorized connection. */ async imports( request: operations.VaultConnectionsImportRequest, options?: RequestOptions, ): Promise { return unwrapAsync(vaultConnectionsImports( this, request, options, )); } /** * Migrate connection * * @remarks * Migrate the connection to the target connector, keeping its credentials and connection state * (settings, metadata, configuration, subscriptions, consents). The source connection record is * removed WITHOUT revoking or disconnecting the downstream token. * * Available migration targets are declared per connector — refer to the connector's * documentation page or the Connector API's `migration_targets` field. * * Migrated tokens carry the source connector's OAuth scopes, so operations exclusive to the * target connector may require re-authorization. * * Retries are idempotent: a partially-completed migration resumes where it left off. */ async migrate( request: operations.VaultConnectionsMigrateRequest, options?: RequestOptions, ): Promise { return unwrapAsync(vaultConnectionsMigrate( this, request, options, )); } /** * Authorize Access Token * * @remarks * Triggers exchanging persisted connection credentials for an access token and store it in Vault. Currently supported for connections with the `client_credentials` or `password` OAuth grant type. * * Note: * - Do not include any credentials in the request body. This operation does not persist changes, but only triggers the exchange of persisted connection credentials for an access token. * - The access token will not be returned in the response. A 200 response code indicates the authorization was successful and that a valid access token was stored on the connection. * - The access token will be used for subsequent API requests. */ async token( request: operations.VaultConnectionsTokenRequest, options?: RequestOptions, ): Promise { return unwrapAsync(vaultConnectionsToken( this, request, options, )); } /** * Confirm Connection * * @remarks * Confirms an OAuth connection after the callback by redeeming its confirm token. * * The confirm step is required when your application's OAuth protection mode was `enforced` when the * authorization flow started. In that case Vault completes the OAuth exchange but leaves the connection * **unconfirmed** and not callable, and the callback redirects to your `redirect_uri` with a hash * fragment containing a `confirm_token`, the `service_id` and the `unified_api`, plus the `nonce` when * the authorize request included one and the `target_origin` when it included an `opener_origin`: * `#confirm_token=&service_id=&unified_api=&nonce=&target_origin=`. * Call this endpoint with that `confirm_token` to confirm the connection and make it callable. * * The `confirm_token` is single use and expires 30 minutes after the callback. Only confirm tokens are * accepted; other tokens (such as an authorize `state`) are rejected. In the `off` * protection mode there is no confirm step: the connection is callable immediately after the * callback and no `confirm_token` is issued. * * Authenticate in one of two ways: * * - With the Vault session JWT as the bearer token (`Authorization: Bearer `) and the * `x-apideck-auth-type: JWT` header, as Hosted Vault and Vault JS do. The application and consumer * are taken from the session. * - With your API key (`Authorization: Bearer `) plus the `x-apideck-app-id` and * `x-apideck-consumer-id` headers, from your backend. */ async confirm( request: operations.VaultConnectionsConfirmRequest, options?: RequestOptions, ): Promise { return unwrapAsync(vaultConnectionsConfirm( this, request, options, )); } }