picdl_rs/boosty/types.rs
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
use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "UPPERCASE")]
/// Prices of a paid post in two currencies
pub struct CurrencyPrices {
/// Price in russian rubles
pub rub: f64,
/// Price in american dollars
pub usd: f64
}
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
/// Paid post teaser
pub struct Teaser {
#[serde(rename = "type")]
/// Type of teaser
pub content_type: String,
/// Width of content
pub width: Option<isize>,
/// Height of content
pub height: Option<isize>,
/// Rendition of content
pub rendition: Option<String>,
/// URL of content
pub url: Option<String>,
/// Teaser ID
pub id: Option<String>,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
/// Uploaded to Boosty video URLs
pub struct PlayerUrls {
#[serde(rename = "type")]
/// Type of URL
pub content_type: String,
/// URL itself
pub url: String,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
/// Attached content to post
pub struct Data {
#[serde(rename = "type")]
/// Type of content
pub content_type: String,
/// Width of content
pub width: Option<isize>,
/// Height of content
pub height: Option<isize>,
/// Rendition of content
pub rendition: Option<String>,
/// URL of content
pub url: Option<String>,
/// Teaser ID
pub id: Option<String>,
/// Player URLs (for uploaded videos to Boosty)
pub player_urls: Option<Vec<PlayerUrls>>,
/// Content itself (for example text)
pub content: Option<String>
}
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
/// Post reactions count
pub struct Reactions {
/// Angry reactions count
pub angry: isize,
/// Heart (likes) reaction count
pub heart: isize,
/// Fire reaction count
pub fire: isize,
/// Like reaction count (not the same as heart)
pub like: isize,
/// Dislike reaction count
pub dislike: isize,
/// Wonder reaction count
pub wonder: isize,
/// Laught reaction count
pub laught: isize,
/// Sad reaction count,
pub sad: isize
}
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
/// Post reactions and comments count
pub struct Count {
/// Likes count
pub likes: isize,
/// Reactions count
pub reactions: Reactions,
/// Comments count
pub comments: isize
}
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
/// Boosty post on a blog
pub struct Post {
/// Creation time in Unix format
pub created_at: u64,
/// Update time in Unix format
pub updated_at: Option<u64>,
/// Publish time in Unix format
pub publish_time: u64,
/// Reactions and comments count
pub count: Count,
/// Paid post data
pub data: Option<Vec<Data>>,
/// Paid post price in two currencies
pub currency_prices: CurrencyPrices,
/// Teaser of paid post
pub teaser: Vec<Teaser>,
/// Is post views counter visible
pub show_views_counter: bool,
/// Price of a paid post (0 if free)
pub price: isize,
/// Post ID
pub id: String,
/// Donations count
pub donations: isize,
/// Post title
pub title: String
}
/// Boosty response
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Response {
/// Vector of `Post`
pub data: Vec<Post>,
}