You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
862 B
TypeScript

import { api } from './client';
import type { ArticleHistoryResponse, ArticleHistoryEntry } from '~/types';
export const articleHistoryApi = {
list: (params: { limit?: number; offset?: number; status?: string; source_type?: string } = {}): Promise<ArticleHistoryResponse> => {
const query = new URLSearchParams();
if (params.limit) query.set('limit', String(params.limit));
if (params.offset) query.set('offset', String(params.offset));
if (params.status) query.set('status', params.status);
if (params.source_type) query.set('source_type', params.source_type);
const qs = query.toString();
return api.get<ArticleHistoryResponse>(`/article-history${qs ? '?' + qs : ''}`);
},
getProvenance: (synthesisId: string): Promise<ArticleHistoryEntry[]> =>
api.get<ArticleHistoryEntry[]>(`/syntheses/${synthesisId}/provenance`),
};