This repository has no description
1import type { BobbinContext, XrpcRequestInit } from "./client";
2import { jsonGet } from "./_request";
3
4// count endpoints share { subject } params and { count, distinctAuthors } output.
5export type CountName =
6 | "sh.tangled.feed.countStars"
7 | "sh.tangled.feed.countStarsBy"
8 | "sh.tangled.feed.countComments"
9 | "sh.tangled.feed.countCommentsBy"
10 | "sh.tangled.feed.countReactions"
11 | "sh.tangled.feed.countReactionsBy"
12 | "sh.tangled.graph.countFollows"
13 | "sh.tangled.graph.countFollowsBy"
14 | "sh.tangled.graph.countVouches"
15 | "sh.tangled.graph.countVouchesBy"
16 | "sh.tangled.git.countRefUpdates"
17 | "sh.tangled.git.countRefUpdatesBy"
18 | "sh.tangled.knot.countKnots"
19 | "sh.tangled.knot.countMembers"
20 | "sh.tangled.knot.countMembersBy"
21 | "sh.tangled.label.countDefinitions"
22 | "sh.tangled.label.countOps"
23 | "sh.tangled.label.countOpsBy"
24 | "sh.tangled.pipeline.countPipelines"
25 | "sh.tangled.pipeline.countPipelinesBy"
26 | "sh.tangled.pipeline.countStatuses"
27 | "sh.tangled.pipeline.countStatusesBy"
28 | "sh.tangled.publicKey.countKeys"
29 | "sh.tangled.repo.countArtifacts"
30 | "sh.tangled.repo.countArtifactsBy"
31 | "sh.tangled.repo.countCollaborators"
32 | "sh.tangled.repo.countCollaboratorsBy"
33 | "sh.tangled.repo.countIssues"
34 | "sh.tangled.repo.countIssuesBy"
35 | "sh.tangled.repo.countPulls"
36 | "sh.tangled.repo.countPullsBy"
37 | "sh.tangled.repo.countRepos"
38 | "sh.tangled.repo.issue.countStates"
39 | "sh.tangled.repo.issue.countStatesBy"
40 | "sh.tangled.repo.pull.countStatuses"
41 | "sh.tangled.repo.pull.countStatusesBy"
42 | "sh.tangled.spindle.countSpindles"
43 | "sh.tangled.spindle.countMembers"
44 | "sh.tangled.spindle.countMembersBy"
45 | "sh.tangled.string.countStrings";
46
47export interface CountResult {
48 count: number;
49 distinctAuthors: number;
50}
51
52export const count = (
53 ctx: BobbinContext,
54 name: CountName,
55 subject: string,
56 init?: XrpcRequestInit
57): Promise<CountResult> => jsonGet<CountResult>(ctx, name, { subject }, init);