wip
This commit is contained in:
commit
adda135743
27 changed files with 4002 additions and 0 deletions
37
src/json/alert.rs
Normal file
37
src/json/alert.rs
Normal file
|
@ -0,0 +1,37 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::{
|
||||
area::Area, contact::Contact, description::Description, image::Image,
|
||||
image_description::ImageDescription, image_title::ImageTitle, link::Link, text::Text,
|
||||
title::Title,
|
||||
};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Alert {
|
||||
pub identifier: String,
|
||||
pub gtrans_origin: Option<String>,
|
||||
pub sent: String,
|
||||
pub title: Title,
|
||||
pub description: Description,
|
||||
pub nation_wide: bool,
|
||||
pub banner: bool,
|
||||
pub instructions: Vec<Text>,
|
||||
pub sender: String,
|
||||
pub publisher_name: Option<String>,
|
||||
pub link: Option<String>,
|
||||
pub links: Vec<Link>,
|
||||
pub contact: Contact,
|
||||
pub event: String,
|
||||
pub all_clear: bool,
|
||||
pub severity: String,
|
||||
pub test_alert: bool,
|
||||
pub technical_test_alert: bool,
|
||||
pub publish_date: String,
|
||||
pub areas: Vec<Area>,
|
||||
pub images: Vec<Image>,
|
||||
pub image_titles: Vec<ImageTitle>,
|
||||
pub image_descriptions: Vec<ImageDescription>,
|
||||
pub event_icon_path: String,
|
||||
pub reference: String,
|
||||
}
|
10
src/json/alerts.rs
Normal file
10
src/json/alerts.rs
Normal file
|
@ -0,0 +1,10 @@
|
|||
use super::alert::Alert;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Alerts {
|
||||
pub heartbeat_age_in_millis: u64,
|
||||
pub render_time: String,
|
||||
pub alerts: Vec<Alert>,
|
||||
}
|
13
src/json/area.rs
Normal file
13
src/json/area.rs
Normal file
|
@ -0,0 +1,13 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::{circle::Circle, description::Description, polygon::Polygon, region::Region};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Area {
|
||||
pub description: Description,
|
||||
pub region_type: String,
|
||||
pub polygons: Vec<Polygon>,
|
||||
pub circles: Vec<Circle>,
|
||||
pub regions: Vec<Region>,
|
||||
}
|
10
src/json/circle.rs
Normal file
10
src/json/circle.rs
Normal file
|
@ -0,0 +1,10 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::coordinate::Coordinate;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Circle {
|
||||
pub center_position: Coordinate,
|
||||
pub radius: String,
|
||||
}
|
8
src/json/contact.rs
Normal file
8
src/json/contact.rs
Normal file
|
@ -0,0 +1,8 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Contact {
|
||||
pub contact: String,
|
||||
pub contact_origin: Option<String>,
|
||||
}
|
10
src/json/coordinate.rs
Normal file
10
src/json/coordinate.rs
Normal file
|
@ -0,0 +1,10 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Coordinate {
|
||||
#[serde(rename = "0")]
|
||||
pub zero: String,
|
||||
#[serde(rename = "1")]
|
||||
pub one: String,
|
||||
}
|
8
src/json/description.rs
Normal file
8
src/json/description.rs
Normal file
|
@ -0,0 +1,8 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Description {
|
||||
pub description: String,
|
||||
pub description_gtrans_origin: Option<String>,
|
||||
}
|
10
src/json/image.rs
Normal file
10
src/json/image.rs
Normal file
|
@ -0,0 +1,10 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Image {
|
||||
pub uri: String,
|
||||
pub digest: String,
|
||||
pub index: u64,
|
||||
pub size: String,
|
||||
}
|
11
src/json/image_description.rs
Normal file
11
src/json/image_description.rs
Normal file
|
@ -0,0 +1,11 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::description::Description;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ImageDescription {
|
||||
pub index: u64,
|
||||
#[serde(flatten)]
|
||||
pub description: Description,
|
||||
}
|
12
src/json/image_title.rs
Normal file
12
src/json/image_title.rs
Normal file
|
@ -0,0 +1,12 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::title::Title;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ImageTitle {
|
||||
pub index: u64,
|
||||
#[serde(flatten)]
|
||||
pub title: Title,
|
||||
pub alt_text: String,
|
||||
}
|
8
src/json/link.rs
Normal file
8
src/json/link.rs
Normal file
|
@ -0,0 +1,8 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Link {
|
||||
pub href: String,
|
||||
pub text: String,
|
||||
}
|
9
src/json/polygon.rs
Normal file
9
src/json/polygon.rs
Normal file
|
@ -0,0 +1,9 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::coordinate::Coordinate;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Polygon {
|
||||
pub coordinates: Vec<Coordinate>,
|
||||
}
|
7
src/json/region.rs
Normal file
7
src/json/region.rs
Normal file
|
@ -0,0 +1,7 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Region {
|
||||
pub region: String,
|
||||
}
|
8
src/json/text.rs
Normal file
8
src/json/text.rs
Normal file
|
@ -0,0 +1,8 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Text {
|
||||
pub text: String,
|
||||
pub text_origin: Option<String>,
|
||||
}
|
8
src/json/title.rs
Normal file
8
src/json/title.rs
Normal file
|
@ -0,0 +1,8 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Title {
|
||||
pub title: String,
|
||||
pub title_gtrans_origin: Option<String>,
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue