export type GetApiApiVocabulariesVocabKeywordArgs = {vocab: string, keyword: string}; export type GetApiApiVocabulariesVocabKeywordOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Returns the specified keyword from the specified vocabulary * * GET /api/Vocabularies/{vocab}/{keyword} */ export const getApiApiVocabulariesVocabKeyword = async (args: GetApiApiVocabulariesVocabKeywordArgs, options: GetApiApiVocabulariesVocabKeywordOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/api/Vocabularies/${encodeURIComponent(String(args.vocab))}/${encodeURIComponent(String(args.keyword))}${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 };