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
#![allow(clippy::struct_excessive_bools)]
use std::collections::HashMap;
use chrono::{
DateTime,
Utc,
};
use warframe_macros::model;
use crate::worldstate::Language;
/// A news item
#[model(endpoint = "/news", return_style = Array)]
pub struct News {
/// The id of the News
pub id: String,
/// The message associated to the News
pub message: String,
/// The link to the image associated with the News
pub image_link: String,
/// Whether the News are prioritized
pub priority: bool,
/// Whether the News are related to an update
pub update: bool,
/// Whether the News are related to a stream
pub stream: bool,
/// The date the News were posted
pub date: DateTime<Utc>,
/// When the event that is associated with the News begins
pub start_date: Option<DateTime<Utc>>,
/// When the event that is associated with the News ends
pub end_date: Option<DateTime<Utc>>,
/// The translations of the News message
pub translations: HashMap<Language, String>,
/// The link to the News
pub link: String,
/// Whether the News are mobile-only
pub mobile_only: bool,
/// The time when the News expire
pub expiry: Option<DateTime<Utc>>,
}
#[cfg(test)]
mod test_news {
use rstest::rstest;
use serde_json::from_str;
use super::News;
use crate::worldstate::Queryable;
type R = <News as Queryable>::Return;
#[rstest]
fn test(
#[files("src/worldstate/models/fixtures/news.json")]
#[mode = str]
news_en: &str,
) {
from_str::<R>(news_en).unwrap();
}
}