/* * 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"; /** * `INVALID` batch shipments cannot be purchased and will have to be removed, fixed, and added to the batch again.
* * @remarks * `VALID` batch shipments can be purchased.
* Batch shipments with the status `TRANSACTION_FAILED` were not able to be purchased and the error will be displayed on the message field
* `INCOMPLETE` batch shipments have an issue with the Address and will need to be removed, fixed, and added to the batch again. */ export const Status = { Invalid: "INVALID", Valid: "VALID", Incomplete: "INCOMPLETE", TransactionFailed: "TRANSACTION_FAILED", } as const; /** * `INVALID` batch shipments cannot be purchased and will have to be removed, fixed, and added to the batch again.
* * @remarks * `VALID` batch shipments can be purchased.
* Batch shipments with the status `TRANSACTION_FAILED` were not able to be purchased and the error will be displayed on the message field
* `INCOMPLETE` batch shipments have an issue with the Address and will need to be removed, fixed, and added to the batch again. */ export type Status = ClosedEnum; export type BatchShipment = { /** * Object ID of the carrier account to be used for this shipment (will override batch default) */ carrierAccount?: string | undefined; /** * A string of up to 100 characters that can be filled with any additional information you want * * @remarks * to attach to the object. */ metadata?: string | undefined; /** * A token that sets the shipping method for the batch, overriding the batch default. * * @remarks * Servicelevel tokens can be found in this list * or at this endpoint. */ servicelevelToken?: string | undefined; /** * List of Shipment and Transaction error messages. */ messages?: Array | undefined; /** * Object ID of this batch shipment. Can be used in the remove_shipments endpoint. */ objectId: string; /** * Object ID of the shipment object created for this batch shipment. */ shipment: string; /** * `INVALID` batch shipments cannot be purchased and will have to be removed, fixed, and added to the batch again.
* * @remarks * `VALID` batch shipments can be purchased.
* Batch shipments with the status `TRANSACTION_FAILED` were not able to be purchased and the error will be displayed on the message field
* `INCOMPLETE` batch shipments have an issue with the Address and will need to be removed, fixed, and added to the batch again. */ status: Status; /** * Object ID of the transaction object created for this batch shipment. */ transaction?: string | undefined; }; /** @internal */ export const Status$inboundSchema: z.ZodMiniEnum = z.enum( Status, ); /** @internal */ export const BatchShipment$inboundSchema: z.ZodMiniType< BatchShipment, unknown > = z.pipe( z.object({ carrier_account: z.optional(z.string()), metadata: z.optional(z.string()), servicelevel_token: z.optional(z.string()), messages: z.optional(z.array(z.any())), object_id: z.string(), shipment: z.string(), status: Status$inboundSchema, transaction: z.optional(z.string()), }), z.transform((v) => { return remap$(v, { "carrier_account": "carrierAccount", "servicelevel_token": "servicelevelToken", "object_id": "objectId", }); }), ); export function batchShipmentFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BatchShipment$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BatchShipment' from JSON`, ); }