export type GetApiApiAutosuggestVocabulariesArgs = {match?: string | undefined}; export type GetApiApiAutosuggestVocabulariesOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Obtain a list of vocabulary names that match the criteria * * GET /api/autosuggest/vocabularies */ export const getApiApiAutosuggestVocabularies = async (args: GetApiApiAutosuggestVocabulariesArgs, options: GetApiApiAutosuggestVocabulariesOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.match != null) query.append("match", String(args.match)) const url = `${baseUrl.replace(/\/+$/, '')}/api/autosuggest/vocabularies${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 };