/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Target attribute for the redirect link */ export const Target = { Self: "_self", Blank: "_blank", Parent: "_parent", Top: "_top", UnfencedTop: "_unfencedTop", } as const; /** * Target attribute for the redirect link */ export type Target = ClosedEnum; export type RedirectDto = { /** * URL to redirect to */ url: string; /** * Target attribute for the redirect link */ target?: Target | undefined; }; /** @internal */ export const Target$inboundSchema: z.ZodNativeEnum = z .nativeEnum(Target); /** @internal */ export const Target$outboundSchema: z.ZodNativeEnum = Target$inboundSchema; /** @internal */ export const RedirectDto$inboundSchema: z.ZodType< RedirectDto, z.ZodTypeDef, unknown > = z.object({ url: z.string(), target: Target$inboundSchema.optional(), }); /** @internal */ export type RedirectDto$Outbound = { url: string; target?: string | undefined; }; /** @internal */ export const RedirectDto$outboundSchema: z.ZodType< RedirectDto$Outbound, z.ZodTypeDef, RedirectDto > = z.object({ url: z.string(), target: Target$outboundSchema.optional(), }); export function redirectDtoToJSON(redirectDto: RedirectDto): string { return JSON.stringify(RedirectDto$outboundSchema.parse(redirectDto)); } export function redirectDtoFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => RedirectDto$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RedirectDto' from JSON`, ); }