Skip to content

fetchRepoUserStats

The counts the stats and repository pin cards add when asked for them. It is exported on its own because the numbers are useful without either card.

Fetch the per-repository counts the REST search API answers, one request each.

fetchRepoUserStats(options, config: CardConfig): Promise<RepoUserStats>
OptionTypeRequiredWhat it is
usernamestringyes—
scopereadonly string[] | undefinednoowner/name and owner/* entries the searches are narrowed to.
searchesreadonly ("issues_commented" | "issues_opened" | "prs_commented" | "prs_opened" | "prs_reviewed")[] | undefinednoThe counts to fetch, one search each; the rest are left out.

Returns Promise<RepoUserStats> — Only the counts that were asked for.

These come from GitHub’s search API rather than from the user’s own GraphQL node, which makes them scopeable — to a repository, to an owner, or to both — and separately rate limited. fetchStats calls this for you when a card asks for one of the counts; call it directly when you want the numbers and not the rest of the stats.

One search request per entry of searches. Ask for none and it makes no request at all.