UNPKG

attio-js

Version:

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

489 lines 21.5 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 "../components/comment.js"; /** * The format that the comment content is provided in. The `plaintext` format uses the line feed character `\n` to create new lines within the note content. Rich text formatting and links are not supported. */ export const PostV2CommentsFormat3 = { Plaintext: "plaintext", }; export const PostV2CommentsType3 = { WorkspaceMember: "workspace-member", }; /** * The format that the comment content is provided in. The `plaintext` format uses the line feed character `\n` to create new lines within the note content. Rich text formatting and links are not supported. */ export const PostV2CommentsFormat2 = { Plaintext: "plaintext", }; export const PostV2CommentsType2 = { WorkspaceMember: "workspace-member", }; /** * The format that the comment content is provided in. The `plaintext` format uses the line feed character `\n` to create new lines within the note content. Rich text formatting and links are not supported. */ export const PostV2CommentsFormat1 = { Plaintext: "plaintext", }; export const PostV2CommentsType1 = { WorkspaceMember: "workspace-member", }; /** @internal */ export const PostV2CommentsFormat3$inboundSchema = z.nativeEnum(PostV2CommentsFormat3); /** @internal */ export const PostV2CommentsFormat3$outboundSchema = PostV2CommentsFormat3$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export var PostV2CommentsFormat3$; (function (PostV2CommentsFormat3$) { /** @deprecated use `PostV2CommentsFormat3$inboundSchema` instead. */ PostV2CommentsFormat3$.inboundSchema = PostV2CommentsFormat3$inboundSchema; /** @deprecated use `PostV2CommentsFormat3$outboundSchema` instead. */ PostV2CommentsFormat3$.outboundSchema = PostV2CommentsFormat3$outboundSchema; })(PostV2CommentsFormat3$ || (PostV2CommentsFormat3$ = {})); /** @internal */ export const PostV2CommentsType3$inboundSchema = z.nativeEnum(PostV2CommentsType3); /** @internal */ export const PostV2CommentsType3$outboundSchema = PostV2CommentsType3$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export var PostV2CommentsType3$; (function (PostV2CommentsType3$) { /** @deprecated use `PostV2CommentsType3$inboundSchema` instead. */ PostV2CommentsType3$.inboundSchema = PostV2CommentsType3$inboundSchema; /** @deprecated use `PostV2CommentsType3$outboundSchema` instead. */ PostV2CommentsType3$.outboundSchema = PostV2CommentsType3$outboundSchema; })(PostV2CommentsType3$ || (PostV2CommentsType3$ = {})); /** @internal */ export const Author3$inboundSchema = z.object({ type: PostV2CommentsType3$inboundSchema, id: z.string(), }); /** @internal */ export const Author3$outboundSchema = z.object({ type: PostV2CommentsType3$outboundSchema, id: z.string(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export var Author3$; (function (Author3$) { /** @deprecated use `Author3$inboundSchema` instead. */ Author3$.inboundSchema = Author3$inboundSchema; /** @deprecated use `Author3$outboundSchema` instead. */ Author3$.outboundSchema = Author3$outboundSchema; })(Author3$ || (Author3$ = {})); export function author3ToJSON(author3) { return JSON.stringify(Author3$outboundSchema.parse(author3)); } export function author3FromJSON(jsonString) { return safeParse(jsonString, (x) => Author3$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Author3' from JSON`); } /** @internal */ export const Entry$inboundSchema = z .object({ list: z.string(), entry_id: z.string(), }).transform((v) => { return remap$(v, { "entry_id": "entryId", }); }); /** @internal */ export const Entry$outboundSchema = z.object({ list: z.string(), entryId: z.string(), }).transform((v) => { return remap$(v, { entryId: "entry_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 PostV2CommentsDataPlaintext3$inboundSchema = z.object({ format: PostV2CommentsFormat3$inboundSchema, content: z.string(), author: z.lazy(() => Author3$inboundSchema), created_at: z.string().optional(), entry: z.lazy(() => Entry$inboundSchema), }).transform((v) => { return remap$(v, { "created_at": "createdAt", }); }); /** @internal */ export const PostV2CommentsDataPlaintext3$outboundSchema = z.object({ format: PostV2CommentsFormat3$outboundSchema, content: z.string(), author: z.lazy(() => Author3$outboundSchema), createdAt: z.string().optional(), entry: z.lazy(() => Entry$outboundSchema), }).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 PostV2CommentsDataPlaintext3$; (function (PostV2CommentsDataPlaintext3$) { /** @deprecated use `PostV2CommentsDataPlaintext3$inboundSchema` instead. */ PostV2CommentsDataPlaintext3$.inboundSchema = PostV2CommentsDataPlaintext3$inboundSchema; /** @deprecated use `PostV2CommentsDataPlaintext3$outboundSchema` instead. */ PostV2CommentsDataPlaintext3$.outboundSchema = PostV2CommentsDataPlaintext3$outboundSchema; })(PostV2CommentsDataPlaintext3$ || (PostV2CommentsDataPlaintext3$ = {})); export function postV2CommentsDataPlaintext3ToJSON(postV2CommentsDataPlaintext3) { return JSON.stringify(PostV2CommentsDataPlaintext3$outboundSchema.parse(postV2CommentsDataPlaintext3)); } export function postV2CommentsDataPlaintext3FromJSON(jsonString) { return safeParse(jsonString, (x) => PostV2CommentsDataPlaintext3$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PostV2CommentsDataPlaintext3' from JSON`); } /** @internal */ export const PostV2CommentsFormat2$inboundSchema = z.nativeEnum(PostV2CommentsFormat2); /** @internal */ export const PostV2CommentsFormat2$outboundSchema = PostV2CommentsFormat2$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export var PostV2CommentsFormat2$; (function (PostV2CommentsFormat2$) { /** @deprecated use `PostV2CommentsFormat2$inboundSchema` instead. */ PostV2CommentsFormat2$.inboundSchema = PostV2CommentsFormat2$inboundSchema; /** @deprecated use `PostV2CommentsFormat2$outboundSchema` instead. */ PostV2CommentsFormat2$.outboundSchema = PostV2CommentsFormat2$outboundSchema; })(PostV2CommentsFormat2$ || (PostV2CommentsFormat2$ = {})); /** @internal */ export const PostV2CommentsType2$inboundSchema = z.nativeEnum(PostV2CommentsType2); /** @internal */ export const PostV2CommentsType2$outboundSchema = PostV2CommentsType2$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export var PostV2CommentsType2$; (function (PostV2CommentsType2$) { /** @deprecated use `PostV2CommentsType2$inboundSchema` instead. */ PostV2CommentsType2$.inboundSchema = PostV2CommentsType2$inboundSchema; /** @deprecated use `PostV2CommentsType2$outboundSchema` instead. */ PostV2CommentsType2$.outboundSchema = PostV2CommentsType2$outboundSchema; })(PostV2CommentsType2$ || (PostV2CommentsType2$ = {})); /** @internal */ export const Author2$inboundSchema = z.object({ type: PostV2CommentsType2$inboundSchema, id: z.string(), }); /** @internal */ export const Author2$outboundSchema = z.object({ type: PostV2CommentsType2$outboundSchema, id: z.string(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export var Author2$; (function (Author2$) { /** @deprecated use `Author2$inboundSchema` instead. */ Author2$.inboundSchema = Author2$inboundSchema; /** @deprecated use `Author2$outboundSchema` instead. */ Author2$.outboundSchema = Author2$outboundSchema; })(Author2$ || (Author2$ = {})); export function author2ToJSON(author2) { return JSON.stringify(Author2$outboundSchema.parse(author2)); } export function author2FromJSON(jsonString) { return safeParse(jsonString, (x) => Author2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Author2' from JSON`); } /** @internal */ export const RecordT$inboundSchema = z.object({ object: z.string(), record_id: z.string(), }).transform((v) => { return remap$(v, { "record_id": "recordId", }); }); /** @internal */ export const RecordT$outboundSchema = z.object({ object: z.string(), recordId: z.string(), }).transform((v) => { return remap$(v, { recordId: "record_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 PostV2CommentsDataPlaintext2$inboundSchema = z.object({ format: PostV2CommentsFormat2$inboundSchema, content: z.string(), author: z.lazy(() => Author2$inboundSchema), created_at: z.string().optional(), record: z.lazy(() => RecordT$inboundSchema), }).transform((v) => { return remap$(v, { "created_at": "createdAt", }); }); /** @internal */ export const PostV2CommentsDataPlaintext2$outboundSchema = z.object({ format: PostV2CommentsFormat2$outboundSchema, content: z.string(), author: z.lazy(() => Author2$outboundSchema), createdAt: z.string().optional(), record: z.lazy(() => RecordT$outboundSchema), }).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 PostV2CommentsDataPlaintext2$; (function (PostV2CommentsDataPlaintext2$) { /** @deprecated use `PostV2CommentsDataPlaintext2$inboundSchema` instead. */ PostV2CommentsDataPlaintext2$.inboundSchema = PostV2CommentsDataPlaintext2$inboundSchema; /** @deprecated use `PostV2CommentsDataPlaintext2$outboundSchema` instead. */ PostV2CommentsDataPlaintext2$.outboundSchema = PostV2CommentsDataPlaintext2$outboundSchema; })(PostV2CommentsDataPlaintext2$ || (PostV2CommentsDataPlaintext2$ = {})); export function postV2CommentsDataPlaintext2ToJSON(postV2CommentsDataPlaintext2) { return JSON.stringify(PostV2CommentsDataPlaintext2$outboundSchema.parse(postV2CommentsDataPlaintext2)); } export function postV2CommentsDataPlaintext2FromJSON(jsonString) { return safeParse(jsonString, (x) => PostV2CommentsDataPlaintext2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PostV2CommentsDataPlaintext2' from JSON`); } /** @internal */ export const PostV2CommentsFormat1$inboundSchema = z.nativeEnum(PostV2CommentsFormat1); /** @internal */ export const PostV2CommentsFormat1$outboundSchema = PostV2CommentsFormat1$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export var PostV2CommentsFormat1$; (function (PostV2CommentsFormat1$) { /** @deprecated use `PostV2CommentsFormat1$inboundSchema` instead. */ PostV2CommentsFormat1$.inboundSchema = PostV2CommentsFormat1$inboundSchema; /** @deprecated use `PostV2CommentsFormat1$outboundSchema` instead. */ PostV2CommentsFormat1$.outboundSchema = PostV2CommentsFormat1$outboundSchema; })(PostV2CommentsFormat1$ || (PostV2CommentsFormat1$ = {})); /** @internal */ export const PostV2CommentsType1$inboundSchema = z.nativeEnum(PostV2CommentsType1); /** @internal */ export const PostV2CommentsType1$outboundSchema = PostV2CommentsType1$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export var PostV2CommentsType1$; (function (PostV2CommentsType1$) { /** @deprecated use `PostV2CommentsType1$inboundSchema` instead. */ PostV2CommentsType1$.inboundSchema = PostV2CommentsType1$inboundSchema; /** @deprecated use `PostV2CommentsType1$outboundSchema` instead. */ PostV2CommentsType1$.outboundSchema = PostV2CommentsType1$outboundSchema; })(PostV2CommentsType1$ || (PostV2CommentsType1$ = {})); /** @internal */ export const Author1$inboundSchema = z.object({ type: PostV2CommentsType1$inboundSchema, id: z.string(), }); /** @internal */ export const Author1$outboundSchema = z.object({ type: PostV2CommentsType1$outboundSchema, id: z.string(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export var Author1$; (function (Author1$) { /** @deprecated use `Author1$inboundSchema` instead. */ Author1$.inboundSchema = Author1$inboundSchema; /** @deprecated use `Author1$outboundSchema` instead. */ Author1$.outboundSchema = Author1$outboundSchema; })(Author1$ || (Author1$ = {})); export function author1ToJSON(author1) { return JSON.stringify(Author1$outboundSchema.parse(author1)); } export function author1FromJSON(jsonString) { return safeParse(jsonString, (x) => Author1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Author1' from JSON`); } /** @internal */ export const PostV2CommentsDataPlaintext1$inboundSchema = z.object({ format: PostV2CommentsFormat1$inboundSchema, content: z.string(), author: z.lazy(() => Author1$inboundSchema), created_at: z.string().optional(), thread_id: z.string(), }).transform((v) => { return remap$(v, { "created_at": "createdAt", "thread_id": "threadId", }); }); /** @internal */ export const PostV2CommentsDataPlaintext1$outboundSchema = z.object({ format: PostV2CommentsFormat1$outboundSchema, content: z.string(), author: z.lazy(() => Author1$outboundSchema), createdAt: z.string().optional(), threadId: z.string(), }).transform((v) => { return remap$(v, { createdAt: "created_at", 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 PostV2CommentsDataPlaintext1$; (function (PostV2CommentsDataPlaintext1$) { /** @deprecated use `PostV2CommentsDataPlaintext1$inboundSchema` instead. */ PostV2CommentsDataPlaintext1$.inboundSchema = PostV2CommentsDataPlaintext1$inboundSchema; /** @deprecated use `PostV2CommentsDataPlaintext1$outboundSchema` instead. */ PostV2CommentsDataPlaintext1$.outboundSchema = PostV2CommentsDataPlaintext1$outboundSchema; })(PostV2CommentsDataPlaintext1$ || (PostV2CommentsDataPlaintext1$ = {})); export function postV2CommentsDataPlaintext1ToJSON(postV2CommentsDataPlaintext1) { return JSON.stringify(PostV2CommentsDataPlaintext1$outboundSchema.parse(postV2CommentsDataPlaintext1)); } export function postV2CommentsDataPlaintext1FromJSON(jsonString) { return safeParse(jsonString, (x) => PostV2CommentsDataPlaintext1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PostV2CommentsDataPlaintext1' from JSON`); } /** @internal */ export const PostV2CommentsDataUnion$inboundSchema = z.union([ z.lazy(() => PostV2CommentsDataPlaintext1$inboundSchema), z.lazy(() => PostV2CommentsDataPlaintext2$inboundSchema), z.lazy(() => PostV2CommentsDataPlaintext3$inboundSchema), ]); /** @internal */ export const PostV2CommentsDataUnion$outboundSchema = z.union([ z.lazy(() => PostV2CommentsDataPlaintext1$outboundSchema), z.lazy(() => PostV2CommentsDataPlaintext2$outboundSchema), z.lazy(() => PostV2CommentsDataPlaintext3$outboundSchema), ]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export var PostV2CommentsDataUnion$; (function (PostV2CommentsDataUnion$) { /** @deprecated use `PostV2CommentsDataUnion$inboundSchema` instead. */ PostV2CommentsDataUnion$.inboundSchema = PostV2CommentsDataUnion$inboundSchema; /** @deprecated use `PostV2CommentsDataUnion$outboundSchema` instead. */ PostV2CommentsDataUnion$.outboundSchema = PostV2CommentsDataUnion$outboundSchema; })(PostV2CommentsDataUnion$ || (PostV2CommentsDataUnion$ = {})); export function postV2CommentsDataUnionToJSON(postV2CommentsDataUnion) { return JSON.stringify(PostV2CommentsDataUnion$outboundSchema.parse(postV2CommentsDataUnion)); } export function postV2CommentsDataUnionFromJSON(jsonString) { return safeParse(jsonString, (x) => PostV2CommentsDataUnion$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PostV2CommentsDataUnion' from JSON`); } /** @internal */ export const PostV2CommentsRequest$inboundSchema = z.object({ data: z.union([ z.lazy(() => PostV2CommentsDataPlaintext1$inboundSchema), z.lazy(() => PostV2CommentsDataPlaintext2$inboundSchema), z.lazy(() => PostV2CommentsDataPlaintext3$inboundSchema), ]), }); /** @internal */ export const PostV2CommentsRequest$outboundSchema = z.object({ data: z.union([ z.lazy(() => PostV2CommentsDataPlaintext1$outboundSchema), z.lazy(() => PostV2CommentsDataPlaintext2$outboundSchema), z.lazy(() => PostV2CommentsDataPlaintext3$outboundSchema), ]), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export var PostV2CommentsRequest$; (function (PostV2CommentsRequest$) { /** @deprecated use `PostV2CommentsRequest$inboundSchema` instead. */ PostV2CommentsRequest$.inboundSchema = PostV2CommentsRequest$inboundSchema; /** @deprecated use `PostV2CommentsRequest$outboundSchema` instead. */ PostV2CommentsRequest$.outboundSchema = PostV2CommentsRequest$outboundSchema; })(PostV2CommentsRequest$ || (PostV2CommentsRequest$ = {})); export function postV2CommentsRequestToJSON(postV2CommentsRequest) { return JSON.stringify(PostV2CommentsRequest$outboundSchema.parse(postV2CommentsRequest)); } export function postV2CommentsRequestFromJSON(jsonString) { return safeParse(jsonString, (x) => PostV2CommentsRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PostV2CommentsRequest' from JSON`); } /** @internal */ export const PostV2CommentsResponse$inboundSchema = z.object({ data: Comment$inboundSchema, }); /** @internal */ export const PostV2CommentsResponse$outboundSchema = z.object({ data: Comment$outboundSchema, }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export var PostV2CommentsResponse$; (function (PostV2CommentsResponse$) { /** @deprecated use `PostV2CommentsResponse$inboundSchema` instead. */ PostV2CommentsResponse$.inboundSchema = PostV2CommentsResponse$inboundSchema; /** @deprecated use `PostV2CommentsResponse$outboundSchema` instead. */ PostV2CommentsResponse$.outboundSchema = PostV2CommentsResponse$outboundSchema; })(PostV2CommentsResponse$ || (PostV2CommentsResponse$ = {})); export function postV2CommentsResponseToJSON(postV2CommentsResponse) { return JSON.stringify(PostV2CommentsResponse$outboundSchema.parse(postV2CommentsResponse)); } export function postV2CommentsResponseFromJSON(jsonString) { return safeParse(jsonString, (x) => PostV2CommentsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PostV2CommentsResponse' from JSON`); } //# sourceMappingURL=postv2comments.js.map