export type GetApiV2ActivityHistoryArgs = {continuationToken?: string | undefined}; export type GetApiV2ActivityHistoryOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get activity history * * GET /v2/activity/history */ export const getApiV2ActivityHistory = async (args: GetApiV2ActivityHistoryArgs, options?: GetApiV2ActivityHistoryOptions) => { const {baseUrl = "https://api.xbl.io", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.continuationToken != null) query.append("continuationToken", String(args.continuationToken)) if (apiKey !== undefined) headers.set("X-Authorization", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v2/activity/history${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 };