UNPKG

attio-js

Version:

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

83 lines 2.86 kB
/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Comment$inboundSchema, Comment$outboundSchema, } from "./comment.js"; /** @internal */ export const ThreadId$inboundSchema = z.object({ workspace_id: z.string(), thread_id: z.string(), }).transform((v) => { return remap$(v, { "workspace_id": "workspaceId", "thread_id": "threadId", }); }); /** @internal */ export const ThreadId$outboundSchema = z.object({ workspaceId: z.string(), threadId: z.string(), }).transform((v) => { return remap$(v, { workspaceId: "workspace_id", threadId: "thread_id", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export var ThreadId$; (function (ThreadId$) { /** @deprecated use `ThreadId$inboundSchema` instead. */ ThreadId$.inboundSchema = ThreadId$inboundSchema; /** @deprecated use `ThreadId$outboundSchema` instead. */ ThreadId$.outboundSchema = ThreadId$outboundSchema; })(ThreadId$ || (ThreadId$ = {})); export function threadIdToJSON(threadId) { return JSON.stringify(ThreadId$outboundSchema.parse(threadId)); } export function threadIdFromJSON(jsonString) { return safeParse(jsonString, (x) => ThreadId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ThreadId' from JSON`); } /** @internal */ export const Thread$inboundSchema = z .object({ id: z.lazy(() => ThreadId$inboundSchema), comments: z.array(Comment$inboundSchema), created_at: z.string(), }).transform((v) => { return remap$(v, { "created_at": "createdAt", }); }); /** @internal */ export const Thread$outboundSchema = z.object({ id: z.lazy(() => ThreadId$outboundSchema), comments: z.array(Comment$outboundSchema), createdAt: z.string(), }).transform((v) => { return remap$(v, { createdAt: "created_at", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export var Thread$; (function (Thread$) { /** @deprecated use `Thread$inboundSchema` instead. */ Thread$.inboundSchema = Thread$inboundSchema; /** @deprecated use `Thread$outboundSchema` instead. */ Thread$.outboundSchema = Thread$outboundSchema; })(Thread$ || (Thread$ = {})); export function threadToJSON(thread) { return JSON.stringify(Thread$outboundSchema.parse(thread)); } export function threadFromJSON(jsonString) { return safeParse(jsonString, (x) => Thread$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Thread' from JSON`); } //# sourceMappingURL=thread.js.map