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.countForks"
34 | "sh.tangled.repo.countIssues"
35 | "sh.tangled.repo.countIssuesBy"
36 | "sh.tangled.repo.countPulls"
37 | "sh.tangled.repo.countPullsBy"
38 | "sh.tangled.repo.countRepos"
39 | "sh.tangled.repo.issue.countStates"
40 | "sh.tangled.repo.issue.countStatesBy"
41 | "sh.tangled.repo.pull.countStatuses"
42 | "sh.tangled.repo.pull.countStatusesBy"
43 | "sh.tangled.spindle.countSpindles"
44 | "sh.tangled.spindle.countMembers"
45 | "sh.tangled.spindle.countMembersBy"
46 | "sh.tangled.string.countStrings";
47
48export interface CountResult {
49 count: number;
50 distinctAuthors: number;
51}
52
53export interface CountFilter {
54 author?: string;
55 state?: "open" | "closed";
56 status?: "open" | "closed" | "merged";
57}
58
59export const count = (
60 ctx: BobbinContext,
61 name: CountName,
62 subject: string,
63 filter: CountFilter = {},
64 init?: XrpcRequestInit
65): Promise<CountResult> => jsonGet<CountResult>(ctx, name, { subject, ...filter }, init);