export type GetApiPublicFaqSlugArgs = {apikey: string, slug: string}; export type GetApiPublicFaqSlugOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Retrieve FAQ * * GET /public/faq/{slug} */ export const getApiPublicFaqSlug = async (args: GetApiPublicFaqSlugArgs, options: GetApiPublicFaqSlugOptions) => { 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/faq/${encodeURIComponent(String(args.slug))}${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 };