parentlink.ts•1.81 kB
/*
* 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 {
CoreLink,
CoreLink$inboundSchema,
CoreLink$Outbound,
CoreLink$outboundSchema,
} from "./corelink.js";
export type ParentLink = {
parent: CoreLink;
};
/** @internal */
export const ParentLink$inboundSchema: z.ZodType<
ParentLink,
z.ZodTypeDef,
unknown
> = z.object({
parent: CoreLink$inboundSchema,
});
/** @internal */
export type ParentLink$Outbound = {
parent: CoreLink$Outbound;
};
/** @internal */
export const ParentLink$outboundSchema: z.ZodType<
ParentLink$Outbound,
z.ZodTypeDef,
ParentLink
> = z.object({
parent: CoreLink$outboundSchema,
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace ParentLink$ {
/** @deprecated use `ParentLink$inboundSchema` instead. */
export const inboundSchema = ParentLink$inboundSchema;
/** @deprecated use `ParentLink$outboundSchema` instead. */
export const outboundSchema = ParentLink$outboundSchema;
/** @deprecated use `ParentLink$Outbound` instead. */
export type Outbound = ParentLink$Outbound;
}
export function parentLinkToJSON(parentLink: ParentLink): string {
return JSON.stringify(ParentLink$outboundSchema.parse(parentLink));
}
export function parentLinkFromJSON(
jsonString: string,
): SafeParseResult<ParentLink, SDKValidationError> {
return safeParse(
jsonString,
(x) => ParentLink$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'ParentLink' from JSON`,
);
}