export type GetApiOtherExtractedTextSearchArgs = {q?: string | undefined, id?: string | undefined, userId?: string | undefined, userName?: string | undefined, naId?: string | undefined, status?: string | undefined, createdAt?: string | undefined, updatedAt?: string | undefined, sortBy?: ('contribution.asc' | 'contribution.desc' | 'createdAt.asc' | 'createdAt.desc' | 'updatedAt.asc' | 'updatedAt.desc') | undefined, includeTotalCount?: boolean | undefined}; export type GetApiOtherExtractedTextSearchOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get search results for active contribution data by sending a request to the catalog with other extracted text as a search parameter. * * GET /other-extracted-text/search */ export const getApiOtherExtractedTextSearch = async (args: GetApiOtherExtractedTextSearchArgs, options?: GetApiOtherExtractedTextSearchOptions) => { const {baseUrl = "https://catalog.archives.gov/api/v2", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.q != null) query.append("q", String(args.q)) if (args.id != null) query.append("id", String(args.id)) if (args.userId != null) query.append("userId", String(args.userId)) if (args.userName != null) query.append("userName", String(args.userName)) if (args.naId != null) query.append("naId", String(args.naId)) if (args.status != null) query.append("status", String(args.status)) if (args.createdAt != null) query.append("createdAt", String(args.createdAt)) if (args.updatedAt != null) query.append("updatedAt", String(args.updatedAt)) if (args.sortBy != null) query.append("sortBy", String(args.sortBy)) if (args.includeTotalCount != null) query.append("includeTotalCount", String(args.includeTotalCount)) const url = `${baseUrl.replace(/\/+$/, '')}/other-extracted-text/search${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 undefined };