export type CreateApiSuppliersPublicPurchasedComponentsCsvArgs = {body: BodyInit}; export type CreateApiSuppliersPublicPurchasedComponentsCsvOptions = {baseUrl?: string | undefined, appId?: string | undefined, fetch?: typeof fetch | undefined}; /** * Upload purchased components csv * * POST /suppliers/public/purchased_components_csv */ export const createApiSuppliersPublicPurchasedComponentsCsv = async (args: CreateApiSuppliersPublicPurchasedComponentsCsvArgs, options?: CreateApiSuppliersPublicPurchasedComponentsCsvOptions) => { const {baseUrl = "https://api.paperlessparts.com/v1", fetch: fetchFn = fetch, appId} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (appId !== undefined) headers.set("Authorization", appId) const url = `${baseUrl.replace(/\/+$/, '')}/suppliers/public/purchased_components_csv${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 };