export type CreateApiCompaniesCompanySlugInboxArgs = {body: BodyInit}; export type CreateApiCompaniesCompanySlugInboxOptions = {baseUrl?: string | undefined, fikenApiOauth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Upload a document to the inbox * * POST /companies/{companySlug}/inbox */ export const createApiCompaniesCompanySlugInbox = async (args: CreateApiCompaniesCompanySlugInboxArgs, options?: CreateApiCompaniesCompanySlugInboxOptions) => { const {baseUrl = "https://api.fiken.no/api/v2", fetch: fetchFn = fetch, fikenApiOauth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (fikenApiOauth !== undefined) headers.set('authorization', `Bearer ${fikenApiOauth}`) const url = `${baseUrl.replace(/\/+$/, '')}/companies/${encodeURIComponent(String(args.companySlug))}/inbox${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 };