Skip to content

Commit

Permalink
Merge pull request #4471 from glouvigny/chore/remove-backend-features-1
Browse files Browse the repository at this point in the history
Removed reactions, reply options and attachments in Go code
  • Loading branch information
glouvigny committed Oct 20, 2022
2 parents 1744b55 + a85ed15 commit fe1c64a
Show file tree
Hide file tree
Showing 69 changed files with 1,502 additions and 10,112 deletions.
204 changes: 19 additions & 185 deletions api/messengertypes.proto
Expand Up @@ -34,9 +34,6 @@ service MessengerService {
// SendContactRequest takes the payload received from ParseDeepLink and send a contact request using the Berty Protocol.
rpc SendContactRequest(SendContactRequest.Request) returns (SendContactRequest.Reply);

// SendReplyOptions sends a list of prefilled response options to a group.
rpc SendReplyOptions (SendReplyOptions.Request) returns (SendReplyOptions.Reply);

// SystemInfo returns runtime information.
rpc SystemInfo(SystemInfo.Request) returns (SystemInfo.Reply);

Expand Down Expand Up @@ -76,15 +73,6 @@ service MessengerService {
// InstanceExportData exports instance data
rpc InstanceExportData (InstanceExportData.Request) returns (stream InstanceExportData.Reply);

// MediaPrepare allows to upload a file and returns a cid to attach to messages
rpc MediaPrepare (stream MediaPrepare.Request) returns (MediaPrepare.Reply);

// MediaRetrieve allows to download a file attached to a message
rpc MediaRetrieve (MediaRetrieve.Request) returns (stream MediaRetrieve.Reply);

// MediaGetRelated Gets previous/next media to be played after current
rpc MediaGetRelated(MediaGetRelated.Request) returns (MediaGetRelated.Reply);

// MessageSearch
rpc MessageSearch (MessageSearch.Request) returns (MessageSearch.Reply);

Expand All @@ -107,9 +95,6 @@ service MessengerService {

// PushReceive handles a push payload, decrypts it if possible, adds it to the local store
rpc PushReceive(PushReceive.Request) returns (PushReceive.Reply);

// InteractionReactionsForEmoji returns a list of reactions on an interaction for a specific emoji
rpc InteractionReactionsForEmoji(InteractionReactionsForEmoji.Request) returns (InteractionReactionsForEmoji.Reply);
}

message PaginatedInteractionsOptions {
Expand All @@ -126,7 +111,7 @@ message PaginatedInteractionsOptions {
bool oldest_to_newest = 4;

// exclude_medias Medias are included by default
bool exclude_medias = 5;
reserved 5; // bool exclude_medias = 5;

// no_bulk should interactions be via atomic update in the stream
bool no_bulk = 6;
Expand Down Expand Up @@ -305,14 +290,6 @@ message SendContactRequest {
message Reply {}
}

message SendReplyOptions {
message Request {
bytes group_pk = 1 [(gogoproto.customname) = "GroupPK"];
AppMessage.ReplyOptions options = 2;
}
message Reply {}
}

message BertyID {
bytes public_rendezvous_seed = 1;
bytes account_pk = 2 [(gogoproto.customname) = "AccountPK"];
Expand All @@ -329,47 +306,35 @@ message AppMessage {
Type type = 1;
bytes payload = 2;
int64 sent_date = 3 [(gogoproto.jsontag) = "sentDate"];
repeated Media medias = 4;
reserved 4; // repeated Media medias = 4;
string target_cid = 5 [(gogoproto.customname) = "TargetCID"];

enum Type {
Undefined = 0;
TypeUserMessage = 1;
TypeUserReaction = 2;
reserved 2; // TypeUserReaction = 2;
TypeGroupInvitation = 3;
TypeSetGroupInfo = 4;
TypeSetUserInfo = 5;
TypeAcknowledge = 6;
TypeReplyOptions = 7;
reserved 7; // TypeReplyOptions
}
message UserMessage {
string body = 1;
}
message UserReaction {
bool state = 1;
string emoji = 2;
}
message GroupInvitation {
string link = 2; // TODO: optimize message size
}
message SetGroupInfo {
string display_name = 1;
string avatar_cid = 2; // TODO: optimize message size
reserved 2; // string avatar_cid = 2; // TODO: optimize message size
}
message SetUserInfo {
string display_name = 1;
string avatar_cid = 2 [(gogoproto.customname) = "AvatarCID"]; // TODO: optimize message size
reserved 2; // string avatar_cid = 2 [(gogoproto.customname) = "AvatarCID"]; // TODO: optimize message size
}
message Acknowledge {
}
message ReplyOptions {
repeated ReplyOption options = 1;
}
}

message ReplyOption {
string display = 1;
string payload = 2;
}

message SystemInfo {
Expand All @@ -395,9 +360,8 @@ message SystemInfo {
int64 devices = 6;
int64 service_tokens = 7;
int64 conversation_replication_info = 8;
int64 reactions = 9;
int64 metadata_events = 10;
int64 medias = 11;
reserved 11; // int64 medias = 11;
int64 shared_push_tokens = 12;
// older, more recent
}
Expand All @@ -422,7 +386,7 @@ message Account {
string link = 3;
repeated ServiceToken service_tokens = 5 [(gogoproto.moretags) = "gorm:\"foreignKey:AccountPK\""];
bool replicate_new_groups_automatically = 6 [(gogoproto.moretags) = "gorm:\"default:true\""];
string avatar_cid = 7 [(gogoproto.moretags) = "gorm:\"column:avatar_cid\"", (gogoproto.customname) = "AvatarCID"];
reserved 7; // string avatar_cid = 7 [(gogoproto.moretags) = "gorm:\"column:avatar_cid\"", (gogoproto.customname) = "AvatarCID"];
bool auto_share_push_token_flag = 8;
bytes device_push_token = 9;
bytes device_push_server = 10;
Expand All @@ -447,12 +411,6 @@ message MetadataEvent {
}

message Interaction {
message ReactionView {
string emoji = 1;
bool own_state = 2;
uint64 count = 3;
}

string cid = 1 [(gogoproto.moretags) = "gorm:\"primaryKey;column:cid\"", (gogoproto.customname) = "CID"];
AppMessage.Type type = 2 [(gogoproto.moretags) = "gorm:\"index\""];
string member_public_key = 7;
Expand All @@ -465,44 +423,18 @@ message Interaction {
int64 sent_date = 9 [(gogoproto.moretags) = "gorm:\"index\""];
bool acknowledged = 10;
string target_cid = 13 [(gogoproto.moretags) = "gorm:\"index;column:target_cid\"", (gogoproto.customname) = "TargetCID"];
repeated Media medias = 15;
repeated ReactionView reactions = 16 [(gogoproto.moretags) = "gorm:\"-\""]; // specific to client model
reserved 15; // repeated Media medias = 15;
reserved 16; // repeated ReactionView reactions = 16 [(gogoproto.moretags) = "gorm:\"-\""]; // specific to client model
bool out_of_store_message = 17;
}

message Media {
string cid = 1 [(gogoproto.moretags) = "gorm:\"primaryKey;column:cid\"", (gogoproto.customname) = "CID"];
string mime_type = 2;
string filename = 3;
string display_name = 4;
bytes metadata_bytes = 6;

// these should not be sent on the bertyprotocol layer
string interaction_cid = 100 [(gogoproto.moretags) = "gorm:\"index;column:interaction_cid\"", (gogoproto.customname) = "InteractionCID"];
State state = 103;
enum State {
StateUnknown = 0;

// specific to media received
StateNeverDownloaded = 1;
StatePartiallyDownloaded = 2;
StateDownloaded = 3;
StateInCache = 4;
StateInvalidCrypto = 5;

// specific to media sent
StatePrepared = 100;
StateAttached = 101;
}
}

message Contact {
string public_key = 1 [(gogoproto.moretags) = "gorm:\"primaryKey\""];
string conversation_public_key = 2;
Conversation conversation = 3;
State state = 4;
string display_name = 5;
string avatar_cid = 9 [(gogoproto.moretags) = "gorm:\"column:avatar_cid\"", (gogoproto.customname) = "AvatarCID"];
reserved 9; // string avatar_cid = 9 [(gogoproto.moretags) = "gorm:\"column:avatar_cid\"", (gogoproto.customname) = "AvatarCID"];
int64 created_date = 7;
// specific to outgoing requests
int64 sent_date = 8;
Expand Down Expand Up @@ -543,10 +475,10 @@ message Conversation {
string account_member_public_key = 11;
string local_device_public_key = 12;
int64 created_date = 13;
string reply_options_cid = 14 [(gogoproto.moretags) = "gorm:\"column:reply_options_cid\"", (gogoproto.customname) = "ReplyOptionsCID"];
Interaction reply_options = 15 [(gogoproto.customname) = "ReplyOptions"];
reserved 14; // string reply_options_cid = 14 [(gogoproto.moretags) = "gorm:\"column:reply_options_cid\"", (gogoproto.customname) = "ReplyOptionsCID"];
reserved 15; // Interaction reply_options = 15 [(gogoproto.customname) = "ReplyOptions"];
repeated ConversationReplicationInfo replication_info = 16 [(gogoproto.moretags) = "gorm:\"foreignKey:ConversationPublicKey\""];
string avatar_cid = 17 [(gogoproto.moretags) = "gorm:\"column:avatar_cid\"", (gogoproto.customname) = "AvatarCID"];
reserved 17; // string avatar_cid = 17 [(gogoproto.moretags) = "gorm:\"column:avatar_cid\"", (gogoproto.customname) = "AvatarCID"];
// info_date is used when SetGroupInfo is called
int64 info_date = 18;
string shared_push_token_identifier = 19;
Expand All @@ -565,7 +497,7 @@ message ConversationReplicationInfo {
message Member { // Composite primary key
string public_key = 1 [(gogoproto.moretags) = "gorm:\"primaryKey\""];
string display_name = 2;
string avatar_cid = 6 [(gogoproto.moretags) = "gorm:\"column:avatar_cid\"", (gogoproto.customname) = "AvatarCID"];
reserved 6; // string avatar_cid = 6 [(gogoproto.moretags) = "gorm:\"column:avatar_cid\"", (gogoproto.customname) = "AvatarCID"];
string conversation_public_key = 3 [(gogoproto.moretags) = "gorm:\"primaryKey\""];
bool is_me = 9;
bool is_creator = 8;
Expand Down Expand Up @@ -608,7 +540,7 @@ message StreamEvent {
TypeMemberUpdated = 8;
TypeDeviceUpdated = 9;
TypeNotified = 10;
TypeMediaUpdated = 11;
reserved 11; // TypeMediaUpdated = 11;
TypeConversationPartialLoad = 12;
TypePeerStatusConnected = 13;
TypePeerStatusReconnecting = 14;
Expand Down Expand Up @@ -641,13 +573,10 @@ message StreamEvent {
Device device = 1;
}
message ListEnded {}
message MediaUpdated {
Media media = 1;
}
message ConversationPartialLoad {
string conversation_pk = 1 [(gogoproto.customname) = "ConversationPK"];
repeated Interaction interactions = 2;
repeated Media medias = 3;
reserved 3; // repeated Media medias = 3;
}
message Notified {
Type type = 1;
Expand Down Expand Up @@ -744,7 +673,7 @@ message EventStream {
message AccountUpdate {
message Request {
string display_name = 1;
string avatar_cid = 2 [(gogoproto.moretags) = "gorm:\"column:avatar_cid\"", (gogoproto.customname) = "AvatarCID"];
reserved 2; // string avatar_cid = 2 [(gogoproto.moretags) = "gorm:\"column:avatar_cid\"", (gogoproto.customname) = "AvatarCID"];
}
message Reply {}
}
Expand Down Expand Up @@ -783,7 +712,7 @@ message Interact {
AppMessage.Type type = 1;
bytes payload = 2;
string conversation_public_key = 3;
repeated string media_cids = 4;
reserved 4; // repeated string media_cids = 4;
string target_cid = 5 [(gogoproto.customname) = "TargetCID"];
bool metadata = 6;
}
Expand Down Expand Up @@ -841,91 +770,6 @@ message LocalConversationState {
Conversation.Type type = 4;
}

message MediaPrepare {
message Request {
bytes block = 1;

/* Header data:
** IMPORTANT: The first request must contain the header data and no block. Header data in following requests will be ignored
*/

Media info = 2;
string uri = 3;
}

message Reply {
string cid = 1;
}
}

message MediaRetrieve {
message Request {
string cid = 1;
}

message Reply {
bytes block = 1;

/* Header data:
** IMPORTANT: The first reply will contain the header data and no block. Header data in following replies will be empty
*/

Media info = 2;
}
}

message MediaGetRelated {
message Request {
string cid = 1 [(gogoproto.customname) = "CID"];
reserved 2;
// bool previous = 2; // TODO: gets previous media instead of next
repeated string mime_types = 3;
repeated string file_names = 4;
}

message Reply {
Media media = 1;
bool end = 2;
}
}

enum MediaMetadataType {
MetadataUnknown = 0;
MetadataKeyValue = 1;
MetadataAudioPreview = 2;
}

message MediaMetadata {
repeated MediaMetadataItem items = 1;
}

message MediaMetadataItem {
MediaMetadataType metadata_type = 1;
bytes payload = 2;
}

message MediaMetadataKV {
string key = 1;
string value = 2;
}

message AudioPreview {
repeated uint32 volume_intensities = 1;
uint32 duration_ms = 2;
string format = 3;
uint32 bitrate = 4;
uint32 sampling_rate = 5;
}

message Reaction {
string target_cid = 2 [(gogoproto.moretags) = "gorm:\"column:target_cid;primaryKey\"", (gogoproto.customname) = "TargetCID"];
string member_public_key = 3 [(gogoproto.moretags) = "gorm:\"primaryKey\""];
string emoji = 4 [(gogoproto.moretags) = "gorm:\"primaryKey\""];
bool is_mine = 5;
bool state = 6;
int64 state_date = 7;
}

message MessageSearch {
message Request {
string query = 1;
Expand Down Expand Up @@ -1010,13 +854,3 @@ message PushTokenSharedForConversation {
SharedPushToken push_token = 1;
}
}

message InteractionReactionsForEmoji {
message Request {
string interaction_cid = 1 [(gogoproto.customname) = "InteractionCID"];
string emoji = 2;
}
message Reply {
repeated Reaction reactions = 1;
}
}
15 changes: 0 additions & 15 deletions api/messengertypes.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fe1c64a

Please sign in to comment.