v0.0.29 Интегрирован gRPC сервис клипов
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
admin 2025-09-02 11:51:55 +03:00
parent f77b03bee1
commit df2871357a
14 changed files with 6196 additions and 16 deletions

3
.env
View File

@ -12,4 +12,5 @@ SMTP_PASSWORD="86AN1z1WxbFX6Q9u"
SMTP_FROM=info@tailly.ru
AppURL="https://tailly.ru"
MESSAGE_SERVICE_ADDRESS="tailly_messages:50052"
SUBSCRIBE_SERVICE_ADDRESS="tailly_subscribers:50053"
SUBSCRIBE_SERVICE_ADDRESS="tailly_subscribers:50053"
CLIP_SERVICE_ADDRESS="tailly_clips:50054"

View File

@ -2,9 +2,6 @@ package main
import (
"context"
"google.golang.org/grpc"
"google.golang.org/grpc/backoff"
"google.golang.org/grpc/keepalive"
"log"
"os"
"os/signal"
@ -17,6 +14,10 @@ import (
"tailly_back_v2/pkg/database"
"tailly_back_v2/proto"
"time"
"google.golang.org/grpc"
"google.golang.org/grpc/backoff"
"google.golang.org/grpc/keepalive"
)
func main() {
@ -75,6 +76,26 @@ func main() {
defer subscribeConn.Close()
subscribeClient := proto.NewSubscribeServiceClient(subscribeConn)
clipConn, err := grpc.Dial(
cfg.GRPC.ClipServiceAddress, // Добавьте этот параметр в конфиг
grpc.WithInsecure(),
grpc.WithKeepaliveParams(keepalive.ClientParameters{
Time: 30 * time.Second,
Timeout: 10 * time.Second,
PermitWithoutStream: true,
}),
grpc.WithConnectParams(grpc.ConnectParams{
Backoff: backoff.DefaultConfig,
MinConnectTimeout: 5 * time.Second,
}),
grpc.WithDefaultServiceConfig(`{"loadBalancingPolicy":"round_robin"}`),
)
if err != nil {
log.Fatalf("failed to connect to clip gRPC service: %v", err)
}
defer clipConn.Close()
clipClient := proto.NewClipServiceClient(clipConn)
// Инициализация зависимостей
tokenAuth := auth.NewTokenAuth(
cfg.Auth.AccessTokenSecret,
@ -128,7 +149,8 @@ func main() {
Session: sessionService,
Mail: mailService,
Messages: messageClient,
Subscribe: subscribeClient, // Добавляем gRPC клиент подписок
Subscribe: subscribeClient,
Clips: clipClient,
}
// HTTP сервер

View File

@ -43,6 +43,12 @@ models:
model: tailly_back_v2/internal/domain.LoginInput
Tokens:
model: tailly_back_v2/internal/domain.Tokens
Clip:
model: tailly_back_v2/internal/domain.Clip
ClipLike:
model: tailly_back_v2/internal/domain.ClipLike
ClipComment:
model: tailly_back_v2/internal/domain.ClipComment
autobind:
- "tailly_back_v2/internal/domain"

View File

@ -32,6 +32,7 @@ type Config struct {
GRPC struct {
MessageServiceAddress string `env:"MESSAGE_SERVICE_ADDRESS"`
SubscribeServiceAddress string `env:"SUBSCRIBE_SERVICE_ADDRESS"`
ClipServiceAddress string `env:"CLIP_SERVICE_ADDRESS"`
}
}

40
internal/domain/clip.go Normal file
View File

@ -0,0 +1,40 @@
package domain
import "time"
type Clip struct {
ID int `json:"id"`
Title string `json:"title"`
VideoURL string `json:"video_url"`
ThumbnailURL string `json:"thumbnail_url"`
Duration int `json:"duration"` // seconds
AuthorID int `json:"author_id"`
LikesCount int `json:"likes_count"`
CommentsCount int `json:"comments_count"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type ClipLike struct {
ID int `json:"id"`
ClipID int `json:"clip_id"`
UserID int `json:"user_id"`
CreatedAt time.Time `json:"created_at"`
}
type ClipComment struct {
ID int `json:"id"`
ClipID int `json:"clip_id"`
AuthorID int `json:"author_id"`
Content string `json:"content"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type CreateClipRequest struct {
UserID int
Title string
VideoData []byte
FileName string
ContentType string
}

View File

@ -0,0 +1,403 @@
package graph
import (
"context"
"fmt"
"io"
"tailly_back_v2/internal/domain"
"tailly_back_v2/proto"
"time"
"github.com/99designs/gqlgen/graphql"
)
// IsLiked is the resolver for the isLiked field.
func (r *clipResolver) IsLiked(ctx context.Context, obj *domain.Clip) (bool, error) {
userID, err := getUserIDFromContext(ctx)
if err != nil {
return false, fmt.Errorf("user not authenticated: %w", err)
}
resp, err := r.ClipClient.CheckIfLiked(ctx, &proto.CheckIfLikedRequest{
ClipId: int32(obj.ID),
UserId: int32(userID),
})
if err != nil {
return false, fmt.Errorf("failed to check like status: %w", err)
}
return resp.IsLiked, nil
}
// CreatedAt is the resolver for the createdAt field.
func (r *clipResolver) CreatedAt(ctx context.Context, obj *domain.Clip) (string, error) {
return obj.CreatedAt.Format(time.RFC3339), nil
}
// UpdatedAt is the resolver for the updatedAt field.
func (r *clipResolver) UpdatedAt(ctx context.Context, obj *domain.Clip) (string, error) {
return obj.UpdatedAt.Format(time.RFC3339), nil
}
// CreatedAt is the resolver for the createdAt field.
func (r *clipCommentResolver) CreatedAt(ctx context.Context, obj *domain.ClipComment) (string, error) {
return obj.CreatedAt.Format(time.RFC3339), nil
}
// UpdatedAt is the resolver for the updatedAt field.
func (r *clipCommentResolver) UpdatedAt(ctx context.Context, obj *domain.ClipComment) (string, error) {
return obj.UpdatedAt.Format(time.RFC3339), nil
}
// CreatedAt is the resolver for the createdAt field.
func (r *clipLikeResolver) CreatedAt(ctx context.Context, obj *domain.ClipLike) (string, error) {
return obj.CreatedAt.Format(time.RFC3339), nil
}
// CreateClip is the resolver for the createClip field.
func (r *mutationResolver) CreateClip(ctx context.Context, title string, video graphql.Upload) (*domain.Clip, error) {
userID, err := getUserIDFromContext(ctx)
if err != nil {
return nil, fmt.Errorf("user not authenticated: %w", err)
}
// Читаем данные видео
videoData, err := io.ReadAll(video.File)
if err != nil {
return nil, fmt.Errorf("failed to read video data: %w", err)
}
resp, err := r.ClipClient.CreateClip(ctx, &proto.CreateClipRequest{
UserId: int32(userID),
Title: title,
VideoData: videoData,
FileName: video.Filename,
ContentType: video.ContentType,
})
if err != nil {
return nil, fmt.Errorf("failed to create clip: %w", err)
}
return r.protoClipToDomain(resp.Clip), nil
}
// DeleteClip is the resolver for the deleteClip field.
func (r *mutationResolver) DeleteClip(ctx context.Context, id int) (bool, error) {
userID, err := getUserIDFromContext(ctx)
if err != nil {
return false, fmt.Errorf("user not authenticated: %w", err)
}
_, err = r.ClipClient.DeleteClip(ctx, &proto.DeleteClipRequest{
ClipId: int32(id),
UserId: int32(userID),
})
if err != nil {
return false, fmt.Errorf("failed to delete clip: %w", err)
}
return true, nil
}
// LikeClip is the resolver for the likeClip field.
func (r *mutationResolver) LikeClip(ctx context.Context, clipID int) (*domain.ClipLike, error) {
userID, err := getUserIDFromContext(ctx)
if err != nil {
return nil, fmt.Errorf("user not authenticated: %w", err)
}
resp, err := r.ClipClient.LikeClip(ctx, &proto.LikeClipRequest{
ClipId: int32(clipID),
UserId: int32(userID),
})
if err != nil {
return nil, fmt.Errorf("failed to like clip: %w", err)
}
return r.protoLikeToDomain(resp.Like), nil
}
// UnlikeClip is the resolver for the unlikeClip field.
func (r *mutationResolver) UnlikeClip(ctx context.Context, clipID int) (bool, error) {
userID, err := getUserIDFromContext(ctx)
if err != nil {
return false, fmt.Errorf("user not authenticated: %w", err)
}
_, err = r.ClipClient.UnlikeClip(ctx, &proto.UnlikeClipRequest{
ClipId: int32(clipID),
UserId: int32(userID),
})
if err != nil {
return false, fmt.Errorf("failed to unlike clip: %w", err)
}
return true, nil
}
// CreateClipComment is the resolver for the createClipComment field.
func (r *mutationResolver) CreateClipComment(ctx context.Context, clipID int, content string) (*domain.ClipComment, error) {
userID, err := getUserIDFromContext(ctx)
if err != nil {
return nil, fmt.Errorf("user not authenticated: %w", err)
}
resp, err := r.ClipClient.CreateComment(ctx, &proto.CreateCommentRequest{
ClipId: int32(clipID),
UserId: int32(userID),
Content: content,
})
if err != nil {
return nil, fmt.Errorf("failed to create comment: %w", err)
}
return r.protoCommentToDomain(resp.Comment), nil
}
// DeleteClipComment is the resolver for the deleteClipComment field.
func (r *mutationResolver) DeleteClipComment(ctx context.Context, commentID int) (bool, error) {
userID, err := getUserIDFromContext(ctx)
if err != nil {
return false, fmt.Errorf("user not authenticated: %w", err)
}
_, err = r.ClipClient.DeleteComment(ctx, &proto.DeleteCommentRequest{
CommentId: int32(commentID),
UserId: int32(userID),
})
if err != nil {
return false, fmt.Errorf("failed to delete comment: %w", err)
}
return true, nil
}
// Clip is the resolver for the clip field.
func (r *queryResolver) Clip(ctx context.Context, id int) (*domain.Clip, error) {
resp, err := r.ClipClient.GetClip(ctx, &proto.GetClipRequest{
ClipId: int32(id),
})
if err != nil {
return nil, fmt.Errorf("failed to get clip: %w", err)
}
return r.protoClipToDomain(resp.Clip), nil
}
// Clips is the resolver for the clips field.
func (r *queryResolver) Clips(ctx context.Context, limit *int, offset *int) ([]*domain.Clip, error) {
limitVal := 20
if limit != nil {
limitVal = *limit
}
offsetVal := 0
if offset != nil {
offsetVal = *offset
}
resp, err := r.ClipClient.GetClips(ctx, &proto.GetClipsRequest{
Limit: int32(limitVal),
Offset: int32(offsetVal),
})
if err != nil {
return nil, fmt.Errorf("failed to get clips: %w", err)
}
return r.protoClipsToDomain(resp.Clips), nil
}
// UserClips is the resolver for the userClips field.
func (r *queryResolver) UserClips(ctx context.Context, userID int, limit *int, offset *int) ([]*domain.Clip, error) {
limitVal := 20
if limit != nil {
limitVal = *limit
}
offsetVal := 0
if offset != nil {
offsetVal = *offset
}
resp, err := r.ClipClient.GetUserClips(ctx, &proto.GetUserClipsRequest{
UserId: int32(userID),
Limit: int32(limitVal),
Offset: int32(offsetVal),
})
if err != nil {
return nil, fmt.Errorf("failed to get user clips: %w", err)
}
return r.protoClipsToDomain(resp.Clips), nil
}
// ClipComments is the resolver for the clipComments field.
func (r *queryResolver) ClipComments(ctx context.Context, clipID int, limit *int, offset *int) ([]*domain.ClipComment, error) {
limitVal := 20
if limit != nil {
limitVal = *limit
}
offsetVal := 0
if offset != nil {
offsetVal = *offset
}
resp, err := r.ClipClient.GetClipComments(ctx, &proto.GetClipCommentsRequest{
ClipId: int32(clipID),
Limit: int32(limitVal),
Offset: int32(offsetVal),
})
if err != nil {
return nil, fmt.Errorf("failed to get clip comments: %w", err)
}
return r.protoCommentsToDomain(resp.Comments), nil
}
// ClipLikes is the resolver for the clipLikes field.
func (r *queryResolver) ClipLikes(ctx context.Context, clipID int, limit *int, offset *int) ([]*domain.ClipLike, error) {
limitVal := 20
if limit != nil {
limitVal = *limit
}
offsetVal := 0
if offset != nil {
offsetVal = *offset
}
resp, err := r.ClipClient.GetClipLikes(ctx, &proto.GetClipLikesRequest{
ClipId: int32(clipID),
Limit: int32(limitVal),
Offset: int32(offsetVal),
})
if err != nil {
return nil, fmt.Errorf("failed to get clip likes: %w", err)
}
return r.protoLikesToDomain(resp.Likes), nil
}
// IsLiked is the resolver for the isLiked field.
func (r *queryResolver) IsLiked(ctx context.Context, clipID int) (bool, error) {
userID, err := getUserIDFromContext(ctx)
if err != nil {
return false, fmt.Errorf("user not authenticated: %w", err)
}
resp, err := r.ClipClient.CheckIfLiked(ctx, &proto.CheckIfLikedRequest{
ClipId: int32(clipID),
UserId: int32(userID),
})
if err != nil {
return false, fmt.Errorf("failed to check like status: %w", err)
}
return resp.IsLiked, nil
}
// ClipCreated is the resolver for the clipCreated field.
func (r *subscriptionResolver) ClipCreated(ctx context.Context) (<-chan *domain.Clip, error) {
// Реализация подписки требует дополнительной инфраструктуры (Redis, Kafka и т.д.)
// Возвращаем ошибку, так как это не реализовано в gRPC сервисе
return nil, fmt.Errorf("subscriptions not implemented")
}
// ClipLiked is the resolver for the clipLiked field.
func (r *subscriptionResolver) ClipLiked(ctx context.Context, clipID int) (<-chan *domain.ClipLike, error) {
// Реализация подписки требует дополнительной инфраструктуры
return nil, fmt.Errorf("subscriptions not implemented")
}
// CommentClipCreated is the resolver for the commentClipCreated field.
func (r *subscriptionResolver) CommentClipCreated(ctx context.Context, clipID int) (<-chan *domain.ClipComment, error) {
// Реализация подписки требует дополнительной инфраструктуры
return nil, fmt.Errorf("subscriptions not implemented")
}
// Вспомогательные методы для конвертации
func (r *Resolver) protoClipToDomain(protoClip *proto.Clip) *domain.Clip {
if protoClip == nil {
return nil
}
return &domain.Clip{
ID: int(protoClip.Id),
Title: protoClip.Title,
VideoURL: protoClip.VideoUrl,
ThumbnailURL: protoClip.ThumbnailUrl,
Duration: int(protoClip.Duration),
AuthorID: int(protoClip.AuthorId),
LikesCount: int(protoClip.LikesCount),
CommentsCount: int(protoClip.CommentsCount),
CreatedAt: protoClip.CreatedAt.AsTime(),
UpdatedAt: protoClip.UpdatedAt.AsTime(),
}
}
func (r *Resolver) protoClipsToDomain(protoClips []*proto.Clip) []*domain.Clip {
var clips []*domain.Clip
for _, protoClip := range protoClips {
clips = append(clips, r.protoClipToDomain(protoClip))
}
return clips
}
func (r *Resolver) protoLikeToDomain(protoLike *proto.ClipLike) *domain.ClipLike {
if protoLike == nil {
return nil
}
return &domain.ClipLike{
ID: int(protoLike.Id),
ClipID: int(protoLike.ClipId),
UserID: int(protoLike.UserId),
CreatedAt: protoLike.CreatedAt.AsTime(),
}
}
func (r *Resolver) protoLikesToDomain(protoLikes []*proto.ClipLike) []*domain.ClipLike {
var likes []*domain.ClipLike
for _, protoLike := range protoLikes {
likes = append(likes, r.protoLikeToDomain(protoLike))
}
return likes
}
func (r *Resolver) protoCommentToDomain(protoComment *proto.ClipComment) *domain.ClipComment {
if protoComment == nil {
return nil
}
return &domain.ClipComment{
ID: int(protoComment.Id),
ClipID: int(protoComment.ClipId),
AuthorID: int(protoComment.AuthorId),
Content: protoComment.Content,
CreatedAt: protoComment.CreatedAt.AsTime(),
UpdatedAt: protoComment.UpdatedAt.AsTime(),
}
}
func (r *Resolver) protoCommentsToDomain(protoComments []*proto.ClipComment) []*domain.ClipComment {
var comments []*domain.ClipComment
for _, protoComment := range protoComments {
comments = append(comments, r.protoCommentToDomain(protoComment))
}
return comments
}
// Clip returns ClipResolver implementation.
func (r *Resolver) Clip() ClipResolver { return &clipResolver{r} }
// ClipComment returns ClipCommentResolver implementation.
func (r *Resolver) ClipComment() ClipCommentResolver { return &clipCommentResolver{r} }
// ClipLike returns ClipLikeResolver implementation.
func (r *Resolver) ClipLike() ClipLikeResolver { return &clipLikeResolver{r} }
type clipResolver struct{ *Resolver }
type clipCommentResolver struct{ *Resolver }
type clipLikeResolver struct{ *Resolver }

File diff suppressed because it is too large Load Diff

View File

@ -16,22 +16,25 @@ import (
type Resolver struct {
Services *service.Services
DeviceRepo repository.DeviceRepository // Добавляем репозиторий устройств напрямую
DeviceRepo repository.DeviceRepository
MessageClient proto.MessageServiceClient
SubscribeClient proto.SubscribeServiceClient
ClipClient proto.ClipServiceClient
}
func NewResolver(
services *service.Services,
db *sql.DB, // Принимаем подключение к БД
db *sql.DB,
messageClient proto.MessageServiceClient,
subscribeClient proto.SubscribeServiceClient,
clipClient proto.ClipServiceClient,
) *Resolver {
return &Resolver{
Services: services,
DeviceRepo: repository.NewDeviceRepository(db),
MessageClient: messageClient,
SubscribeClient: subscribeClient,
ClipClient: clipClient,
}
}

View File

@ -169,6 +169,41 @@ type MarkNotificationReadResult {
success: Boolean!
message: String!
}
# Клип
type Clip {
id: Int! # Уникальный идентификатор
title: String! # Заголовок клипа
videoUrl: String! # URL видео
thumbnailUrl: String! # URL превью
duration: Int! # Длительность в секундах
authorId: Int! # ID автора клипа
commentsCount: Int! # Количество комментариев
likesCount: Int! # Количество лайков
isLiked: Boolean! # Лайкнул ли текущий пользователь
createdAt: String! # Дата создания
updatedAt: String! # Дата обновления
}
# Лайк клипа
type ClipLike {
id: Int! # Уникальный идентификатор
clipId: Int! # ID клипа
userId: Int! # ID пользователя
createdAt: String! # Дата создания
}
# Комментарий к клипу
type ClipComment {
id: Int! # Уникальный идентификатор
clipId: Int! # ID клипа
authorId: Int! # ID автора комментария
content: String! # Текст комментария
createdAt: String! # Дата создания
updatedAt: String! # Дата обновления
}
scalar Upload
# Запросы (получение данных)
type Query {
@ -205,8 +240,16 @@ type Query {
limit: Int = 20
offset: Int = 0
): NotificationsResponse!
clip(id: Int!): Clip! # Получить клип по ID
clips(limit: Int, offset: Int): [Clip!]! # Получить клипы с пагинацией
userClips(userId: Int!, limit: Int, offset: Int): [Clip!]! # Клипы пользователя
clipComments(clipId: Int!, limit: Int, offset: Int): [ClipComment!]! # Комментарии клипа
clipLikes(clipId: Int!, limit: Int, offset: Int): [ClipLike!]! # Лайки клипа
isLiked(clipId: Int!): Boolean! # Проверить лайк текущего пользователя
}
# Мутации (изменение данных)
type Mutation {
# Регистрация нового пользователя
@ -246,8 +289,17 @@ type Mutation {
followUser(followingId: Int!): FollowResult!
unfollowUser(followingId: Int!): UnfollowResult!
markNotificationAsRead(notificationId: Int!): MarkNotificationReadResult!
createClip(title: String!, video: Upload!): Clip! # Создать клип
deleteClip(id: Int!): Boolean! # Удалить клип
likeClip(clipId: Int!): ClipLike! # Лайкнуть клип
unlikeClip(clipId: Int!): Boolean! # Убрать лайк
createClipComment(clipId: Int!, content: String!): ClipComment! # Создать комментарий
deleteClipComment(commentId: Int!): Boolean! # Удалить комментарий
}
type Subscription {
messageStream(userId: Int!): Message!
clipCreated: Clip! # Новый клип создан
clipLiked(clipId: Int!): ClipLike! # Лайк поставлен клипу
commentClipCreated(clipId: Int!): ClipComment! # Новый комментарий к клипу
}

View File

@ -3,12 +3,6 @@ package http
import (
"context"
"database/sql"
"github.com/99designs/gqlgen/graphql/handler"
"github.com/99designs/gqlgen/graphql/handler/transport"
"github.com/99designs/gqlgen/graphql/playground"
"github.com/go-chi/chi/v5"
"github.com/gorilla/websocket"
"github.com/prometheus/client_golang/prometheus/promhttp"
"log"
"net/http"
"os"
@ -18,6 +12,13 @@ import (
"tailly_back_v2/internal/service"
"tailly_back_v2/pkg/auth"
"time"
"github.com/99designs/gqlgen/graphql/handler"
"github.com/99designs/gqlgen/graphql/handler/transport"
"github.com/99designs/gqlgen/graphql/playground"
"github.com/go-chi/chi/v5"
"github.com/gorilla/websocket"
"github.com/prometheus/client_golang/prometheus/promhttp"
)
type Server struct {
@ -66,7 +67,7 @@ func (s *Server) configureRouter() {
s.router.Use(middleware.CORS(allowedOrigins))
// Основной GraphQL обработчик
resolver := graph.NewResolver(s.services, s.db, s.services.Messages, s.services.Subscribe)
resolver := graph.NewResolver(s.services, s.db, s.services.Messages, s.services.Subscribe, s.services.Clips)
srv := handler.NewDefaultServer(graph.NewExecutableSchema(graph.Config{
Resolvers: resolver,
}))

View File

@ -17,9 +17,10 @@ type Services struct {
Audit AuditService
Messages proto.MessageServiceClient
Subscribe proto.SubscribeServiceClient
Clips proto.ClipServiceClient
}
func NewServices(authService AuthService, userService UserService, postService PostService, commentService CommentService, likeService LikeService, mailService MailService, auditService AuditService, recoveryService RecoveryService, sessionService SessionService, messages proto.MessageServiceClient, subscribe proto.SubscribeServiceClient) *Services {
func NewServices(authService AuthService, userService UserService, postService PostService, commentService CommentService, likeService LikeService, mailService MailService, auditService AuditService, recoveryService RecoveryService, sessionService SessionService, messages proto.MessageServiceClient, subscribe proto.SubscribeServiceClient, clips proto.ClipServiceClient) *Services {
return &Services{
Auth: authService,
User: userService,
@ -32,5 +33,6 @@ func NewServices(authService AuthService, userService UserService, postService P
Audit: auditService,
Messages: messages,
Subscribe: subscribe,
Clips: clips,
}
}

1625
proto/clip.pb.go Normal file

File diff suppressed because it is too large Load Diff

163
proto/clip.proto Normal file
View File

@ -0,0 +1,163 @@
syntax = "proto3";
package proto;
option go_package = ".;proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
service ClipService {
// Клипы
rpc CreateClip(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 {
int32 user_id = 1;
string title = 2;
bytes video_data = 3;
string file_name = 4;
string content_type = 5;
}
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 duration = 5;
int32 author_id = 6;
int32 likes_count = 7;
int32 comments_count = 8;
google.protobuf.Timestamp created_at = 9;
google.protobuf.Timestamp updated_at = 10;
}
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;
}

546
proto/clip_grpc.pb.go Normal file
View File

@ -0,0 +1,546 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc v3.21.12
// source: clip.proto
package proto
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
emptypb "google.golang.org/protobuf/types/known/emptypb"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
ClipService_CreateClip_FullMethodName = "/proto.ClipService/CreateClip"
ClipService_GetClip_FullMethodName = "/proto.ClipService/GetClip"
ClipService_GetUserClips_FullMethodName = "/proto.ClipService/GetUserClips"
ClipService_GetClips_FullMethodName = "/proto.ClipService/GetClips"
ClipService_DeleteClip_FullMethodName = "/proto.ClipService/DeleteClip"
ClipService_LikeClip_FullMethodName = "/proto.ClipService/LikeClip"
ClipService_UnlikeClip_FullMethodName = "/proto.ClipService/UnlikeClip"
ClipService_GetClipLikes_FullMethodName = "/proto.ClipService/GetClipLikes"
ClipService_CheckIfLiked_FullMethodName = "/proto.ClipService/CheckIfLiked"
ClipService_CreateComment_FullMethodName = "/proto.ClipService/CreateComment"
ClipService_GetClipComments_FullMethodName = "/proto.ClipService/GetClipComments"
ClipService_DeleteComment_FullMethodName = "/proto.ClipService/DeleteComment"
)
// ClipServiceClient is the client API for ClipService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type ClipServiceClient interface {
// Клипы
CreateClip(ctx context.Context, in *CreateClipRequest, opts ...grpc.CallOption) (*CreateClipResponse, error)
GetClip(ctx context.Context, in *GetClipRequest, opts ...grpc.CallOption) (*GetClipResponse, error)
GetUserClips(ctx context.Context, in *GetUserClipsRequest, opts ...grpc.CallOption) (*GetUserClipsResponse, error)
GetClips(ctx context.Context, in *GetClipsRequest, opts ...grpc.CallOption) (*GetClipsResponse, error)
DeleteClip(ctx context.Context, in *DeleteClipRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
// Лайки
LikeClip(ctx context.Context, in *LikeClipRequest, opts ...grpc.CallOption) (*LikeClipResponse, error)
UnlikeClip(ctx context.Context, in *UnlikeClipRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
GetClipLikes(ctx context.Context, in *GetClipLikesRequest, opts ...grpc.CallOption) (*GetClipLikesResponse, error)
CheckIfLiked(ctx context.Context, in *CheckIfLikedRequest, opts ...grpc.CallOption) (*CheckIfLikedResponse, error)
// Комментарии
CreateComment(ctx context.Context, in *CreateCommentRequest, opts ...grpc.CallOption) (*CreateCommentResponse, error)
GetClipComments(ctx context.Context, in *GetClipCommentsRequest, opts ...grpc.CallOption) (*GetClipCommentsResponse, error)
DeleteComment(ctx context.Context, in *DeleteCommentRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
}
type clipServiceClient struct {
cc grpc.ClientConnInterface
}
func NewClipServiceClient(cc grpc.ClientConnInterface) ClipServiceClient {
return &clipServiceClient{cc}
}
func (c *clipServiceClient) CreateClip(ctx context.Context, in *CreateClipRequest, opts ...grpc.CallOption) (*CreateClipResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CreateClipResponse)
err := c.cc.Invoke(ctx, ClipService_CreateClip_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *clipServiceClient) GetClip(ctx context.Context, in *GetClipRequest, opts ...grpc.CallOption) (*GetClipResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetClipResponse)
err := c.cc.Invoke(ctx, ClipService_GetClip_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *clipServiceClient) GetUserClips(ctx context.Context, in *GetUserClipsRequest, opts ...grpc.CallOption) (*GetUserClipsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetUserClipsResponse)
err := c.cc.Invoke(ctx, ClipService_GetUserClips_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *clipServiceClient) GetClips(ctx context.Context, in *GetClipsRequest, opts ...grpc.CallOption) (*GetClipsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetClipsResponse)
err := c.cc.Invoke(ctx, ClipService_GetClips_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *clipServiceClient) DeleteClip(ctx context.Context, in *DeleteClipRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, ClipService_DeleteClip_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *clipServiceClient) LikeClip(ctx context.Context, in *LikeClipRequest, opts ...grpc.CallOption) (*LikeClipResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(LikeClipResponse)
err := c.cc.Invoke(ctx, ClipService_LikeClip_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *clipServiceClient) UnlikeClip(ctx context.Context, in *UnlikeClipRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, ClipService_UnlikeClip_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *clipServiceClient) GetClipLikes(ctx context.Context, in *GetClipLikesRequest, opts ...grpc.CallOption) (*GetClipLikesResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetClipLikesResponse)
err := c.cc.Invoke(ctx, ClipService_GetClipLikes_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *clipServiceClient) CheckIfLiked(ctx context.Context, in *CheckIfLikedRequest, opts ...grpc.CallOption) (*CheckIfLikedResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CheckIfLikedResponse)
err := c.cc.Invoke(ctx, ClipService_CheckIfLiked_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *clipServiceClient) CreateComment(ctx context.Context, in *CreateCommentRequest, opts ...grpc.CallOption) (*CreateCommentResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CreateCommentResponse)
err := c.cc.Invoke(ctx, ClipService_CreateComment_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *clipServiceClient) GetClipComments(ctx context.Context, in *GetClipCommentsRequest, opts ...grpc.CallOption) (*GetClipCommentsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GetClipCommentsResponse)
err := c.cc.Invoke(ctx, ClipService_GetClipComments_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *clipServiceClient) DeleteComment(ctx context.Context, in *DeleteCommentRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, ClipService_DeleteComment_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// ClipServiceServer is the server API for ClipService service.
// All implementations must embed UnimplementedClipServiceServer
// for forward compatibility.
type ClipServiceServer interface {
// Клипы
CreateClip(context.Context, *CreateClipRequest) (*CreateClipResponse, error)
GetClip(context.Context, *GetClipRequest) (*GetClipResponse, error)
GetUserClips(context.Context, *GetUserClipsRequest) (*GetUserClipsResponse, error)
GetClips(context.Context, *GetClipsRequest) (*GetClipsResponse, error)
DeleteClip(context.Context, *DeleteClipRequest) (*emptypb.Empty, error)
// Лайки
LikeClip(context.Context, *LikeClipRequest) (*LikeClipResponse, error)
UnlikeClip(context.Context, *UnlikeClipRequest) (*emptypb.Empty, error)
GetClipLikes(context.Context, *GetClipLikesRequest) (*GetClipLikesResponse, error)
CheckIfLiked(context.Context, *CheckIfLikedRequest) (*CheckIfLikedResponse, error)
// Комментарии
CreateComment(context.Context, *CreateCommentRequest) (*CreateCommentResponse, error)
GetClipComments(context.Context, *GetClipCommentsRequest) (*GetClipCommentsResponse, error)
DeleteComment(context.Context, *DeleteCommentRequest) (*emptypb.Empty, error)
mustEmbedUnimplementedClipServiceServer()
}
// UnimplementedClipServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedClipServiceServer struct{}
func (UnimplementedClipServiceServer) CreateClip(context.Context, *CreateClipRequest) (*CreateClipResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateClip not implemented")
}
func (UnimplementedClipServiceServer) GetClip(context.Context, *GetClipRequest) (*GetClipResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetClip not implemented")
}
func (UnimplementedClipServiceServer) GetUserClips(context.Context, *GetUserClipsRequest) (*GetUserClipsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetUserClips not implemented")
}
func (UnimplementedClipServiceServer) GetClips(context.Context, *GetClipsRequest) (*GetClipsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetClips not implemented")
}
func (UnimplementedClipServiceServer) DeleteClip(context.Context, *DeleteClipRequest) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteClip not implemented")
}
func (UnimplementedClipServiceServer) LikeClip(context.Context, *LikeClipRequest) (*LikeClipResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method LikeClip not implemented")
}
func (UnimplementedClipServiceServer) UnlikeClip(context.Context, *UnlikeClipRequest) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method UnlikeClip not implemented")
}
func (UnimplementedClipServiceServer) GetClipLikes(context.Context, *GetClipLikesRequest) (*GetClipLikesResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetClipLikes not implemented")
}
func (UnimplementedClipServiceServer) CheckIfLiked(context.Context, *CheckIfLikedRequest) (*CheckIfLikedResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CheckIfLiked not implemented")
}
func (UnimplementedClipServiceServer) CreateComment(context.Context, *CreateCommentRequest) (*CreateCommentResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateComment not implemented")
}
func (UnimplementedClipServiceServer) GetClipComments(context.Context, *GetClipCommentsRequest) (*GetClipCommentsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetClipComments not implemented")
}
func (UnimplementedClipServiceServer) DeleteComment(context.Context, *DeleteCommentRequest) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteComment not implemented")
}
func (UnimplementedClipServiceServer) mustEmbedUnimplementedClipServiceServer() {}
func (UnimplementedClipServiceServer) testEmbeddedByValue() {}
// UnsafeClipServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to ClipServiceServer will
// result in compilation errors.
type UnsafeClipServiceServer interface {
mustEmbedUnimplementedClipServiceServer()
}
func RegisterClipServiceServer(s grpc.ServiceRegistrar, srv ClipServiceServer) {
// If the following call pancis, it indicates UnimplementedClipServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&ClipService_ServiceDesc, srv)
}
func _ClipService_CreateClip_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateClipRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ClipServiceServer).CreateClip(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ClipService_CreateClip_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ClipServiceServer).CreateClip(ctx, req.(*CreateClipRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ClipService_GetClip_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetClipRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ClipServiceServer).GetClip(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ClipService_GetClip_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ClipServiceServer).GetClip(ctx, req.(*GetClipRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ClipService_GetUserClips_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetUserClipsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ClipServiceServer).GetUserClips(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ClipService_GetUserClips_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ClipServiceServer).GetUserClips(ctx, req.(*GetUserClipsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ClipService_GetClips_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetClipsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ClipServiceServer).GetClips(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ClipService_GetClips_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ClipServiceServer).GetClips(ctx, req.(*GetClipsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ClipService_DeleteClip_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteClipRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ClipServiceServer).DeleteClip(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ClipService_DeleteClip_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ClipServiceServer).DeleteClip(ctx, req.(*DeleteClipRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ClipService_LikeClip_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(LikeClipRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ClipServiceServer).LikeClip(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ClipService_LikeClip_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ClipServiceServer).LikeClip(ctx, req.(*LikeClipRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ClipService_UnlikeClip_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UnlikeClipRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ClipServiceServer).UnlikeClip(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ClipService_UnlikeClip_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ClipServiceServer).UnlikeClip(ctx, req.(*UnlikeClipRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ClipService_GetClipLikes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetClipLikesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ClipServiceServer).GetClipLikes(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ClipService_GetClipLikes_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ClipServiceServer).GetClipLikes(ctx, req.(*GetClipLikesRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ClipService_CheckIfLiked_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CheckIfLikedRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ClipServiceServer).CheckIfLiked(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ClipService_CheckIfLiked_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ClipServiceServer).CheckIfLiked(ctx, req.(*CheckIfLikedRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ClipService_CreateComment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateCommentRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ClipServiceServer).CreateComment(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ClipService_CreateComment_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ClipServiceServer).CreateComment(ctx, req.(*CreateCommentRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ClipService_GetClipComments_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetClipCommentsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ClipServiceServer).GetClipComments(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ClipService_GetClipComments_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ClipServiceServer).GetClipComments(ctx, req.(*GetClipCommentsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ClipService_DeleteComment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteCommentRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ClipServiceServer).DeleteComment(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: ClipService_DeleteComment_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ClipServiceServer).DeleteComment(ctx, req.(*DeleteCommentRequest))
}
return interceptor(ctx, in, info, handler)
}
// ClipService_ServiceDesc is the grpc.ServiceDesc for ClipService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var ClipService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "proto.ClipService",
HandlerType: (*ClipServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "CreateClip",
Handler: _ClipService_CreateClip_Handler,
},
{
MethodName: "GetClip",
Handler: _ClipService_GetClip_Handler,
},
{
MethodName: "GetUserClips",
Handler: _ClipService_GetUserClips_Handler,
},
{
MethodName: "GetClips",
Handler: _ClipService_GetClips_Handler,
},
{
MethodName: "DeleteClip",
Handler: _ClipService_DeleteClip_Handler,
},
{
MethodName: "LikeClip",
Handler: _ClipService_LikeClip_Handler,
},
{
MethodName: "UnlikeClip",
Handler: _ClipService_UnlikeClip_Handler,
},
{
MethodName: "GetClipLikes",
Handler: _ClipService_GetClipLikes_Handler,
},
{
MethodName: "CheckIfLiked",
Handler: _ClipService_CheckIfLiked_Handler,
},
{
MethodName: "CreateComment",
Handler: _ClipService_CreateComment_Handler,
},
{
MethodName: "GetClipComments",
Handler: _ClipService_GetClipComments_Handler,
},
{
MethodName: "DeleteComment",
Handler: _ClipService_DeleteComment_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "clip.proto",
}