export type Identifier = string; export type GetApiV3DocumentsIdentifierRedactedArgs = {identifier: Identifier}; export type GetApiV3DocumentsIdentifierRedactedOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get redacted document * * GET /v3/documents/{identifier}/redacted */ export const getApiV3DocumentsIdentifierRedacted = async (args: GetApiV3DocumentsIdentifierRedactedArgs, options?: GetApiV3DocumentsIdentifierRedactedOptions) => { const {baseUrl = "https://api.affinda.com", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/pdf") if (ApiKeyAuth !== undefined) headers.set('authorization', `Bearer ${ApiKeyAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v3/documents/${encodeURIComponent(String(args.identifier))}/redacted${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };