|
@@ -4,7 +4,29 @@
|
|
|
|
|
|
// The metadata is a serde_json::Value
|
|
// The metadata is a serde_json::Value
|
|
// Please refer to https://docs.rs/serde_json/latest/serde_json/value/fn.from_value.html
|
|
// Please refer to https://docs.rs/serde_json/latest/serde_json/value/fn.from_value.html
|
|
-// on how to interpret it as an instance of type T, implementing Deserialize.
|
|
|
|
|
|
+// on how to interpret it as an instance of type T, implementing Serialize/Deserialize.
|
|
|
|
+
|
|
|
|
+// For example, if we want to sends a Zulip message every Friday at 11:30am ET into #t-release
|
|
|
|
+// with a @T-release meeting! content, we should create some Job like:
|
|
|
|
+//
|
|
|
|
+// #[derive(Serialize, Deserialize)]
|
|
|
|
+// struct ZulipMetadata {
|
|
|
|
+// pub message: String
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// let metadata = serde_json::value::to_value(ZulipMetadata {
|
|
|
|
+// message: "@T-release meeting!".to_string()
|
|
|
|
+// }).unwrap();
|
|
|
|
+//
|
|
|
|
+// Job {
|
|
|
|
+// name: "send_zulip_message",
|
|
|
|
+// expected_time: "2022-09-30T11:30:00+10:00",
|
|
|
|
+// frequency: Some(7),
|
|
|
|
+// frequency_unit: Some(FrequencyUnit::Days),
|
|
|
|
+// metadata: metadata
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// ... and add the corresponding "send_zulip_message" handler.
|
|
|
|
|
|
pub async fn handle_job(name: &String, metadata: &serde_json::Value) -> anyhow::Result<()> {
|
|
pub async fn handle_job(name: &String, metadata: &serde_json::Value) -> anyhow::Result<()> {
|
|
match name {
|
|
match name {
|