import type { BobbinContext, XrpcRequestInit } from "$lib/api/client"; import { jsonGet } from "$lib/api/_request"; import type { TicketState } from "$lib/api/records"; // count endpoints share { subject } params and { count, distinctAuthors } output. export type CountName = | "sh.tangled.feed.countStars" | "sh.tangled.feed.countStarsBy" | "sh.tangled.feed.countComments" | "sh.tangled.feed.countCommentsBy" | "sh.tangled.feed.countReactions" | "sh.tangled.feed.countReactionsBy" | "sh.tangled.graph.countFollows" | "sh.tangled.graph.countFollowsBy" | "sh.tangled.graph.countVouches" | "sh.tangled.graph.countVouchesBy" | "sh.tangled.label.countDefinitions" | "sh.tangled.label.countOps" | "sh.tangled.label.countOpsBy" | "sh.tangled.publicKey.countKeys" | "sh.tangled.repo.countArtifacts" | "sh.tangled.repo.countArtifactsBy" | "sh.tangled.repo.countCollaborators" | "sh.tangled.repo.countCollaboratorsBy" | "sh.tangled.repo.countForks" | "sh.tangled.repo.countIssues" | "sh.tangled.repo.countIssuesBy" | "sh.tangled.repo.countPulls" | "sh.tangled.repo.countPullsBy" | "sh.tangled.repo.countRepos" | "sh.tangled.repo.issue.countStates" | "sh.tangled.repo.issue.countStatesBy" | "sh.tangled.repo.pull.countStatuses" | "sh.tangled.repo.pull.countStatusesBy" | "sh.tangled.string.countStrings"; export interface CountResult { count: number; distinctAuthors: number; } export interface CountFilter { author?: string; state?: TicketState; status?: TicketState; } export const count = ( ctx: BobbinContext, name: CountName, subject: string, filter: CountFilter = {}, init?: XrpcRequestInit ): Promise => jsonGet(ctx, name, { subject, ...filter }, init);