/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CreateAuthenticatorPayload = | (components.OAuthCredentials & { provider: "atlassian" }) | (components.OAuthCredentials & { provider: "dropbox" }) | (components.OAuthCredentials & { provider: "microsoft" }) | (components.OAuthCredentials & { provider: "salesforce" }) | (components.OAuthCredentials & { provider: "slack" }) | (components.OAuthCredentials & { provider: "hubspot" }) | components.CreateGoogleAuthenticator; /** @internal */ export const CreateAuthenticatorPayload$inboundSchema: z.ZodType< CreateAuthenticatorPayload, z.ZodTypeDef, unknown > = z.union([ components.OAuthCredentials$inboundSchema.and( z.object({ provider: z.literal("atlassian") }), ), components.OAuthCredentials$inboundSchema.and( z.object({ provider: z.literal("dropbox") }), ), components.OAuthCredentials$inboundSchema.and( z.object({ provider: z.literal("microsoft") }), ), components.OAuthCredentials$inboundSchema.and( z.object({ provider: z.literal("salesforce") }), ), components.OAuthCredentials$inboundSchema.and( z.object({ provider: z.literal("slack") }), ), components.OAuthCredentials$inboundSchema.and( z.object({ provider: z.literal("hubspot") }), ), components.CreateGoogleAuthenticator$inboundSchema, ]); /** @internal */ export type CreateAuthenticatorPayload$Outbound = | (components.OAuthCredentials$Outbound & { provider: "atlassian" }) | (components.OAuthCredentials$Outbound & { provider: "dropbox" }) | (components.OAuthCredentials$Outbound & { provider: "microsoft" }) | (components.OAuthCredentials$Outbound & { provider: "salesforce" }) | (components.OAuthCredentials$Outbound & { provider: "slack" }) | (components.OAuthCredentials$Outbound & { provider: "hubspot" }) | components.CreateGoogleAuthenticator$Outbound; /** @internal */ export const CreateAuthenticatorPayload$outboundSchema: z.ZodType< CreateAuthenticatorPayload$Outbound, z.ZodTypeDef, CreateAuthenticatorPayload > = z.union([ components.OAuthCredentials$outboundSchema.and( z.object({ provider: z.literal("atlassian") }), ), components.OAuthCredentials$outboundSchema.and( z.object({ provider: z.literal("dropbox") }), ), components.OAuthCredentials$outboundSchema.and( z.object({ provider: z.literal("microsoft") }), ), components.OAuthCredentials$outboundSchema.and( z.object({ provider: z.literal("salesforce") }), ), components.OAuthCredentials$outboundSchema.and( z.object({ provider: z.literal("slack") }), ), components.OAuthCredentials$outboundSchema.and( z.object({ provider: z.literal("hubspot") }), ), components.CreateGoogleAuthenticator$outboundSchema, ]); export function createAuthenticatorPayloadToJSON( createAuthenticatorPayload: CreateAuthenticatorPayload, ): string { return JSON.stringify( CreateAuthenticatorPayload$outboundSchema.parse(createAuthenticatorPayload), ); } export function createAuthenticatorPayloadFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateAuthenticatorPayload$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateAuthenticatorPayload' from JSON`, ); }