Add ref_count management for deletions with atomic operations and error handling
This commit is contained in:
@@ -13,6 +13,10 @@ import {
|
||||
ArtifactListParams,
|
||||
ProjectListParams,
|
||||
GlobalSearchResponse,
|
||||
Stats,
|
||||
DeduplicationStats,
|
||||
TimelineStats,
|
||||
CrossProjectStats,
|
||||
} from './types';
|
||||
|
||||
const API_BASE = '/api/v1';
|
||||
@@ -156,3 +160,29 @@ export async function uploadArtifact(projectName: string, packageName: string, f
|
||||
export function getDownloadUrl(projectName: string, packageName: string, ref: string): string {
|
||||
return `${API_BASE}/project/${projectName}/${packageName}/+/${ref}`;
|
||||
}
|
||||
|
||||
// Stats API
|
||||
export async function getStats(): Promise<Stats> {
|
||||
const response = await fetch(`${API_BASE}/stats`);
|
||||
return handleResponse<Stats>(response);
|
||||
}
|
||||
|
||||
export async function getDeduplicationStats(): Promise<DeduplicationStats> {
|
||||
const response = await fetch(`${API_BASE}/stats/deduplication`);
|
||||
return handleResponse<DeduplicationStats>(response);
|
||||
}
|
||||
|
||||
export async function getTimelineStats(
|
||||
period: 'day' | 'week' | 'month' = 'day',
|
||||
fromDate?: string,
|
||||
toDate?: string
|
||||
): Promise<TimelineStats> {
|
||||
const params = buildQueryString({ period, from_date: fromDate, to_date: toDate });
|
||||
const response = await fetch(`${API_BASE}/stats/timeline${params}`);
|
||||
return handleResponse<TimelineStats>(response);
|
||||
}
|
||||
|
||||
export async function getCrossProjectStats(): Promise<CrossProjectStats> {
|
||||
const response = await fetch(`${API_BASE}/stats/cross-project`);
|
||||
return handleResponse<CrossProjectStats>(response);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user