thunderstore_api/models/v2/
available_community.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::Community;
8use crate::models::v2::package::Category;
9#[cfg(feature = "ts-rs")]
10use ts_rs::TS;
11
12#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize, Deserialize)]
13#[cfg_attr(feature = "ts-rs", derive(TS))]
14#[cfg_attr(feature = "ts-rs", ts(export))]
15pub struct AvailableCommunity {
16    pub community: Community,
17    pub categories: Vec<Category>,
18    pub url: String,
19}
20
21impl AvailableCommunity {
22    #[must_use]
23    pub fn new(community: Community, categories: Vec<Category>, url: String) -> AvailableCommunity {
24        AvailableCommunity {
25            community,
26            categories,
27            url,
28        }
29    }
30}