Source code for deltachat_rpc_client.deltachat

from __future__ import annotations

from typing import TYPE_CHECKING

from ._utils import AttrDict
from .account import Account

    from .rpc import Rpc

[docs] class DeltaChat: """ Delta Chat accounts manager. This is the root of the object oriented API. """ def __init__(self, rpc: "Rpc") -> None: self.rpc = rpc
[docs] def add_account(self) -> Account: """Create a new account database.""" account_id = self.rpc.add_account() return Account(self, account_id)
[docs] def get_all_accounts(self) -> list[Account]: """Return a list of all available accounts.""" account_ids = self.rpc.get_all_account_ids() return [Account(self, account_id) for account_id in account_ids]
[docs] def start_io(self) -> None: """Start the I/O of all accounts.""" self.rpc.start_io_for_all_accounts()
[docs] def stop_io(self) -> None: """Stop the I/O of all accounts.""" self.rpc.stop_io_for_all_accounts()
[docs] def maybe_network(self) -> None: """Indicate that the network likely has come back or just that the network conditions might have changed. """ self.rpc.maybe_network()
[docs] def get_system_info(self) -> AttrDict: """Get information about the Delta Chat core in this system.""" return AttrDict(self.rpc.get_system_info())
[docs] def set_translations(self, translations: dict[str, str]) -> None: """Set stock translation strings.""" self.rpc.set_stock_strings(translations)