export type AttachDeliveryCommand = {deliveryMan?: string | undefined, payerAddress?: string | undefined, payerName?: string | undefined, sendToAll?: boolean | undefined, shippingAddressId: number, shippingFee?: number | undefined, trackingNumber: number}; export type CreateApiApiSecretaryAndAcceptorAttachDeliveryAcceptorCodeArgs = {acceptorCode: string, body: AttachDeliveryCommand}; export type CreateApiApiSecretaryAndAcceptorAttachDeliveryAcceptorCodeOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * attachDelivery * * POST /api/secretary-and-acceptor/attachDelivery/{acceptorCode} */ export const createApiApiSecretaryAndAcceptorAttachDeliveryAcceptorCode = async (args: CreateApiApiSecretaryAndAcceptorAttachDeliveryAcceptorCodeArgs, options: CreateApiApiSecretaryAndAcceptorAttachDeliveryAcceptorCodeOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/api/secretary-and-acceptor/attachDelivery/${encodeURIComponent(String(args.acceptorCode))}${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 undefined };