-
-
Notifications
You must be signed in to change notification settings - Fork 89
api survey
Floris Bruynooghe edited this page Feb 12, 2021
·
4 revisions
Rust API conventions in the deltachat-core-rust library.
A survey of existing APIs used to create the main objects. The APIs as shown are not actual signatures, but only approximations that allow to compare their behaviour without the full complexity.
Questions:
- Any main types missing?
- Any constructors missing?
Contact::add_or_lookup(context: &Context, name: &str, addr: &str);
//-> Result<(u32, Modifier)>
Contact::lookup_id_by_addr(context: &Context, addr: &str, min_origin: Origin);
// -> Result<Option<u32>>
Contact::load_from_db(context: &Context, contact_id: u32);
// -> Result<Self>
Contact::create(context: &Context, name: &str, addr: &str);
// -> Result<u32>
Contact::get_all(context: &Context, listflags: u32, query: &str);
// -> Result<Vec<u32>>
Contact::get_all_blocked(context: &Context);
// -> Vec<u32>
ChatId::new(id: u32);
// -> Self
chat::create_or_lookup_by_contact_id(context: &Context, contact_id: u32, create_blocked: Blocked);
//-> Result<(ChatId, Blocked)>
chat::lookup_by_contact_id(context: &Context, contact_id: u32);
// -> Result<(ChatId, Blocked)>
chat::create_by_contact_id(context: &Context, contact_id: u32);
// -> Result<ChatId>
chat::create_by_msg_id(context: &Context, msg_id: MsgId);
// -> Result<ChatId>
chat::create_group_chat(context: &Context, protect: ProtectionStatus, chat_name: &str);
// -> Result<ChatId>
Chat::load_from_db(context: &Context, chat_id: ChatId);
// -> Result<Self>
MsgId::new(id: u32); // Also MsgId::new_unset()
// -> Self
Message::new(viewtype: ViewType);
// -> Self
Message::load_from_db(context: &Context, id: MsgId);
// -> Result<Message, Error>
BlobObject::create(context: &Context, suggested_name: &str, data: &[u8]);
// -> Result<Self, Error>