thunderstore_api/models/v2/
front_page_content.rs

1////////////////////////////////////////////////////////////////////////////////
2// This Source Code Form is subject to the terms of the Mozilla Public         /
3// License, v. 2.0. If a copy of the MPL was not distributed with this         /
4// file, You can obtain one at https://mozilla.org/MPL/2.0/.                   /
5////////////////////////////////////////////////////////////////////////////////
6
7use crate::models::v2::community;
8#[cfg(feature = "ts-rs")]
9use ts_rs::TS;
10
11#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize, Deserialize)]
12#[cfg_attr(feature = "ts-rs", derive(TS))]
13#[cfg_attr(feature = "ts-rs", ts(export))]
14pub struct FrontPageContent {
15    #[serde(rename = "communities")]
16    pub communities: Vec<community::Card>,
17    #[serde(rename = "download_count")]
18    pub download_count: u32,
19    #[serde(rename = "package_count")]
20    pub package_count: u32,
21}
22
23impl FrontPageContent {
24    #[must_use]
25    pub fn new(
26        communities: Vec<community::Card>,
27        download_count: u32,
28        package_count: u32,
29    ) -> FrontPageContent {
30        FrontPageContent {
31            communities,
32            download_count,
33            package_count,
34        }
35    }
36}