export type GetApiRegisteredAgentDeliveriesIdFileArgs = {id: string, 'filter[account_id]'?: string | undefined, include?: (Array<'company' | 'ref_jurisdiction' | 'document_type'>) | undefined}; export type GetApiRegisteredAgentDeliveriesIdFileOptions = {baseUrl?: string | undefined, Oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download a specific Registered Agent Delivery (Document). The account ID is required. * * GET /registered-agent-deliveries/{id}/file */ export const getApiRegisteredAgentDeliveriesIdFile = async (args: GetApiRegisteredAgentDeliveriesIdFileArgs, options?: GetApiRegisteredAgentDeliveriesIdFileOptions) => { const {baseUrl = "https://www.harborcompliance.com/api/v1", fetch: fetchFn = fetch, Oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/pdf") if (args['filter[account_id]'] != null) query.append("filter[account_id]", String(args['filter[account_id]'])) if (args.include != null) query.append("include", args.include.join(',')) if (Oauth2 !== undefined) headers.set('authorization', `Bearer ${Oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/registered-agent-deliveries/${encodeURIComponent(String(args.id))}/file${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() };