systemprompt_provider_contracts/
rss.rs1use anyhow::Result;
2use async_trait::async_trait;
3use chrono::{DateTime, Utc};
4use systemprompt_identifiers::SourceId;
5
6#[derive(Debug)]
7pub struct RssFeedContext<'a> {
8 pub base_url: &'a str,
9 pub source_name: &'a str,
10}
11
12#[derive(Debug, Clone)]
13pub struct RssFeedMetadata {
14 pub title: String,
15 pub link: String,
16 pub description: String,
17 pub language: Option<String>,
18}
19
20#[derive(Debug, Clone)]
21pub struct RssFeedItem {
22 pub title: String,
23 pub link: String,
24 pub description: String,
25 pub pub_date: DateTime<Utc>,
26 pub guid: String,
27 pub author: Option<String>,
28}
29
30#[derive(Debug, Clone)]
31pub struct RssFeedSpec {
32 pub source_id: SourceId,
33 pub max_items: i64,
34 pub output_filename: String,
35}
36
37#[async_trait]
38pub trait RssFeedProvider: Send + Sync {
39 fn provider_id(&self) -> &'static str;
40
41 fn feed_specs(&self) -> Vec<RssFeedSpec>;
42
43 async fn feed_metadata(&self, ctx: &RssFeedContext<'_>) -> Result<RssFeedMetadata>;
44
45 async fn fetch_items(&self, ctx: &RssFeedContext<'_>, limit: i64) -> Result<Vec<RssFeedItem>>;
46
47 fn priority(&self) -> u32 {
48 100
49 }
50}