mirror of
https://seed.radicle.dev/rad:zwTxygwuz5LDGBq255RA2CbNGrz8.git
synced 2026-11-29 14:50:35 +08:00
This mostly useful for development, but serves as a way to show a valid JSON representation of a node event. Signed-off-by: Lars Wirzenius <liw@liw.fi>
34 lines
1.1 KiB
Rust
34 lines
1.1 KiB
Rust
use std::str::FromStr;
|
|
|
|
use radicle::git::{Oid, RefString};
|
|
use radicle::{
|
|
node::Event,
|
|
prelude::{NodeId, RepoId},
|
|
storage::RefUpdate,
|
|
};
|
|
|
|
fn main() {
|
|
let event = Event::RefsFetched {
|
|
remote: NodeId::from_str("z6MkgEMYod7Hxfy9qCvDv5hYHkZ4ciWmLFgfvm3Wn1b2w2FV").unwrap(),
|
|
rid: RepoId::from_urn("rad:zwTxygwuz5LDGBq255RA2CbNGrz8").unwrap(),
|
|
updated: vec![RefUpdate::Skipped {
|
|
name: RefString::try_from("shutdown").expect("create name"),
|
|
oid: Oid::try_from("0").unwrap(),
|
|
}],
|
|
};
|
|
println!("{}", serde_json::to_string(&event).unwrap());
|
|
|
|
println!();
|
|
|
|
let event = Event::RefsFetched {
|
|
remote: NodeId::from_str("z6MkgEMYod7Hxfy9qCvDv5hYHkZ4ciWmLFgfvm3Wn1b2w2FV").unwrap(),
|
|
rid: RepoId::from_urn("rad:zwTxygwuz5LDGBq255RA2CbNGrz8").unwrap(),
|
|
updated: vec![RefUpdate::Updated {
|
|
name: RefString::try_from("shutdown").expect("create name"),
|
|
old: Oid::try_from("0").unwrap(),
|
|
new: Oid::try_from("0").unwrap(),
|
|
}],
|
|
};
|
|
println!("{}", serde_json::to_string(&event).unwrap());
|
|
}
|