/* * 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"; export type CreateGoogleAuthenticator = { provider: "google"; /** * The unique name of your authenticator, used to identify it and distinguish it from others. This name must be unique. Attempting to reuse the same name will result in an error. */ name: string; clientId: string; clientSecret: string; domain?: string | null | undefined; projectNumber?: string | null | undefined; }; /** @internal */ export const CreateGoogleAuthenticator$inboundSchema: z.ZodType< CreateGoogleAuthenticator, z.ZodTypeDef, unknown > = z.object({ provider: z.literal("google"), name: z.string(), client_id: z.string(), client_secret: z.string(), domain: z.nullable(z.string()).optional(), project_number: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { "client_id": "clientId", "client_secret": "clientSecret", "project_number": "projectNumber", }); }); /** @internal */ export type CreateGoogleAuthenticator$Outbound = { provider: "google"; name: string; client_id: string; client_secret: string; domain?: string | null | undefined; project_number?: string | null | undefined; }; /** @internal */ export const CreateGoogleAuthenticator$outboundSchema: z.ZodType< CreateGoogleAuthenticator$Outbound, z.ZodTypeDef, CreateGoogleAuthenticator > = z.object({ provider: z.literal("google"), name: z.string(), clientId: z.string(), clientSecret: z.string(), domain: z.nullable(z.string()).optional(), projectNumber: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { clientId: "client_id", clientSecret: "client_secret", projectNumber: "project_number", }); }); export function createGoogleAuthenticatorToJSON( createGoogleAuthenticator: CreateGoogleAuthenticator, ): string { return JSON.stringify( CreateGoogleAuthenticator$outboundSchema.parse(createGoogleAuthenticator), ); } export function createGoogleAuthenticatorFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateGoogleAuthenticator$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateGoogleAuthenticator' from JSON`, ); }