diff --git a/frontend/src/api/client.ts b/frontend/src/api/client.ts index 78e565a..112d63c 100644 --- a/frontend/src/api/client.ts +++ b/frontend/src/api/client.ts @@ -598,3 +598,25 @@ export const createApiKey = (name: string, scope: 'read' | 'write') => apiPost<{ key: string; api_key: ApiKeyEntry }>('/api/api-keys', { name, scope }) export const revokeApiKey = (id: number) => apiDelete(`/api/api-keys/${id}`) + +// ─── News ───────────────────────────────────────────────────────────────────── + +import type { NewsItem } from '@/types/news' + +export interface GetNewsItemsParams { + days?: number + limit?: number + offset?: number + feed_id?: number | null +} + +export function getNewsItems(params: GetNewsItemsParams = {}) { + const p = new URLSearchParams() + if (params.days != null) p.set('days', String(params.days)) + if (params.limit != null) p.set('limit', String(params.limit)) + if (params.offset != null) p.set('offset', String(params.offset)) + if (params.feed_id != null) p.set('feed_id', String(params.feed_id)) + return apiGet<{ items: NewsItem[]; offset: number; limit: number }>( + `/api/briefing/news?${p}` + ) +} diff --git a/frontend/src/types/news.ts b/frontend/src/types/news.ts new file mode 100644 index 0000000..93e371e --- /dev/null +++ b/frontend/src/types/news.ts @@ -0,0 +1,10 @@ +export interface NewsItem { + id: number + title: string + url: string + snippet: string + published_at: string | null + topics: string[] + source: string + reaction: 'up' | 'down' | null +}