gw2lib_model/game_mechanics/
pets.rs

1use serde::{Deserialize, Serialize};
2
3pub use crate::game_mechanics::skills::SkillId;
4use crate::*;
5
6pub type PetId = u16;
7
8#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
9#[cfg_attr(test, serde(deny_unknown_fields))]
10pub struct PetSkill {
11    pub id: SkillId,
12}
13
14#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
15#[cfg_attr(test, serde(deny_unknown_fields))]
16pub struct Pet {
17    pub id: PetId,
18    pub name: String,
19    pub description: String,
20    pub icon: Option<String>,
21    pub skills: Vec<PetSkill>,
22}
23
24impl Endpoint for Pet {
25    const AUTHENTICATED: bool = false;
26    const LOCALE: bool = true;
27    const URL: &'static str = "v2/pets";
28    const VERSION: &'static str = "2024-03-09T00:00:00.000Z";
29}
30
31impl EndpointWithId for Pet {
32    type IdType = PetId;
33}
34
35impl BulkEndpoint for Pet {
36    const ALL: bool = true;
37
38    fn id(&self) -> &Self::IdType {
39        &self.id
40    }
41}