/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { integrationsCreate } from "../funcs/integrationsCreate.js"; import { integrationsDelete } from "../funcs/integrationsDelete.js"; import { integrationsGenerateChatOAuthUrl } from "../funcs/integrationsGenerateChatOAuthUrl.js"; import { integrationsGenerateConnectOAuthUrl } from "../funcs/integrationsGenerateConnectOAuthUrl.js"; import { integrationsGenerateLinkUserOAuthUrl } from "../funcs/integrationsGenerateLinkUserOAuthUrl.js"; import { integrationsIntegrationsControllerAutoConfigureIntegration } from "../funcs/integrationsIntegrationsControllerAutoConfigureIntegration.js"; import { integrationsList } from "../funcs/integrationsList.js"; import { integrationsListActive } from "../funcs/integrationsListActive.js"; import { integrationsSetAsPrimary } from "../funcs/integrationsSetAsPrimary.js"; import { integrationsUpdate } from "../funcs/integrationsUpdate.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"; export class Integrations extends ClientSDK { /** * List all integrations * * @remarks * List all the channels integrations created in the organization */ async list( idempotencyKey?: string | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(integrationsList( this, idempotencyKey, options, )); } /** * Create an integration * * @remarks * Create an integration for the current environment the user is based on the API key provided. * Each provider supports different credentials, check the provider documentation for more details. */ async create( createIntegrationRequestDto: components.CreateIntegrationRequestDto, idempotencyKey?: string | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(integrationsCreate( this, createIntegrationRequestDto, idempotencyKey, options, )); } /** * Update an integration * * @remarks * Update an integration by its unique key identifier **integrationId**. * Each provider supports different credentials, check the provider documentation for more details. */ async update( updateIntegrationRequestDto: components.UpdateIntegrationRequestDto, integrationId: string, idempotencyKey?: string | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(integrationsUpdate( this, updateIntegrationRequestDto, integrationId, idempotencyKey, options, )); } /** * Delete an integration * * @remarks * Delete an integration by its unique key identifier **integrationId**. * This action is irreversible. */ async delete( integrationId: string, idempotencyKey?: string | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(integrationsDelete( this, integrationId, idempotencyKey, options, )); } /** * Auto-configure an integration for inbound webhooks * * @remarks * Auto-configure an integration by its unique key identifier **integrationId** for inbound webhook support. * This will automatically generate required webhook signing keys and configure webhook endpoints. */ async integrationsControllerAutoConfigureIntegration( integrationId: string, idempotencyKey?: string | undefined, options?: RequestOptions, ): Promise< operations.IntegrationsControllerAutoConfigureIntegrationResponse > { return unwrapAsync( integrationsIntegrationsControllerAutoConfigureIntegration( this, integrationId, idempotencyKey, options, ), ); } /** * Update integration as primary * * @remarks * Update an integration as **primary** by its unique key identifier **integrationId**. * This API will set the integration as primary for that channel in the current environment. * Primary integration is used to deliver notification for sms and email channels in the workflow. */ async setAsPrimary( integrationId: string, idempotencyKey?: string | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(integrationsSetAsPrimary( this, integrationId, idempotencyKey, options, )); } /** * List active integrations * * @remarks * List all the active integrations created in the organization */ async listActive( idempotencyKey?: string | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(integrationsListActive( this, idempotencyKey, options, )); } /** * Generate OAuth URL for a workspace/tenant connection * * @remarks * Generate an OAuth URL that creates a workspace or tenant-level channel connection (Slack workspace install or MS Teams admin consent). * The generated URL expires after 5 minutes. */ async generateConnectOAuthUrl( generateConnectOauthUrlRequestDto: components.GenerateConnectOauthUrlRequestDto, idempotencyKey?: string | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(integrationsGenerateConnectOAuthUrl( this, generateConnectOauthUrlRequestDto, idempotencyKey, options, )); } /** * Generate OAuth URL to link a subscriber user identity * * @remarks * Generate an OAuth URL that links a specific subscriber to their chat identity (Slack user ID or MS Teams user OID). * The generated URL expires after 5 minutes. */ async generateLinkUserOAuthUrl( generateLinkUserOauthUrlRequestDto: components.GenerateLinkUserOauthUrlRequestDto, idempotencyKey?: string | undefined, options?: RequestOptions, ): Promise< operations.IntegrationsControllerGenerateLinkUserOAuthUrlResponse > { return unwrapAsync(integrationsGenerateLinkUserOAuthUrl( this, generateLinkUserOauthUrlRequestDto, idempotencyKey, options, )); } /** * Generate chat OAuth URL * * @remarks * **Deprecated** — use `POST /integrations/channel-connections/oauth` (connect) or `POST /integrations/channel-endpoints/oauth` (link_user) instead. * Generate an OAuth URL for chat integrations like Slack and MS Teams. * This URL allows subscribers to authorize the integration, enabling the system to send messages * through their chat workspace. The generated URL expires after 5 minutes. * * @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible. */ async generateChatOAuthUrl( generateChatOauthUrlRequestDto: components.GenerateChatOauthUrlRequestDto, idempotencyKey?: string | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(integrationsGenerateChatOAuthUrl( this, generateChatOauthUrlRequestDto, idempotencyKey, options, )); } }