MCPcopy Create free account
hub / github.com/sourcebot-dev/sourcebot / listCommits

Function listCommits

packages/web/src/app/api/(client)/client.ts:143–165  ·  view source on GitHub ↗
(queryParams: ListCommitsQueryParams)

Source from the content-addressed store, hash-verified

141}
142
143export const listCommits = async (queryParams: ListCommitsQueryParams): Promise<ListCommitsResponse | ServiceError> => {
144 const url = new URL("/api/commits", window.location.origin);
145 for (const [key, value] of Object.entries(queryParams)) {
146 if (value !== undefined && value !== '') {
147 url.searchParams.set(key, value.toString());
148 }
149 }
150
151 const response = await fetch(url, {
152 method: "GET",
153 headers: {
154 "X-Sourcebot-Client-Source": "sourcebot-web-client",
155 },
156 });
157
158 const result = await response.json();
159 if (isServiceError(result)) {
160 return result;
161 }
162
163 const totalCount = parseInt(response.headers.get('X-Total-Count') ?? '0', 10);
164 return { commits: result as Commit[], totalCount };
165}
166
167export const getFiles = async (body: GetFilesRequest): Promise<GetFilesResponse | ServiceError> => {
168 const result = await fetch("/api/files", {

Callers 2

HistoryPanelFunction · 0.90
LatestCommitInfoFunction · 0.90

Calls 1

isServiceErrorFunction · 0.90

Tested by

no test coverage detected