This repository has no description
1import type { BobbinContext, QueryValue, XrpcRequestInit } from './client';
2import { jsonGet, rawGet } from './_request';
3import type * as Archive from './lexicons/types/sh/tangled/repo/archive';
4import type * as Blob_ from './lexicons/types/sh/tangled/repo/blob';
5import type * as Branch from './lexicons/types/sh/tangled/repo/branch';
6import type * as Branches from './lexicons/types/sh/tangled/repo/branches';
7import type * as Compare from './lexicons/types/sh/tangled/repo/compare';
8import type * as DescribeRepo from './lexicons/types/sh/tangled/repo/describeRepo';
9import type * as Diff from './lexicons/types/sh/tangled/repo/diff';
10import type * as GetDefaultBranch from './lexicons/types/sh/tangled/repo/getDefaultBranch';
11import type * as Languages from './lexicons/types/sh/tangled/repo/languages';
12import type * as ListSecrets from './lexicons/types/sh/tangled/repo/listSecrets';
13import type * as Log from './lexicons/types/sh/tangled/repo/log';
14import type * as Tag from './lexicons/types/sh/tangled/repo/tag';
15import type * as Tags from './lexicons/types/sh/tangled/repo/tags';
16import type * as Tree from './lexicons/types/sh/tangled/repo/tree';
17
18// wrappers for bobbin's knot-proxied repo endpoints.
19
20const asParams = (params: object): Record<string, QueryValue> =>
21 params as unknown as Record<string, QueryValue>;
22
23export const tree = (ctx: BobbinContext, params: Tree.$params, init?: XrpcRequestInit) =>
24 jsonGet<Tree.$output>(ctx, 'sh.tangled.repo.tree', asParams(params), init);
25
26export const blob = (ctx: BobbinContext, params: Blob_.$params, init?: XrpcRequestInit) =>
27 jsonGet<Blob_.$output>(ctx, 'sh.tangled.repo.blob', asParams(params), init);
28
29export const branch = (ctx: BobbinContext, params: Branch.$params, init?: XrpcRequestInit) =>
30 jsonGet<Branch.$output>(ctx, 'sh.tangled.repo.branch', asParams(params), init);
31
32export const getDefaultBranch = (
33 ctx: BobbinContext,
34 params: GetDefaultBranch.$params,
35 init?: XrpcRequestInit
36) =>
37 jsonGet<GetDefaultBranch.$output>(
38 ctx,
39 'sh.tangled.repo.getDefaultBranch',
40 asParams(params),
41 init
42 );
43
44export const describeRepo = (
45 ctx: BobbinContext,
46 params: DescribeRepo.$params,
47 init?: XrpcRequestInit
48) => jsonGet<DescribeRepo.$output>(ctx, 'sh.tangled.repo.describeRepo', asParams(params), init);
49
50export const languages = (ctx: BobbinContext, params: Languages.$params, init?: XrpcRequestInit) =>
51 jsonGet<Languages.$output>(ctx, 'sh.tangled.repo.languages', asParams(params), init);
52
53export const listSecrets = (
54 ctx: BobbinContext,
55 params: ListSecrets.$params,
56 init?: XrpcRequestInit
57) => jsonGet<ListSecrets.$output>(ctx, 'sh.tangled.repo.listSecrets', asParams(params), init);
58
59// schema-less json passthroughs; callers supply the shape.
60
61export const log = <T = unknown>(ctx: BobbinContext, params: Log.$params, init?: XrpcRequestInit) =>
62 jsonGet<T>(ctx, 'sh.tangled.repo.log', asParams(params), init);
63
64export const diff = <T = unknown>(
65 ctx: BobbinContext,
66 params: Diff.$params,
67 init?: XrpcRequestInit
68) => jsonGet<T>(ctx, 'sh.tangled.repo.diff', asParams(params), init);
69
70export const compare = <T = unknown>(
71 ctx: BobbinContext,
72 params: Compare.$params,
73 init?: XrpcRequestInit
74) => jsonGet<T>(ctx, 'sh.tangled.repo.compare', asParams(params), init);
75
76export const branches = <T = unknown>(
77 ctx: BobbinContext,
78 params: Branches.$params,
79 init?: XrpcRequestInit
80) => jsonGet<T>(ctx, 'sh.tangled.repo.branches', asParams(params), init);
81
82export const tags = <T = unknown>(
83 ctx: BobbinContext,
84 params: Tags.$params,
85 init?: XrpcRequestInit
86) => jsonGet<T>(ctx, 'sh.tangled.repo.tags', asParams(params), init);
87
88export const tag = <T = unknown>(ctx: BobbinContext, params: Tag.$params, init?: XrpcRequestInit) =>
89 jsonGet<T>(ctx, 'sh.tangled.repo.tag', asParams(params), init);
90
91// raw response for streaming/download.
92
93export const archive = (ctx: BobbinContext, params: Archive.$params, init?: XrpcRequestInit) =>
94 rawGet(ctx, 'sh.tangled.repo.archive', asParams(params), init);