export type GetApiApiV1ServersIdLeaderboardCardArgs = {id: unknown, start?: number | undefined, limit?: number | undefined}; export type GetApiApiV1ServersIdLeaderboardCardOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Get Server Leaderboard Card * * GET /api/v1/servers/{id}/leaderboard/card */ export const getApiApiV1ServersIdLeaderboardCard = async (args: GetApiApiV1ServersIdLeaderboardCardArgs, options: GetApiApiV1ServersIdLeaderboardCardOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.start != null) query.append("start", String(args.start)) if (args.limit != null) query.append("limit", String(args.limit)) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/servers/${encodeURIComponent(String(args.id))}/leaderboard/card${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 };