attio-js
Version:
Developer-friendly & type-safe JS/TS SDK based on the official OpenAPI spec of Attio.
98 lines • 3.38 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 StatusId$inboundSchema = z.object({
workspace_id: z.string(),
object_id: z.string(),
attribute_id: z.string(),
status_id: z.string(),
}).transform((v) => {
return remap$(v, {
"workspace_id": "workspaceId",
"object_id": "objectId",
"attribute_id": "attributeId",
"status_id": "statusId",
});
});
/** @internal */
export const StatusId$outboundSchema = z.object({
workspaceId: z.string(),
objectId: z.string(),
attributeId: z.string(),
statusId: z.string(),
}).transform((v) => {
return remap$(v, {
workspaceId: "workspace_id",
objectId: "object_id",
attributeId: "attribute_id",
statusId: "status_id",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export var StatusId$;
(function (StatusId$) {
/** @deprecated use `StatusId$inboundSchema` instead. */
StatusId$.inboundSchema = StatusId$inboundSchema;
/** @deprecated use `StatusId$outboundSchema` instead. */
StatusId$.outboundSchema = StatusId$outboundSchema;
})(StatusId$ || (StatusId$ = {}));
export function statusIdToJSON(statusId) {
return JSON.stringify(StatusId$outboundSchema.parse(statusId));
}
export function statusIdFromJSON(jsonString) {
return safeParse(jsonString, (x) => StatusId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'StatusId' from JSON`);
}
/** @internal */
export const Status$inboundSchema = z
.object({
id: z.lazy(() => StatusId$inboundSchema),
title: z.string(),
is_archived: z.boolean(),
celebration_enabled: z.boolean(),
target_time_in_status: z.nullable(z.string()),
}).transform((v) => {
return remap$(v, {
"is_archived": "isArchived",
"celebration_enabled": "celebrationEnabled",
"target_time_in_status": "targetTimeInStatus",
});
});
/** @internal */
export const Status$outboundSchema = z.object({
id: z.lazy(() => StatusId$outboundSchema),
title: z.string(),
isArchived: z.boolean(),
celebrationEnabled: z.boolean(),
targetTimeInStatus: z.nullable(z.string()),
}).transform((v) => {
return remap$(v, {
isArchived: "is_archived",
celebrationEnabled: "celebration_enabled",
targetTimeInStatus: "target_time_in_status",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export var Status$;
(function (Status$) {
/** @deprecated use `Status$inboundSchema` instead. */
Status$.inboundSchema = Status$inboundSchema;
/** @deprecated use `Status$outboundSchema` instead. */
Status$.outboundSchema = Status$outboundSchema;
})(Status$ || (Status$ = {}));
export function statusToJSON(status) {
return JSON.stringify(Status$outboundSchema.parse(status));
}
export function statusFromJSON(jsonString) {
return safeParse(jsonString, (x) => Status$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Status' from JSON`);
}
//# sourceMappingURL=status.js.map