From f692c7a3e0399a147d75209bc2831e4b13324417 Mon Sep 17 00:00:00 2001 From: Lautaro Bustos Date: Mon, 22 Apr 2024 15:54:37 -0300 Subject: [PATCH] feat: new proto for the new social service (#197) * feat: new proto for new EA social service * fix: rename * fix: wrong folder Co-authored-by: Lean Mendoza Signed-off-by: Lautaro Bustos * fix: wrong pkg --------- Signed-off-by: Lautaro Bustos Co-authored-by: Lean Mendoza --- .../social/friendships/friendships.proto | 5 - .../social_service_v2/social_service.proto | 111 ++++++++++++++++++ public/social_service_v2.proto | 4 + 3 files changed, 115 insertions(+), 5 deletions(-) create mode 100644 proto/decentraland/social_service_v2/social_service.proto create mode 100644 public/social_service_v2.proto diff --git a/proto/decentraland/social/friendships/friendships.proto b/proto/decentraland/social/friendships/friendships.proto index a405f14f..238e8516 100644 --- a/proto/decentraland/social/friendships/friendships.proto +++ b/proto/decentraland/social/friendships/friendships.proto @@ -1,8 +1,3 @@ -// *** -// FOR INTERNAL USE ONLY, IN BETA VERSION OF THE PROTOCOL. -// SUBJECT TO CHANGE. -// *** - syntax = "proto3"; package decentraland.social.friendships; diff --git a/proto/decentraland/social_service_v2/social_service.proto b/proto/decentraland/social_service_v2/social_service.proto new file mode 100644 index 00000000..4c0a575e --- /dev/null +++ b/proto/decentraland/social_service_v2/social_service.proto @@ -0,0 +1,111 @@ +syntax = "proto3"; +package decentraland.social_service_v2; + +import "google/protobuf/empty.proto"; + +// Errors + +message InvalidFriendshipAction {} + +message InternalServerError {} + +// Types + +message User { string address = 1; } + +message RequestResponse { + User user = 1; + int64 created_at = 2; + optional string message = 3; +} + +message RequestPayload { + User user = 1; + optional string message = 3; +} + +message Requests { + repeated RequestResponse requests = 1; +} + +message AcceptResponse { User user = 1; } + +message AcceptPayload { User user = 1; } + +message RejectResponse { User user = 1; } + +message RejectPayload { User user = 1; } + +message DeleteResponse { User user = 1; } + +message DeletePayload { User user = 1; } + +message CancelResponse { User user = 1; } + +message CancelPayload { User user = 1; } + +message UpsertFriendshipPayload { + oneof action { + RequestPayload request = 1; + AcceptPayload accept = 2; + RejectPayload reject = 4; + DeletePayload delete = 5; + CancelPayload cancel = 6; + } +} + +message MutualFriendsPayload { + User user = 1; +} + +message UsersResponse { + repeated User users = 1; +} + +message FriendshipRequestsResponse { + oneof response { + Requests requests = 1; + InternalServerError internal_server_error = 2; + } +} + +message UpsertFriendshipResponse { + message Accepted {} + oneof response { + Accepted accepted = 1; + InvalidFriendshipAction invalid_friendship_action = 2; + InternalServerError internal_server_error = 3; + } +} + +message FriendshipUpdate { + oneof update { + RequestResponse request = 1; + AcceptResponse accept = 2; + RejectResponse reject = 4; + DeleteResponse delete = 5; + CancelResponse cancel = 6; + } +} + +service SocialService { + // Get the list of friends for the authenticated user + rpc GetFriends(google.protobuf.Empty) returns (stream UsersResponse) {} + + // Get the list of mutual friends between the authenticated user and the one in the parameter + rpc GetMutualFriends(MutualFriendsPayload) returns (stream UsersResponse) {} + + // Get the pending friendship requests for the authenticated user + rpc GetPendingFriendshipRequests(google.protobuf.Empty) returns (FriendshipRequestsResponse) {} + + // Get the sent friendship requests for the authenticated user + rpc GetSentFriendshipRequests(google.protobuf.Empty) returns (FriendshipRequestsResponse) {} + + // Create or update friendship status: REQUEST, ACCEPT, REJECT, CANCEL, DELETE + rpc UpsertFriendship(UpsertFriendshipPayload) + returns (UpsertFriendshipResponse) {} + + // Subscribe to updates of friendship status: REQUEST, ACCEPT, REJECT, CANCEL, DELETE + rpc SubscribeToFriendshipUpdates(google.protobuf.Empty) + returns (stream FriendshipUpdate) {} +} diff --git a/public/social_service_v2.proto b/public/social_service_v2.proto new file mode 100644 index 00000000..1e1c917e --- /dev/null +++ b/public/social_service_v2.proto @@ -0,0 +1,4 @@ +syntax = "proto3"; +package decentraland.social; + +import public "decentraland/social_service_v2/social_service.proto";