1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
use warframe_macros::model;
use super::{
faction::Faction,
reward::Reward,
reward_type::RewardType,
};
type DateTime = chrono::DateTime<chrono::Utc>;
/// An defender/attacker of an Invasion
#[model]
pub struct InvasionMember {
/// The reward of the mission.
pub reward: Option<Reward>,
/// The localized faction that houses the node/mission
pub faction: String,
/// The faction that houses the node/mission
pub faction_key: Faction,
}
/// An Invasion
#[model(endpoint = "/invasions", return_style = Array)]
pub struct Invasion {
/// The time the Invasion began
pub activation: DateTime,
/// Whether the Invasion is over
pub completed: bool,
/// Percentage of the Invasion's completion
pub completion: f32,
/// How many fights have happened
pub count: i32,
/// The Invasion's description
#[serde(rename = "desc")]
pub description: String,
/// The i18n of the node
pub node: String,
/// The name of the node
pub node_key: String,
/// The amount of runs required to qualify for the reward. (most likely 3)
pub required_runs: i32,
/// Whether the fight is against infested enemies
pub vs_infestation: bool,
/// The invading faction information
pub attacker: InvasionMember,
/// The defending faction information
pub defender: InvasionMember,
/// A list of reward types
pub reward_types: Vec<RewardType>,
}
#[cfg(test)]
mod test_invasion {
use rstest::rstest;
use serde_json::from_str;
use super::Invasion;
use crate::worldstate::Queryable;
type R = <Invasion as Queryable>::Return;
#[rstest]
fn test(
#[files("src/worldstate/models/fixtures/invasion.json")]
#[mode = str]
invasion_en: &str,
) {
from_str::<R>(invasion_en).unwrap();
}
}