Expose the new `trigger_state_refresh` proxmox-notify API to allow
update jobs to trigger a refresh of the crate's internal state.

This currently only serves the purpose of preventing unused OAuth2 refresh
tokens from expiring.

Signed-off-by: Arthur Bied-Charreton <[email protected]>
Reviewed-by: Lukas Wagner <[email protected]>
---
 common/src/bindings/notify.rs | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/common/src/bindings/notify.rs b/common/src/bindings/notify.rs
index ff1e6cf..8316013 100644
--- a/common/src/bindings/notify.rs
+++ b/common/src/bindings/notify.rs
@@ -141,6 +141,20 @@ pub mod proxmox_rs_notify {
         api::common::send(&config, &notification)
     }
 
+    /// Method: Refresh the state for all endpoints.
+    ///
+    /// This iterates through all configured targets, refreshing their state 
if needed.
+    /// The caller is responsible for locking the notifications config.
+    ///
+    /// See [`api::common::trigger_state_refresh`]
+    #[export(serialize_error)]
+    pub fn trigger_state_refresh(
+        #[try_from_ref] this: &NotificationConfig,
+    ) -> Result<(), HttpError> {
+        let config = this.config.lock().unwrap();
+        api::common::trigger_state_refresh(&config)
+    }
+
     /// Method: Get a list of all notification targets.
     ///
     /// See [`api::get_targets`].
-- 
2.47.3



Reply via email to