export type CreateApiOrdersDraftAttachmentsIdArgs = {id: number, body: BodyInit}; export type CreateApiOrdersDraftAttachmentsIdOptions = {baseUrl?: string | undefined, accessToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Upload draft attachments for an order email * * POST /orders/draft-attachments/{id} */ export const createApiOrdersDraftAttachmentsId = async (args: CreateApiOrdersDraftAttachmentsIdArgs, options?: CreateApiOrdersDraftAttachmentsIdOptions) => { const {baseUrl = "https://api.findmydocument.net", fetch: fetchFn = fetch, accessToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (accessToken !== undefined) headers.set('authorization', `Bearer ${accessToken}`) const url = `${baseUrl.replace(/\/+$/, '')}/orders/draft-attachments/${encodeURIComponent(String(args.id))}${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 };