// Social — A social network: users, posts, comments, likes and follows — the GraphQL one. // sondahub (https://sondahub.com): served over gRPC-Web and Connect at https://api.sondahub.com/grpc. // Writes are simulated: answered as a real server would, kept only in the x-sondahub-session token you send back. syntax = "proto3"; package sondahub.social.v1; import "google/protobuf/struct.proto"; service SocialService { // A page of users: page, limit, sort, q and filter (field → value, with the REST operator suffixes: price_lt → 20). rpc ListUsers(ListUsersRequest) returns (ListUsersResponse); // One user by id. rpc GetUser(GetUserRequest) returns (User); // Create a user (simulated, kept in your session token). id and the timestamps are set by the server. rpc CreateUser(User) returns (User); // Change the fields set in user (simulated). rpc UpdateUser(UpdateUserRequest) returns (User); // Delete one (simulated); answers what was removed. rpc DeleteUser(DeleteUserRequest) returns (User); // A page of posts: page, limit, sort, q and filter (field → value, with the REST operator suffixes: price_lt → 20). rpc ListPosts(ListPostsRequest) returns (ListPostsResponse); // One post by id. rpc GetPost(GetPostRequest) returns (Post); // Create a post (simulated, kept in your session token). id and the timestamps are set by the server. rpc CreatePost(Post) returns (Post); // Change the fields set in post (simulated). rpc UpdatePost(UpdatePostRequest) returns (Post); // Delete one (simulated); answers what was removed. rpc DeletePost(DeletePostRequest) returns (Post); // A page of comments: page, limit, sort, q and filter (field → value, with the REST operator suffixes: price_lt → 20). rpc ListComments(ListCommentsRequest) returns (ListCommentsResponse); // One comment by id. rpc GetComment(GetCommentRequest) returns (Comment); // Create a comment (simulated, kept in your session token). id and the timestamps are set by the server. rpc CreateComment(Comment) returns (Comment); // Change the fields set in comment (simulated). rpc UpdateComment(UpdateCommentRequest) returns (Comment); // Delete one (simulated); answers what was removed. rpc DeleteComment(DeleteCommentRequest) returns (Comment); // A page of likes: page, limit, sort, q and filter (field → value, with the REST operator suffixes: price_lt → 20). rpc ListLikes(ListLikesRequest) returns (ListLikesResponse); // One like by id. rpc GetLike(GetLikeRequest) returns (Like); // Create a like (simulated, kept in your session token). id and the timestamps are set by the server. rpc CreateLike(Like) returns (Like); // Change the fields set in like (simulated). rpc UpdateLike(UpdateLikeRequest) returns (Like); // Delete one (simulated); answers what was removed. rpc DeleteLike(DeleteLikeRequest) returns (Like); // A page of follows: page, limit, sort, q and filter (field → value, with the REST operator suffixes: price_lt → 20). rpc ListFollows(ListFollowsRequest) returns (ListFollowsResponse); // One follow by id. rpc GetFollow(GetFollowRequest) returns (Follow); // Create a follow (simulated, kept in your session token). id and the timestamps are set by the server. rpc CreateFollow(Follow) returns (Follow); // Change the fields set in follow (simulated). rpc UpdateFollow(UpdateFollowRequest) returns (Follow); // Delete one (simulated); answers what was removed. rpc DeleteFollow(DeleteFollowRequest) returns (Follow); // The API's live activity as a server stream, each topic at its own pace: posts (every 5 s), likes (every 2 s). max_events ends the stream (default 10, at most 120). rpc Watch(WatchRequest) returns (stream Event); } message User { // Assigned by the server. Seed records keep their ids across restarts; records you create continue after the seed. int64 id = 1; // When the record was created (ISO 8601, UTC). optional string created_at = 2; // When the record last changed. optional string updated_at = 3; // Unique handle. optional string username = 4; optional string display_name = 5; optional string email = 6; optional string bio = 7; // A generated SVG served by the hub. optional string avatar_url = 8; optional string location = 9; optional string website = 10; optional bool verified = 11; optional bool private = 12; optional int64 followers_count = 13; optional int64 following_count = 14; optional int64 posts_count = 15; optional string joined_at = 16; } message ListUsersRequest { int32 page = 1; int32 limit = 2; string sort = 3; string q = 4; map filter = 5; } message ListUsersResponse { repeated User data = 1; int32 page = 2; int32 limit = 3; int32 total = 4; int32 pages = 5; } message UpdateUserRequest { int64 id = 1; User user = 2; } message GetUserRequest { int64 id = 1; } message DeleteUserRequest { int64 id = 1; } message Post { // Assigned by the server. Seed records keep their ids across restarts; records you create continue after the seed. int64 id = 1; // When the record was created (ISO 8601, UTC). optional string created_at = 2; // When the record last changed. optional string updated_at = 3; optional int64 author_id = 4; optional string body = 5; google.protobuf.Value hashtags = 6; google.protobuf.Value media = 7; optional string visibility = 8; // Set when the post is a reply. optional int64 reply_to_id = 9; optional int64 likes_count = 10; optional int64 comments_count = 11; optional int64 reposts_count = 12; optional string language = 13; optional string published_at = 14; optional string edited_at = 15; } message ListPostsRequest { int32 page = 1; int32 limit = 2; string sort = 3; string q = 4; map filter = 5; } message ListPostsResponse { repeated Post data = 1; int32 page = 2; int32 limit = 3; int32 total = 4; int32 pages = 5; } message UpdatePostRequest { int64 id = 1; Post post = 2; } message GetPostRequest { int64 id = 1; } message DeletePostRequest { int64 id = 1; } message Comment { // Assigned by the server. Seed records keep their ids across restarts; records you create continue after the seed. int64 id = 1; // When the record was created (ISO 8601, UTC). optional string created_at = 2; // When the record last changed. optional string updated_at = 3; optional int64 post_id = 4; optional int64 author_id = 5; optional int64 parent_id = 6; optional string body = 7; optional int64 likes_count = 8; optional bool flagged = 9; } message ListCommentsRequest { int32 page = 1; int32 limit = 2; string sort = 3; string q = 4; map filter = 5; } message ListCommentsResponse { repeated Comment data = 1; int32 page = 2; int32 limit = 3; int32 total = 4; int32 pages = 5; } message UpdateCommentRequest { int64 id = 1; Comment comment = 2; } message GetCommentRequest { int64 id = 1; } message DeleteCommentRequest { int64 id = 1; } message Like { // Assigned by the server. Seed records keep their ids across restarts; records you create continue after the seed. int64 id = 1; // When the record was created (ISO 8601, UTC). optional string created_at = 2; // When the record last changed. optional string updated_at = 3; optional int64 user_id = 4; optional int64 post_id = 5; } message ListLikesRequest { int32 page = 1; int32 limit = 2; string sort = 3; string q = 4; map filter = 5; } message ListLikesResponse { repeated Like data = 1; int32 page = 2; int32 limit = 3; int32 total = 4; int32 pages = 5; } message UpdateLikeRequest { int64 id = 1; Like like = 2; } message GetLikeRequest { int64 id = 1; } message DeleteLikeRequest { int64 id = 1; } message Follow { // Assigned by the server. Seed records keep their ids across restarts; records you create continue after the seed. int64 id = 1; // When the record was created (ISO 8601, UTC). optional string created_at = 2; // When the record last changed. optional string updated_at = 3; optional int64 follower_id = 4; optional int64 followee_id = 5; optional string status = 6; optional bool notifications = 7; } message ListFollowsRequest { int32 page = 1; int32 limit = 2; string sort = 3; string q = 4; map filter = 5; } message ListFollowsResponse { repeated Follow data = 1; int32 page = 2; int32 limit = 3; int32 total = 4; int32 pages = 5; } message UpdateFollowRequest { int64 id = 1; Follow follow = 2; } message GetFollowRequest { int64 id = 1; } message DeleteFollowRequest { int64 id = 1; } message WatchRequest { repeated string topics = 1; int32 max_events = 2; } message Event { string topic = 1; string api = 2; string ts = 3; google.protobuf.Struct data = 4; }