export type GetApiExplorerQuestionsRecommendArgs = {aiGenerated?: boolean | undefined, n?: number | undefined, tagId?: number | undefined}; export type GetApiExplorerQuestionsRecommendOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Get recommend questions * * GET /explorer/questions/recommend/ */ export const getApiExplorerQuestionsRecommend = async (args: GetApiExplorerQuestionsRecommendArgs, options: GetApiExplorerQuestionsRecommendOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.aiGenerated != null) query.append("aiGenerated", String(args.aiGenerated)) if (args.n != null) query.append("n", String(args.n)) if (args.tagId != null) query.append("tagId", String(args.tagId)) const url = `${baseUrl.replace(/\/+$/, '')}/explorer/questions/recommend/${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 };