/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { AuthStartRequestDelivery, AuthStartRequestDelivery$inboundSchema, AuthStartRequestDelivery$Outbound, AuthStartRequestDelivery$outboundSchema, } from "./authstartrequestdelivery.js"; import { AuthStartRequestSubjects, AuthStartRequestSubjects$inboundSchema, AuthStartRequestSubjects$Outbound, AuthStartRequestSubjects$outboundSchema, } from "./authstartrequestsubjects.js"; export type AuthStartRequest = { /** * CallbackURL is an optional callback URL (webhook) where Prove Auth will delivery the user's Push Auth response at * * @remarks * the end of the auth flow. If there are any errors encountered during the auth flow, those will be delivered to * the callback URL as well. If not provided, the customer server must call the AuthFinish endpoint to retrieve the * auth results. The request will be sent as a POST and will contain the same response body as the AuthFinish * response. */ callbackUrl?: string | undefined; delivery?: AuthStartRequestDelivery | undefined; /** * RequestID is a UUID generated on the customer side to be associated with the unique request for tracking. * * @remarks * Acceptable characters are: alphanumeric with symbols '-._+=/'. */ requestId: string; subjects: AuthStartRequestSubjects; }; /** @internal */ export const AuthStartRequest$inboundSchema: z.ZodType< AuthStartRequest, z.ZodTypeDef, unknown > = z.object({ callbackUrl: z.string().optional(), delivery: AuthStartRequestDelivery$inboundSchema.optional(), requestId: z.string(), subjects: AuthStartRequestSubjects$inboundSchema, }); /** @internal */ export type AuthStartRequest$Outbound = { callbackUrl?: string | undefined; delivery?: AuthStartRequestDelivery$Outbound | undefined; requestId: string; subjects: AuthStartRequestSubjects$Outbound; }; /** @internal */ export const AuthStartRequest$outboundSchema: z.ZodType< AuthStartRequest$Outbound, z.ZodTypeDef, AuthStartRequest > = z.object({ callbackUrl: z.string().optional(), delivery: AuthStartRequestDelivery$outboundSchema.optional(), requestId: z.string(), subjects: AuthStartRequestSubjects$outboundSchema, }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AuthStartRequest$ { /** @deprecated use `AuthStartRequest$inboundSchema` instead. */ export const inboundSchema = AuthStartRequest$inboundSchema; /** @deprecated use `AuthStartRequest$outboundSchema` instead. */ export const outboundSchema = AuthStartRequest$outboundSchema; /** @deprecated use `AuthStartRequest$Outbound` instead. */ export type Outbound = AuthStartRequest$Outbound; } export function authStartRequestToJSON( authStartRequest: AuthStartRequest, ): string { return JSON.stringify( AuthStartRequest$outboundSchema.parse(authStartRequest), ); } export function authStartRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AuthStartRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AuthStartRequest' from JSON`, ); }