export type GetApiResourceTenantLocatorDocumentsNameArgs = {tenantLocator: string, name: string, byStaticName?: boolean | undefined, date?: string | undefined, jurisdiction?: string | undefined}; export type GetApiResourceTenantLocatorDocumentsNameOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * GET /resource/{tenantLocator}/documents/{name} */ export const getApiResourceTenantLocatorDocumentsName = async (args: GetApiResourceTenantLocatorDocumentsNameArgs, options: GetApiResourceTenantLocatorDocumentsNameOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.byStaticName != null) query.append("byStaticName", String(args.byStaticName)) if (args.date != null) query.append("date", String(args.date)) if (args.jurisdiction != null) query.append("jurisdiction", String(args.jurisdiction)) const url = `${baseUrl.replace(/\/+$/, '')}/resource/${encodeURIComponent(String(args.tenantLocator))}/documents/${encodeURIComponent(String(args.name))}${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() };