/* * 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$ } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Currency, Currency$outboundSchema } from "./currency.js"; import { CustomField, CustomField$Outbound, CustomField$outboundSchema, } from "./customfield.js"; import { ExpenseLineItemInput, ExpenseLineItemInput$Outbound, ExpenseLineItemInput$outboundSchema, } from "./expenselineiteminput.js"; import { LinkedDepartmentInput, LinkedDepartmentInput$Outbound, LinkedDepartmentInput$outboundSchema, } from "./linkeddepartmentinput.js"; import { LinkedFinancialAccountInput, LinkedFinancialAccountInput$Outbound, LinkedFinancialAccountInput$outboundSchema, } from "./linkedfinancialaccount.js"; import { LinkedLocationInput, LinkedLocationInput$Outbound, LinkedLocationInput$outboundSchema, } from "./linkedlocationinput.js"; import { LinkedSupplierInput, LinkedSupplierInput$Outbound, LinkedSupplierInput$outboundSchema, } from "./linkedsupplierinput.js"; import { LinkedTaxRateInput, LinkedTaxRateInput$Outbound, LinkedTaxRateInput$outboundSchema, } from "./linkedtaxrateinput.js"; import { LinkedTrackingCategory, LinkedTrackingCategory$Outbound, LinkedTrackingCategory$outboundSchema, } from "./linkedtrackingcategory.js"; import { PassThroughBody, PassThroughBody$Outbound, PassThroughBody$outboundSchema, } from "./passthroughbody.js"; /** * The type of payment for the expense. */ export const ExpenseUpdateInputPaymentType = { Cash: "cash", Check: "check", CreditCard: "credit_card", Other: "other", } as const; /** * The type of payment for the expense. */ export type ExpenseUpdateInputPaymentType = OpenEnum< typeof ExpenseUpdateInputPaymentType >; /** * The type of expense. */ export const ExpenseUpdateInputExpenseType = { Expense: "expense", Refund: "refund", } as const; /** * The type of expense. */ export type ExpenseUpdateInputExpenseType = OpenEnum< typeof ExpenseUpdateInputExpenseType >; /** * Expense status */ export const ExpenseUpdateInputStatus = { Draft: "draft", Posted: "posted", Voided: "voided", } as const; /** * Expense status */ export type ExpenseUpdateInputStatus = OpenEnum< typeof ExpenseUpdateInputStatus >; /** * The writable shape of Expense for a single-record update. Identical to the model with the read-only properties removed and no required properties, because PATCH is partial and the API already validates it that way. */ export type ExpenseUpdateInput = { /** * Id to be displayed. */ displayId?: string | null | undefined; /** * Number. */ number?: string | null | undefined; /** * The date of the transaction - YYYY:MM::DDThh:mm:ss.sTZD */ transactionDate?: Date | null | undefined; /** * The unique identifier for the ledger account that this expense should be credited to. Deprecated, use account instead. * * @deprecated field: Deprecated. Use account instead.. */ accountId?: string | undefined; /** * A flexible account reference that can represent a ledger account (GL account), a bank account, or an employee payable account, depending on the connector's requirements. */ account?: LinkedFinancialAccountInput | null | undefined; /** * The ID of the supplier this entity is linked to. Deprecated, use supplier instead. * * @deprecated field: Deprecated. Use supplier instead.. */ supplierId?: string | undefined; /** * The supplier this entity is linked to. */ supplier?: LinkedSupplierInput | null | undefined; /** * The company ID the transaction belongs to */ companyId?: string | null | undefined; location?: LinkedLocationInput | null | undefined; /** * The ID of the department */ departmentId?: string | null | undefined; department?: LinkedDepartmentInput | null | undefined; /** * The type of payment for the expense. */ paymentType?: ExpenseUpdateInputPaymentType | null | undefined; /** * Indicates the associated currency for an amount of money. Values correspond to [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217). */ currency?: Currency | null | undefined; /** * Currency Exchange Rate at the time entity was recorded/generated. */ currencyRate?: number | null | undefined; /** * The type of expense. */ type?: ExpenseUpdateInputExpenseType | null | undefined; /** * The memo of the expense. */ memo?: string | null | undefined; taxRate?: LinkedTaxRateInput | undefined; /** * Amounts are including tax */ taxInclusive?: boolean | null | undefined; /** * Subtotal amount, normally before tax. */ subTotal?: number | null | undefined; /** * Total tax amount applied to this transaction. */ totalTax?: number | null | undefined; /** * The total amount of the expense line item. */ totalAmount?: number | null | undefined; /** * A list of linked tracking categories. */ trackingCategories?: Array | null | undefined; /** * Expense line items linked to this expense. */ lineItems?: Array | undefined; /** * Optional reference identifier for the transaction. */ reference?: string | null | undefined; /** * URL link to a source document - shown as 'Go to [appName]' in the downstream app. Currently only supported for Xero. */ sourceDocumentUrl?: string | null | undefined; customFields?: Array | undefined; /** * Expense status */ status?: ExpenseUpdateInputStatus | 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 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 ExpenseUpdateInputPaymentType$outboundSchema: z.ZodType< string, z.ZodTypeDef, ExpenseUpdateInputPaymentType > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(ExpenseUpdateInputPaymentType) ); /** @internal */ export const ExpenseUpdateInputExpenseType$outboundSchema: z.ZodType< string, z.ZodTypeDef, ExpenseUpdateInputExpenseType > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(ExpenseUpdateInputExpenseType) ); /** @internal */ export const ExpenseUpdateInputStatus$outboundSchema: z.ZodType< string, z.ZodTypeDef, ExpenseUpdateInputStatus > = /* @__PURE__ */ lazySchema$(() => openEnums.outboundSchema(ExpenseUpdateInputStatus) ); /** @internal */ export type ExpenseUpdateInput$Outbound = { display_id?: string | null | undefined; number?: string | null | undefined; transaction_date?: string | null | undefined; account_id?: string | undefined; account?: LinkedFinancialAccountInput$Outbound | null | undefined; supplier_id?: string | undefined; supplier?: LinkedSupplierInput$Outbound | null | undefined; company_id?: string | null | undefined; location?: LinkedLocationInput$Outbound | null | undefined; department_id?: string | null | undefined; department?: LinkedDepartmentInput$Outbound | null | undefined; payment_type?: string | null | undefined; currency?: string | null | undefined; currency_rate?: number | null | undefined; type?: string | null | undefined; memo?: string | null | undefined; tax_rate?: LinkedTaxRateInput$Outbound | undefined; tax_inclusive?: boolean | null | undefined; sub_total?: number | null | undefined; total_tax?: number | null | undefined; total_amount?: number | null | undefined; tracking_categories?: | Array | null | undefined; line_items?: Array | undefined; reference?: string | null | undefined; source_document_url?: string | null | undefined; custom_fields?: Array | undefined; status?: string | null | undefined; row_version?: string | null | undefined; pass_through?: Array | undefined; }; /** @internal */ export const ExpenseUpdateInput$outboundSchema: z.ZodType< ExpenseUpdateInput$Outbound, z.ZodTypeDef, ExpenseUpdateInput > = /* @__PURE__ */ lazySchema$(() => z.object({ displayId: z.nullable(z.string()).optional(), number: z.nullable(z.string()).optional(), transactionDate: z.nullable(z.date().transform(v => v.toISOString())) .optional(), accountId: z.string().optional(), account: z.nullable(LinkedFinancialAccountInput$outboundSchema).optional(), supplierId: z.string().optional(), supplier: z.nullable(LinkedSupplierInput$outboundSchema).optional(), companyId: z.nullable(z.string()).optional(), location: z.nullable(LinkedLocationInput$outboundSchema).optional(), departmentId: z.nullable(z.string()).optional(), department: z.nullable(LinkedDepartmentInput$outboundSchema).optional(), paymentType: z.nullable(ExpenseUpdateInputPaymentType$outboundSchema) .optional(), currency: z.nullable(Currency$outboundSchema).optional(), currencyRate: z.nullable(z.number()).optional(), type: z.nullable(ExpenseUpdateInputExpenseType$outboundSchema).optional(), memo: z.nullable(z.string()).optional(), taxRate: LinkedTaxRateInput$outboundSchema.optional(), taxInclusive: z.nullable(z.boolean()).optional(), subTotal: z.nullable(z.number()).optional(), totalTax: z.nullable(z.number()).optional(), totalAmount: z.nullable(z.number()).optional(), trackingCategories: z.nullable( z.array(z.nullable(LinkedTrackingCategory$outboundSchema)), ).optional(), lineItems: z.array(ExpenseLineItemInput$outboundSchema).optional(), reference: z.nullable(z.string()).optional(), sourceDocumentUrl: z.nullable(z.string()).optional(), customFields: z.array(CustomField$outboundSchema).optional(), status: z.nullable(ExpenseUpdateInputStatus$outboundSchema).optional(), rowVersion: z.nullable(z.string()).optional(), passThrough: z.array(PassThroughBody$outboundSchema).optional(), }).transform((v) => { return remap$(v, { displayId: "display_id", transactionDate: "transaction_date", accountId: "account_id", supplierId: "supplier_id", companyId: "company_id", departmentId: "department_id", paymentType: "payment_type", currencyRate: "currency_rate", taxRate: "tax_rate", taxInclusive: "tax_inclusive", subTotal: "sub_total", totalTax: "total_tax", totalAmount: "total_amount", trackingCategories: "tracking_categories", lineItems: "line_items", sourceDocumentUrl: "source_document_url", customFields: "custom_fields", rowVersion: "row_version", passThrough: "pass_through", }); }) ); export function expenseUpdateInputToJSON( expenseUpdateInput: ExpenseUpdateInput, ): string { return JSON.stringify( ExpenseUpdateInput$outboundSchema.parse(expenseUpdateInput), ); }