Skip to content

Commit 07069c3

Browse files
committed
api(deltachat-rpc-client): add APIs for background fetch
1 parent 26f6b85 commit 07069c3

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

deltachat-rpc-client/src/deltachat_rpc_client/deltachat.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from typing import TYPE_CHECKING
66

7-
from ._utils import AttrDict
7+
from ._utils import AttrDict, futuremethod
88
from .account import Account
99

1010
if TYPE_CHECKING:
@@ -39,6 +39,15 @@ def stop_io(self) -> None:
3939
"""Stop the I/O of all accounts."""
4040
self.rpc.stop_io_for_all_accounts()
4141

42+
@futuremethod
43+
def background_fetch(self, timeout_in_seconds: int) -> None:
44+
"""Run background fetch for all accounts."""
45+
yield self.rpc.background_fetch.future(timeout_in_seconds)
46+
47+
def stop_background_fetch(self) -> None:
48+
"""Stop ongoing background fetch."""
49+
self.rpc.stop_background_fetch()
50+
4251
def maybe_network(self) -> None:
4352
"""Indicate that the network conditions might have changed."""
4453
self.rpc.maybe_network()

0 commit comments

Comments
 (0)