status-im / status-protocol-go

Status Protocol implementation in Go
Mozilla Public License 2.0
0 stars 1 forks source link

Add chats API calls #41

Closed cammellos closed 5 years ago

cammellos commented 5 years ago

This commits adds two API calls:

SaveChat GetChats

The first one behaves like an upsert. The second takes two parameters, from, to and returns chats in reverse order by timestamp.

Members and MembershipUpdates have been stored as blob of data to simplify the querying (we never query them separately).

I have changed the Chat type from interface to a concrete type, the most relevant change is that ID is now a string , for one-to-one it should be set to the hexencoded public key of the user, the chat-name for public chats, and uuid+pk-of-creator for private group chats, in order to be consistent with status-react. We append the type in the database to avoid having cases where a public-chat name is the same as a public pk for example.

I will test this against status-react/status-console-client before merging, so please don't merge, but it would be useful to get some feedback, thanks!

cammellos commented 5 years ago

@adambabik @PombeirP ready to be reviewed again, thanks for the feedback!