export type CreateApiBapiV1UtilsUploadImageArgs = {body: BodyInit}; export type CreateApiBapiV1UtilsUploadImageOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * 이미지 업로드 * * POST /bapi/v1/utils/upload/image */ export const createApiBapiV1UtilsUploadImage = async (args: CreateApiBapiV1UtilsUploadImageArgs, options?: CreateApiBapiV1UtilsUploadImageOptions) => { const {baseUrl = "https://api.wincl.io:443", fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (Bearer !== undefined) headers.set('authorization', `Bearer ${Bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/bapi/v1/utils/upload/image${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: 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() };