/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { lazySchema as lazySchema$, safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { PassThroughBody, PassThroughBody$inboundSchema, } from "./passthroughbody.js"; /** * The type of the category. */ export const CategoryType = { Supplier: "supplier", Expense: "expense", Revenue: "revenue", Customer: "customer", } as const; /** * The type of the category. */ export type CategoryType = OpenEnum; /** * Based on the status some functionality is enabled or disabled. */ export const CategoryStatus = { Active: "active", Inactive: "inactive", } as const; /** * Based on the status some functionality is enabled or disabled. */ export type CategoryStatus = OpenEnum; export type Category = { /** * A unique identifier for an object. */ id?: string | undefined; /** * The name of the category. */ name?: string | undefined; /** * Display ID of the category */ displayId?: string | null | undefined; /** * The type of the category. */ type?: CategoryType | undefined; /** * Based on the status some functionality is enabled or disabled. */ status?: CategoryStatus | undefined; /** * When custom mappings are configured on the resource, the result is included here. */ customMappings?: { [k: string]: any } | null | undefined; /** * A binary value used to detect updates to a object and prevent data conflicts. It is incremented each time an update is made to the object. */ rowVersion?: string | null | undefined; /** * The user who last updated the object. */ updatedBy?: string | null | undefined; /** * The user who created the object. */ createdBy?: string | null | undefined; /** * The date and time when the object was last updated. */ updatedAt?: Date | null | undefined; /** * The date and time when the object was created. */ createdAt?: Date | null | undefined; /** * The pass_through property allows passing service-specific, custom data or structured modifications in request body when creating or updating resources. */ passThrough?: Array | undefined; }; /** @internal */ export const CategoryType$inboundSchema: z.ZodType< CategoryType, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(CategoryType)); /** @internal */ export const CategoryStatus$inboundSchema: z.ZodType< CategoryStatus, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => openEnums.inboundSchema(CategoryStatus)); /** @internal */ export const Category$inboundSchema: z.ZodType< Category, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), name: types.optional(types.string()), display_id: z.nullable(types.string()).optional(), type: types.optional(CategoryType$inboundSchema), status: types.optional(CategoryStatus$inboundSchema), custom_mappings: z.nullable(z.record(z.any())).optional(), row_version: z.nullable(types.string()).optional(), updated_by: z.nullable(types.string()).optional(), created_by: z.nullable(types.string()).optional(), updated_at: z.nullable(types.date()).optional(), created_at: z.nullable(types.date()).optional(), pass_through: types.optional(z.array(PassThroughBody$inboundSchema)), }).transform((v) => { return remap$(v, { "display_id": "displayId", "custom_mappings": "customMappings", "row_version": "rowVersion", "updated_by": "updatedBy", "created_by": "createdBy", "updated_at": "updatedAt", "created_at": "createdAt", "pass_through": "passThrough", }); }) ); export function categoryFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Category$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Category' from JSON`, ); }