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