gw2lib_model/misc/
raids.rs

1use serde::{Deserialize, Serialize};
2
3use crate::{BulkEndpoint, Endpoint, EndpointWithId};
4
5pub type RaidId = String;
6pub type WingId = String;
7pub type EventId = String;
8
9#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
10pub struct Raid {
11    pub id: RaidId,
12    pub wings: Vec<Wing>,
13}
14
15#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
16pub struct Wing {
17    pub id: WingId,
18    pub events: Vec<Event>,
19}
20
21#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
22pub struct Event {
23    pub id: EventId,
24    #[serde(rename = "type")]
25    pub _type: String,
26}
27
28impl EndpointWithId for Raid {
29    type IdType = RaidId;
30}
31
32impl Endpoint for Raid {
33    const AUTHENTICATED: bool = false;
34    const LOCALE: bool = true;
35    const URL: &'static str = "v2/raids";
36    const VERSION: &'static str = "2023-08-02T00:00:00.000Z";
37}
38
39impl BulkEndpoint for Raid {
40    const ALL: bool = true;
41
42    fn id(&self) -> &Self::IdType {
43        &self.id
44    }
45}