/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; 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"; /** * Indicates the status of the manifest. */ export const ManifestStatus = { Queued: "QUEUED", Success: "SUCCESS", Error: "ERROR", } as const; /** * Indicates the status of the manifest. */ export type ManifestStatus = ClosedEnum; export type Manifest = { /** * ID of carrier account */ carrierAccount: string; /** * All shipments to be submitted on this day will be closed out. * * @remarks * Must be in the format `2014-01-18T00:35:03.463Z` (ISO 8601 date). */ shipmentDate: string; /** * IDs transactions to use. If you set this to null or not send this parameter, * * @remarks * Shippo will automatically assign all applicable transactions. */ transactions?: Array | undefined; /** * ID of the Address object that should be used as pickup address for the scan form. * * @remarks * The USPS will validate this address before creating the scan form. */ addressFrom: string; /** * An array containing the URLs to all returned manifest documents. */ documents: Array; /** * An array of codes and messages describing the error that occurred if any. */ errors?: Array | undefined; /** * Date and time of object creation. */ objectCreated: Date; /** * Unique identifier of the given object. */ objectId: string; /** * Username of the user who created the object. */ objectOwner: string; /** * Date and time of last object update. */ objectUpdated: Date; /** * Indicates the status of the manifest. */ status: ManifestStatus; }; /** @internal */ export const ManifestStatus$inboundSchema: z.ZodMiniEnum< typeof ManifestStatus > = z.enum(ManifestStatus); /** @internal */ export const Manifest$inboundSchema: z.ZodMiniType = z.pipe( z.object({ carrier_account: z.string(), shipment_date: z.string(), transactions: z.optional(z.array(z.string())), address_from: z.string(), documents: z.array(z.string()), errors: z.optional(z.array(z.string())), object_created: z.pipe( z.iso.datetime({ offset: true }), z.transform(v => new Date(v)), ), object_id: z.string(), object_owner: z.string(), object_updated: z.pipe( z.iso.datetime({ offset: true }), z.transform(v => new Date(v)), ), status: ManifestStatus$inboundSchema, }), z.transform((v) => { return remap$(v, { "carrier_account": "carrierAccount", "shipment_date": "shipmentDate", "address_from": "addressFrom", "object_created": "objectCreated", "object_id": "objectId", "object_owner": "objectOwner", "object_updated": "objectUpdated", }); }), ); export function manifestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Manifest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Manifest' from JSON`, ); }