gw2lib_model/misc/
worlds.rs1use serde::{Deserialize, Serialize};
2
3use crate::*;
4
5pub type WorldId = u16;
6
7#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
8#[cfg_attr(test, serde(deny_unknown_fields))]
9pub enum PopulationLevel {
10 Medium,
11 High,
12 VeryHigh,
13 Full,
14}
15
16#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
17#[cfg_attr(test, serde(deny_unknown_fields))]
18pub struct World {
19 pub id: WorldId,
20 pub name: String,
21 pub population: PopulationLevel,
22}
23
24impl Endpoint for World {
25 const AUTHENTICATED: bool = false;
26 const LOCALE: bool = true;
27 const URL: &'static str = "v2/worlds";
28 const VERSION: &'static str = "2022-07-22T00:00:00.000Z";
29}
30
31impl EndpointWithId for World {
32 type IdType = WorldId;
33}
34
35impl BulkEndpoint for World {
36 const ALL: bool = true;
37
38 fn id(&self) -> &Self::IdType {
39 &self.id
40 }
41}