export type GetApiApiFurusatoTopMoversArgs = {window?: ('24h' | '7d' | '30d') | undefined, limit?: number | undefined, prefecture?: string | undefined, category?: string | undefined, muni_code?: string | undefined}; export type GetApiApiFurusatoTopMoversOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * イベント発生数の多い返礼品 Top N ($0.20 paid) * * GET /api/furusato/top_movers */ export const getApiApiFurusatoTopMovers = async (args: GetApiApiFurusatoTopMoversArgs, options?: GetApiApiFurusatoTopMoversOptions) => { const {baseUrl = "https://localgov.jp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.window != null) query.append("window", String(args.window)) if (args.limit != null) query.append("limit", String(args.limit)) if (args.prefecture != null) query.append("prefecture", String(args.prefecture)) if (args.category != null) query.append("category", String(args.category)) if (args.muni_code != null) query.append("muni_code", String(args.muni_code)) const url = `${baseUrl.replace(/\/+$/, '')}/api/furusato/top_movers${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 };