export type ApproveTransactionDeliveryRequestV4Dto = {note: string}; export type CreateApiTransactionsTransactionIdDeliveriesDeliveryIdAcceptArgs = {transactionId: number, deliveryId: string, 'orderful-api-version'?: string | undefined, body: ApproveTransactionDeliveryRequestV4Dto}; export type CreateApiTransactionsTransactionIdDeliveriesDeliveryIdAcceptOptions = {baseUrl?: string | undefined, APIKEY?: string | undefined, fetch?: typeof fetch | undefined}; /** * Accept a transaction delivery. * * POST /transactions/{transactionId}/deliveries/{deliveryId}/accept */ export const createApiTransactionsTransactionIdDeliveriesDeliveryIdAccept = async (args: CreateApiTransactionsTransactionIdDeliveriesDeliveryIdAcceptArgs, options?: CreateApiTransactionsTransactionIdDeliveriesDeliveryIdAcceptOptions) => { const {baseUrl = "https://api.orderful.com", fetch: fetchFn = fetch, APIKEY} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['orderful-api-version'] != null) headers.set("orderful-api-version", String(args['orderful-api-version'])) if (APIKEY !== undefined) headers.set("orderful-api-key", APIKEY) const url = `${baseUrl.replace(/\/+$/, '')}/transactions/${encodeURIComponent(String(args.transactionId))}/deliveries/${encodeURIComponent(String(args.deliveryId))}/accept${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 };