attio-js
Version:
Developer-friendly & type-safe JS/TS SDK based on the official OpenAPI spec of Attio.
127 lines • 5.53 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";
import { Note$inboundSchema, Note$outboundSchema, } from "../components/note.js";
/**
* The format of the note content to be created. The `plaintext` format uses the line feed character `\n` to create new lines within the note content. The `markdown` format supports rich text formatting, and links.
*/
export const PostV2NotesFormat = {
Plaintext: "plaintext",
Markdown: "markdown",
};
/** @internal */
export const PostV2NotesFormat$inboundSchema = z.nativeEnum(PostV2NotesFormat);
/** @internal */
export const PostV2NotesFormat$outboundSchema = PostV2NotesFormat$inboundSchema;
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export var PostV2NotesFormat$;
(function (PostV2NotesFormat$) {
/** @deprecated use `PostV2NotesFormat$inboundSchema` instead. */
PostV2NotesFormat$.inboundSchema = PostV2NotesFormat$inboundSchema;
/** @deprecated use `PostV2NotesFormat$outboundSchema` instead. */
PostV2NotesFormat$.outboundSchema = PostV2NotesFormat$outboundSchema;
})(PostV2NotesFormat$ || (PostV2NotesFormat$ = {}));
/** @internal */
export const PostV2NotesData$inboundSchema = z.object({
parent_object: z.string(),
parent_record_id: z.string(),
title: z.string(),
format: PostV2NotesFormat$inboundSchema,
content: z.string(),
created_at: z.string().optional(),
}).transform((v) => {
return remap$(v, {
"parent_object": "parentObject",
"parent_record_id": "parentRecordId",
"created_at": "createdAt",
});
});
/** @internal */
export const PostV2NotesData$outboundSchema = z.object({
parentObject: z.string(),
parentRecordId: z.string(),
title: z.string(),
format: PostV2NotesFormat$outboundSchema,
content: z.string(),
createdAt: z.string().optional(),
}).transform((v) => {
return remap$(v, {
parentObject: "parent_object",
parentRecordId: "parent_record_id",
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 PostV2NotesData$;
(function (PostV2NotesData$) {
/** @deprecated use `PostV2NotesData$inboundSchema` instead. */
PostV2NotesData$.inboundSchema = PostV2NotesData$inboundSchema;
/** @deprecated use `PostV2NotesData$outboundSchema` instead. */
PostV2NotesData$.outboundSchema = PostV2NotesData$outboundSchema;
})(PostV2NotesData$ || (PostV2NotesData$ = {}));
export function postV2NotesDataToJSON(postV2NotesData) {
return JSON.stringify(PostV2NotesData$outboundSchema.parse(postV2NotesData));
}
export function postV2NotesDataFromJSON(jsonString) {
return safeParse(jsonString, (x) => PostV2NotesData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PostV2NotesData' from JSON`);
}
/** @internal */
export const PostV2NotesRequest$inboundSchema = z.object({
data: z.lazy(() => PostV2NotesData$inboundSchema),
});
/** @internal */
export const PostV2NotesRequest$outboundSchema = z.object({
data: z.lazy(() => PostV2NotesData$outboundSchema),
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export var PostV2NotesRequest$;
(function (PostV2NotesRequest$) {
/** @deprecated use `PostV2NotesRequest$inboundSchema` instead. */
PostV2NotesRequest$.inboundSchema = PostV2NotesRequest$inboundSchema;
/** @deprecated use `PostV2NotesRequest$outboundSchema` instead. */
PostV2NotesRequest$.outboundSchema = PostV2NotesRequest$outboundSchema;
})(PostV2NotesRequest$ || (PostV2NotesRequest$ = {}));
export function postV2NotesRequestToJSON(postV2NotesRequest) {
return JSON.stringify(PostV2NotesRequest$outboundSchema.parse(postV2NotesRequest));
}
export function postV2NotesRequestFromJSON(jsonString) {
return safeParse(jsonString, (x) => PostV2NotesRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PostV2NotesRequest' from JSON`);
}
/** @internal */
export const PostV2NotesResponse$inboundSchema = z.object({
data: Note$inboundSchema,
});
/** @internal */
export const PostV2NotesResponse$outboundSchema = z.object({
data: Note$outboundSchema,
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export var PostV2NotesResponse$;
(function (PostV2NotesResponse$) {
/** @deprecated use `PostV2NotesResponse$inboundSchema` instead. */
PostV2NotesResponse$.inboundSchema = PostV2NotesResponse$inboundSchema;
/** @deprecated use `PostV2NotesResponse$outboundSchema` instead. */
PostV2NotesResponse$.outboundSchema = PostV2NotesResponse$outboundSchema;
})(PostV2NotesResponse$ || (PostV2NotesResponse$ = {}));
export function postV2NotesResponseToJSON(postV2NotesResponse) {
return JSON.stringify(PostV2NotesResponse$outboundSchema.parse(postV2NotesResponse));
}
export function postV2NotesResponseFromJSON(jsonString) {
return safeParse(jsonString, (x) => PostV2NotesResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PostV2NotesResponse' from JSON`);
}
//# sourceMappingURL=postv2notes.js.map