-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Social service E@ new payloads and responses (#238)
* feat: GetFriends with pagination and filter by status * feat: Get Friendship Requests with pagination * feat: Add optional pagination to GetMutualFriends * feat: Upsert Friendship Response has data about the frienship * feat: Add new endpoint to retrieve the status of a friendship * refactor: Only send id and timestamps on upsert response * feat: New version of the same service to avoid breaking changes * refactor: Get F Status response * feat: Distinguish request status * feat: Add pagination data in the response of the paginated rpc calls * fix: Better versioning of social service * fix: Re add previous missing files * chore: missing eof * refactor: new service is v3, original one is v1 * chore: comments * feat: Remove stream return from Get Friends and MutualFriends
- Loading branch information
1 parent
1ba2979
commit 5fa9a47
Showing
5 changed files
with
439 additions
and
0 deletions.
There are no files selected for viewing
163 changes: 163 additions & 0 deletions
163
proto/decentraland/social_service/v1/social_service.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
syntax = "proto3"; | ||
package decentraland.social_service.v1; | ||
|
||
// This message is a response that is sent from the server to the client | ||
message FriendshipEventResponse { | ||
oneof body { | ||
RequestResponse request = 1; | ||
AcceptResponse accept = 2; | ||
RejectResponse reject = 4; | ||
DeleteResponse delete = 5; | ||
CancelResponse cancel = 6; | ||
} | ||
} | ||
|
||
message FriendshipEventResponses { | ||
repeated FriendshipEventResponse responses = 1; | ||
} | ||
|
||
message FriendshipEventPayload { | ||
oneof body { | ||
RequestPayload request = 1; | ||
AcceptPayload accept = 2; | ||
RejectPayload reject = 4; | ||
DeletePayload delete = 5; | ||
CancelPayload cancel = 6; | ||
} | ||
} | ||
|
||
message User { string address = 1; } | ||
|
||
message Users { repeated User users = 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 { | ||
int64 total = 1; // Total amount of friendship requests | ||
repeated RequestResponse items = 2; | ||
} | ||
|
||
message RequestEvents { | ||
Requests outgoing = 1; // Requests the authed user have sent to users | ||
Requests incoming = 2; // Requests the authed user have received from users | ||
} | ||
|
||
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 UpdateFriendshipPayload { | ||
FriendshipEventPayload event = 1; | ||
// For internal use only, subject to change. | ||
optional Payload auth_token = 2; | ||
} | ||
|
||
message MutualFriendsPayload { | ||
User user = 1; | ||
// For internal use only, subject to change. | ||
optional Payload auth_token = 2; | ||
} | ||
|
||
message Payload { | ||
// For internal use only, subject to change. | ||
optional string synapse_token = 1; | ||
} | ||
|
||
message BadRequestError { | ||
string message = 1; | ||
} | ||
message UnauthorizedError { | ||
string message = 1; | ||
} | ||
message ForbiddenError { | ||
string message = 1; | ||
} | ||
message TooManyRequestsError { | ||
string message = 1; | ||
} | ||
message InternalServerError { | ||
string message = 1; | ||
} | ||
|
||
message UsersResponse { | ||
oneof response { | ||
Users users = 1; | ||
InternalServerError internal_server_error = 2; | ||
UnauthorizedError unauthorized_error = 3; | ||
ForbiddenError forbidden_error = 4; | ||
TooManyRequestsError too_many_requests_error = 5; | ||
BadRequestError bad_request_error = 6; | ||
} | ||
} | ||
|
||
message RequestEventsResponse { | ||
oneof response { | ||
RequestEvents events = 1; | ||
InternalServerError internal_server_error = 2; | ||
UnauthorizedError unauthorized_error = 3; | ||
ForbiddenError forbidden_error = 4; | ||
TooManyRequestsError too_many_requests_error = 5; | ||
} | ||
} | ||
|
||
message UpdateFriendshipResponse { | ||
oneof response { | ||
FriendshipEventResponse event = 1; | ||
InternalServerError internal_server_error = 2; | ||
UnauthorizedError unauthorized_error = 3; | ||
ForbiddenError forbidden_error = 4; | ||
TooManyRequestsError too_many_requests_error = 5; | ||
BadRequestError bad_request_error = 6; | ||
} | ||
} | ||
|
||
message SubscribeFriendshipEventsUpdatesResponse { | ||
oneof response { | ||
FriendshipEventResponses events = 1; | ||
InternalServerError internal_server_error = 2; | ||
UnauthorizedError unauthorized_error = 3; | ||
ForbiddenError forbidden_error = 4; | ||
TooManyRequestsError too_many_requests_error = 5; | ||
} | ||
} | ||
|
||
// @deprecated, only available for old explorer compatibility | ||
service FriendshipsService { | ||
// Get the list of friends for the authenticated user | ||
rpc GetFriends(Payload) 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 list of request events for the authenticated user | ||
rpc GetRequestEvents(Payload) returns (RequestEventsResponse) {} | ||
|
||
// Update friendship status: REQUEST, ACCEPT, REJECT, CANCEL, DELETE | ||
rpc UpdateFriendshipEvent(UpdateFriendshipPayload) | ||
returns (UpdateFriendshipResponse) {} | ||
|
||
// Subscribe to updates of friendship status: REQUEST, ACCEPT, REJECT, CANCEL, DELETE | ||
rpc SubscribeFriendshipEventsUpdates(Payload) | ||
returns (stream SubscribeFriendshipEventsUpdatesResponse) {} | ||
} |
112 changes: 112 additions & 0 deletions
112
proto/decentraland/social_service/v2/social_service.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
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; | ||
} | ||
} | ||
|
||
// @deprecated, used for initial migration without Matrix | ||
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) {} | ||
} |
Oops, something went wrong.