import {z} from 'zod' export type CommissionSalesPartner = {id?: string | undefined, version?: string | undefined, commissionFix?: unknown | undefined, commissionPercentage?: unknown | undefined, commissionType: 'FIX' | 'FIX_AND_MARGIN' | 'FIX_AND_REVENUE' | 'MARGIN' | 'NO_COMMISSION' | 'REVENUE', createdDate?: number | undefined, lastModifiedDate?: number | undefined, salesPartnerSupplierId: string}; export type EntityReference = {entityId?: string | undefined, entityName?: string | undefined}; export type OnlyId = {id?: string | undefined}; export type CustomAttribute = {attributeDefinitionId?: string | undefined, booleanValue?: boolean | undefined, dateValue?: number | undefined, entityId?: string | undefined, entityReferences?: Array | undefined, numberValue?: unknown | undefined, selectedValueId?: string | undefined, selectedValues?: Array | undefined, stringValue?: string | undefined}; export type RecordAddress = {city?: string | undefined, company?: string | undefined, company2?: string | undefined, countryCode?: ('AC' | 'AD' | 'AE' | 'AF' | 'AG' | 'AI' | 'AL' | 'AM' | 'AN' | 'AO' | 'AQ' | 'AR' | 'AS' | 'AT' | 'AU' | 'AW' | 'AX' | 'AZ' | 'BA' | 'BB' | 'BD' | 'BE' | 'BF' | 'BG' | 'BH' | 'BI' | 'BJ' | 'BL' | 'BM' | 'BN' | 'BO' | 'BQ' | 'BR' | 'BS' | 'BT' | 'BV' | 'BW' | 'BY' | 'BZ' | 'CA' | 'CC' | 'CD' | 'CF' | 'CG' | 'CH' | 'CI' | 'CK' | 'CL' | 'CM' | 'CN' | 'CO' | 'CR' | 'CS' | 'CU' | 'CV' | 'CW' | 'CX' | 'CY' | 'CZ' | 'DE' | 'DG' | 'DJ' | 'DK' | 'DM' | 'DO' | 'DZ' | 'EA' | 'EC' | 'EE' | 'EG' | 'EH' | 'ER' | 'ES' | 'ET' | 'EU' | 'FI' | 'FJ' | 'FK' | 'FM' | 'FO' | 'FR' | 'GA' | 'GB' | 'GD' | 'GE' | 'GF' | 'GG' | 'GH' | 'GI' | 'GL' | 'GM' | 'GN' | 'GP' | 'GQ' | 'GR' | 'GS' | 'GT' | 'GU' | 'GW' | 'GY' | 'HK' | 'HM' | 'HN' | 'HR' | 'HT' | 'HU' | 'IC' | 'ID' | 'IE' | 'IL' | 'IM' | 'IN' | 'IO' | 'IQ' | 'IR' | 'IS' | 'IT' | 'JE' | 'JM' | 'JO' | 'JP' | 'KE' | 'KG' | 'KH' | 'KI' | 'KM' | 'KN' | 'KP' | 'KR' | 'KW' | 'KY' | 'KZ' | 'LA' | 'LB' | 'LC' | 'LI' | 'LK' | 'LR' | 'LS' | 'LT' | 'LU' | 'LV' | 'LY' | 'MA' | 'MC' | 'MD' | 'ME' | 'MF' | 'MG' | 'MH' | 'MK' | 'ML' | 'MM' | 'MN' | 'MO' | 'MP' | 'MQ' | 'MR' | 'MS' | 'MT' | 'MU' | 'MV' | 'MW' | 'MX' | 'MY' | 'MZ' | 'NA' | 'NC' | 'NE' | 'NF' | 'NG' | 'NI' | 'NL' | 'NO' | 'NP' | 'NR' | 'NU' | 'NZ' | 'OM' | 'PA' | 'PE' | 'PF' | 'PG' | 'PH' | 'PK' | 'PL' | 'PM' | 'PN' | 'PR' | 'PS' | 'PT' | 'PW' | 'PY' | 'QA' | 'RE' | 'RO' | 'RS' | 'RU' | 'RW' | 'SA' | 'SB' | 'SC' | 'SD' | 'SE' | 'SG' | 'SH' | 'SI' | 'SJ' | 'SK' | 'SL' | 'SM' | 'SN' | 'SO' | 'SR' | 'SS' | 'ST' | 'SV' | 'SX' | 'SY' | 'SZ' | 'TA' | 'TC' | 'TD' | 'TF' | 'TG' | 'TH' | 'TJ' | 'TK' | 'TL' | 'TM' | 'TN' | 'TO' | 'TR' | 'TT' | 'TV' | 'TW' | 'TZ' | 'UA' | 'UG' | 'UM' | 'UNKNOWN' | 'US' | 'UY' | 'UZ' | 'VA' | 'VC' | 'VE' | 'VG' | 'VI' | 'VN' | 'VU' | 'WF' | 'WS' | 'XI' | 'XK' | 'YE' | 'YT' | 'ZA' | 'ZM' | 'ZW') | undefined, firstName?: string | undefined, globalLocationNumber?: string | undefined, lastName?: string | undefined, middleName?: string | undefined, phoneNumber?: string | undefined, postOfficeBoxCity?: string | undefined, postOfficeBoxNumber?: string | undefined, postOfficeBoxZipCode?: string | undefined, salutation?: ('COMPANY' | 'FAMILY' | 'MR' | 'MRS' | 'NO_SALUTATION') | undefined, state?: string | undefined, street1?: string | undefined, street2?: string | undefined, titleId?: string | undefined, zipcode?: string | undefined}; export type EmailAddresses = {bccAddresses?: string | undefined, ccAddresses?: string | undefined, toAddresses?: string | undefined}; export type ReductionAdditionItem = {position?: number | undefined, source?: ('ARTICLE' | 'ARTICLE_AND_CUSTOMER' | 'ARTICLE_CATEGORY' | 'ARTICLE_CATEGORY_AND_CUSTOMER') | undefined, specialPriceReduction?: boolean | undefined, title?: string | undefined, type?: ('ADDITIONAL_ABS' | 'ADDITION_PERCENT' | 'REDUCTION_ABS' | 'REDUCTION_PERCENT') | undefined, value?: unknown | undefined}; export type BlanketSalesOrderItem = {id?: string | undefined, version?: string | undefined, createdDate?: number | undefined, lastModifiedDate?: number | undefined, orderDate?: number | undefined, orderItemId?: string | undefined, plannedShippingDate?: number | undefined, positionNumber?: number | undefined, releasedQuantity: unknown, servicePeriodFrom?: number | undefined, servicePeriodTo?: number | undefined}; export type BlanketSalesOrderStatusHistory = {status?: ('CANCELLED' | 'CLOSED' | 'CONFIRMED' | 'ENTRY_IN_PROGRESS') | undefined, statusDate?: number | undefined, userId?: string | undefined}; export type BlanketSalesOrder = {id?: string | undefined, version?: string | undefined, articleId: string, blanketSalesOrderNumber?: string | undefined, calculationMode?: 'ROUND_SUMS_TO_0_05' | undefined, commercialLanguage?: string | undefined, commissionSalesPartners?: Array | undefined, createdDate?: number | undefined, creatorId?: string | undefined, currencyConversionDate?: number | undefined, currencyConversionLocked?: boolean | undefined, currencyConversionRate?: unknown | undefined, customAttributes?: Array | undefined, customerId: string, customerReference?: string | undefined, defaultHeaderDiscount?: unknown | undefined, defaultHeaderSurcharge?: unknown | undefined, defaultShippingCarrierId?: string | undefined, deliveryAddress?: RecordAddress | undefined, deliveryEmailAddresses?: EmailAddresses | undefined, description?: string | undefined, discountPercentage?: unknown | undefined, distributionChannel?: string | undefined, endDate?: number | undefined, factoring?: boolean | undefined, fulfillmentProviderId?: string | undefined, invoiceAddress?: RecordAddress | undefined, invoiceRecipientId?: string | undefined, lastModifiedDate?: number | undefined, lastStatusChangeUserId?: string | undefined, manualUnitPrice?: boolean | undefined, nonStandardTaxId?: string | undefined, note?: string | undefined, orderDate?: number | undefined, orderNumberAtCustomer?: string | undefined, orderQuantity?: unknown | undefined, paymentMethodId?: string | undefined, recipientCountryCode?: ('AC' | 'AD' | 'AE' | 'AF' | 'AG' | 'AI' | 'AL' | 'AM' | 'AN' | 'AO' | 'AQ' | 'AR' | 'AS' | 'AT' | 'AU' | 'AW' | 'AX' | 'AZ' | 'BA' | 'BB' | 'BD' | 'BE' | 'BF' | 'BG' | 'BH' | 'BI' | 'BJ' | 'BL' | 'BM' | 'BN' | 'BO' | 'BQ' | 'BR' | 'BS' | 'BT' | 'BV' | 'BW' | 'BY' | 'BZ' | 'CA' | 'CC' | 'CD' | 'CF' | 'CG' | 'CH' | 'CI' | 'CK' | 'CL' | 'CM' | 'CN' | 'CO' | 'CR' | 'CS' | 'CU' | 'CV' | 'CW' | 'CX' | 'CY' | 'CZ' | 'DE' | 'DG' | 'DJ' | 'DK' | 'DM' | 'DO' | 'DZ' | 'EA' | 'EC' | 'EE' | 'EG' | 'EH' | 'ER' | 'ES' | 'ET' | 'EU' | 'FI' | 'FJ' | 'FK' | 'FM' | 'FO' | 'FR' | 'GA' | 'GB' | 'GD' | 'GE' | 'GF' | 'GG' | 'GH' | 'GI' | 'GL' | 'GM' | 'GN' | 'GP' | 'GQ' | 'GR' | 'GS' | 'GT' | 'GU' | 'GW' | 'GY' | 'HK' | 'HM' | 'HN' | 'HR' | 'HT' | 'HU' | 'IC' | 'ID' | 'IE' | 'IL' | 'IM' | 'IN' | 'IO' | 'IQ' | 'IR' | 'IS' | 'IT' | 'JE' | 'JM' | 'JO' | 'JP' | 'KE' | 'KG' | 'KH' | 'KI' | 'KM' | 'KN' | 'KP' | 'KR' | 'KW' | 'KY' | 'KZ' | 'LA' | 'LB' | 'LC' | 'LI' | 'LK' | 'LR' | 'LS' | 'LT' | 'LU' | 'LV' | 'LY' | 'MA' | 'MC' | 'MD' | 'ME' | 'MF' | 'MG' | 'MH' | 'MK' | 'ML' | 'MM' | 'MN' | 'MO' | 'MP' | 'MQ' | 'MR' | 'MS' | 'MT' | 'MU' | 'MV' | 'MW' | 'MX' | 'MY' | 'MZ' | 'NA' | 'NC' | 'NE' | 'NF' | 'NG' | 'NI' | 'NL' | 'NO' | 'NP' | 'NR' | 'NU' | 'NZ' | 'OM' | 'PA' | 'PE' | 'PF' | 'PG' | 'PH' | 'PK' | 'PL' | 'PM' | 'PN' | 'PR' | 'PS' | 'PT' | 'PW' | 'PY' | 'QA' | 'RE' | 'RO' | 'RS' | 'RU' | 'RW' | 'SA' | 'SB' | 'SC' | 'SD' | 'SE' | 'SG' | 'SH' | 'SI' | 'SJ' | 'SK' | 'SL' | 'SM' | 'SN' | 'SO' | 'SR' | 'SS' | 'ST' | 'SV' | 'SX' | 'SY' | 'SZ' | 'TA' | 'TC' | 'TD' | 'TF' | 'TG' | 'TH' | 'TJ' | 'TK' | 'TL' | 'TM' | 'TN' | 'TO' | 'TR' | 'TT' | 'TV' | 'TW' | 'TZ' | 'UA' | 'UG' | 'UM' | 'UNKNOWN' | 'US' | 'UY' | 'UZ' | 'VA' | 'VC' | 'VE' | 'VG' | 'VI' | 'VN' | 'VU' | 'WF' | 'WS' | 'XI' | 'XK' | 'YE' | 'YT' | 'ZA' | 'ZM' | 'ZW') | undefined, recordAddress?: RecordAddress | undefined, recordComment?: string | undefined, recordCurrencyId?: string | undefined, recordEmailAddresses?: EmailAddresses | undefined, recordFreeText?: string | undefined, recordOpening?: string | undefined, reductionAdditionItems?: Array | undefined, releases?: Array | undefined, residualQuantity?: unknown | undefined, responsibleUserId?: string | undefined, salesInvoiceEmailAddresses?: EmailAddresses | undefined, sentToRecipient?: boolean | undefined, shipmentMethodId?: string | undefined, startDate?: number | undefined, status?: ('CANCELLED' | 'CLOSED' | 'CONFIRMED' | 'ENTRY_IN_PROGRESS') | undefined, statusHistory?: Array | undefined, tags?: Array | undefined, taxId?: string | undefined, termOfPaymentId?: string | undefined, unitPrice?: unknown | undefined, warehouseId?: string | undefined}; export type CreateApiBlanketSalesOrderArgs = {dryRun?: boolean | undefined, body: BlanketSalesOrder}; export type CreateApiBlanketSalesOrderOptions = {baseUrl: string, APIToken?: string | undefined, fetch?: typeof fetch | undefined}; export const commissionSalesPartner = z.object({id: z.string().optional(), version: z.string().optional(), commissionFix: z.string().optional(), commissionPercentage: z.string().optional(), commissionType: z.enum(["FIX", "FIX_AND_MARGIN", "FIX_AND_REVENUE", "MARGIN", "NO_COMMISSION", "REVENUE"]), createdDate: z.number().int().optional(), lastModifiedDate: z.number().int().optional(), salesPartnerSupplierId: z.string()}); export const entityReference = z.object({entityId: z.string().optional(), entityName: z.string().optional()}); export const onlyId = z.object({id: z.string().optional()}); export const customAttribute = z.object({attributeDefinitionId: z.string().optional(), booleanValue: z.boolean().optional(), dateValue: z.number().int().optional(), entityId: z.string().optional(), entityReferences: z.array(entityReference).optional(), numberValue: z.string().optional(), selectedValueId: z.string().optional(), selectedValues: z.array(onlyId).optional(), stringValue: z.string().optional()}); export const recordAddress = z.object({city: z.string().optional(), company: z.string().optional(), company2: z.string().optional(), countryCode: z.enum(["AC", "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AN", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CS", "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DG", "DJ", "DK", "DM", "DO", "DZ", "EA", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "EU", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "IC", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SX", "SY", "SZ", "TA", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "UNKNOWN", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "XI", "XK", "YE", "YT", "ZA", "ZM", "ZW"]).optional(), firstName: z.string().optional(), globalLocationNumber: z.string().optional(), lastName: z.string().optional(), middleName: z.string().optional(), phoneNumber: z.string().optional(), postOfficeBoxCity: z.string().optional(), postOfficeBoxNumber: z.string().optional(), postOfficeBoxZipCode: z.string().optional(), salutation: z.enum(["COMPANY", "FAMILY", "MR", "MRS", "NO_SALUTATION"]).optional(), state: z.string().optional(), street1: z.string().optional(), street2: z.string().optional(), titleId: z.string().optional(), zipcode: z.string().optional()}); export const emailAddresses = z.object({bccAddresses: z.string().optional(), ccAddresses: z.string().optional(), toAddresses: z.string().optional()}); export const reductionAdditionItem = z.object({position: z.number().int().optional(), source: z.enum(["ARTICLE", "ARTICLE_AND_CUSTOMER", "ARTICLE_CATEGORY", "ARTICLE_CATEGORY_AND_CUSTOMER"]).optional(), specialPriceReduction: z.boolean().optional(), title: z.string().optional(), type: z.enum(["ADDITIONAL_ABS", "ADDITION_PERCENT", "REDUCTION_ABS", "REDUCTION_PERCENT"]).optional(), value: z.string().optional()}); export const blanketSalesOrderItem = z.object({id: z.string().optional(), version: z.string().optional(), createdDate: z.number().int().optional(), lastModifiedDate: z.number().int().optional(), orderDate: z.number().int().optional(), orderItemId: z.string().optional(), plannedShippingDate: z.number().int().optional(), positionNumber: z.number().int().optional(), releasedQuantity: z.string(), servicePeriodFrom: z.number().int().optional(), servicePeriodTo: z.number().int().optional()}); export const blanketSalesOrderStatusHistory = z.object({status: z.enum(["CANCELLED", "CLOSED", "CONFIRMED", "ENTRY_IN_PROGRESS"]).optional(), statusDate: z.number().int().optional(), userId: z.string().optional()}); export const blanketSalesOrder = z.object({id: z.string().optional(), version: z.string().optional(), articleId: z.string(), blanketSalesOrderNumber: z.string().optional(), calculationMode: z.literal("ROUND_SUMS_TO_0_05").optional(), commercialLanguage: z.string().optional(), commissionSalesPartners: z.array(commissionSalesPartner).optional(), createdDate: z.number().int().optional(), creatorId: z.string().optional(), currencyConversionDate: z.number().int().optional(), currencyConversionLocked: z.boolean().optional(), currencyConversionRate: z.string().optional(), customAttributes: z.array(customAttribute).optional(), customerId: z.string(), customerReference: z.string().optional(), defaultHeaderDiscount: z.string().optional(), defaultHeaderSurcharge: z.string().optional(), defaultShippingCarrierId: z.string().optional(), deliveryAddress: recordAddress.optional(), deliveryEmailAddresses: emailAddresses.optional(), description: z.string().optional(), discountPercentage: z.string().optional(), distributionChannel: z.string().optional(), endDate: z.number().int().optional(), factoring: z.boolean().optional(), fulfillmentProviderId: z.string().optional(), invoiceAddress: recordAddress.optional(), invoiceRecipientId: z.string().optional(), lastModifiedDate: z.number().int().optional(), lastStatusChangeUserId: z.string().optional(), manualUnitPrice: z.boolean().optional(), nonStandardTaxId: z.string().optional(), note: z.string().optional(), orderDate: z.number().int().optional(), orderNumberAtCustomer: z.string().optional(), orderQuantity: z.string().optional(), paymentMethodId: z.string().optional(), recipientCountryCode: z.enum(["AC", "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AN", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CS", "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DG", "DJ", "DK", "DM", "DO", "DZ", "EA", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "EU", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "IC", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SX", "SY", "SZ", "TA", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "UNKNOWN", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "XI", "XK", "YE", "YT", "ZA", "ZM", "ZW"]).optional(), recordAddress: recordAddress.optional(), recordComment: z.string().optional(), recordCurrencyId: z.string().optional(), recordEmailAddresses: emailAddresses.optional(), recordFreeText: z.string().optional(), recordOpening: z.string().optional(), reductionAdditionItems: z.array(reductionAdditionItem).optional(), releases: z.array(blanketSalesOrderItem).optional(), residualQuantity: z.string().optional(), responsibleUserId: z.string().optional(), salesInvoiceEmailAddresses: emailAddresses.optional(), sentToRecipient: z.boolean().optional(), shipmentMethodId: z.string().optional(), startDate: z.number().int().optional(), status: z.enum(["CANCELLED", "CLOSED", "CONFIRMED", "ENTRY_IN_PROGRESS"]).optional(), statusHistory: z.array(blanketSalesOrderStatusHistory).optional(), tags: z.array(z.string()).optional(), taxId: z.string().optional(), termOfPaymentId: z.string().optional(), unitPrice: z.string().optional(), warehouseId: z.string().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 }; /** * create a blanketSalesOrder * * POST /blanketSalesOrder */ export const createApiBlanketSalesOrder = async (args: CreateApiBlanketSalesOrderArgs, options: CreateApiBlanketSalesOrderOptions) => { const {baseUrl, fetch: fetchFn = fetch, APIToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (args.dryRun != null) query.append("dryRun", String(args.dryRun)) if (APIToken !== undefined) headers.set("AuthenticationToken", APIToken) const url = `${baseUrl.replace(/\/+$/, '')}/blanketSalesOrder${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(blanketSalesOrder, await res.json()) };