attio-js
Version:
Developer-friendly & type-safe JS/TS SDK based on the official OpenAPI spec of Attio.
155 lines • 5.64 kB
JavaScript
/*
* 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 NoteType = {
ApiToken: "api-token",
WorkspaceMember: "workspace-member",
System: "system",
App: "app",
};
/** @internal */
export const NoteId$inboundSchema = z
.object({
workspace_id: z.string(),
note_id: z.string(),
}).transform((v) => {
return remap$(v, {
"workspace_id": "workspaceId",
"note_id": "noteId",
});
});
/** @internal */
export const NoteId$outboundSchema = z.object({
workspaceId: z.string(),
noteId: z.string(),
}).transform((v) => {
return remap$(v, {
workspaceId: "workspace_id",
noteId: "note_id",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export var NoteId$;
(function (NoteId$) {
/** @deprecated use `NoteId$inboundSchema` instead. */
NoteId$.inboundSchema = NoteId$inboundSchema;
/** @deprecated use `NoteId$outboundSchema` instead. */
NoteId$.outboundSchema = NoteId$outboundSchema;
})(NoteId$ || (NoteId$ = {}));
export function noteIdToJSON(noteId) {
return JSON.stringify(NoteId$outboundSchema.parse(noteId));
}
export function noteIdFromJSON(jsonString) {
return safeParse(jsonString, (x) => NoteId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'NoteId' from JSON`);
}
/** @internal */
export const NoteType$inboundSchema = z
.nativeEnum(NoteType);
/** @internal */
export const NoteType$outboundSchema = NoteType$inboundSchema;
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export var NoteType$;
(function (NoteType$) {
/** @deprecated use `NoteType$inboundSchema` instead. */
NoteType$.inboundSchema = NoteType$inboundSchema;
/** @deprecated use `NoteType$outboundSchema` instead. */
NoteType$.outboundSchema = NoteType$outboundSchema;
})(NoteType$ || (NoteType$ = {}));
/** @internal */
export const NoteCreatedByActor$inboundSchema = z.object({
id: z.nullable(z.string()).optional(),
type: z.nullable(NoteType$inboundSchema).optional(),
});
/** @internal */
export const NoteCreatedByActor$outboundSchema = z.object({
id: z.nullable(z.string()).optional(),
type: z.nullable(NoteType$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 NoteCreatedByActor$;
(function (NoteCreatedByActor$) {
/** @deprecated use `NoteCreatedByActor$inboundSchema` instead. */
NoteCreatedByActor$.inboundSchema = NoteCreatedByActor$inboundSchema;
/** @deprecated use `NoteCreatedByActor$outboundSchema` instead. */
NoteCreatedByActor$.outboundSchema = NoteCreatedByActor$outboundSchema;
})(NoteCreatedByActor$ || (NoteCreatedByActor$ = {}));
export function noteCreatedByActorToJSON(noteCreatedByActor) {
return JSON.stringify(NoteCreatedByActor$outboundSchema.parse(noteCreatedByActor));
}
export function noteCreatedByActorFromJSON(jsonString) {
return safeParse(jsonString, (x) => NoteCreatedByActor$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'NoteCreatedByActor' from JSON`);
}
/** @internal */
export const Note$inboundSchema = z
.object({
id: z.lazy(() => NoteId$inboundSchema),
parent_object: z.string(),
parent_record_id: z.string(),
title: z.string(),
content_plaintext: z.string(),
content_markdown: z.string(),
created_by_actor: z.lazy(() => NoteCreatedByActor$inboundSchema),
created_at: z.string(),
}).transform((v) => {
return remap$(v, {
"parent_object": "parentObject",
"parent_record_id": "parentRecordId",
"content_plaintext": "contentPlaintext",
"content_markdown": "contentMarkdown",
"created_by_actor": "createdByActor",
"created_at": "createdAt",
});
});
/** @internal */
export const Note$outboundSchema = z.object({
id: z.lazy(() => NoteId$outboundSchema),
parentObject: z.string(),
parentRecordId: z.string(),
title: z.string(),
contentPlaintext: z.string(),
contentMarkdown: z.string(),
createdByActor: z.lazy(() => NoteCreatedByActor$outboundSchema),
createdAt: z.string(),
}).transform((v) => {
return remap$(v, {
parentObject: "parent_object",
parentRecordId: "parent_record_id",
contentPlaintext: "content_plaintext",
contentMarkdown: "content_markdown",
createdByActor: "created_by_actor",
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 Note$;
(function (Note$) {
/** @deprecated use `Note$inboundSchema` instead. */
Note$.inboundSchema = Note$inboundSchema;
/** @deprecated use `Note$outboundSchema` instead. */
Note$.outboundSchema = Note$outboundSchema;
})(Note$ || (Note$ = {}));
export function noteToJSON(note) {
return JSON.stringify(Note$outboundSchema.parse(note));
}
export function noteFromJSON(jsonString) {
return safeParse(jsonString, (x) => Note$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Note' from JSON`);
}
//# sourceMappingURL=note.js.map