UNPKG

attio-js

Version:

Developer-friendly & type-safe JS/TS SDK based on the official OpenAPI spec of Attio.

76 lines (67 loc) 2.1 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 { ObjectT, ObjectT$inboundSchema, ObjectT$Outbound, ObjectT$outboundSchema, } from "../components/object.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Success */ export type GetV2ObjectsResponse = { data: Array<ObjectT>; }; /** @internal */ export const GetV2ObjectsResponse$inboundSchema: z.ZodType< GetV2ObjectsResponse, z.ZodTypeDef, unknown > = z.object({ data: z.array(ObjectT$inboundSchema), }); /** @internal */ export type GetV2ObjectsResponse$Outbound = { data: Array<ObjectT$Outbound>; }; /** @internal */ export const GetV2ObjectsResponse$outboundSchema: z.ZodType< GetV2ObjectsResponse$Outbound, z.ZodTypeDef, GetV2ObjectsResponse > = z.object({ data: z.array(ObjectT$outboundSchema), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GetV2ObjectsResponse$ { /** @deprecated use `GetV2ObjectsResponse$inboundSchema` instead. */ export const inboundSchema = GetV2ObjectsResponse$inboundSchema; /** @deprecated use `GetV2ObjectsResponse$outboundSchema` instead. */ export const outboundSchema = GetV2ObjectsResponse$outboundSchema; /** @deprecated use `GetV2ObjectsResponse$Outbound` instead. */ export type Outbound = GetV2ObjectsResponse$Outbound; } export function getV2ObjectsResponseToJSON( getV2ObjectsResponse: GetV2ObjectsResponse, ): string { return JSON.stringify( GetV2ObjectsResponse$outboundSchema.parse(getV2ObjectsResponse), ); } export function getV2ObjectsResponseFromJSON( jsonString: string, ): SafeParseResult<GetV2ObjectsResponse, SDKValidationError> { return safeParse( jsonString, (x) => GetV2ObjectsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetV2ObjectsResponse' from JSON`, ); }