export type Channel = string; export type CreateApiV1SellerTicketAttachmentChannelArgs = {channel: Channel, body: BodyInit}; export type CreateApiV1SellerTicketAttachmentChannelOptions = {baseUrl?: string | undefined, SellerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Upload Attachment * * POST /v1/seller/ticket/attachment/{channel} */ export const createApiV1SellerTicketAttachmentChannel = async (args: CreateApiV1SellerTicketAttachmentChannelArgs, options?: CreateApiV1SellerTicketAttachmentChannelOptions) => { const {baseUrl = "https://scx-sbx.api.jtl-software.com", fetch: fetchFn = fetch, SellerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (SellerAuth !== undefined) headers.set('authorization', `Bearer ${SellerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/seller/ticket/attachment/${encodeURIComponent(String(args.channel))}${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 undefined };