/* * 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 { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { AuditLogAction, AuditLogAction$inboundSchema, } from "./auditlogaction.js"; import { AuditLogEntryResource, AuditLogEntryResource$inboundSchema, } from "./auditlogentryresource.js"; import { AuditLogEntryUser, AuditLogEntryUser$inboundSchema, } from "./auditlogentryuser.js"; export type AuditLogEntry = { /** * Always `audit-log`. */ type: "audit-log"; /** * The ID for the audit log entry. */ id?: string | null | undefined; /** * The ID of the merchant account this entry was created for. */ merchantAccountId?: string | null | undefined; resource: AuditLogEntryResource; action: AuditLogAction; user: AuditLogEntryUser; /** * The date and time that the action was performed. */ timestamp: Date; }; /** @internal */ export const AuditLogEntry$inboundSchema: z.ZodType< AuditLogEntry, z.ZodTypeDef, unknown > = z.object({ type: z.literal("audit-log").default("audit-log"), id: z.nullable(z.string()).optional(), merchant_account_id: z.nullable(z.string()).optional(), resource: AuditLogEntryResource$inboundSchema, action: AuditLogAction$inboundSchema, user: AuditLogEntryUser$inboundSchema, timestamp: z.string().datetime({ offset: true }).transform(v => new Date(v)), }).transform((v) => { return remap$(v, { "merchant_account_id": "merchantAccountId", }); }); export function auditLogEntryFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AuditLogEntry$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AuditLogEntry' from JSON`, ); }