From 07069c348b4f7129a18edf3017a61cfc55ade22d Mon Sep 17 00:00:00 2001 From: link2xt Date: Fri, 14 Nov 2025 23:27:52 +0000 Subject: [PATCH] api(deltachat-rpc-client): add APIs for background fetch --- .../src/deltachat_rpc_client/deltachat.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/deltachat-rpc-client/src/deltachat_rpc_client/deltachat.py b/deltachat-rpc-client/src/deltachat_rpc_client/deltachat.py index 58ee30b32..3d23eac46 100644 --- a/deltachat-rpc-client/src/deltachat_rpc_client/deltachat.py +++ b/deltachat-rpc-client/src/deltachat_rpc_client/deltachat.py @@ -4,7 +4,7 @@ from __future__ import annotations from typing import TYPE_CHECKING -from ._utils import AttrDict +from ._utils import AttrDict, futuremethod from .account import Account if TYPE_CHECKING: @@ -39,6 +39,15 @@ class DeltaChat: """Stop the I/O of all accounts.""" self.rpc.stop_io_for_all_accounts() + @futuremethod + def background_fetch(self, timeout_in_seconds: int) -> None: + """Run background fetch for all accounts.""" + yield self.rpc.background_fetch.future(timeout_in_seconds) + + def stop_background_fetch(self) -> None: + """Stop ongoing background fetch.""" + self.rpc.stop_background_fetch() + def maybe_network(self) -> None: """Indicate that the network conditions might have changed.""" self.rpc.maybe_network()