/*
* 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 { SDKValidationError } from "../errors/sdkvalidationerror.js";
export type Link = {
href: string;
type: string;
};
/** @internal */
export const Link$inboundSchema: z.ZodType = z
.object({
href: z.string(),
type: z.string(),
});
/** @internal */
export type Link$Outbound = {
href: string;
type: string;
};
/** @internal */
export const Link$outboundSchema: z.ZodType =
z.object({
href: z.string(),
type: z.string(),
});
export function linkToJSON(link: Link): string {
return JSON.stringify(Link$outboundSchema.parse(link));
}
export function linkFromJSON(
jsonString: string,
): SafeParseResult {
return safeParse(
jsonString,
(x) => Link$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'Link' from JSON`,
);
}