mirror of
https://github.com/deltachat/deltachat-core.git
synced 2025-10-04 02:09:17 +02:00
revamp api high level page, strike last references of "ffi.CData"
This commit is contained in:
parent
68c401ea76
commit
1f0812c907
3 changed files with 39 additions and 16 deletions
|
@ -6,21 +6,43 @@ high level API reference
|
|||
|
||||
This API is work in progress and may change in versions prior to 1.0.
|
||||
|
||||
.. autosummary::
|
||||
- :class:`deltachat.account.Account` (your main entry point, creates the
|
||||
other classes)
|
||||
- :class:`deltachat.chatting.Contact`
|
||||
- :class:`deltachat.chatting.Chat`
|
||||
- :class:`deltachat.chatting.Message`
|
||||
- :class:`deltachat.chatting.MessageState`
|
||||
|
||||
deltachat.account
|
||||
deltachat.chatting
|
||||
Account
|
||||
-------
|
||||
|
||||
account module
|
||||
--------------
|
||||
|
||||
.. automodule:: deltachat.account
|
||||
.. autoclass:: deltachat.account.Account
|
||||
:members:
|
||||
|
||||
|
||||
chatting module
|
||||
---------------
|
||||
Contact
|
||||
-------
|
||||
|
||||
.. automodule:: deltachat.chatting
|
||||
.. autoclass:: deltachat.chatting.Contact
|
||||
:members:
|
||||
|
||||
Chat
|
||||
----
|
||||
|
||||
.. autoclass:: deltachat.chatting.Chat
|
||||
:members:
|
||||
|
||||
Message
|
||||
-------
|
||||
|
||||
.. autoclass:: deltachat.chatting.Message
|
||||
:members:
|
||||
|
||||
|
||||
MessageState
|
||||
------------
|
||||
|
||||
.. autoclass:: deltachat.chatting.MessageState
|
||||
:members:
|
||||
|
||||
|
||||
|
|
|
@ -20,8 +20,9 @@ from .chatting import Contact, Chat, Message
|
|||
|
||||
|
||||
class Account(object):
|
||||
""" An account contains configuration and provides methods
|
||||
for configuration, contact and chat creation and manipulation.
|
||||
""" Each account is tied to a sqlite database file which is fully managed
|
||||
by the underlying deltachat c-library. All public Account methods are
|
||||
meant to be memory-safe and return memory-safe objects.
|
||||
"""
|
||||
|
||||
def __init__(self, db_path, logid=None):
|
||||
|
@ -86,7 +87,7 @@ class Account(object):
|
|||
self.check_is_configured()
|
||||
return Contact(self._dc_context, lib.DC_CONTACT_ID_SELF)
|
||||
|
||||
def create_contact(self, email, name=ffi.NULL):
|
||||
def create_contact(self, email, name=None):
|
||||
""" create a (new) Contact. If there already is a Contact
|
||||
with that e-mail address, it is unblocked and its name is
|
||||
updated.
|
||||
|
@ -100,7 +101,7 @@ class Account(object):
|
|||
contact_id = lib.dc_create_contact(self._dc_context.p, name, email)
|
||||
return Contact(self._dc_context, contact_id)
|
||||
|
||||
def get_contacts(self, query=ffi.NULL, with_self=False, only_verified=False):
|
||||
def get_contacts(self, query=None, with_self=False, only_verified=False):
|
||||
""" get a (filtered) list of contacts.
|
||||
|
||||
:param query: if a string is specified, only return contacts
|
||||
|
|
|
@ -3,8 +3,8 @@ from .capi import ffi
|
|||
|
||||
|
||||
def convert_to_bytes_utf8(obj):
|
||||
if obj == ffi.NULL:
|
||||
return obj
|
||||
if obj == ffi.NULL or obj is None:
|
||||
return ffi.NULL
|
||||
if not isinstance(obj, bytes):
|
||||
return obj.encode("utf8")
|
||||
return obj
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue