export type CreateApiPublicV1DocumentsDocumentIdSectionsUploadsUploadArgs = {document_id: string, merge_field_scope?: ('document' | 'upload') | undefined, body: BodyInit}; export type CreateApiPublicV1DocumentsDocumentIdSectionsUploadsUploadOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create Document Section from File Upload * * POST /public/v1/documents/{document_id}/sections/uploads?upload * * Also accepts auth: oauth2 */ export const createApiPublicV1DocumentsDocumentIdSectionsUploadsUpload = async (args: CreateApiPublicV1DocumentsDocumentIdSectionsUploadsUploadArgs, options?: CreateApiPublicV1DocumentsDocumentIdSectionsUploadsUploadOptions) => { const {baseUrl = "https://api.pandadoc.com", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "multipart/form-data") if (args.merge_field_scope != null) query.append("merge_field_scope", String(args.merge_field_scope)) if (apiKey !== undefined) headers.set("Authorization", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/public/v1/documents/${encodeURIComponent(String(args.document_id))}/sections/uploads?upload${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() };