/* * 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 { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Address, Address$inboundSchema, Address$Outbound, Address$outboundSchema, } from "./address.js"; import { CustomMappings, CustomMappings$inboundSchema, CustomMappings$Outbound, CustomMappings$outboundSchema, } from "./custommappings.js"; import { PassThroughBody, PassThroughBody$inboundSchema, PassThroughBody$Outbound, PassThroughBody$outboundSchema, } from "./passthroughbody.js"; import { SubsidiaryReference, SubsidiaryReference$inboundSchema, SubsidiaryReference$Outbound, SubsidiaryReference$outboundSchema, } from "./subsidiaryreference.js"; import { SubsidiaryReferenceInput, SubsidiaryReferenceInput$inboundSchema, SubsidiaryReferenceInput$Outbound, SubsidiaryReferenceInput$outboundSchema, } from "./subsidiaryreferenceinput.js"; /** * Based on the status some functionality is enabled or disabled. */ export const LocationStatus = { Active: "active", Inactive: "inactive", } as const; /** * Based on the status some functionality is enabled or disabled. */ export type LocationStatus = ClosedEnum; export type AccountingLocation = { /** * A unique identifier for an object. */ id?: string | undefined; /** * A unique identifier for an object. */ parentId?: string | null | undefined; /** * The name of the company. */ companyName?: string | null | undefined; /** * The display name of the location. */ displayName?: string | null | undefined; /** * Based on the status some functionality is enabled or disabled. */ status?: LocationStatus | undefined; addresses?: Array
| undefined; subsidiaries?: Array | undefined; /** * When custom mappings are configured on the resource, the result is included here. */ customMappings?: CustomMappings | 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; }; export type AccountingLocationInput = { /** * A unique identifier for an object. */ parentId?: string | null | undefined; /** * The name of the company. */ companyName?: string | null | undefined; /** * The display name of the location. */ displayName?: string | null | undefined; /** * Based on the status some functionality is enabled or disabled. */ status?: LocationStatus | undefined; addresses?: Array
| undefined; subsidiaries?: Array | 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 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 LocationStatus$inboundSchema: z.ZodNativeEnum< typeof LocationStatus > = z.nativeEnum(LocationStatus); /** @internal */ export const LocationStatus$outboundSchema: z.ZodNativeEnum< typeof LocationStatus > = LocationStatus$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace LocationStatus$ { /** @deprecated use `LocationStatus$inboundSchema` instead. */ export const inboundSchema = LocationStatus$inboundSchema; /** @deprecated use `LocationStatus$outboundSchema` instead. */ export const outboundSchema = LocationStatus$outboundSchema; } /** @internal */ export const AccountingLocation$inboundSchema: z.ZodType< AccountingLocation, z.ZodTypeDef, unknown > = z.object({ id: z.string().optional(), parent_id: z.nullable(z.string()).optional(), company_name: z.nullable(z.string()).optional(), display_name: z.nullable(z.string()).optional(), status: LocationStatus$inboundSchema.optional(), addresses: z.array(Address$inboundSchema).optional(), subsidiaries: z.array(SubsidiaryReference$inboundSchema).optional(), custom_mappings: z.nullable(CustomMappings$inboundSchema).optional(), row_version: z.nullable(z.string()).optional(), updated_by: z.nullable(z.string()).optional(), created_by: z.nullable(z.string()).optional(), updated_at: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), created_at: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), pass_through: z.array(PassThroughBody$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "parent_id": "parentId", "company_name": "companyName", "display_name": "displayName", "custom_mappings": "customMappings", "row_version": "rowVersion", "updated_by": "updatedBy", "created_by": "createdBy", "updated_at": "updatedAt", "created_at": "createdAt", "pass_through": "passThrough", }); }); /** @internal */ export type AccountingLocation$Outbound = { id?: string | undefined; parent_id?: string | null | undefined; company_name?: string | null | undefined; display_name?: string | null | undefined; status?: string | undefined; addresses?: Array | undefined; subsidiaries?: Array | undefined; custom_mappings?: CustomMappings$Outbound | null | undefined; row_version?: string | null | undefined; updated_by?: string | null | undefined; created_by?: string | null | undefined; updated_at?: string | null | undefined; created_at?: string | null | undefined; pass_through?: Array | undefined; }; /** @internal */ export const AccountingLocation$outboundSchema: z.ZodType< AccountingLocation$Outbound, z.ZodTypeDef, AccountingLocation > = z.object({ id: z.string().optional(), parentId: z.nullable(z.string()).optional(), companyName: z.nullable(z.string()).optional(), displayName: z.nullable(z.string()).optional(), status: LocationStatus$outboundSchema.optional(), addresses: z.array(Address$outboundSchema).optional(), subsidiaries: z.array(SubsidiaryReference$outboundSchema).optional(), customMappings: z.nullable(CustomMappings$outboundSchema).optional(), rowVersion: z.nullable(z.string()).optional(), updatedBy: z.nullable(z.string()).optional(), createdBy: z.nullable(z.string()).optional(), updatedAt: z.nullable(z.date().transform(v => v.toISOString())).optional(), createdAt: z.nullable(z.date().transform(v => v.toISOString())).optional(), passThrough: z.array(PassThroughBody$outboundSchema).optional(), }).transform((v) => { return remap$(v, { parentId: "parent_id", companyName: "company_name", displayName: "display_name", customMappings: "custom_mappings", rowVersion: "row_version", updatedBy: "updated_by", createdBy: "created_by", updatedAt: "updated_at", createdAt: "created_at", passThrough: "pass_through", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AccountingLocation$ { /** @deprecated use `AccountingLocation$inboundSchema` instead. */ export const inboundSchema = AccountingLocation$inboundSchema; /** @deprecated use `AccountingLocation$outboundSchema` instead. */ export const outboundSchema = AccountingLocation$outboundSchema; /** @deprecated use `AccountingLocation$Outbound` instead. */ export type Outbound = AccountingLocation$Outbound; } export function accountingLocationToJSON( accountingLocation: AccountingLocation, ): string { return JSON.stringify( AccountingLocation$outboundSchema.parse(accountingLocation), ); } export function accountingLocationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingLocation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingLocation' from JSON`, ); } /** @internal */ export const AccountingLocationInput$inboundSchema: z.ZodType< AccountingLocationInput, z.ZodTypeDef, unknown > = z.object({ parent_id: z.nullable(z.string()).optional(), company_name: z.nullable(z.string()).optional(), display_name: z.nullable(z.string()).optional(), status: LocationStatus$inboundSchema.optional(), addresses: z.array(Address$inboundSchema).optional(), subsidiaries: z.array(SubsidiaryReferenceInput$inboundSchema).optional(), row_version: z.nullable(z.string()).optional(), pass_through: z.array(PassThroughBody$inboundSchema).optional(), }).transform((v) => { return remap$(v, { "parent_id": "parentId", "company_name": "companyName", "display_name": "displayName", "row_version": "rowVersion", "pass_through": "passThrough", }); }); /** @internal */ export type AccountingLocationInput$Outbound = { parent_id?: string | null | undefined; company_name?: string | null | undefined; display_name?: string | null | undefined; status?: string | undefined; addresses?: Array | undefined; subsidiaries?: Array | undefined; row_version?: string | null | undefined; pass_through?: Array | undefined; }; /** @internal */ export const AccountingLocationInput$outboundSchema: z.ZodType< AccountingLocationInput$Outbound, z.ZodTypeDef, AccountingLocationInput > = z.object({ parentId: z.nullable(z.string()).optional(), companyName: z.nullable(z.string()).optional(), displayName: z.nullable(z.string()).optional(), status: LocationStatus$outboundSchema.optional(), addresses: z.array(Address$outboundSchema).optional(), subsidiaries: z.array(SubsidiaryReferenceInput$outboundSchema).optional(), rowVersion: z.nullable(z.string()).optional(), passThrough: z.array(PassThroughBody$outboundSchema).optional(), }).transform((v) => { return remap$(v, { parentId: "parent_id", companyName: "company_name", displayName: "display_name", rowVersion: "row_version", passThrough: "pass_through", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AccountingLocationInput$ { /** @deprecated use `AccountingLocationInput$inboundSchema` instead. */ export const inboundSchema = AccountingLocationInput$inboundSchema; /** @deprecated use `AccountingLocationInput$outboundSchema` instead. */ export const outboundSchema = AccountingLocationInput$outboundSchema; /** @deprecated use `AccountingLocationInput$Outbound` instead. */ export type Outbound = AccountingLocationInput$Outbound; } export function accountingLocationInputToJSON( accountingLocationInput: AccountingLocationInput, ): string { return JSON.stringify( AccountingLocationInput$outboundSchema.parse(accountingLocationInput), ); } export function accountingLocationInputFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountingLocationInput$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingLocationInput' from JSON`, ); }