UNPKG

attio-js

Version:

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

328 lines 13.4 kB
"use strict"; /* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || (function () { var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; return function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.Comment$ = exports.Comment$outboundSchema = exports.Comment$inboundSchema = exports.Author$ = exports.Author$outboundSchema = exports.Author$inboundSchema = exports.AuthorType$ = exports.AuthorType$outboundSchema = exports.AuthorType$inboundSchema = exports.ResolvedBy$ = exports.ResolvedBy$outboundSchema = exports.ResolvedBy$inboundSchema = exports.ResolvedByType$ = exports.ResolvedByType$outboundSchema = exports.ResolvedByType$inboundSchema = exports.RecordT$ = exports.RecordT$outboundSchema = exports.RecordT$inboundSchema = exports.Entry$ = exports.Entry$outboundSchema = exports.Entry$inboundSchema = exports.CommentId$ = exports.CommentId$outboundSchema = exports.CommentId$inboundSchema = exports.AuthorType = exports.ResolvedByType = void 0; exports.commentIdToJSON = commentIdToJSON; exports.commentIdFromJSON = commentIdFromJSON; exports.entryToJSON = entryToJSON; exports.entryFromJSON = entryFromJSON; exports.recordToJSON = recordToJSON; exports.recordFromJSON = recordFromJSON; exports.resolvedByToJSON = resolvedByToJSON; exports.resolvedByFromJSON = resolvedByFromJSON; exports.authorToJSON = authorToJSON; exports.authorFromJSON = authorFromJSON; exports.commentToJSON = commentToJSON; exports.commentFromJSON = commentFromJSON; const z = __importStar(require("zod")); const primitives_js_1 = require("../../lib/primitives.js"); const schemas_js_1 = require("../../lib/schemas.js"); /** * The type of actor. [Read more information on actor types here](/docs/actors). */ exports.ResolvedByType = { ApiToken: "api-token", WorkspaceMember: "workspace-member", System: "system", App: "app", }; /** * The type of actor. [Read more information on actor types here](/docs/actors). */ exports.AuthorType = { ApiToken: "api-token", WorkspaceMember: "workspace-member", System: "system", App: "app", }; /** @internal */ exports.CommentId$inboundSchema = z.object({ workspace_id: z.string(), comment_id: z.string(), }).transform((v) => { return (0, primitives_js_1.remap)(v, { "workspace_id": "workspaceId", "comment_id": "commentId", }); }); /** @internal */ exports.CommentId$outboundSchema = z.object({ workspaceId: z.string(), commentId: z.string(), }).transform((v) => { return (0, primitives_js_1.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. */ var CommentId$; (function (CommentId$) { /** @deprecated use `CommentId$inboundSchema` instead. */ CommentId$.inboundSchema = exports.CommentId$inboundSchema; /** @deprecated use `CommentId$outboundSchema` instead. */ CommentId$.outboundSchema = exports.CommentId$outboundSchema; })(CommentId$ || (exports.CommentId$ = CommentId$ = {})); function commentIdToJSON(commentId) { return JSON.stringify(exports.CommentId$outboundSchema.parse(commentId)); } function commentIdFromJSON(jsonString) { return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CommentId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CommentId' from JSON`); } /** @internal */ exports.Entry$inboundSchema = z .object({ entry_id: z.string(), list_id: z.string(), }).transform((v) => { return (0, primitives_js_1.remap)(v, { "entry_id": "entryId", "list_id": "listId", }); }); /** @internal */ exports.Entry$outboundSchema = z.object({ entryId: z.string(), listId: z.string(), }).transform((v) => { return (0, primitives_js_1.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. */ var Entry$; (function (Entry$) { /** @deprecated use `Entry$inboundSchema` instead. */ Entry$.inboundSchema = exports.Entry$inboundSchema; /** @deprecated use `Entry$outboundSchema` instead. */ Entry$.outboundSchema = exports.Entry$outboundSchema; })(Entry$ || (exports.Entry$ = Entry$ = {})); function entryToJSON(entry) { return JSON.stringify(exports.Entry$outboundSchema.parse(entry)); } function entryFromJSON(jsonString) { return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Entry$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Entry' from JSON`); } /** @internal */ exports.RecordT$inboundSchema = z.object({ record_id: z.string(), object_id: z.string(), }).transform((v) => { return (0, primitives_js_1.remap)(v, { "record_id": "recordId", "object_id": "objectId", }); }); /** @internal */ exports.RecordT$outboundSchema = z.object({ recordId: z.string(), objectId: z.string(), }).transform((v) => { return (0, primitives_js_1.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. */ var RecordT$; (function (RecordT$) { /** @deprecated use `RecordT$inboundSchema` instead. */ RecordT$.inboundSchema = exports.RecordT$inboundSchema; /** @deprecated use `RecordT$outboundSchema` instead. */ RecordT$.outboundSchema = exports.RecordT$outboundSchema; })(RecordT$ || (exports.RecordT$ = RecordT$ = {})); function recordToJSON(recordT) { return JSON.stringify(exports.RecordT$outboundSchema.parse(recordT)); } function recordFromJSON(jsonString) { return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.RecordT$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RecordT' from JSON`); } /** @internal */ exports.ResolvedByType$inboundSchema = z.nativeEnum(exports.ResolvedByType); /** @internal */ exports.ResolvedByType$outboundSchema = exports.ResolvedByType$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ var ResolvedByType$; (function (ResolvedByType$) { /** @deprecated use `ResolvedByType$inboundSchema` instead. */ ResolvedByType$.inboundSchema = exports.ResolvedByType$inboundSchema; /** @deprecated use `ResolvedByType$outboundSchema` instead. */ ResolvedByType$.outboundSchema = exports.ResolvedByType$outboundSchema; })(ResolvedByType$ || (exports.ResolvedByType$ = ResolvedByType$ = {})); /** @internal */ exports.ResolvedBy$inboundSchema = z.object({ id: z.nullable(z.string()).optional(), type: z.nullable(exports.ResolvedByType$inboundSchema).optional(), }); /** @internal */ exports.ResolvedBy$outboundSchema = z.object({ id: z.nullable(z.string()).optional(), type: z.nullable(exports.ResolvedByType$outboundSchema).optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ var ResolvedBy$; (function (ResolvedBy$) { /** @deprecated use `ResolvedBy$inboundSchema` instead. */ ResolvedBy$.inboundSchema = exports.ResolvedBy$inboundSchema; /** @deprecated use `ResolvedBy$outboundSchema` instead. */ ResolvedBy$.outboundSchema = exports.ResolvedBy$outboundSchema; })(ResolvedBy$ || (exports.ResolvedBy$ = ResolvedBy$ = {})); function resolvedByToJSON(resolvedBy) { return JSON.stringify(exports.ResolvedBy$outboundSchema.parse(resolvedBy)); } function resolvedByFromJSON(jsonString) { return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ResolvedBy$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResolvedBy' from JSON`); } /** @internal */ exports.AuthorType$inboundSchema = z .nativeEnum(exports.AuthorType); /** @internal */ exports.AuthorType$outboundSchema = exports.AuthorType$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ var AuthorType$; (function (AuthorType$) { /** @deprecated use `AuthorType$inboundSchema` instead. */ AuthorType$.inboundSchema = exports.AuthorType$inboundSchema; /** @deprecated use `AuthorType$outboundSchema` instead. */ AuthorType$.outboundSchema = exports.AuthorType$outboundSchema; })(AuthorType$ || (exports.AuthorType$ = AuthorType$ = {})); /** @internal */ exports.Author$inboundSchema = z .object({ id: z.nullable(z.string()).optional(), type: z.nullable(exports.AuthorType$inboundSchema).optional(), }); /** @internal */ exports.Author$outboundSchema = z.object({ id: z.nullable(z.string()).optional(), type: z.nullable(exports.AuthorType$outboundSchema).optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ var Author$; (function (Author$) { /** @deprecated use `Author$inboundSchema` instead. */ Author$.inboundSchema = exports.Author$inboundSchema; /** @deprecated use `Author$outboundSchema` instead. */ Author$.outboundSchema = exports.Author$outboundSchema; })(Author$ || (exports.Author$ = Author$ = {})); function authorToJSON(author) { return JSON.stringify(exports.Author$outboundSchema.parse(author)); } function authorFromJSON(jsonString) { return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Author$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Author' from JSON`); } /** @internal */ exports.Comment$inboundSchema = z.object({ id: z.lazy(() => exports.CommentId$inboundSchema), thread_id: z.string(), content_plaintext: z.string(), entry: z.nullable(z.lazy(() => exports.Entry$inboundSchema)), record: z.lazy(() => exports.RecordT$inboundSchema), resolved_at: z.nullable(z.string()), resolved_by: z.lazy(() => exports.ResolvedBy$inboundSchema), created_at: z.string(), author: z.lazy(() => exports.Author$inboundSchema), }).transform((v) => { return (0, primitives_js_1.remap)(v, { "thread_id": "threadId", "content_plaintext": "contentPlaintext", "resolved_at": "resolvedAt", "resolved_by": "resolvedBy", "created_at": "createdAt", }); }); /** @internal */ exports.Comment$outboundSchema = z.object({ id: z.lazy(() => exports.CommentId$outboundSchema), threadId: z.string(), contentPlaintext: z.string(), entry: z.nullable(z.lazy(() => exports.Entry$outboundSchema)), record: z.lazy(() => exports.RecordT$outboundSchema), resolvedAt: z.nullable(z.string()), resolvedBy: z.lazy(() => exports.ResolvedBy$outboundSchema), createdAt: z.string(), author: z.lazy(() => exports.Author$outboundSchema), }).transform((v) => { return (0, primitives_js_1.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. */ var Comment$; (function (Comment$) { /** @deprecated use `Comment$inboundSchema` instead. */ Comment$.inboundSchema = exports.Comment$inboundSchema; /** @deprecated use `Comment$outboundSchema` instead. */ Comment$.outboundSchema = exports.Comment$outboundSchema; })(Comment$ || (exports.Comment$ = Comment$ = {})); function commentToJSON(comment) { return JSON.stringify(exports.Comment$outboundSchema.parse(comment)); } function commentFromJSON(jsonString) { return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Comment$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Comment' from JSON`); } //# sourceMappingURL=comment.js.map