export type CancelRequestDTO = {cancelType?: string | undefined, cancelReason?: string | undefined}; export type CreateApiV1OrderCancelOrderNoOrderNoArgs = {orderNo: string, body: CancelRequestDTO}; export type CreateApiV1OrderCancelOrderNoOrderNoOptions = {baseUrl: string, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * 주문 취소 * * POST /v1/order/cancel/orderNo/{orderNo} */ export const createApiV1OrderCancelOrderNoOrderNo = async (args: CreateApiV1OrderCancelOrderNoOrderNoArgs, options: CreateApiV1OrderCancelOrderNoOrderNoOptions) => { const {baseUrl, fetch: fetchFn = fetch, ApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") if (ApiKey !== undefined) headers.set("Authorization", ApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/order/cancel/orderNo/${encodeURIComponent(String(args.orderNo))}${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 res.blob() };