initial commit
This commit is contained in:
9
src/main.rs
Normal file
9
src/main.rs
Normal file
@ -0,0 +1,9 @@
|
||||
mod status;
|
||||
|
||||
fn main() {
|
||||
let status = status::status();
|
||||
|
||||
let serialized = serde_json::to_string(&status).unwrap();
|
||||
|
||||
println!("{serialized}");
|
||||
}
|
108
src/status.rs
Normal file
108
src/status.rs
Normal file
@ -0,0 +1,108 @@
|
||||
use spaceapi::{
|
||||
sensors::{DoorLockedSensor, SensorMetadataWithLocation, Sensors},
|
||||
Contact, Location, State, Status, StatusBuilder,
|
||||
};
|
||||
|
||||
const SPACE_NAME: &str = "Chaospott";
|
||||
const SPACE_LOGO: &str = "https://chaospott.de/images/logo.png";
|
||||
const SPACE_URL: &str = "https://chaospott.de";
|
||||
|
||||
pub fn status() -> Status {
|
||||
let mut status = StatusBuilder::v14(SPACE_NAME)
|
||||
.logo(SPACE_LOGO)
|
||||
.url(SPACE_URL)
|
||||
.location(Location {
|
||||
address: Some("Sibyllastr. 9, 45136 Essen, Germany".into()),
|
||||
lat: 51.438476,
|
||||
lon: 7.024991,
|
||||
..Default::default()
|
||||
})
|
||||
.contact(Contact {
|
||||
email: Some("info@chaospott.de".into()),
|
||||
irc: Some("irc://irc.hackint.org/#chaospott".into()),
|
||||
issue_mail: Some("support@chaospott.de".into()),
|
||||
mastodon: Some("https://chaos.social/@chaospott".into()),
|
||||
matrix: Some("#chaospott:matrix.chaospott.de".into()),
|
||||
ml: Some("discuss@lists.chaospott.de".into()),
|
||||
mumble: Some("mumble://mumble.chaospott.de".into()),
|
||||
phone: Some("+49 201 85892243".into()),
|
||||
..Default::default()
|
||||
})
|
||||
// .add_issue_report_channel(IssueReportChannel::IssueMail)
|
||||
// .add_issue_report_channel(IssueReportChannel::Ml)
|
||||
.state(State {
|
||||
open: Some(false),
|
||||
..State::default()
|
||||
})
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
let mut sensores = Sensors::default();
|
||||
|
||||
sensores.door_locked.push(DoorLockedSensor {
|
||||
value: true,
|
||||
metadata: SensorMetadataWithLocation {
|
||||
name: None,
|
||||
description: None,
|
||||
location: "aerie".to_string(),
|
||||
},
|
||||
});
|
||||
sensores.door_locked.push(DoorLockedSensor {
|
||||
value: true,
|
||||
metadata: SensorMetadataWithLocation {
|
||||
name: None,
|
||||
description: None,
|
||||
location: "cellar".to_string(),
|
||||
},
|
||||
});
|
||||
status.sensors = Some(sensores);
|
||||
let mut status = StatusBuilder::v14(SPACE_NAME)
|
||||
.logo(SPACE_LOGO)
|
||||
.url(SPACE_URL)
|
||||
.location(Location {
|
||||
address: Some("Sibyllastr. 9, 45136 Essen, Germany".into()),
|
||||
lat: 51.438476,
|
||||
lon: 7.024991,
|
||||
..Default::default()
|
||||
})
|
||||
.contact(Contact {
|
||||
email: Some("info@chaospott.de".into()),
|
||||
irc: Some("irc://irc.hackint.org/#chaospott".into()),
|
||||
issue_mail: Some("support@chaospott.de".into()),
|
||||
mastodon: Some("https://chaos.social/@chaospott".into()),
|
||||
matrix: Some("#chaospott:matrix.chaospott.de".into()),
|
||||
ml: Some("discuss@lists.chaospott.de".into()),
|
||||
mumble: Some("mumble://mumble.chaospott.de".into()),
|
||||
phone: Some("+49 201 85892243".into()),
|
||||
..Default::default()
|
||||
})
|
||||
// .add_issue_report_channel(IssueReportChannel::IssueMail)
|
||||
// .add_issue_report_channel(IssueReportChannel::Ml)
|
||||
.state(State {
|
||||
open: Some(false),
|
||||
..State::default()
|
||||
})
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
let mut sensores = Sensors::default();
|
||||
|
||||
sensores.door_locked.push(DoorLockedSensor {
|
||||
value: true,
|
||||
metadata: SensorMetadataWithLocation {
|
||||
name: None,
|
||||
description: None,
|
||||
location: "aerie".to_string(),
|
||||
},
|
||||
});
|
||||
sensores.door_locked.push(DoorLockedSensor {
|
||||
value: true,
|
||||
metadata: SensorMetadataWithLocation {
|
||||
name: None,
|
||||
description: None,
|
||||
location: "cellar".to_string(),
|
||||
},
|
||||
});
|
||||
status.sensors = Some(sensores);
|
||||
status
|
||||
}
|
Reference in New Issue
Block a user