export type GetApiPublicCategoriesSlugFaqsArgs = {apikey: string, slug: string}; export type GetApiPublicCategoriesSlugFaqsOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * FAQ List * * GET /public/categories/{slug}/faqs */ export const getApiPublicCategoriesSlugFaqs = async (args: GetApiPublicCategoriesSlugFaqsArgs, options: GetApiPublicCategoriesSlugFaqsOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.apikey != null) headers.set("apikey", String(args.apikey)) const url = `${baseUrl.replace(/\/+$/, '')}/public/categories/${encodeURIComponent(String(args.slug))}/faqs${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 };