use serde::{Deserialize, Serialize};
use crate::model::{ContentCounter, CurrencyPrices, Post, ReactionCounter, Thumbnail};
#[derive(Debug, Clone, Serialize)]
pub struct BundleQuery {
pub full_data: Option<bool>,
pub limit: Option<u32>,
pub for_owner: Option<bool>,
pub comments_limit: Option<u32>,
pub reply_limit: Option<u32>,
}
impl Default for BundleQuery {
fn default() -> Self {
Self {
full_data: Some(true),
limit: Some(12),
for_owner: Some(true),
comments_limit: Some(2),
reply_limit: Some(1),
}
}
}
#[derive(Deserialize, Debug)]
pub struct BundlesResponse {
pub data: BundlesData,
}
#[derive(Deserialize, Debug)]
pub struct BundlesData {
pub bundles: Vec<Bundle>,
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct Bundle {
pub id: String,
pub title: String,
pub description: String,
pub price: i32,
pub currency_prices: CurrencyPrices,
pub hidden: bool,
pub has_access: bool,
pub created_at: i64,
pub updated_at: i64,
pub published_at: i64,
pub deleted_at: Option<i64>,
pub blog_id: u64,
pub published_posts_counter: u32,
pub accessible_posts_counter: u32,
pub sorting: String,
pub content_counters: Vec<ContentCounter>,
pub thumbnail: Thumbnail,
}
#[derive(Deserialize, Debug)]
pub struct BundleItemsResponse {
pub data: BundleItemsData,
pub extra: BundleExtra,
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct BundleItemsData {
pub bundle_items: Vec<BundleItem>,
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct BundleExtra {
pub is_last: bool,
pub offset: usize,
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
pub struct BundleItem {
#[serde(flatten)]
pub post: Post,
pub position: u32,
pub bundle_id: String,
pub bundle_ids: Vec<String>,
pub post_id: String,
pub change: String,
pub is_draft: bool,
pub reaction_counters: Vec<ReactionCounter>,
pub bundles: Vec<Bundle>,
}