export type ProcessDelayedEINDocumentRequest = {document_id: string}; export type CreateApiV1ReferralsIdProcessEinDocumentArgs = {id: string, body: ProcessDelayedEINDocumentRequest}; export type CreateApiV1ReferralsIdProcessEinDocumentOptions = {baseUrl?: string | undefined, oAuth2ClientCredentials?: string | undefined, fetch?: typeof fetch | undefined}; /** * Process a delayed EIN document after upload * * POST /v1/referrals/{id}/process_ein_document */ export const createApiV1ReferralsIdProcessEinDocument = async (args: CreateApiV1ReferralsIdProcessEinDocumentArgs, options?: CreateApiV1ReferralsIdProcessEinDocumentOptions) => { const {baseUrl = "https://api.brex.com", fetch: fetchFn = fetch, oAuth2ClientCredentials} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (oAuth2ClientCredentials !== undefined) headers.set('authorization', `Bearer ${oAuth2ClientCredentials}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/referrals/${encodeURIComponent(String(args.id))}/process_ein_document${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };