To define a upper boundary of responsibilities and help align the ChatSDK with developers consuming the library, here is an outline of a possible API.
enum ConversationType {
Private,
Group,
Forum,
Broadcast,
GatedGroup,
};
struct Client {
Client(
DeliverySerivce deliveryService, // RLN Initalized Waku Object
MessageStore msgStore
);
// Sensible default constructors
static Client createClientWithNewAccount(....)
static Client createClientWithExistingAccount(....);
// Content Creation
Conversation createPrivateV1Convo( ...);
Conversation createPrivateV2Convo( ...);
Conversation createGroupV1Convo( ...);
// Get Historical Objects
void listConversations();
// TODO: Should Apps be responsible for message storage and migration?
void listMessages(String conversationId);
// New Data handlers
void onNewConversation(Conversation (*f)());
void onConversationUpdate(Conversation (*f)()); // Changes to desc, or members
void onNewMessage(Message (*f)()); // TODO: Watchout for Racecondition here
}
struct Conversation {
ConversationType conversationType;
void sendMessage(Message m);
bool addParticipant();
bool removeParticipant();
...
);