export type GetApiUsersIdActivityArgs = {id: number, limit?: number | undefined, cursor?: string | undefined, type?: (Array<'RECEIVE' | 'SEND' | 'BRIDGE' | 'CONVERT' | 'REDEMPTION' | 'ONRAMP' | 'OFFRAMP' | 'SPEND' | 'BORROW' | 'REPAY' | 'COLLATERAL_ADD' | 'COLLATERAL_REMOVE'>) | undefined, status?: (Array<'pending' | 'completed' | 'failed' | 'abandoned'>) | undefined, chainId?: Array | undefined, assetKey?: Array | undefined, assetKeyAll?: Array | undefined, occurredFrom?: number | undefined, occurredTo?: number | undefined}; export type GetApiUsersIdActivityOptions = {baseUrl: string, bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Cursor-paginated activity feed for a user (v2) * * GET /users/{id}/activity */ export const getApiUsersIdActivity = async (args: GetApiUsersIdActivityArgs, options: GetApiUsersIdActivityOptions) => { const {baseUrl, fetch: fetchFn = fetch, bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.limit != null) query.append("limit", String(args.limit)) if (args.cursor != null) query.append("cursor", String(args.cursor)) for (const item of args.type ?? []) query.append("type", String(item)) for (const item of args.status ?? []) query.append("status", String(item)) for (const item of args.chainId ?? []) query.append("chainId", String(item)) for (const item of args.assetKey ?? []) query.append("assetKey", String(item)) for (const item of args.assetKeyAll ?? []) query.append("assetKeyAll", String(item)) if (args.occurredFrom != null) query.append("occurredFrom", String(args.occurredFrom)) if (args.occurredTo != null) query.append("occurredTo", String(args.occurredTo)) if (bearer !== undefined) headers.set('authorization', `Bearer ${bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/users/${encodeURIComponent(String(args.id))}/activity${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 };