[PATCH proxmox-perl-rs v3 10/23] pve-rs: notify: Add binding for triggering state refresh

Arthur Bied-Charreton
2026-04-15T07:04:39Z

Expose the new `trigger_state_refresh` proxmox-notify API to allow
update jobs to manually 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 <a.bied-charreton@proxmox.com>
Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>
---
common/src/bindings/notify.rs | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/common/src/bindings/notify.rs b/common/src/bindings/notify.rs
index ff1e6cf..1f43d67 100644
--- a/common/src/bindings/notify.rs
+++ b/common/src/bindings/notify.rs
@@ -141,6 +141,19 @@ 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.
+ ///
+ /// See [`api::common::refresh_targets`]
+ #[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