/* * 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 { lazySchema as lazySchema$, safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { ResourceStatus, ResourceStatus$inboundSchema, } from "./resourcestatus.js"; export type LinkedResources = { /** * ID of the resource, typically a lowercased version of name. */ id?: string | undefined; /** * Name of the property in our Unified API. */ unifiedProperty?: string | undefined; }; /** * JSON Schema of the resource in our Unified API */ export type Schema = {}; export type ApiResource = { /** * ID of the resource, typically a lowercased version of name. */ id?: string | undefined; /** * Name of the resource (plural) */ name?: string | undefined; /** * Status of the resource. Resources with status live or beta are callable. */ status?: ResourceStatus | undefined; /** * List of linked resources. */ linkedResources?: Array | undefined; /** * JSON Schema of the resource in our Unified API */ schema?: Schema | undefined; }; /** @internal */ export const LinkedResources$inboundSchema: z.ZodType< LinkedResources, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), unified_property: types.optional(types.string()), }).transform((v) => { return remap$(v, { "unified_property": "unifiedProperty", }); }) ); export function linkedResourcesFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => LinkedResources$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LinkedResources' from JSON`, ); } /** @internal */ export const Schema$inboundSchema: z.ZodType = /* @__PURE__ */ lazySchema$(() => z.object({})); export function schemaFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Schema$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Schema' from JSON`, ); } /** @internal */ export const ApiResource$inboundSchema: z.ZodType< ApiResource, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), name: types.optional(types.string()), status: types.optional(ResourceStatus$inboundSchema), linked_resources: types.optional( z.array(z.lazy(() => LinkedResources$inboundSchema)), ), schema: types.optional(z.lazy(() => Schema$inboundSchema)), }).transform((v) => { return remap$(v, { "linked_resources": "linkedResources", }); }) ); export function apiResourceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ApiResource$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ApiResource' from JSON`, ); }