/* * 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 { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { ChannelCredentials, ChannelCredentials$inboundSchema, ChannelCredentials$Outbound, ChannelCredentials$outboundSchema, } from "./channelcredentials.js"; import { ChatOrPushProviderEnum, ChatOrPushProviderEnum$inboundSchema, ChatOrPushProviderEnum$outboundSchema, } from "./chatorpushproviderenum.js"; export type ChannelSettingsDto = { /** * The provider identifier for the credentials */ providerId: ChatOrPushProviderEnum; /** * The integration identifier */ integrationIdentifier?: string | undefined; /** * Credentials payload for the specified provider */ credentials: ChannelCredentials; /** * The unique identifier of the integration associated with this channel. */ integrationId: string; }; /** @internal */ export const ChannelSettingsDto$inboundSchema: z.ZodType< ChannelSettingsDto, z.ZodTypeDef, unknown > = z.object({ providerId: ChatOrPushProviderEnum$inboundSchema, integrationIdentifier: z.string().optional(), credentials: ChannelCredentials$inboundSchema, _integrationId: z.string(), }).transform((v) => { return remap$(v, { "_integrationId": "integrationId", }); }); /** @internal */ export type ChannelSettingsDto$Outbound = { providerId: string; integrationIdentifier?: string | undefined; credentials: ChannelCredentials$Outbound; _integrationId: string; }; /** @internal */ export const ChannelSettingsDto$outboundSchema: z.ZodType< ChannelSettingsDto$Outbound, z.ZodTypeDef, ChannelSettingsDto > = z.object({ providerId: ChatOrPushProviderEnum$outboundSchema, integrationIdentifier: z.string().optional(), credentials: ChannelCredentials$outboundSchema, integrationId: z.string(), }).transform((v) => { return remap$(v, { integrationId: "_integrationId", }); }); export function channelSettingsDtoToJSON( channelSettingsDto: ChannelSettingsDto, ): string { return JSON.stringify( ChannelSettingsDto$outboundSchema.parse(channelSettingsDto), ); } export function channelSettingsDtoFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ChannelSettingsDto$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ChannelSettingsDto' from JSON`, ); }