/* * 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 AuthorizeIntent = { state: string; authorizeUrl: string; expiresInSeconds: number; }; /** @internal */ export const AuthorizeIntent$inboundSchema: z.ZodType< AuthorizeIntent, z.ZodTypeDef, unknown > = z.object({ state: z.string(), authorize_url: z.string(), expires_in_seconds: z.number().int(), }).transform((v) => { return remap$(v, { "authorize_url": "authorizeUrl", "expires_in_seconds": "expiresInSeconds", }); }); /** @internal */ export type AuthorizeIntent$Outbound = { state: string; authorize_url: string; expires_in_seconds: number; }; /** @internal */ export const AuthorizeIntent$outboundSchema: z.ZodType< AuthorizeIntent$Outbound, z.ZodTypeDef, AuthorizeIntent > = z.object({ state: z.string(), authorizeUrl: z.string(), expiresInSeconds: z.number().int(), }).transform((v) => { return remap$(v, { authorizeUrl: "authorize_url", expiresInSeconds: "expires_in_seconds", }); }); export function authorizeIntentToJSON( authorizeIntent: AuthorizeIntent, ): string { return JSON.stringify(AuthorizeIntent$outboundSchema.parse(authorizeIntent)); } export function authorizeIntentFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AuthorizeIntent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AuthorizeIntent' from JSON`, ); }