boosty_rs/
types.rs

1use serde::{Serialize, Deserialize};
2
3#[derive(Serialize, Deserialize, Debug, Clone)]
4#[serde(rename_all = "UPPERCASE")]
5/// Prices of a paid post in two currencies
6pub struct CurrencyPrices {
7    /// Price in russian rubles
8    pub rub: f64,
9    /// Price in american dollars
10    pub usd: f64
11}
12
13#[derive(Serialize, Deserialize, Debug, Clone)]
14#[serde(rename_all = "camelCase")]
15/// Paid post teaser
16pub struct Teaser {
17    #[serde(rename = "type")]
18    /// Type of teaser
19    pub content_type: String,
20    /// Width of content
21    pub width: Option<isize>,
22    /// Height of content
23    pub height: Option<isize>,
24    /// Rendition of content
25    pub rendition: Option<String>,
26    /// URL of content
27    pub url: Option<String>,
28    /// Teaser ID
29    pub id: Option<String>,
30}
31
32#[derive(Serialize, Deserialize, Debug, Clone)]
33#[serde(rename_all = "camelCase")]
34/// Uploaded to Boosty video URLs 
35pub struct PlayerUrls {
36    #[serde(rename = "type")]
37    /// Type of URL
38    pub content_type: String,
39    /// URL itself
40    pub url: String,
41}
42
43#[derive(Serialize, Deserialize, Debug, Clone)]
44#[serde(rename_all = "camelCase")]
45/// Attached content to post
46pub struct Data {
47    #[serde(rename = "type")]
48    /// Type of content
49    pub content_type: String,
50    /// Width of content
51    pub width: Option<isize>,
52    /// Height of content
53    pub height: Option<isize>,
54    /// Rendition of content
55    pub rendition: Option<String>,
56    /// URL of content
57    pub url: Option<String>,
58    /// Teaser ID
59    pub id: Option<String>,
60    /// Player URLs (for uploaded videos to Boosty)
61    pub player_urls: Option<Vec<PlayerUrls>>,
62    /// Content itself (for example text)
63    pub content: Option<String>
64}
65
66#[derive(Serialize, Deserialize, Debug, Clone)]
67#[serde(rename_all = "camelCase")]
68/// Post reactions count
69pub struct Reactions {
70    /// Angry reactions count
71    pub angry: isize,
72    /// Heart (likes) reaction count
73    pub heart: isize,
74    /// Fire reaction count
75    pub fire: isize,
76    /// Like reaction count (not the same as heart)
77    pub like: isize,
78    /// Dislike reaction count
79    pub dislike: isize,
80    /// Wonder reaction count
81    pub wonder: isize,
82    /// Laught reaction count
83    pub laught: isize,
84    /// Sad reaction count,
85    pub sad: isize
86}
87
88#[derive(Serialize, Deserialize, Debug, Clone)]
89#[serde(rename_all = "camelCase")]
90/// Post reactions and comments count
91pub struct Count {
92    /// Likes count
93    pub likes: isize,
94    /// Reactions count
95    pub reactions: Reactions,
96    /// Comments count
97    pub comments: isize
98}
99
100#[derive(Serialize, Deserialize, Debug, Clone)]
101#[serde(rename_all = "camelCase")]
102/// Boosty post on a blog
103pub struct Post {
104    /// Creation time in Unix format
105    pub created_at: u64,
106    /// Update time in Unix format
107    pub updated_at: Option<u64>,
108    /// Publish time in Unix format
109    pub publish_time: u64,
110    /// Reactions and comments count
111    pub count: Count,
112    /// Paid post data
113    pub data: Option<Vec<Data>>,
114    /// Paid post price in two currencies
115    pub currency_prices: CurrencyPrices,
116    /// Teaser of paid post
117    pub teaser: Vec<Teaser>,
118    /// Is post views counter visible
119    pub show_views_counter: bool,
120    /// Price of a paid post (0 if free)
121    pub price: isize,
122    /// Post ID
123    pub id: String,
124    /// Donations count
125    pub donations: isize,
126    /// Post title
127    pub title: String
128}