Skip to main content

Function: getTrendingHandler()

getTrendingHandler(c, params): Promise<{ cursor: string; hasMore: boolean; trending: object[]; window: "24h" | "7d" | "30d"; }>

Defined in: src/api/handlers/xrpc/metrics/getTrending.ts:84

Handler for pub.chive.metrics.getTrending query.

Parameters

c

Context<ChiveEnv>

Hono context with Chive environment

params

Validated query parameters

cursor

string = ...

Pagination cursor for next page.

limit

number = ...

Maximum items to return.

window

"24h" | "7d" | "30d" = ...

Returns

Promise<{ cursor: string; hasMore: boolean; trending: object[]; window: "24h" | "7d" | "30d"; }>

Trending preprints for the selected time window

Example

GET /xrpc/pub.chive.metrics.getTrending?window=7d&limit=20

Response:
{
"trending": [
{ "uri": "...", "title": "...", "viewsInWindow": 1500, "rank": 1 },
...
],
"window": "7d"
}