UNPKG

attio-js

Version:

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

280 lines 10.1 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"; /** * The type of actor. [Read more information on actor types here](/docs/actors). */ export const ResolvedByType = { ApiToken: "api-token", WorkspaceMember: "workspace-member", System: "system", App: "app", }; /** * The type of actor. [Read more information on actor types here](/docs/actors). */ export const AuthorType = { ApiToken: "api-token", WorkspaceMember: "workspace-member", System: "system", App: "app", }; /** @internal */ export const CommentId$inboundSchema = z.object({ workspace_id: z.string(), comment_id: z.string(), }).transform((v) => { return remap$(v, { "workspace_id": "workspaceId", "comment_id": "commentId", }); }); /** @internal */ export const CommentId$outboundSchema = z.object({ workspaceId: z.string(), commentId: z.string(), }).transform((v) => { return remap$(v, { workspaceId: "workspace_id", commentId: "comment_id", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export var CommentId$; (function (CommentId$) { /** @deprecated use `CommentId$inboundSchema` instead. */ CommentId$.inboundSchema = CommentId$inboundSchema; /** @deprecated use `CommentId$outboundSchema` instead. */ CommentId$.outboundSchema = CommentId$outboundSchema; })(CommentId$ || (CommentId$ = {})); export function commentIdToJSON(commentId) { return JSON.stringify(CommentId$outboundSchema.parse(commentId)); } export function commentIdFromJSON(jsonString) { return safeParse(jsonString, (x) => CommentId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CommentId' from JSON`); } /** @internal */ export const Entry$inboundSchema = z .object({ entry_id: z.string(), list_id: z.string(), }).transform((v) => { return remap$(v, { "entry_id": "entryId", "list_id": "listId", }); }); /** @internal */ export const Entry$outboundSchema = z.object({ entryId: z.string(), listId: z.string(), }).transform((v) => { return remap$(v, { entryId: "entry_id", listId: "list_id", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export var Entry$; (function (Entry$) { /** @deprecated use `Entry$inboundSchema` instead. */ Entry$.inboundSchema = Entry$inboundSchema; /** @deprecated use `Entry$outboundSchema` instead. */ Entry$.outboundSchema = Entry$outboundSchema; })(Entry$ || (Entry$ = {})); export function entryToJSON(entry) { return JSON.stringify(Entry$outboundSchema.parse(entry)); } export function entryFromJSON(jsonString) { return safeParse(jsonString, (x) => Entry$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Entry' from JSON`); } /** @internal */ export const RecordT$inboundSchema = z.object({ record_id: z.string(), object_id: z.string(), }).transform((v) => { return remap$(v, { "record_id": "recordId", "object_id": "objectId", }); }); /** @internal */ export const RecordT$outboundSchema = z.object({ recordId: z.string(), objectId: z.string(), }).transform((v) => { return remap$(v, { recordId: "record_id", objectId: "object_id", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export var RecordT$; (function (RecordT$) { /** @deprecated use `RecordT$inboundSchema` instead. */ RecordT$.inboundSchema = RecordT$inboundSchema; /** @deprecated use `RecordT$outboundSchema` instead. */ RecordT$.outboundSchema = RecordT$outboundSchema; })(RecordT$ || (RecordT$ = {})); export function recordToJSON(recordT) { return JSON.stringify(RecordT$outboundSchema.parse(recordT)); } export function recordFromJSON(jsonString) { return safeParse(jsonString, (x) => RecordT$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RecordT' from JSON`); } /** @internal */ export const ResolvedByType$inboundSchema = z.nativeEnum(ResolvedByType); /** @internal */ export const ResolvedByType$outboundSchema = ResolvedByType$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export var ResolvedByType$; (function (ResolvedByType$) { /** @deprecated use `ResolvedByType$inboundSchema` instead. */ ResolvedByType$.inboundSchema = ResolvedByType$inboundSchema; /** @deprecated use `ResolvedByType$outboundSchema` instead. */ ResolvedByType$.outboundSchema = ResolvedByType$outboundSchema; })(ResolvedByType$ || (ResolvedByType$ = {})); /** @internal */ export const ResolvedBy$inboundSchema = z.object({ id: z.nullable(z.string()).optional(), type: z.nullable(ResolvedByType$inboundSchema).optional(), }); /** @internal */ export const ResolvedBy$outboundSchema = z.object({ id: z.nullable(z.string()).optional(), type: z.nullable(ResolvedByType$outboundSchema).optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export var ResolvedBy$; (function (ResolvedBy$) { /** @deprecated use `ResolvedBy$inboundSchema` instead. */ ResolvedBy$.inboundSchema = ResolvedBy$inboundSchema; /** @deprecated use `ResolvedBy$outboundSchema` instead. */ ResolvedBy$.outboundSchema = ResolvedBy$outboundSchema; })(ResolvedBy$ || (ResolvedBy$ = {})); export function resolvedByToJSON(resolvedBy) { return JSON.stringify(ResolvedBy$outboundSchema.parse(resolvedBy)); } export function resolvedByFromJSON(jsonString) { return safeParse(jsonString, (x) => ResolvedBy$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResolvedBy' from JSON`); } /** @internal */ export const AuthorType$inboundSchema = z .nativeEnum(AuthorType); /** @internal */ export const AuthorType$outboundSchema = AuthorType$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export var AuthorType$; (function (AuthorType$) { /** @deprecated use `AuthorType$inboundSchema` instead. */ AuthorType$.inboundSchema = AuthorType$inboundSchema; /** @deprecated use `AuthorType$outboundSchema` instead. */ AuthorType$.outboundSchema = AuthorType$outboundSchema; })(AuthorType$ || (AuthorType$ = {})); /** @internal */ export const Author$inboundSchema = z .object({ id: z.nullable(z.string()).optional(), type: z.nullable(AuthorType$inboundSchema).optional(), }); /** @internal */ export const Author$outboundSchema = z.object({ id: z.nullable(z.string()).optional(), type: z.nullable(AuthorType$outboundSchema).optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export var Author$; (function (Author$) { /** @deprecated use `Author$inboundSchema` instead. */ Author$.inboundSchema = Author$inboundSchema; /** @deprecated use `Author$outboundSchema` instead. */ Author$.outboundSchema = Author$outboundSchema; })(Author$ || (Author$ = {})); export function authorToJSON(author) { return JSON.stringify(Author$outboundSchema.parse(author)); } export function authorFromJSON(jsonString) { return safeParse(jsonString, (x) => Author$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Author' from JSON`); } /** @internal */ export const Comment$inboundSchema = z.object({ id: z.lazy(() => CommentId$inboundSchema), thread_id: z.string(), content_plaintext: z.string(), entry: z.nullable(z.lazy(() => Entry$inboundSchema)), record: z.lazy(() => RecordT$inboundSchema), resolved_at: z.nullable(z.string()), resolved_by: z.lazy(() => ResolvedBy$inboundSchema), created_at: z.string(), author: z.lazy(() => Author$inboundSchema), }).transform((v) => { return remap$(v, { "thread_id": "threadId", "content_plaintext": "contentPlaintext", "resolved_at": "resolvedAt", "resolved_by": "resolvedBy", "created_at": "createdAt", }); }); /** @internal */ export const Comment$outboundSchema = z.object({ id: z.lazy(() => CommentId$outboundSchema), threadId: z.string(), contentPlaintext: z.string(), entry: z.nullable(z.lazy(() => Entry$outboundSchema)), record: z.lazy(() => RecordT$outboundSchema), resolvedAt: z.nullable(z.string()), resolvedBy: z.lazy(() => ResolvedBy$outboundSchema), createdAt: z.string(), author: z.lazy(() => Author$outboundSchema), }).transform((v) => { return remap$(v, { threadId: "thread_id", contentPlaintext: "content_plaintext", resolvedAt: "resolved_at", resolvedBy: "resolved_by", 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 Comment$; (function (Comment$) { /** @deprecated use `Comment$inboundSchema` instead. */ Comment$.inboundSchema = Comment$inboundSchema; /** @deprecated use `Comment$outboundSchema` instead. */ Comment$.outboundSchema = Comment$outboundSchema; })(Comment$ || (Comment$ = {})); export function commentToJSON(comment) { return JSON.stringify(Comment$outboundSchema.parse(comment)); } export function commentFromJSON(jsonString) { return safeParse(jsonString, (x) => Comment$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Comment' from JSON`); } //# sourceMappingURL=comment.js.map