/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Represents the status of a managed bank feed sync. */ export type SyncStatusResult = { /** * The unique identifier for the sync. */ syncId: string; /** * The ID of the client associated with the company that owns the source bank account. */ clientId: string; /** * The ID of the company that owns the source bank account. */ companyId: string; /** * The name of the company that owns the source bank account. */ companyName: string; /** * The ID of the target accounting data connection. */ dataConnectionId: string; /** * The ID of the source bank account from which transactions are fetched. */ sourceAccountId: string; /** * The start of the sync period. */ periodStartUtc: Date; /** * The end of the sync period. */ periodEndUtc: Date; /** * The UTC timestamp when the sync started executing. */ executionStartUtc: Date; /** * The current status of the sync. Known values are `Started`, `Failed`, `SuccessDataPushed`, `SuccessNoDataPushed`, `PartialSuccessDataPushed`. */ status: string; /** * The UTC timestamp when the sync execution ended, if completed (i.e. `status` is any value other than `Started`). */ executionEndUtc?: Date | null | undefined; /** * Error message if the sync failed. */ errorMessage?: string | null | undefined; /** * Error code if the sync failed. */ errorCode?: string | null | undefined; /** * List of write operation keys associated with the sync, if the sync resulted in write attempts. */ pushOperationKeys?: Array | null | undefined; }; /** @internal */ export const SyncStatusResult$inboundSchema: z.ZodType< SyncStatusResult, z.ZodTypeDef, unknown > = z.object({ syncId: z.string(), clientId: z.string(), companyId: z.string(), companyName: z.string(), dataConnectionId: z.string(), sourceAccountId: z.string(), periodStartUtc: z.string().datetime({ offset: true }).transform(v => new Date(v) ), periodEndUtc: z.string().datetime({ offset: true }).transform(v => new Date(v) ), executionStartUtc: z.string().datetime({ offset: true }).transform(v => new Date(v) ), status: z.string(), executionEndUtc: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), errorMessage: z.nullable(z.string()).optional(), errorCode: z.nullable(z.string()).optional(), pushOperationKeys: z.nullable(z.array(z.string())).optional(), }); export function syncStatusResultFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SyncStatusResult$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SyncStatusResult' from JSON`, ); }