parentandselflinks.ts•2.18 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";
/**
* The location and content type of related resources
*/
export type ParentAndSelfLinks = {
self: CoreLink;
parent: CoreLink;
};
/** @internal */
export const ParentAndSelfLinks$inboundSchema: z.ZodType<
ParentAndSelfLinks,
z.ZodTypeDef,
unknown
> = z.object({
self: CoreLink$inboundSchema,
parent: CoreLink$inboundSchema,
});
/** @internal */
export type ParentAndSelfLinks$Outbound = {
self: CoreLink$Outbound;
parent: CoreLink$Outbound;
};
/** @internal */
export const ParentAndSelfLinks$outboundSchema: z.ZodType<
ParentAndSelfLinks$Outbound,
z.ZodTypeDef,
ParentAndSelfLinks
> = z.object({
self: CoreLink$outboundSchema,
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 ParentAndSelfLinks$ {
/** @deprecated use `ParentAndSelfLinks$inboundSchema` instead. */
export const inboundSchema = ParentAndSelfLinks$inboundSchema;
/** @deprecated use `ParentAndSelfLinks$outboundSchema` instead. */
export const outboundSchema = ParentAndSelfLinks$outboundSchema;
/** @deprecated use `ParentAndSelfLinks$Outbound` instead. */
export type Outbound = ParentAndSelfLinks$Outbound;
}
export function parentAndSelfLinksToJSON(
parentAndSelfLinks: ParentAndSelfLinks,
): string {
return JSON.stringify(
ParentAndSelfLinks$outboundSchema.parse(parentAndSelfLinks),
);
}
export function parentAndSelfLinksFromJSON(
jsonString: string,
): SafeParseResult<ParentAndSelfLinks, SDKValidationError> {
return safeParse(
jsonString,
(x) => ParentAndSelfLinks$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'ParentAndSelfLinks' from JSON`,
);
}