export type GetApiItemsItemNameSemanticSemanticClassArgs = {'Accept-Language'?: string | undefined, itemName: string, semanticClass: string}; export type GetApiItemsItemNameSemanticSemanticClassOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Gets the item which defines the requested semantics of an item. * * GET /items/{itemName}/semantic/{semanticClass} */ export const getApiItemsItemNameSemanticSemanticClass = async (args: GetApiItemsItemNameSemanticSemanticClassArgs, options: GetApiItemsItemNameSemanticSemanticClassOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['Accept-Language'] != null) headers.set("Accept-Language", String(args['Accept-Language'])) const url = `${baseUrl.replace(/\/+$/, '')}/items/${encodeURIComponent(String(args.itemName))}/semantic/${encodeURIComponent(String(args.semanticClass))}${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 };