feat: add NewsItem type and getNewsItems() API client function
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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}`
|
||||
)
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user