tailly_back_v2/proto/clip.proto
2025-09-09 19:34:41 +03:00

168 lines
3.3 KiB
Protocol Buffer

syntax = "proto3";
package proto;
option go_package = ".;proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
service ClipService {
// Клипы
rpc CreateClip(stream CreateClipRequest) returns (CreateClipResponse) {}
rpc GetClip(GetClipRequest) returns (GetClipResponse);
rpc GetUserClips(GetUserClipsRequest) returns (GetUserClipsResponse);
rpc GetClips(GetClipsRequest) returns (GetClipsResponse);
rpc DeleteClip(DeleteClipRequest) returns (google.protobuf.Empty);
// Лайки
rpc LikeClip(LikeClipRequest) returns (LikeClipResponse);
rpc UnlikeClip(UnlikeClipRequest) returns (google.protobuf.Empty);
rpc GetClipLikes(GetClipLikesRequest) returns (GetClipLikesResponse);
rpc CheckIfLiked(CheckIfLikedRequest) returns (CheckIfLikedResponse);
// Комментарии
rpc CreateComment(CreateCommentRequest) returns (CreateCommentResponse);
rpc GetClipComments(GetClipCommentsRequest) returns (GetClipCommentsResponse);
rpc DeleteComment(DeleteCommentRequest) returns (google.protobuf.Empty);
}
message CreateClipRequest {
oneof data {
Metadata metadata = 1;
bytes chunk = 2;
}
}
message Metadata {
int32 user_id = 1;
string title = 2;
string file_name = 3;
string content_type = 4;
}
message CreateClipResponse {
Clip clip = 1;
}
message GetClipRequest {
int32 clip_id = 1;
}
message GetClipResponse {
Clip clip = 1;
}
message GetUserClipsRequest {
int32 user_id = 1;
int32 limit = 2;
int32 offset = 3;
}
message GetUserClipsResponse {
repeated Clip clips = 1;
int32 total_count = 2;
}
message GetClipsRequest {
int32 limit = 1;
int32 offset = 2;
}
message GetClipsResponse {
repeated Clip clips = 1;
int32 total_count = 2;
}
message DeleteClipRequest {
int32 clip_id = 1;
int32 user_id = 2;
}
message LikeClipRequest {
int32 clip_id = 1;
int32 user_id = 2;
}
message LikeClipResponse {
ClipLike like = 1;
}
message UnlikeClipRequest {
int32 clip_id = 1;
int32 user_id = 2;
}
message GetClipLikesRequest {
int32 clip_id = 1;
int32 limit = 2;
int32 offset = 3;
}
message GetClipLikesResponse {
repeated ClipLike likes = 1;
int32 total_count = 2;
}
message CheckIfLikedRequest {
int32 clip_id = 1;
int32 user_id = 2;
}
message CheckIfLikedResponse {
bool is_liked = 1;
}
message CreateCommentRequest {
int32 clip_id = 1;
int32 user_id = 2;
string content = 3;
}
message CreateCommentResponse {
ClipComment comment = 1;
}
message GetClipCommentsRequest {
int32 clip_id = 1;
int32 limit = 2;
int32 offset = 3;
}
message GetClipCommentsResponse {
repeated ClipComment comments = 1;
int32 total_count = 2;
}
message DeleteCommentRequest {
int32 comment_id = 1;
int32 user_id = 2;
}
message Clip {
int32 id = 1;
string title = 2;
string video_url = 3;
string thumbnail_url = 4;
int32 author_id = 5;
int32 likes_count = 6;
int32 comments_count = 7;
google.protobuf.Timestamp created_at = 8;
google.protobuf.Timestamp updated_at = 9;
}
message ClipLike {
int32 id = 1;
int32 clip_id = 2;
int32 user_id = 3;
google.protobuf.Timestamp created_at = 4;
}
message ClipComment {
int32 id = 1;
int32 clip_id = 2;
int32 author_id = 3;
string content = 4;
google.protobuf.Timestamp created_at = 5;
google.protobuf.Timestamp updated_at = 6;
}