import {z} from 'zod' export type DesiredDeliveryDateOptions = {exactDateDelivery?: boolean | undefined}; export type AddressLineComponents = {streetName?: string | undefined, primaryAddressNumber?: string | undefined, secondaryAddressNumber?: string | undefined, district?: string | undefined, neighborhood?: string | undefined}; export type CSAddress = {name?: string | undefined, phoneNumber?: string | undefined, phoneNumberCountryCode?: string | undefined, emailAddress?: string | undefined, company?: string | undefined, street1?: string | undefined, street2?: string | undefined, city?: string | undefined, state?: string | undefined, countryCode: string, postalCode: string, addressType?: ('commercial' | 'residential') | undefined, addressLineComponents?: AddressLineComponents | undefined}; export type Tip = {type?: ('FIXED' | 'PERCENTAGE') | undefined, value?: number | undefined, currency?: string | undefined}; export type LastMileDeliveryOptions = {deliveryInstruction?: ('LEAVE_AT_DOOR' | 'MEET_AT_DOOR') | undefined, undeliverableInstruction?: ('LEAVE_AT_DOOR' | 'RETURN' | 'DESTROY') | undefined, tip?: Tip | undefined, tipForLabelCreate?: Tip | undefined, deliverableActionForLabelCreate?: ('RETURN' | 'LEAVE_AT_DOOR' | 'DISCARD' | 'MEET_AT_DOOR') | undefined, undeliverableActionForLabelCreate?: ('RETURN' | 'LEAVE_AT_DOOR' | 'DISCARD' | 'MEET_AT_DOOR') | undefined}; export type TimeWindow = {startWindow: string, endWindow: string, timeZone?: string | undefined}; export type InvoicePrePaidAmount = {value?: number | undefined, currencyCode?: string | undefined}; export type WindsorFrameworkInfo = {atRisk?: boolean | undefined}; export type EuropeanUnionInfo = {vendorIossNumber?: string | undefined, vendorIossAddress?: CSAddress | undefined, windsorFramework?: WindsorFrameworkInfo | undefined}; export type ExportReturnInfo = {originalExportDate?: string | undefined, originalExportTrackingId?: string | undefined, originalOutboundCarrier?: string | undefined}; export type ElectronicExportInformation = {exportDate?: string | undefined, pointOfOrigin?: string | undefined}; export type Weight = {weightUnit?: ('g' | 'kg' | 'oz' | 'lb') | undefined, weight?: number | undefined}; export type StandardizedProductId = {type?: ('GTIN' | 'EAN' | 'UPC' | 'ISBN' | 'unknown') | undefined, value?: string | undefined}; export type ScheduleBInformation = {scheduleBNumber: string, scheduleBQuantity: number, scheduleBUnitOfMeasurement: 'barrels' | 'carat' | 'content_kilogram' | 'square_centimeter' | 'content_ton' | 'curie' | 'clean_yield_kilogram' | 'dozen' | 'dozen_pieces' | 'dozen_pairs' | 'fiber_meter' | 'gross_container' | 'gram' | 'gross' | 'hundred' | 'kilogram' | 'cubic_kilometer' | 'kilogram_total_sugars' | 'liter' | 'meter' | 'square_meter' | 'cubic_meter' | 'millicurie' | 'number' | 'pieces' | 'proof_liter' | 'pack' | 'pairs' | 'running_bales' | 'square' | 'ton' | 'thousand' | 'no_quantity_required' | 'unknown'}; export type ExportLicense = {licenseNumber: string, licenseLineValue: number, licenseExpiration: string}; export type ExportLicenseInformation = {licenseType: string, licenseExemptionCode?: string | undefined, exportLicense?: ExportLicense | undefined}; export type ElectronicExportCommodityInformation = {exportType: 'domestic' | 'foreign' | 'unknown', exportInformationCode: string, scheduleBInformation: ScheduleBInformation, eccnNumber: string, exportLicenseInformation: ExportLicenseInformation}; export type CpscCertificateOfCompliance = {filingMode: 'FULL' | 'REFERENCE', cpscProductId?: string | undefined, applicableCpscRules?: Array | undefined, dateOfManufacture?: string | undefined, manufacturerName?: string | undefined, manufacturerAddress?: CSAddress | undefined, lastComplianceTestingDate?: string | undefined, testingLabName?: string | undefined, testingLabAddress?: CSAddress | undefined, testingLabContactInfo?: string | undefined, importerRecordKeeperContact?: string | undefined, registryProductId?: string | undefined, registryVersionId?: string | undefined, registryCertifierId?: string | undefined}; export type CustomsItemData = {customsValue?: number | undefined, customsValueCurrency?: string | undefined, commodityDescription?: string | undefined, countryOfManufacture?: string | undefined, customsWeight?: Weight | undefined, quantity?: number | undefined, productId?: string | undefined, standardizedProductIds?: Array | undefined, manufacturerProductId?: string | undefined, quantityUnitOfMeasurement?: ('bag' | 'barrel' | 'box' | 'case_of_goods' | 'container' | 'crate' | 'cylinder' | 'envelope' | 'pallet' | 'piece' | 'roll' | 'tube' | 'unknown') | undefined, harmonizedTariffNumber?: string | undefined, importHarmonizedTariffNumber?: string | undefined, commodityPartNumber?: string | undefined, marksAndNumbers?: string | undefined, electronicExportCommodityInformation?: ElectronicExportCommodityInformation | undefined, b13AFilingOption?: ('NOT_REQUIRED' | 'MANUALLY_ATTACHED' | 'FILED_ELECTRONICALLY' | 'SUMMARY_REPORTING' | 'CARRIER_TO_STAMP' | 'UNKNOWN') | undefined, exportComplianceStatement?: string | undefined, cpscCertificateOfCompliance?: CpscCertificateOfCompliance | undefined}; export type RequestTaxIdentificationNumber = {number?: string | undefined, tinType?: ('PERSONAL_NATIONAL' | 'PERSONAL_STATE' | 'FEDERAL' | 'BUSINESS_NATIONAL' | 'BUSINESS_STATE' | 'BUSINESS_UNION') | undefined}; export type ImporterOfRecord = {importerAddress?: CSAddress | undefined, accountNumber?: string | undefined, taxIdentificationNumbers?: Array | undefined}; export type Broker = {brokerAddress?: CSAddress | undefined, accountNumber?: string | undefined, taxIdentificationNumbers?: Array | undefined, deliveryInstructions?: string | undefined, type?: ('IMPORT' | 'EXPORT') | undefined}; export type SoldTo = {address?: CSAddress | undefined, accountNumber?: string | undefined, taxIdentificationNumbers?: Array | undefined}; export type RequestCustomsInfo = {totalCustomsValue?: number | undefined, totalCustomsValueCurrency?: string | undefined, customsDescription?: string | undefined, reasonForExport?: ('sale' | 'gift' | 'sample' | 'returns' | 'personal_effects' | 'unknown') | undefined, businessIndicator?: ('B2C' | 'B2B' | 'unknown') | undefined, invoiceDate?: string | undefined, invoiceNumber?: string | undefined, invoicePrePaidAmount?: InvoicePrePaidAmount | undefined, europeanUnionInfo?: EuropeanUnionInfo | undefined, exportReturnInfo?: ExportReturnInfo | undefined, ultimateConsigneeAddress?: CSAddress | undefined, ultimateConsigneeType?: ('direct_consumer' | 'government_entity' | 'reseller' | 'unknown') | undefined, aesInternalTransactionNumber?: string | undefined, electronicExportInformation?: ElectronicExportInformation | undefined, b13AFilingOption?: ('NOT_REQUIRED' | 'MANUALLY_ATTACHED' | 'FILED_ELECTRONICALLY' | 'SUMMARY_REPORTING' | 'CARRIER_TO_STAMP' | 'UNKNOWN') | undefined, exportComplianceStatement?: string | undefined, permitNumber?: string | undefined, customsItems?: Array | undefined, incoterm?: ('DDP' | 'DDU' | 'DAP' | 'DPU' | 'FCA' | 'CPT' | 'FOB' | 'EXW') | undefined, declarationStatement?: string | undefined, taxIdentificationNumber?: string | undefined, importerOfRecord?: ImporterOfRecord | undefined, brokers?: Array | undefined, soldTo?: SoldTo | undefined}; export type EmergencyResponseInfo = {phoneNumber?: string | undefined, contactName?: string | undefined, contractNumber?: string | undefined}; export type HazmatInfo = {category: 'defined' | 'aerosols_flammable' | 'contains_lithium_ion' | 'packaged_lithium_ion' | 'lithium_ion_battery_only' | 'contains_lithium_metal' | 'packaged_lithium_metal' | 'lithium_metal_battery_only' | 'dry_ice', quantity: number, quantityType: 'gross' | 'net', quantityUnits: 'g' | 'kg' | 'lb' | 'oz' | 'ml' | 'l' | 'gal', containerType: 'fiberboard_box' | 'wooden_box' | 'plastic_jerrican' | 'metal_box' | 'steel_drum' | 'other' | 'plastic_box' | 'plastic_drum' | 'styrofoam_box' | 'cylinder' | 'envirotainer' | 'plywood_box' | 'aluminum_drum' | 'aluminum_cylinder' | 'plastic_pail' | 'plywood_drum' | 'fiber_drum' | 'steel_jerrican' | 'aluminum_jerrican' | 'steel_box' | 'carton' | 'aluminum_box', hazmatId?: string | undefined, properShippingName?: string | undefined, packingGroup?: ('I' | 'II' | 'III') | undefined, transportMode?: ('ground' | 'passenger_and_cargo_aircraft' | 'cargo_aircraft_only') | undefined, packingInstructionCode?: string | undefined, hazardClass?: ('class_1_explosive' | 'class_2_flammable_gas' | 'class_3_flammable_liquid' | 'class_4_flammable_solid' | 'class_5_organic_peroxide' | 'class_6_poisonous_material' | 'class_7_radioactive' | 'class_8_corrosive_material' | 'class_9_miscellaneous' | 'forbidden' | 'other') | undefined, subsidiaryClasses?: Array | undefined, numberOfInnerPackagings?: number | undefined, innerPackagingType?: string | undefined, outerPackagingType?: string | undefined, shipperDeclarationStatement?: ('FDG' | 'LQ_air' | 'EQ' | 'small_battery_air' | 'small_battery_ground' | 'cargo_aircraft_only') | undefined, wattHours?: number | undefined, lithiumContent?: number | undefined, numberOfCells?: number | undefined, numberOfBatteries?: number | undefined, batteryConfiguration?: ('contained_in_equipment' | 'packed_with_equipment' | 'standalone') | undefined}; export type OrderItem = {orderItemReferenceIdentifier?: string | undefined, shipiumOrderId?: string | undefined, partnerOrderId?: string | undefined, hazmat?: boolean | undefined, hazmatInfo?: HazmatInfo | undefined, productTaxCode?: string | undefined, nmfcCode?: string | undefined, nmfcFreightClass?: string | undefined, deliveryEstimateId?: string | undefined, productId: string, quantity: number, productDetails?: Array | undefined, itemWeight?: Weight | undefined, productDescription?: string | undefined, serialNumbers?: Array | undefined}; export type LinearDimensions = {linearUnit?: ('in' | 'cm') | undefined, length?: number | undefined, width?: number | undefined, height?: number | undefined}; export type PackagingTypeParameters = {packagingMaterial?: ('box' | 'envelope' | 'flat_pack' | 'fedex_one_rate_envelope' | 'fedex_one_rate_pak' | 'fedex_one_rate_extra_small_box' | 'fedex_one_rate_small_box' | 'fedex_one_rate_medium_box' | 'fedex_one_rate_large_box' | 'fedex_one_rate_extra_large_box' | 'fedex_one_rate_tube' | 'fedex_ten_kg_box' | 'fedex_twenty_five_kg_box' | 'mailing_tube' | 'parcel_pallet' | 'small_tire' | 'large_tire' | 'usps_large_box' | 'usps_large_box_to_apo_fpo_dpo' | 'usps_medium_box' | 'usps_small_box' | 'usps_legal_envelope' | 'usps_envelope' | 'usps_padded_envelope' | 'ups_express_envelope') | undefined, packagingSizeName?: string | undefined, packagingTypeId?: string | undefined, linearDimensions?: LinearDimensions | undefined, packagingWeight?: Weight | undefined}; export type DeclaredValue = {declaredValue?: number | undefined, currencyCode?: string | undefined}; export type MultiParcelShipmentPackageParameters = {packageReferenceIdentifier: string, partnerProvidedPackageId?: string | undefined, orderItemQuantities: Array, packagingType?: PackagingTypeParameters | undefined, totalWeight?: Weight | undefined, totalDeclaredValue?: DeclaredValue | undefined, deliveredDateTime?: string | undefined}; export type ThirdPartyBillingCredentials = {accountNumber?: string | undefined, countryCode?: string | undefined, postalCode?: string | undefined}; export type ThirdPartyBillingAccounts = {carrierId: string, thirdPartyBillingCredentials: ThirdPartyBillingCredentials, billThirdPartyForShippingCost?: boolean | undefined, billThirdPartyDutiesAndTaxes?: boolean | undefined}; export type CarrierCollectBilling = {accountNumber?: string | undefined, collectBillingAddress?: CSAddress | undefined}; export type ConfigurationOverrides = {maximumAdditionalDaysToHold?: number | undefined, labelToDockDoorHours?: number | undefined}; export type PayorAccountCredentials = {accountNumber?: string | undefined, accountCountryCode?: string | undefined, accountPostalCode?: string | undefined}; export type RegistrationInformation = {typeCode?: ('VAT' | 'EIN' | 'GST' | 'SSN' | 'EOR' | 'DUN' | 'FED' | 'STA' | 'CNP' | 'IE' | 'INN' | 'KPP' | 'OGR' | 'OKP' | 'MRN' | 'SDT' | 'FTZ' | 'DAN' | 'TAN' | 'DTF' | 'RGP' | 'DLI' | 'NID' | 'PAS' | 'MID' | 'IMS' | 'EIC') | undefined, registrationNumber?: string | undefined, issuerCountryCode?: string | undefined}; export type UspsInformation = {customerRegistrationId?: string | undefined, mailerId?: string | undefined, manifest?: string | undefined, permitNumber?: string | undefined, permitPostalCode?: string | undefined}; export type AdditionalCarrierSpecificInformation = {usps?: UspsInformation | undefined}; export type PayorAccounts = {accountType: 'consignee' | 'collect' | 'third_party' | 'recipient' | 'sender', carrierId?: string | undefined, payorAccountCredentials: PayorAccountCredentials, payorAccountAddress?: CSAddress | undefined, registrationInformation?: RegistrationInformation | undefined, additionalCarrierSpecificInformation?: AdditionalCarrierSpecificInformation | undefined, billForShippingCost?: boolean | undefined, billDutiesAndTaxes?: boolean | undefined}; export type DocumentGenerationRequest = {documentBlueprintId?: string | undefined}; export type MultiParcelShipmentParameters = {partnerShipmentId?: string | undefined, orderedDateTime?: string | undefined, shippedDateTime?: string | undefined, desiredDeliveryDate?: string | undefined, preferredCarrierDeliveryDateTime?: string | undefined, desiredDeliveryDateOptions?: DesiredDeliveryDateOptions | undefined, businessDaysOfTransit?: number | undefined, ignoreUpgradeSpendLimits?: boolean | undefined, includePackagesArray?: boolean | undefined, carrierName?: string | undefined, shipFromAddress: CSAddress, destinationAddress: CSAddress, returnToAddress?: CSAddress | undefined, shipOption?: string | undefined, shipmentTags?: Array | undefined, saturdayDelivery?: boolean | undefined, desktopDelivery?: boolean | undefined, deliverySignatureOption?: ('None' | 'Signature' | 'ResidentSignature' | 'AdultSignature' | 'AdultResidentSignature' | 'Unknown') | undefined, lastMileDeliveryOptions?: LastMileDeliveryOptions | undefined, deliveryWindow?: TimeWindow | undefined, pickupWindow?: TimeWindow | undefined, deliveryNote?: string | undefined, referenceIdentifier?: string | undefined, referenceIdentifier2?: string | undefined, referenceIdentifier3?: string | undefined, referenceIdentifier4?: string | undefined, referenceIdentifier5?: string | undefined, purchaseOrderIdentifier?: string | undefined, partnerReferenceIdentifier?: string | undefined, partnerReferenceIdentifier2?: string | undefined, carrierProcessingId?: string | undefined, fulfillmentContext?: string | undefined, fulfillmentType?: ('customer' | 'at_large' | 'returns' | 'hundredweight' | 'reship' | 'unknown') | undefined, tenantId?: string | undefined, thirdPartyBillingSetId?: string | undefined, forceThirdPartyBilling?: boolean | undefined, fulfillmentContextIds?: Array | undefined, originId?: string | undefined, customsInfo?: RequestCustomsInfo | undefined, testMode?: boolean | undefined, orderSourceName?: string | undefined, emergencyResponseInfo?: EmergencyResponseInfo | undefined, packages: Array, thirdPartyBillingAccounts?: Array | undefined, collectBilling?: CarrierCollectBilling | undefined, configurationOverrides?: ConfigurationOverrides | undefined, payorAccounts?: Array | undefined, endorsementType?: ('AddressServiceRequested' | 'ForwardingServiceRequested' | 'ChangeServiceRequested' | 'ReturnServiceRequested' | 'CarrierLeaveIfNoResponse') | undefined, useShipFromAddressInRequest?: boolean | undefined, documentGenerationRequests?: Array | undefined}; export type ShipmentParameters = {partnerShipmentId?: string | undefined, orderedDateTime?: string | undefined, shippedDateTime?: string | undefined, desiredDeliveryDate?: string | undefined, preferredCarrierDeliveryDateTime?: string | undefined, desiredDeliveryDateOptions?: DesiredDeliveryDateOptions | undefined, businessDaysOfTransit?: number | undefined, includePackagesArray?: boolean | undefined, ignoreUpgradeSpendLimits?: boolean | undefined, deliveredDateTime?: string | undefined, carrierName?: string | undefined, carrierTrackingId?: string | undefined, orderItemQuantities?: Array | undefined, shipFromAddress: CSAddress, destinationAddress: CSAddress, returnToAddress?: CSAddress | undefined, shipOption?: string | undefined, packagingType?: PackagingTypeParameters | undefined, totalWeight?: Weight | undefined, shipmentTags?: Array | undefined, customsInfo?: RequestCustomsInfo | undefined, totalDeclaredValue?: DeclaredValue | undefined, saturdayDelivery?: boolean | undefined, desktopDelivery?: boolean | undefined, deliverySignatureOption?: ('None' | 'Signature' | 'ResidentSignature' | 'AdultSignature' | 'AdultResidentSignature' | 'Unknown') | undefined, lastMileDeliveryOptions?: LastMileDeliveryOptions | undefined, pickupWindow?: TimeWindow | undefined, deliveryWindow?: TimeWindow | undefined, originId?: string | undefined, deliveryNote?: string | undefined, referenceIdentifier?: string | undefined, referenceIdentifier2?: string | undefined, referenceIdentifier3?: string | undefined, referenceIdentifier4?: string | undefined, referenceIdentifier5?: string | undefined, partnerReferenceIdentifier?: string | undefined, partnerReferenceIdentifier2?: string | undefined, purchaseOrderIdentifier?: string | undefined, carrierProcessingId?: string | undefined, fulfillmentContext?: string | undefined, fulfillmentType?: ('customer' | 'at_large' | 'returns' | 'hundredweight' | 'reship' | 'unknown') | undefined, tenantId?: string | undefined, thirdPartyBillingSetId?: string | undefined, forceThirdPartyBilling?: boolean | undefined, fulfillmentContextIds?: Array | undefined, orderSourceName?: string | undefined, testMode?: boolean | undefined, thirdPartyBillingAccounts?: Array | undefined, collectBilling?: CarrierCollectBilling | undefined, configurationOverrides?: ConfigurationOverrides | undefined, payorAccounts?: Array | undefined, packageReferenceIdentifier?: string | undefined, endorsementType?: ('AddressServiceRequested' | 'ForwardingServiceRequested' | 'ChangeServiceRequested' | 'ReturnServiceRequested' | 'CarrierLeaveIfNoResponse') | undefined, useShipFromAddressInRequest?: boolean | undefined, emergencyResponseInfo?: EmergencyResponseInfo | undefined, documentGenerationRequests?: Array | undefined}; export type CreateUsingExistingShipment = {partnerShipmentId?: string | undefined, shipiumShipmentId?: string | undefined}; export type CreateUsingExistingOrder = {partnerOrderId?: string | undefined, shipiumOrderId?: string | undefined, orderIdForLookup?: string | undefined}; export type PrinterlessLabelParameters = {type?: string | undefined, imageFormat?: string | undefined}; export type HoldAtLocation = {holdAtLocationId?: string | undefined, useHoldAtLocation?: boolean | undefined}; export type CarrierLabelCreate = {currencyCode?: string | undefined, labelFormats?: Array | undefined, printerlessParameters?: PrinterlessLabelParameters | undefined, includeLabelImagesInResponse?: boolean | undefined, customLabelEntries?: {[key: string]: string} | undefined, testMode?: boolean | undefined, eligibleForManifest?: boolean | undefined, contentDescription?: string | undefined, holdAtLocation?: HoldAtLocation | undefined}; export type InjectionParameter = {injectionProfileId?: string | undefined, injectionSiteId?: string | undefined}; export type Contact = {contactName?: string | undefined, phoneNumber?: string | undefined, phoneNumberCountryCode?: string | undefined, email?: string | undefined}; export type ReturnLabelCreate = {partnerShipmentId?: string | undefined, returnToAddress?: CSAddress | undefined, returnToContactInfo?: Contact | undefined, fulfillmentContext?: string | undefined, inlineReturnReferenceIdentifier?: string | undefined, inlineReturnReferenceIdentifier2?: string | undefined, inlineReturnReferenceIdentifier3?: string | undefined, inlineReturnReferenceIdentifier4?: string | undefined, inlineReturnReferenceIdentifier5?: string | undefined, inlineReturnPartnerReferenceIdentifier?: string | undefined, inlineReturnPartnerReferenceIdentifier2?: string | undefined, saturdayDelivery?: boolean | undefined, returnPaymentType?: ('prepaid' | 'pay_on_use') | undefined}; export type CustomerForwardLabelCreate = {partnerShipmentId: string, fulfillmentContext?: string | undefined, fulfillmentContextId?: string | undefined, desiredDeliveryDate?: string | undefined, referenceIdentifier?: string | undefined, referenceIdentifier2?: string | undefined, referenceIdentifier3?: string | undefined, referenceIdentifier4?: string | undefined, referenceIdentifier5?: string | undefined, destinationAddress: CSAddress, packagingType: PackagingTypeParameters, labelParameters: CarrierLabelCreate, totalWeight: Weight, orderItemQuantities?: Array | undefined, generateLabel?: boolean | undefined, tenantId?: string | undefined, customsInfo?: RequestCustomsInfo | undefined}; export type MegaShipmentProcessCreate = {currencyCode: string, multiParcelShipmentParameters?: MultiParcelShipmentParameters | undefined, shipmentParameters?: ShipmentParameters | undefined, createUsingExistingShipment?: CreateUsingExistingShipment | undefined, createUsingExistingOrder?: CreateUsingExistingOrder | undefined, generateLabel?: boolean | undefined, includeEvaluatedServiceMethodsInResponse?: boolean | undefined, includeLineItemsInEvaluatedServiceMethods?: boolean | undefined, labelParameters?: CarrierLabelCreate | undefined, carrierServiceMethodAllowList?: Array | undefined, ignoreRuleSets?: boolean | undefined, includeInjectionProfiles?: boolean | undefined, injectionParameters?: Array | undefined, inlineReturnsLabel?: ReturnLabelCreate | undefined, customerForwardLabels?: Array | undefined, ignoreCarrierMinimumDimensions?: boolean | undefined}; export type BulkLabelRequestOptions = {tenantId?: string | undefined, fulfillmentContext?: string | undefined, currencyCode?: string | undefined, includeFullShipmentResponses?: boolean | undefined}; export type BulkLabelRequest = {shipmentRequests?: Array | undefined, options?: BulkLabelRequestOptions | undefined}; export type CreateApiApiV1ShipmentBulkprocessingLabelsArgs = {includeLedgerInOrchestrationMetadata?: boolean | undefined, body: BulkLabelRequest}; export type CreateApiApiV1ShipmentBulkprocessingLabelsOptions = {baseUrl?: string | undefined, oauth2Scheme?: string | undefined, fetch?: typeof fetch | undefined}; export const orchestrationLedger = z.object({generatedAssets: z.record(z.string(), z.string()).optional(), resultIds: z.array(z.string()).optional(), log: z.array(z.string()).optional()}); export const orchestratedAssetMetadata = z.object({orchestrationId: z.string().optional(), orchestrationTimeStamp: z.string().optional(), orchestrationLedger: orchestrationLedger.optional()}); export const orchestratedAssetBatchResults = z.object({orchestratedAssetMetadata: orchestratedAssetMetadata.optional(), results: z.array(z.object({})).optional(), failures: z.array(z.object({})).optional()}); export const validateResponse = async ( schema: { readonly '~standard': { readonly validate: (value: unknown) => ({ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }) | Promise<{ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }> } }, value: unknown ): Promise => { const result = await schema['~standard'].validate(value) if (result.issues !== undefined) { const detail = result.issues .map(({ message, path }) => path?.length ? `${path.map((segment) => String(typeof segment === 'object' ? segment.key : segment)).join('.')}: ${message}` : message ) .join('; ') throw new Error(`Response does not match the schema: ${detail}`, { cause: { issues: result.issues } }) } return result.value }; /** * A synchronous bulk orchestration in front of the MegaShipmentProcess, allowing concurrent requests to be created and return results together. Please note that this endpoint is will block while the the full request is completely processed. Failures will not block and are returned alongside the results. * * POST /api/v1/shipment/bulkprocessing/labels */ export const createApiApiV1ShipmentBulkprocessingLabels = async (args: CreateApiApiV1ShipmentBulkprocessingLabelsArgs, options?: CreateApiApiV1ShipmentBulkprocessingLabelsOptions) => { const {baseUrl = "https://api.shipium.com", fetch: fetchFn = fetch, oauth2Scheme} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (args.includeLedgerInOrchestrationMetadata != null) query.append("includeLedgerInOrchestrationMetadata", String(args.includeLedgerInOrchestrationMetadata)) if (oauth2Scheme !== undefined) headers.set('authorization', `Bearer ${oauth2Scheme}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/shipment/bulkprocessing/labels${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return validateResponse(orchestratedAssetBatchResults, await res.json()) };