/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { ConfigurationsDto, ConfigurationsDto$inboundSchema, } from "./configurationsdto.js"; import { CredentialsDto, CredentialsDto$inboundSchema, } from "./credentialsdto.js"; import { StepFilterDto, StepFilterDto$inboundSchema } from "./stepfilterdto.js"; /** * The channel type for the integration, which defines how it communicates (e.g., email, SMS). Not set for agent-kind integrations. */ export const IntegrationResponseDtoChannel = { InApp: "in_app", Email: "email", Sms: "sms", Chat: "chat", Push: "push", } as const; /** * The channel type for the integration, which defines how it communicates (e.g., email, SMS). Not set for agent-kind integrations. */ export type IntegrationResponseDtoChannel = ClosedEnum< typeof IntegrationResponseDtoChannel >; /** * Distinguishes delivery integrations from agent-runtime integrations. Defaults to "delivery". Agent integrations do not have a channel. */ export const Kind = { Delivery: "delivery", Agent: "agent", } as const; /** * Distinguishes delivery integrations from agent-runtime integrations. Defaults to "delivery". Agent integrations do not have a channel. */ export type Kind = ClosedEnum; export type IntegrationResponseDto = { /** * The unique identifier of the integration record in the database. This is automatically generated. */ id?: string | undefined; /** * The unique identifier for the environment associated with this integration. This links to the Environment collection. */ environmentId: string; /** * The unique identifier for the organization that owns this integration. This links to the Organization collection. */ organizationId: string; /** * The name of the integration, which is used to identify it in the user interface. */ name: string; /** * A unique string identifier for the integration, often used for API calls or internal references. */ identifier: string; /** * The identifier for the provider of the integration (e.g., "mailgun", "twilio"). */ providerId: string; /** * The channel type for the integration, which defines how it communicates (e.g., email, SMS). Not set for agent-kind integrations. */ channel?: IntegrationResponseDtoChannel | undefined; /** * Distinguishes delivery integrations from agent-runtime integrations. Defaults to "delivery". Agent integrations do not have a channel. */ kind?: Kind | undefined; /** * The decrypted credentials required for the integration to function (e.g. provider API keys, signing secrets). Only returned to dashboard/session-token callers; API-key authenticated callers receive the integration metadata without this field to avoid amplifying API-key leaks into provider-credential leaks. */ credentials?: CredentialsDto | undefined; /** * The configurations required for enabling the additional configurations of the integration. */ configurations?: ConfigurationsDto | undefined; /** * Indicates whether the integration is currently active. An active integration will process events and messages. */ active: boolean; /** * Indicates whether the integration has been marked as deleted (soft delete). */ deleted: boolean; /** * The timestamp indicating when the integration was deleted. This is set when the integration is soft deleted. */ deletedAt?: string | undefined; /** * The identifier of the user who performed the deletion of this integration. Useful for audit trails. */ deletedBy?: string | undefined; /** * Indicates whether this integration is marked as primary. A primary integration is often the default choice for processing. */ primary: boolean; /** * An array of conditions associated with the integration that may influence its behavior or processing logic. */ conditions?: Array | undefined; }; /** @internal */ export const IntegrationResponseDtoChannel$inboundSchema: z.ZodNativeEnum< typeof IntegrationResponseDtoChannel > = z.nativeEnum(IntegrationResponseDtoChannel); /** @internal */ export const Kind$inboundSchema: z.ZodNativeEnum = z.nativeEnum( Kind, ); /** @internal */ export const IntegrationResponseDto$inboundSchema: z.ZodType< IntegrationResponseDto, z.ZodTypeDef, unknown > = z.object({ _id: z.string().optional(), _environmentId: z.string(), _organizationId: z.string(), name: z.string(), identifier: z.string(), providerId: z.string(), channel: IntegrationResponseDtoChannel$inboundSchema.optional(), kind: Kind$inboundSchema.optional(), credentials: CredentialsDto$inboundSchema.optional(), configurations: ConfigurationsDto$inboundSchema.optional(), active: z.boolean(), deleted: z.boolean(), deletedAt: z.string().optional(), deletedBy: z.string().optional(), primary: z.boolean(), conditions: z.array(StepFilterDto$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "_id": "id", "_environmentId": "environmentId", "_organizationId": "organizationId", }); }); export function integrationResponseDtoFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => IntegrationResponseDto$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'IntegrationResponseDto' from JSON`, ); }