1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
use std::collections::{BTreeSet, HashMap};
use serde::{Deserialize, Serialize};
use url::Url;
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
pub struct User {
pub id: u64,
pub name: String,
pub short_name: String,
pub url: String,
pub bio: Option<String>,
pub small_avatar_url: String,
pub medium_avatar_url: String,
pub avatar_url: String,
pub large_avatar_url: String,
pub curated_topics: Option<Vec<Topic>>,
pub followed_topics: Option<Vec<Topic>>,
pub premium_features: Option<BTreeSet<String>>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Topic {
pub id: u64,
pub small_image_url: String,
pub medium_image_url: String,
pub image_url: String,
pub large_image_url: String,
pub description: Option<String>,
pub name: String,
pub short_name: String,
pub url: String,
pub lang: String,
pub curated_post_count: u64,
pub creator: Option<Box<User>>,
pub pinned_post: Option<Post>,
pub curated_posts: Option<Vec<Post>>,
pub tags: Option<Vec<TopicTag>>,
pub stats: Option<Stats>,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
pub struct TopicTag {
pub tag: String,
pub post_count: u32,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Stats {
pub uv: i32,
pub uvp: i32,
pub v: i32,
pub vp: i32,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Post {
pub id: i64,
pub content: String,
pub html_content: String,
pub html_fragment: Option<String>,
pub insight: Option<String>,
pub html_insight: Option<String>,
pub title: String,
pub thanks_count: u32,
pub reactions_count: u32,
pub url: Option<String>,
pub scoop_url: String,
pub scoop_short_url: String,
pub small_image_url: Option<String>,
pub medium_image_url: Option<String>,
pub image_url: Option<String>,
pub large_image_url: Option<String>,
pub image_width: Option<u32>,
pub image_height: Option<u32>,
pub image_size: Option<String>,
pub image_position: Option<String>,
pub tags: Option<Vec<String>>,
pub comments_count: u32,
pub page_views: Option<u32>,
pub page_clicks: Option<u32>,
pub author: Option<User>,
pub is_user_suggestion: bool,
pub suggested_by: Option<User>,
pub twitter_author: Option<String>,
pub publication_date: Option<i64>,
pub curation_date: i64,
pub topic_id: u64,
pub topic: Option<Box<Topic>>,
pub metadata: Option<HashMap<String, String>>,
}
#[derive(Debug, Clone)]
pub struct SearchResults {
pub users: Option<Vec<User>>,
pub topics: Option<Vec<Topic>>,
pub posts: Option<Vec<Post>>,
pub total_found: i32,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
pub struct RecipientsList {
pub id: i64,
pub name: String,
pub emails: Vec<String>,
}
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub enum SuggestionEngineType {
ResearchContent,
ContentMonitoring,
Topic,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct SuggestionEngine {
pub id: i64,
pub r#type: SuggestionEngineType,
pub name: String,
pub saved_searches: Option<Vec<SuggestionEngineSavedSearch>>,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct SuggestionEngineSavedSearch {
id: i64,
name: String,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "snake_case", tag = "type")]
pub enum SourceTypeData {
#[serde(rename_all = "camelCase")]
AdvancedSearch { query: String },
#[serde(rename_all = "camelCase")]
Webpage { webpage_url: Url },
#[serde(rename_all = "camelCase")]
Rss { rss_url: Url },
#[serde(rename_all = "camelCase")]
TwitterSearch { twitter_search_query: String },
#[serde(rename_all = "camelCase")]
TwitterList {
twitter_list_name: String,
twitter_list_owner: String,
},
#[serde(rename_all = "camelCase")]
TwitterFollowUser { twitter_user: String },
}
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Source {
pub id: i64,
pub name: String,
pub description: String,
pub icon_url: Url,
pub url: Option<Url>,
#[serde(flatten)]
pub source_type_data: SourceTypeData,
}