attio-js
Version:
Developer-friendly & type-safe JS/TS SDK based on the official OpenAPI spec of Attio.
91 lines • 3.15 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";
/** @internal */
export const ObjectId$inboundSchema = z.object({
workspace_id: z.string(),
object_id: z.string(),
}).transform((v) => {
return remap$(v, {
"workspace_id": "workspaceId",
"object_id": "objectId",
});
});
/** @internal */
export const ObjectId$outboundSchema = z.object({
workspaceId: z.string(),
objectId: z.string(),
}).transform((v) => {
return remap$(v, {
workspaceId: "workspace_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 ObjectId$;
(function (ObjectId$) {
/** @deprecated use `ObjectId$inboundSchema` instead. */
ObjectId$.inboundSchema = ObjectId$inboundSchema;
/** @deprecated use `ObjectId$outboundSchema` instead. */
ObjectId$.outboundSchema = ObjectId$outboundSchema;
})(ObjectId$ || (ObjectId$ = {}));
export function objectIdToJSON(objectId) {
return JSON.stringify(ObjectId$outboundSchema.parse(objectId));
}
export function objectIdFromJSON(jsonString) {
return safeParse(jsonString, (x) => ObjectId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ObjectId' from JSON`);
}
/** @internal */
export const ObjectT$inboundSchema = z.object({
id: z.lazy(() => ObjectId$inboundSchema),
api_slug: z.nullable(z.string()),
singular_noun: z.nullable(z.string()),
plural_noun: z.nullable(z.string()),
created_at: z.string(),
}).transform((v) => {
return remap$(v, {
"api_slug": "apiSlug",
"singular_noun": "singularNoun",
"plural_noun": "pluralNoun",
"created_at": "createdAt",
});
});
/** @internal */
export const ObjectT$outboundSchema = z.object({
id: z.lazy(() => ObjectId$outboundSchema),
apiSlug: z.nullable(z.string()),
singularNoun: z.nullable(z.string()),
pluralNoun: z.nullable(z.string()),
createdAt: z.string(),
}).transform((v) => {
return remap$(v, {
apiSlug: "api_slug",
singularNoun: "singular_noun",
pluralNoun: "plural_noun",
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 ObjectT$;
(function (ObjectT$) {
/** @deprecated use `ObjectT$inboundSchema` instead. */
ObjectT$.inboundSchema = ObjectT$inboundSchema;
/** @deprecated use `ObjectT$outboundSchema` instead. */
ObjectT$.outboundSchema = ObjectT$outboundSchema;
})(ObjectT$ || (ObjectT$ = {}));
export function objectToJSON(objectT) {
return JSON.stringify(ObjectT$outboundSchema.parse(objectT));
}
export function objectFromJSON(jsonString) {
return safeParse(jsonString, (x) => ObjectT$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ObjectT' from JSON`);
}
//# sourceMappingURL=object.js.map