export type HeadApiConceptschemesSchemeIdCArgs = {scheme_id: string, type?: string | undefined, mode?: string | undefined, label?: string | undefined, collection?: string | undefined, sort?: string | undefined, language?: string | undefined}; export type HeadApiConceptschemesSchemeIdCOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Check if concepts or collections exist in a scheme. * * HEAD /conceptschemes/{scheme_id}/c */ export const headApiConceptschemesSchemeIdC = async (args: HeadApiConceptschemesSchemeIdCArgs, options: HeadApiConceptschemesSchemeIdCOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.type != null) query.append("type", String(args.type)) if (args.mode != null) query.append("mode", String(args.mode)) if (args.label != null) query.append("label", String(args.label)) if (args.collection != null) query.append("collection", String(args.collection)) if (args.sort != null) query.append("sort", String(args.sort)) if (args.language != null) query.append("language", String(args.language)) const url = `${baseUrl.replace(/\/+$/, '')}/conceptschemes/${encodeURIComponent(String(args.scheme_id))}/c${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "HEAD", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };