♻️ Remove most of the dealer deps and move to nexus
This commit is contained in:
@ -1,24 +1,26 @@
|
||||
package database
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.solsynth.dev/hydrogen/passport/pkg/internal/gap"
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex/cruda"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/samber/lo"
|
||||
"github.com/spf13/viper"
|
||||
"gorm.io/driver/postgres"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/logger"
|
||||
"gorm.io/gorm/schema"
|
||||
)
|
||||
|
||||
var C *gorm.DB
|
||||
|
||||
func NewGorm() error {
|
||||
var err error
|
||||
dsn, err := cruda.NewCrudaConn(gap.Nx).AllocDatabase("passport")
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to alloc database from nexus: %v", err)
|
||||
}
|
||||
|
||||
dialector := postgres.Open(viper.GetString("database.dsn"))
|
||||
C, err = gorm.Open(dialector, &gorm.Config{NamingStrategy: schema.NamingStrategy{
|
||||
TablePrefix: viper.GetString("database.prefix"),
|
||||
}, Logger: logger.New(&log.Logger, logger.Config{
|
||||
C, err = gorm.Open(postgres.Open(dsn), &gorm.Config{Logger: logger.New(&log.Logger, logger.Config{
|
||||
Colorful: true,
|
||||
IgnoreRecordNotFoundError: true,
|
||||
LogLevel: lo.Ternary(viper.GetBool("debug.database"), logger.Info, logger.Silent),
|
||||
|
@ -2,17 +2,17 @@ package gap
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.solsynth.dev/hydrogen/dealer/pkg/hyper"
|
||||
"git.solsynth.dev/hydrogen/dealer/pkg/proto"
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex"
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/proto"
|
||||
"github.com/rs/zerolog/log"
|
||||
"strings"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
var H *hyper.HyperConn
|
||||
var Nx *nex.Conn
|
||||
|
||||
func RegisterService() error {
|
||||
func InitializeToNexus() error {
|
||||
grpcBind := strings.SplitN(viper.GetString("grpc_bind"), ":", 2)
|
||||
httpBind := strings.SplitN(viper.GetString("bind"), ":", 2)
|
||||
|
||||
@ -22,16 +22,16 @@ func RegisterService() error {
|
||||
httpOutbound := fmt.Sprintf("%s:%s", outboundIp, httpBind[1])
|
||||
|
||||
var err error
|
||||
H, err = hyper.NewHyperConn(viper.GetString("dealer.addr"), &proto.ServiceInfo{
|
||||
Nx, err = nex.NewNexusConn(viper.GetString("dealer.addr"), &proto.ServiceInfo{
|
||||
Id: viper.GetString("id"),
|
||||
Type: hyper.ServiceTypeAuthProvider,
|
||||
Type: nex.ServiceTypeAuth,
|
||||
Label: "Passport",
|
||||
GrpcAddr: grpcOutbound,
|
||||
HttpAddr: &httpOutbound,
|
||||
})
|
||||
if err == nil {
|
||||
go func() {
|
||||
err := H.KeepRegisterService()
|
||||
err := Nx.RunRegistering()
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("An error occurred while registering service...")
|
||||
}
|
||||
|
@ -7,11 +7,16 @@ import (
|
||||
"git.solsynth.dev/hydrogen/passport/pkg/internal/models"
|
||||
"github.com/samber/lo"
|
||||
|
||||
"git.solsynth.dev/hydrogen/dealer/pkg/proto"
|
||||
"git.solsynth.dev/hydrogen/passport/pkg/internal/services"
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/proto"
|
||||
)
|
||||
|
||||
type authenticateServer struct {
|
||||
proto.UnimplementedAuthServiceServer
|
||||
}
|
||||
|
||||
func (v *Server) Authenticate(_ context.Context, in *proto.AuthRequest) (*proto.AuthReply, error) {
|
||||
ctx, perms, atk, rtk, err := services.Authenticate(in.GetAccessToken(), in.GetRefreshToken(), 0)
|
||||
if err != nil {
|
||||
|
@ -2,8 +2,8 @@ package grpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"git.solsynth.dev/hydrogen/dealer/pkg/proto"
|
||||
"git.solsynth.dev/hydrogen/passport/pkg/internal/services"
|
||||
"git.solsynth.dev/hydrogen/passport/pkg/proto"
|
||||
)
|
||||
|
||||
func (v *Server) RecordEvent(ctx context.Context, request *proto.RecordEventRequest) (*proto.RecordEventResponse, error) {
|
||||
|
@ -3,15 +3,15 @@ package grpc
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"git.solsynth.dev/hydrogen/dealer/pkg/hyper"
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
"git.solsynth.dev/hydrogen/passport/pkg/internal/database"
|
||||
"github.com/samber/lo"
|
||||
|
||||
"git.solsynth.dev/hydrogen/dealer/pkg/proto"
|
||||
"git.solsynth.dev/hydrogen/passport/pkg/internal/models"
|
||||
"git.solsynth.dev/hydrogen/passport/pkg/internal/services"
|
||||
"git.solsynth.dev/hydrogen/passport/pkg/proto"
|
||||
)
|
||||
|
||||
func (v *Server) NotifyUser(_ context.Context, in *proto.NotifyUserRequest) (*proto.NotifyResponse, error) {
|
||||
@ -21,7 +21,7 @@ func (v *Server) NotifyUser(_ context.Context, in *proto.NotifyUserRequest) (*pr
|
||||
return nil, fmt.Errorf("unable to get account: %v", err)
|
||||
}
|
||||
|
||||
metadata := hyper.DecodeMap(in.GetNotify().GetMetadata())
|
||||
metadata := nex.DecodeMap(in.GetNotify().GetMetadata())
|
||||
|
||||
notification := models.Notification{
|
||||
Topic: in.GetNotify().GetTopic(),
|
||||
@ -63,7 +63,7 @@ func (v *Server) NotifyUserBatch(_ context.Context, in *proto.NotifyUserBatchReq
|
||||
return nil, fmt.Errorf("unable to get account: %v", err)
|
||||
}
|
||||
|
||||
metadata := hyper.DecodeMap(in.GetNotify().GetMetadata())
|
||||
metadata := nex.DecodeMap(in.GetNotify().GetMetadata())
|
||||
|
||||
var checklist = make(map[uint]bool, len(users))
|
||||
var notifications []models.Notification
|
||||
@ -111,7 +111,7 @@ func (v *Server) NotifyAllUser(_ context.Context, in *proto.NotifyRequest) (*pro
|
||||
return nil, fmt.Errorf("unable to get account: %v", err)
|
||||
}
|
||||
|
||||
metadata := hyper.DecodeMap(in.GetMetadata())
|
||||
metadata := nex.DecodeMap(in.GetMetadata())
|
||||
|
||||
var checklist = make(map[uint]bool, len(users))
|
||||
var notifications []models.Notification
|
||||
|
@ -3,12 +3,12 @@ package grpc
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex"
|
||||
|
||||
"git.solsynth.dev/hydrogen/dealer/pkg/hyper"
|
||||
"git.solsynth.dev/hydrogen/dealer/pkg/proto"
|
||||
"git.solsynth.dev/hydrogen/passport/pkg/internal/database"
|
||||
"git.solsynth.dev/hydrogen/passport/pkg/internal/models"
|
||||
"git.solsynth.dev/hydrogen/passport/pkg/internal/services"
|
||||
"git.solsynth.dev/hydrogen/passport/pkg/proto"
|
||||
"github.com/samber/lo"
|
||||
)
|
||||
|
||||
@ -27,7 +27,7 @@ func (v *Server) ListCommunityRealm(ctx context.Context, empty *proto.ListRealmR
|
||||
Description: item.Description,
|
||||
IsPublic: item.IsPublic,
|
||||
IsCommunity: item.IsCommunity,
|
||||
AccessPolicy: hyper.EncodeMap(item.AccessPolicy),
|
||||
AccessPolicy: nex.EncodeMap(item.AccessPolicy),
|
||||
}
|
||||
if item.Avatar != nil {
|
||||
info.Avatar = *item.Avatar
|
||||
@ -59,7 +59,7 @@ func (v *Server) ListAvailableRealm(ctx context.Context, request *proto.LookupUs
|
||||
Description: item.Description,
|
||||
IsPublic: item.IsPublic,
|
||||
IsCommunity: item.IsCommunity,
|
||||
AccessPolicy: hyper.EncodeMap(item.AccessPolicy),
|
||||
AccessPolicy: nex.EncodeMap(item.AccessPolicy),
|
||||
}
|
||||
if item.Avatar != nil {
|
||||
info.Avatar = *item.Avatar
|
||||
@ -91,7 +91,7 @@ func (v *Server) ListOwnedRealm(ctx context.Context, request *proto.LookupUserRe
|
||||
Description: item.Description,
|
||||
IsPublic: item.IsPublic,
|
||||
IsCommunity: item.IsCommunity,
|
||||
AccessPolicy: hyper.EncodeMap(item.AccessPolicy),
|
||||
AccessPolicy: nex.EncodeMap(item.AccessPolicy),
|
||||
}
|
||||
if item.Avatar != nil {
|
||||
info.Avatar = *item.Avatar
|
||||
@ -132,7 +132,7 @@ func (v *Server) GetRealm(ctx context.Context, request *proto.LookupRealmRequest
|
||||
Description: realm.Description,
|
||||
IsPublic: realm.IsPublic,
|
||||
IsCommunity: realm.IsCommunity,
|
||||
AccessPolicy: hyper.EncodeMap(realm.AccessPolicy),
|
||||
AccessPolicy: nex.EncodeMap(realm.AccessPolicy),
|
||||
}
|
||||
if realm.Avatar != nil {
|
||||
info.Avatar = *realm.Avatar
|
||||
|
@ -5,7 +5,8 @@ import (
|
||||
|
||||
"google.golang.org/grpc/reflection"
|
||||
|
||||
"git.solsynth.dev/hydrogen/dealer/pkg/proto"
|
||||
"git.solsynth.dev/hydrogen/passport/pkg/proto"
|
||||
nroto "git.solsynth.dev/hypernet/nexus/pkg/proto"
|
||||
"github.com/spf13/viper"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
@ -13,10 +14,10 @@ import (
|
||||
)
|
||||
|
||||
type Server struct {
|
||||
proto.UnimplementedAuthServer
|
||||
nroto.UnimplementedAuthServiceServer
|
||||
nroto.UnimplementedDirectoryServiceServer
|
||||
proto.UnimplementedNotifierServer
|
||||
proto.UnimplementedRealmServer
|
||||
proto.UnimplementedStreamControllerServer
|
||||
proto.UnimplementedEventRecorderServer
|
||||
health.UnimplementedHealthServer
|
||||
|
||||
@ -28,10 +29,9 @@ func NewServer() *Server {
|
||||
srv: grpc.NewServer(),
|
||||
}
|
||||
|
||||
proto.RegisterAuthServer(server.srv, server)
|
||||
nroto.RegisterAuthServiceServer(server.srv, server)
|
||||
proto.RegisterNotifierServer(server.srv, server)
|
||||
proto.RegisterRealmServer(server.srv, server)
|
||||
proto.RegisterStreamControllerServer(server.srv, server)
|
||||
proto.RegisterEventRecorderServer(server.srv, server)
|
||||
health.RegisterHealthServer(server.srv, server)
|
||||
|
||||
|
@ -2,20 +2,22 @@ package grpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"git.solsynth.dev/hydrogen/dealer/pkg/proto"
|
||||
"git.solsynth.dev/hydrogen/passport/pkg/internal/services"
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex"
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/proto"
|
||||
)
|
||||
|
||||
func (v *Server) EmitStreamEvent(ctx context.Context, request *proto.StreamEventRequest) (*proto.StreamEventResponse, error) {
|
||||
func (v *Server) BroadcastEvent(ctx context.Context, request *proto.EventInfo) (*proto.EventResponse, error) {
|
||||
switch request.GetEvent() {
|
||||
case "ClientRegister":
|
||||
case "ws.client.register":
|
||||
// No longer need update user online status
|
||||
// Based on realtime sever connection status
|
||||
break
|
||||
case "ClientUnregister":
|
||||
case "ws.client.unregister":
|
||||
// Update user last seen at
|
||||
_ = services.SetAccountLastSeen(uint(request.GetUserId()))
|
||||
data := nex.DecodeMap(request.GetData())
|
||||
_ = services.SetAccountLastSeen(uint(data["user"].(float64)))
|
||||
}
|
||||
|
||||
return &proto.StreamEventResponse{}, nil
|
||||
return &proto.EventResponse{}, nil
|
||||
}
|
||||
|
@ -1,27 +0,0 @@
|
||||
package exts
|
||||
|
||||
import (
|
||||
"git.solsynth.dev/hydrogen/dealer/pkg/hyper"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/spf13/viper"
|
||||
"time"
|
||||
)
|
||||
|
||||
func SetAuthCookies(c *fiber.Ctx, atk, rtk string) {
|
||||
c.Cookie(&fiber.Cookie{
|
||||
Name: hyper.CookieAtk,
|
||||
Value: atk,
|
||||
Domain: viper.GetString("security.cookie_domain"),
|
||||
SameSite: viper.GetString("security.cookie_samesite"),
|
||||
Expires: time.Now().Add(60 * time.Minute),
|
||||
Path: "/",
|
||||
})
|
||||
c.Cookie(&fiber.Cookie{
|
||||
Name: hyper.CookieRtk,
|
||||
Value: rtk,
|
||||
Domain: viper.GetString("security.cookie_domain"),
|
||||
SameSite: viper.GetString("security.cookie_samesite"),
|
||||
Expires: time.Now().Add(24 * 30 * time.Hour),
|
||||
Path: "/",
|
||||
})
|
||||
}
|
@ -312,7 +312,7 @@ func DeleteAccount(id uint) error {
|
||||
return err
|
||||
} else {
|
||||
InvalidAuthCacheWithUser(id)
|
||||
_, _ = proto.NewServiceDirectoryClient(gap.H.GetDealerGrpcConn()).BroadcastDeletion(context.Background(), &proto.DeletionRequest{
|
||||
_, _ = proto.NewServiceDirectoryClient(gap.Nx.GetDealerGrpcConn()).BroadcastDeletion(context.Background(), &proto.DeletionRequest{
|
||||
ResourceType: "account",
|
||||
ResourceId: fmt.Sprintf("%d", id),
|
||||
})
|
||||
|
@ -16,24 +16,7 @@ import (
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
func Authenticate(atk, rtk string, rty int) (ctx models.AuthContext, perms map[string]any, newAtk, newRtk string, err error) {
|
||||
var claims PayloadClaims
|
||||
claims, err = DecodeJwt(atk)
|
||||
if err != nil {
|
||||
if len(rtk) > 0 && rty < 1 {
|
||||
// Auto refresh and retry
|
||||
newAtk, newRtk, err = RefreshToken(rtk)
|
||||
if err == nil {
|
||||
return Authenticate(newAtk, newRtk, rty+1)
|
||||
}
|
||||
}
|
||||
err = fiber.NewError(fiber.StatusUnauthorized, fmt.Sprintf("invalid auth key: %v", err))
|
||||
return
|
||||
}
|
||||
|
||||
newAtk = atk
|
||||
newRtk = rtk
|
||||
|
||||
func Authenticate(atk, rtk string, rty int) (ctx models.AuthContext, perms map[string]any, err error) {
|
||||
if ctx, err = GetAuthContext(claims.ID); err == nil {
|
||||
var heldPerms map[string]any
|
||||
rawHeldPerms, _ := jsoniter.Marshal(ctx.Account.PermNodes)
|
||||
|
@ -88,7 +88,7 @@ func GetFactorCode(factor models.AuthFactor) (bool, error) {
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
_, err := proto.NewPostmanClient(gap.H.GetDealerGrpcConn()).DeliverEmail(ctx, &proto.DeliverEmailRequest{
|
||||
_, err := proto.NewPostmanClient(gap.Nx.GetDealerGrpcConn()).DeliverEmail(ctx, &proto.DeliverEmailRequest{
|
||||
To: user.GetPrimaryEmail().Content,
|
||||
Email: &proto.EmailRequest{
|
||||
Subject: subject,
|
||||
|
@ -3,10 +3,10 @@ package services
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"git.solsynth.dev/hypernet/nexus/pkg/nex"
|
||||
"reflect"
|
||||
"time"
|
||||
|
||||
"git.solsynth.dev/hydrogen/dealer/pkg/hyper"
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/samber/lo"
|
||||
@ -18,6 +18,8 @@ import (
|
||||
"git.solsynth.dev/hydrogen/passport/pkg/internal/models"
|
||||
)
|
||||
|
||||
// TODO Awaiting for the new notification pusher
|
||||
|
||||
func AddNotifySubscriber(user models.Account, provider, id, tk, ua string) (models.NotificationSubscriber, error) {
|
||||
var prev models.NotificationSubscriber
|
||||
var subscriber models.NotificationSubscriber
|
||||
@ -49,7 +51,7 @@ func AddNotifySubscriber(user models.Account, provider, id, tk, ua string) (mode
|
||||
}
|
||||
|
||||
// NewNotification will create a notification and push via the push method it
|
||||
// Please provide the notification with the account field is not empty
|
||||
// Pleases provide the notification with the account field is not empty
|
||||
func NewNotification(notification models.Notification) error {
|
||||
if ok := CheckNotificationNotifiable(notification.Account, notification.Topic); !ok {
|
||||
log.Info().Str("topic", notification.Topic).Uint("uid", notification.AccountID).Msg("Notification dismissed by user...")
|
||||
@ -99,9 +101,9 @@ func PushNotification(notification models.Notification, skipNotifiableCheck ...b
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
_, err := proto.NewStreamControllerClient(gap.H.GetDealerGrpcConn()).PushStream(ctx, &proto.PushStreamRequest{
|
||||
_, err := proto.NewStreamControllerClient(gap.Nx.GetNexusGrpcConn()).PushStream(ctx, &proto.PushStreamRequest{
|
||||
UserId: lo.ToPtr(uint64(notification.AccountID)),
|
||||
Body: hyper.NetworkPackage{
|
||||
Body: nex.WebSocketPackage{
|
||||
Action: "notifications.new",
|
||||
Payload: notification,
|
||||
}.Marshal(),
|
||||
@ -133,7 +135,7 @@ func PushNotification(notification models.Notification, skipNotifiableCheck ...b
|
||||
|
||||
ctx, cancel = context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
_, err = proto.NewPostmanClient(gap.H.GetDealerGrpcConn()).DeliverNotificationBatch(ctx, &proto.DeliverNotificationBatchRequest{
|
||||
_, err = proto.NewPostmanClient(gap.Nx.GetNexusGrpcConn()).DeliverNotificationBatch(ctx, &proto.DeliverNotificationBatchRequest{
|
||||
Providers: providers,
|
||||
DeviceTokens: tokens,
|
||||
Notify: &proto.NotifyRequest{
|
||||
@ -186,12 +188,12 @@ func PushNotificationBatch(notifications []models.Notification, skipNotifiableCh
|
||||
var subscribers []models.NotificationSubscriber
|
||||
database.C.Where("account_id IN ?", accountIdx).Find(&subscribers)
|
||||
|
||||
stream := proto.NewStreamControllerClient(gap.H.GetDealerGrpcConn())
|
||||
stream := proto.NewStreamControllerClient(gap.Nx.GetNexusGrpcConn())
|
||||
for _, notification := range notifications {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
_, _ = stream.PushStream(ctx, &proto.PushStreamRequest{
|
||||
UserId: lo.ToPtr(uint64(notification.AccountID)),
|
||||
Body: hyper.NetworkPackage{
|
||||
Body: nex.WebSocketPackage{
|
||||
Action: "notifications.new",
|
||||
Payload: notification,
|
||||
}.Marshal(),
|
||||
@ -215,7 +217,7 @@ func PushNotificationBatch(notifications []models.Notification, skipNotifiableCh
|
||||
metadata, _ := jsoniter.Marshal(notification.Metadata)
|
||||
|
||||
ctx, cancel = context.WithTimeout(context.Background(), 5*time.Second)
|
||||
_, _ = proto.NewPostmanClient(gap.H.GetDealerGrpcConn()).DeliverNotificationBatch(ctx, &proto.DeliverNotificationBatchRequest{
|
||||
_, _ = proto.NewPostmanClient(gap.Nx.GetNexusGrpcConn()).DeliverNotificationBatch(ctx, &proto.DeliverNotificationBatchRequest{
|
||||
Providers: providers,
|
||||
DeviceTokens: tokens,
|
||||
Notify: &proto.NotifyRequest{
|
||||
|
@ -60,7 +60,7 @@ func CacheUserStatus(uid uint, status models.Status) {
|
||||
}
|
||||
|
||||
func GetUserOnline(uid uint) bool {
|
||||
pc := proto.NewStreamControllerClient(gap.H.GetDealerGrpcConn())
|
||||
pc := proto.NewStreamControllerClient(gap.Nx.GetDealerGrpcConn())
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
resp, err := pc.CountStreamConnection(ctx, &proto.CountConnectionRequest{
|
||||
|
@ -145,7 +145,7 @@ func NotifyMagicToken(token models.MagicToken) error {
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
_, err := proto.NewPostmanClient(gap.H.GetDealerGrpcConn()).DeliverEmail(ctx, &proto.DeliverEmailRequest{
|
||||
_, err := proto.NewPostmanClient(gap.Nx.GetDealerGrpcConn()).DeliverEmail(ctx, &proto.DeliverEmailRequest{
|
||||
To: user.GetPrimaryEmail().Content,
|
||||
Email: &proto.EmailRequest{
|
||||
Subject: subject,
|
||||
|
10
pkg/main.go
10
pkg/main.go
@ -37,6 +37,11 @@ func main() {
|
||||
log.Panic().Err(err).Msg("An error occurred when loading settings.")
|
||||
}
|
||||
|
||||
// Connect to nexus
|
||||
if err := gap.InitializeToNexus(); err != nil {
|
||||
log.Fatal().Err(err).Msg("An error occurred when connecting to nexus...")
|
||||
}
|
||||
|
||||
// Connect to database
|
||||
if err := database.NewGorm(); err != nil {
|
||||
log.Fatal().Err(err).Msg("An error occurred when connect to database.")
|
||||
@ -49,11 +54,6 @@ func main() {
|
||||
log.Fatal().Err(err).Msg("An error occurred when initializing cache.")
|
||||
}
|
||||
|
||||
// Connect other services
|
||||
if err := gap.RegisterService(); err != nil {
|
||||
log.Error().Err(err).Msg("An error occurred when registering service to gateway...")
|
||||
}
|
||||
|
||||
// Server
|
||||
go server.NewServer().Listen()
|
||||
|
||||
|
408
pkg/proto/notify.pb.go
Normal file
408
pkg/proto/notify.pb.go
Normal file
@ -0,0 +1,408 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.35.1
|
||||
// protoc v5.28.2
|
||||
// source: notify.proto
|
||||
|
||||
package proto
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type NotifyUserRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
UserId uint64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
|
||||
Notify *NotifyRequest `protobuf:"bytes,2,opt,name=notify,proto3" json:"notify,omitempty"`
|
||||
}
|
||||
|
||||
func (x *NotifyUserRequest) Reset() {
|
||||
*x = NotifyUserRequest{}
|
||||
mi := &file_notify_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *NotifyUserRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*NotifyUserRequest) ProtoMessage() {}
|
||||
|
||||
func (x *NotifyUserRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_notify_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use NotifyUserRequest.ProtoReflect.Descriptor instead.
|
||||
func (*NotifyUserRequest) Descriptor() ([]byte, []int) {
|
||||
return file_notify_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *NotifyUserRequest) GetUserId() uint64 {
|
||||
if x != nil {
|
||||
return x.UserId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *NotifyUserRequest) GetNotify() *NotifyRequest {
|
||||
if x != nil {
|
||||
return x.Notify
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type NotifyUserBatchRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
UserId []uint64 `protobuf:"varint,1,rep,packed,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
|
||||
Notify *NotifyRequest `protobuf:"bytes,2,opt,name=notify,proto3" json:"notify,omitempty"`
|
||||
}
|
||||
|
||||
func (x *NotifyUserBatchRequest) Reset() {
|
||||
*x = NotifyUserBatchRequest{}
|
||||
mi := &file_notify_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *NotifyUserBatchRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*NotifyUserBatchRequest) ProtoMessage() {}
|
||||
|
||||
func (x *NotifyUserBatchRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_notify_proto_msgTypes[1]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use NotifyUserBatchRequest.ProtoReflect.Descriptor instead.
|
||||
func (*NotifyUserBatchRequest) Descriptor() ([]byte, []int) {
|
||||
return file_notify_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *NotifyUserBatchRequest) GetUserId() []uint64 {
|
||||
if x != nil {
|
||||
return x.UserId
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *NotifyUserBatchRequest) GetNotify() *NotifyRequest {
|
||||
if x != nil {
|
||||
return x.Notify
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type NotifyRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"`
|
||||
Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
|
||||
Subtitle *string `protobuf:"bytes,3,opt,name=subtitle,proto3,oneof" json:"subtitle,omitempty"`
|
||||
Body string `protobuf:"bytes,4,opt,name=body,proto3" json:"body,omitempty"`
|
||||
Metadata []byte `protobuf:"bytes,5,opt,name=metadata,proto3" json:"metadata,omitempty"`
|
||||
Avatar *string `protobuf:"bytes,6,opt,name=avatar,proto3,oneof" json:"avatar,omitempty"`
|
||||
Picture *string `protobuf:"bytes,7,opt,name=picture,proto3,oneof" json:"picture,omitempty"`
|
||||
IsRealtime bool `protobuf:"varint,8,opt,name=is_realtime,json=isRealtime,proto3" json:"is_realtime,omitempty"`
|
||||
IsForcePush bool `protobuf:"varint,9,opt,name=is_force_push,json=isForcePush,proto3" json:"is_force_push,omitempty"`
|
||||
}
|
||||
|
||||
func (x *NotifyRequest) Reset() {
|
||||
*x = NotifyRequest{}
|
||||
mi := &file_notify_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *NotifyRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*NotifyRequest) ProtoMessage() {}
|
||||
|
||||
func (x *NotifyRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_notify_proto_msgTypes[2]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use NotifyRequest.ProtoReflect.Descriptor instead.
|
||||
func (*NotifyRequest) Descriptor() ([]byte, []int) {
|
||||
return file_notify_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *NotifyRequest) GetTopic() string {
|
||||
if x != nil {
|
||||
return x.Topic
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *NotifyRequest) GetTitle() string {
|
||||
if x != nil {
|
||||
return x.Title
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *NotifyRequest) GetSubtitle() string {
|
||||
if x != nil && x.Subtitle != nil {
|
||||
return *x.Subtitle
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *NotifyRequest) GetBody() string {
|
||||
if x != nil {
|
||||
return x.Body
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *NotifyRequest) GetMetadata() []byte {
|
||||
if x != nil {
|
||||
return x.Metadata
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *NotifyRequest) GetAvatar() string {
|
||||
if x != nil && x.Avatar != nil {
|
||||
return *x.Avatar
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *NotifyRequest) GetPicture() string {
|
||||
if x != nil && x.Picture != nil {
|
||||
return *x.Picture
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *NotifyRequest) GetIsRealtime() bool {
|
||||
if x != nil {
|
||||
return x.IsRealtime
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *NotifyRequest) GetIsForcePush() bool {
|
||||
if x != nil {
|
||||
return x.IsForcePush
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type NotifyResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
IsSuccess bool `protobuf:"varint,1,opt,name=is_success,json=isSuccess,proto3" json:"is_success,omitempty"`
|
||||
AffectedCount int64 `protobuf:"varint,2,opt,name=affected_count,json=affectedCount,proto3" json:"affected_count,omitempty"`
|
||||
}
|
||||
|
||||
func (x *NotifyResponse) Reset() {
|
||||
*x = NotifyResponse{}
|
||||
mi := &file_notify_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *NotifyResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*NotifyResponse) ProtoMessage() {}
|
||||
|
||||
func (x *NotifyResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_notify_proto_msgTypes[3]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use NotifyResponse.ProtoReflect.Descriptor instead.
|
||||
func (*NotifyResponse) Descriptor() ([]byte, []int) {
|
||||
return file_notify_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *NotifyResponse) GetIsSuccess() bool {
|
||||
if x != nil {
|
||||
return x.IsSuccess
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *NotifyResponse) GetAffectedCount() int64 {
|
||||
if x != nil {
|
||||
return x.AffectedCount
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
var File_notify_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_notify_proto_rawDesc = []byte{
|
||||
0x0a, 0x0c, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x5a, 0x0a, 0x11, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x55,
|
||||
0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73,
|
||||
0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x75, 0x73, 0x65,
|
||||
0x72, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x06, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4e, 0x6f, 0x74, 0x69,
|
||||
0x66, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x06, 0x6e, 0x6f, 0x74, 0x69, 0x66,
|
||||
0x79, 0x22, 0x5f, 0x0a, 0x16, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x55, 0x73, 0x65, 0x72, 0x42,
|
||||
0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x75,
|
||||
0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28, 0x04, 0x52, 0x06, 0x75, 0x73,
|
||||
0x65, 0x72, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x06, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4e, 0x6f, 0x74,
|
||||
0x69, 0x66, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x06, 0x6e, 0x6f, 0x74, 0x69,
|
||||
0x66, 0x79, 0x22, 0xb1, 0x02, 0x0a, 0x0d, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x52, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69,
|
||||
0x74, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65,
|
||||
0x12, 0x1f, 0x0a, 0x08, 0x73, 0x75, 0x62, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01,
|
||||
0x28, 0x09, 0x48, 0x00, 0x52, 0x08, 0x73, 0x75, 0x62, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x88, 0x01,
|
||||
0x01, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74,
|
||||
0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74,
|
||||
0x61, 0x12, 0x1b, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28,
|
||||
0x09, 0x48, 0x01, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x88, 0x01, 0x01, 0x12, 0x1d,
|
||||
0x0a, 0x07, 0x70, 0x69, 0x63, 0x74, 0x75, 0x72, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x48,
|
||||
0x02, 0x52, 0x07, 0x70, 0x69, 0x63, 0x74, 0x75, 0x72, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1f, 0x0a,
|
||||
0x0b, 0x69, 0x73, 0x5f, 0x72, 0x65, 0x61, 0x6c, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01,
|
||||
0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x52, 0x65, 0x61, 0x6c, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x22,
|
||||
0x0a, 0x0d, 0x69, 0x73, 0x5f, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x5f, 0x70, 0x75, 0x73, 0x68, 0x18,
|
||||
0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x73, 0x46, 0x6f, 0x72, 0x63, 0x65, 0x50, 0x75,
|
||||
0x73, 0x68, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x73, 0x75, 0x62, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x42,
|
||||
0x09, 0x0a, 0x07, 0x5f, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x70,
|
||||
0x69, 0x63, 0x74, 0x75, 0x72, 0x65, 0x22, 0x56, 0x0a, 0x0e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x73, 0x5f, 0x73,
|
||||
0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x73,
|
||||
0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x61, 0x66, 0x66, 0x65, 0x63,
|
||||
0x74, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52,
|
||||
0x0d, 0x61, 0x66, 0x66, 0x65, 0x63, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x32, 0xd6,
|
||||
0x01, 0x0a, 0x08, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x3f, 0x0a, 0x0a, 0x4e,
|
||||
0x6f, 0x74, 0x69, 0x66, 0x79, 0x55, 0x73, 0x65, 0x72, 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4e, 0x6f, 0x74, 0x69,
|
||||
0x66, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x49, 0x0a, 0x0f,
|
||||
0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x55, 0x73, 0x65, 0x72, 0x42, 0x61, 0x74, 0x63, 0x68, 0x12,
|
||||
0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x55, 0x73,
|
||||
0x65, 0x72, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3e, 0x0a, 0x0d, 0x4e, 0x6f, 0x74, 0x69, 0x66,
|
||||
0x79, 0x41, 0x6c, 0x6c, 0x55, 0x73, 0x65, 0x72, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x3b, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_notify_proto_rawDescOnce sync.Once
|
||||
file_notify_proto_rawDescData = file_notify_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_notify_proto_rawDescGZIP() []byte {
|
||||
file_notify_proto_rawDescOnce.Do(func() {
|
||||
file_notify_proto_rawDescData = protoimpl.X.CompressGZIP(file_notify_proto_rawDescData)
|
||||
})
|
||||
return file_notify_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_notify_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_notify_proto_goTypes = []any{
|
||||
(*NotifyUserRequest)(nil), // 0: proto.NotifyUserRequest
|
||||
(*NotifyUserBatchRequest)(nil), // 1: proto.NotifyUserBatchRequest
|
||||
(*NotifyRequest)(nil), // 2: proto.NotifyRequest
|
||||
(*NotifyResponse)(nil), // 3: proto.NotifyResponse
|
||||
}
|
||||
var file_notify_proto_depIdxs = []int32{
|
||||
2, // 0: proto.NotifyUserRequest.notify:type_name -> proto.NotifyRequest
|
||||
2, // 1: proto.NotifyUserBatchRequest.notify:type_name -> proto.NotifyRequest
|
||||
0, // 2: proto.Notifier.NotifyUser:input_type -> proto.NotifyUserRequest
|
||||
1, // 3: proto.Notifier.NotifyUserBatch:input_type -> proto.NotifyUserBatchRequest
|
||||
2, // 4: proto.Notifier.NotifyAllUser:input_type -> proto.NotifyRequest
|
||||
3, // 5: proto.Notifier.NotifyUser:output_type -> proto.NotifyResponse
|
||||
3, // 6: proto.Notifier.NotifyUserBatch:output_type -> proto.NotifyResponse
|
||||
3, // 7: proto.Notifier.NotifyAllUser:output_type -> proto.NotifyResponse
|
||||
5, // [5:8] is the sub-list for method output_type
|
||||
2, // [2:5] is the sub-list for method input_type
|
||||
2, // [2:2] is the sub-list for extension type_name
|
||||
2, // [2:2] is the sub-list for extension extendee
|
||||
0, // [0:2] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_notify_proto_init() }
|
||||
func file_notify_proto_init() {
|
||||
if File_notify_proto != nil {
|
||||
return
|
||||
}
|
||||
file_notify_proto_msgTypes[2].OneofWrappers = []any{}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_notify_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 4,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_notify_proto_goTypes,
|
||||
DependencyIndexes: file_notify_proto_depIdxs,
|
||||
MessageInfos: file_notify_proto_msgTypes,
|
||||
}.Build()
|
||||
File_notify_proto = out.File
|
||||
file_notify_proto_rawDesc = nil
|
||||
file_notify_proto_goTypes = nil
|
||||
file_notify_proto_depIdxs = nil
|
||||
}
|
38
pkg/proto/notify.proto
Normal file
38
pkg/proto/notify.proto
Normal file
@ -0,0 +1,38 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option go_package = ".;proto";
|
||||
|
||||
package proto;
|
||||
|
||||
service Notifier {
|
||||
rpc NotifyUser(NotifyUserRequest) returns (NotifyResponse) {}
|
||||
rpc NotifyUserBatch(NotifyUserBatchRequest) returns (NotifyResponse) {}
|
||||
rpc NotifyAllUser(NotifyRequest) returns(NotifyResponse) {}
|
||||
}
|
||||
|
||||
message NotifyUserRequest {
|
||||
uint64 user_id = 1;
|
||||
NotifyRequest notify = 2;
|
||||
}
|
||||
|
||||
message NotifyUserBatchRequest {
|
||||
repeated uint64 user_id = 1;
|
||||
NotifyRequest notify = 2;
|
||||
}
|
||||
|
||||
message NotifyRequest {
|
||||
string topic = 1;
|
||||
string title = 2;
|
||||
optional string subtitle = 3;
|
||||
string body = 4;
|
||||
bytes metadata = 5;
|
||||
optional string avatar = 6;
|
||||
optional string picture = 7;
|
||||
bool is_realtime = 8;
|
||||
bool is_force_push = 9;
|
||||
}
|
||||
|
||||
message NotifyResponse {
|
||||
bool is_success = 1;
|
||||
int64 affected_count = 2;
|
||||
}
|
197
pkg/proto/notify_grpc.pb.go
Normal file
197
pkg/proto/notify_grpc.pb.go
Normal file
@ -0,0 +1,197 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.5.1
|
||||
// - protoc v5.28.2
|
||||
// source: notify.proto
|
||||
|
||||
package proto
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// 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 (
|
||||
Notifier_NotifyUser_FullMethodName = "/proto.Notifier/NotifyUser"
|
||||
Notifier_NotifyUserBatch_FullMethodName = "/proto.Notifier/NotifyUserBatch"
|
||||
Notifier_NotifyAllUser_FullMethodName = "/proto.Notifier/NotifyAllUser"
|
||||
)
|
||||
|
||||
// NotifierClient is the client API for Notifier 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 NotifierClient interface {
|
||||
NotifyUser(ctx context.Context, in *NotifyUserRequest, opts ...grpc.CallOption) (*NotifyResponse, error)
|
||||
NotifyUserBatch(ctx context.Context, in *NotifyUserBatchRequest, opts ...grpc.CallOption) (*NotifyResponse, error)
|
||||
NotifyAllUser(ctx context.Context, in *NotifyRequest, opts ...grpc.CallOption) (*NotifyResponse, error)
|
||||
}
|
||||
|
||||
type notifierClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewNotifierClient(cc grpc.ClientConnInterface) NotifierClient {
|
||||
return ¬ifierClient{cc}
|
||||
}
|
||||
|
||||
func (c *notifierClient) NotifyUser(ctx context.Context, in *NotifyUserRequest, opts ...grpc.CallOption) (*NotifyResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(NotifyResponse)
|
||||
err := c.cc.Invoke(ctx, Notifier_NotifyUser_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *notifierClient) NotifyUserBatch(ctx context.Context, in *NotifyUserBatchRequest, opts ...grpc.CallOption) (*NotifyResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(NotifyResponse)
|
||||
err := c.cc.Invoke(ctx, Notifier_NotifyUserBatch_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *notifierClient) NotifyAllUser(ctx context.Context, in *NotifyRequest, opts ...grpc.CallOption) (*NotifyResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(NotifyResponse)
|
||||
err := c.cc.Invoke(ctx, Notifier_NotifyAllUser_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// NotifierServer is the server API for Notifier service.
|
||||
// All implementations must embed UnimplementedNotifierServer
|
||||
// for forward compatibility.
|
||||
type NotifierServer interface {
|
||||
NotifyUser(context.Context, *NotifyUserRequest) (*NotifyResponse, error)
|
||||
NotifyUserBatch(context.Context, *NotifyUserBatchRequest) (*NotifyResponse, error)
|
||||
NotifyAllUser(context.Context, *NotifyRequest) (*NotifyResponse, error)
|
||||
mustEmbedUnimplementedNotifierServer()
|
||||
}
|
||||
|
||||
// UnimplementedNotifierServer 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 UnimplementedNotifierServer struct{}
|
||||
|
||||
func (UnimplementedNotifierServer) NotifyUser(context.Context, *NotifyUserRequest) (*NotifyResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method NotifyUser not implemented")
|
||||
}
|
||||
func (UnimplementedNotifierServer) NotifyUserBatch(context.Context, *NotifyUserBatchRequest) (*NotifyResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method NotifyUserBatch not implemented")
|
||||
}
|
||||
func (UnimplementedNotifierServer) NotifyAllUser(context.Context, *NotifyRequest) (*NotifyResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method NotifyAllUser not implemented")
|
||||
}
|
||||
func (UnimplementedNotifierServer) mustEmbedUnimplementedNotifierServer() {}
|
||||
func (UnimplementedNotifierServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeNotifierServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to NotifierServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeNotifierServer interface {
|
||||
mustEmbedUnimplementedNotifierServer()
|
||||
}
|
||||
|
||||
func RegisterNotifierServer(s grpc.ServiceRegistrar, srv NotifierServer) {
|
||||
// If the following call pancis, it indicates UnimplementedNotifierServer 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(&Notifier_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _Notifier_NotifyUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(NotifyUserRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(NotifierServer).NotifyUser(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Notifier_NotifyUser_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(NotifierServer).NotifyUser(ctx, req.(*NotifyUserRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Notifier_NotifyUserBatch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(NotifyUserBatchRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(NotifierServer).NotifyUserBatch(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Notifier_NotifyUserBatch_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(NotifierServer).NotifyUserBatch(ctx, req.(*NotifyUserBatchRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Notifier_NotifyAllUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(NotifyRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(NotifierServer).NotifyAllUser(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Notifier_NotifyAllUser_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(NotifierServer).NotifyAllUser(ctx, req.(*NotifyRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Notifier_ServiceDesc is the grpc.ServiceDesc for Notifier service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var Notifier_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "proto.Notifier",
|
||||
HandlerType: (*NotifierServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "NotifyUser",
|
||||
Handler: _Notifier_NotifyUser_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "NotifyUserBatch",
|
||||
Handler: _Notifier_NotifyUserBatch_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "NotifyAllUser",
|
||||
Handler: _Notifier_NotifyAllUser_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "notify.proto",
|
||||
}
|
773
pkg/proto/realm.pb.go
Normal file
773
pkg/proto/realm.pb.go
Normal file
@ -0,0 +1,773 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.35.1
|
||||
// protoc v5.28.2
|
||||
// source: realm.proto
|
||||
|
||||
package proto
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type RealmInfo struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Alias string `protobuf:"bytes,2,opt,name=alias,proto3" json:"alias,omitempty"`
|
||||
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"`
|
||||
Avatar string `protobuf:"bytes,6,opt,name=avatar,proto3" json:"avatar,omitempty"`
|
||||
Banner string `protobuf:"bytes,7,opt,name=banner,proto3" json:"banner,omitempty"`
|
||||
IsPublic bool `protobuf:"varint,9,opt,name=is_public,json=isPublic,proto3" json:"is_public,omitempty"`
|
||||
IsCommunity bool `protobuf:"varint,10,opt,name=is_community,json=isCommunity,proto3" json:"is_community,omitempty"`
|
||||
AccessPolicy []byte `protobuf:"bytes,11,opt,name=access_policy,json=accessPolicy,proto3" json:"access_policy,omitempty"`
|
||||
}
|
||||
|
||||
func (x *RealmInfo) Reset() {
|
||||
*x = RealmInfo{}
|
||||
mi := &file_realm_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *RealmInfo) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RealmInfo) ProtoMessage() {}
|
||||
|
||||
func (x *RealmInfo) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_realm_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use RealmInfo.ProtoReflect.Descriptor instead.
|
||||
func (*RealmInfo) Descriptor() ([]byte, []int) {
|
||||
return file_realm_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *RealmInfo) GetId() uint64 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *RealmInfo) GetAlias() string {
|
||||
if x != nil {
|
||||
return x.Alias
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RealmInfo) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RealmInfo) GetDescription() string {
|
||||
if x != nil {
|
||||
return x.Description
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RealmInfo) GetAvatar() string {
|
||||
if x != nil {
|
||||
return x.Avatar
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RealmInfo) GetBanner() string {
|
||||
if x != nil {
|
||||
return x.Banner
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RealmInfo) GetIsPublic() bool {
|
||||
if x != nil {
|
||||
return x.IsPublic
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *RealmInfo) GetIsCommunity() bool {
|
||||
if x != nil {
|
||||
return x.IsCommunity
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *RealmInfo) GetAccessPolicy() []byte {
|
||||
if x != nil {
|
||||
return x.AccessPolicy
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ListRealmRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *ListRealmRequest) Reset() {
|
||||
*x = ListRealmRequest{}
|
||||
mi := &file_realm_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ListRealmRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ListRealmRequest) ProtoMessage() {}
|
||||
|
||||
func (x *ListRealmRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_realm_proto_msgTypes[1]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ListRealmRequest.ProtoReflect.Descriptor instead.
|
||||
func (*ListRealmRequest) Descriptor() ([]byte, []int) {
|
||||
return file_realm_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
type LookupUserRealmRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
UserId uint64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
|
||||
}
|
||||
|
||||
func (x *LookupUserRealmRequest) Reset() {
|
||||
*x = LookupUserRealmRequest{}
|
||||
mi := &file_realm_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *LookupUserRealmRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*LookupUserRealmRequest) ProtoMessage() {}
|
||||
|
||||
func (x *LookupUserRealmRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_realm_proto_msgTypes[2]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use LookupUserRealmRequest.ProtoReflect.Descriptor instead.
|
||||
func (*LookupUserRealmRequest) Descriptor() ([]byte, []int) {
|
||||
return file_realm_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *LookupUserRealmRequest) GetUserId() uint64 {
|
||||
if x != nil {
|
||||
return x.UserId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type LookupRealmRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id *uint64 `protobuf:"varint,1,opt,name=id,proto3,oneof" json:"id,omitempty"`
|
||||
Alias *string `protobuf:"bytes,2,opt,name=alias,proto3,oneof" json:"alias,omitempty"`
|
||||
IsPublic *bool `protobuf:"varint,3,opt,name=is_public,json=isPublic,proto3,oneof" json:"is_public,omitempty"`
|
||||
IsCommunity *bool `protobuf:"varint,4,opt,name=is_community,json=isCommunity,proto3,oneof" json:"is_community,omitempty"`
|
||||
}
|
||||
|
||||
func (x *LookupRealmRequest) Reset() {
|
||||
*x = LookupRealmRequest{}
|
||||
mi := &file_realm_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *LookupRealmRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*LookupRealmRequest) ProtoMessage() {}
|
||||
|
||||
func (x *LookupRealmRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_realm_proto_msgTypes[3]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use LookupRealmRequest.ProtoReflect.Descriptor instead.
|
||||
func (*LookupRealmRequest) Descriptor() ([]byte, []int) {
|
||||
return file_realm_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *LookupRealmRequest) GetId() uint64 {
|
||||
if x != nil && x.Id != nil {
|
||||
return *x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *LookupRealmRequest) GetAlias() string {
|
||||
if x != nil && x.Alias != nil {
|
||||
return *x.Alias
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *LookupRealmRequest) GetIsPublic() bool {
|
||||
if x != nil && x.IsPublic != nil {
|
||||
return *x.IsPublic
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *LookupRealmRequest) GetIsCommunity() bool {
|
||||
if x != nil && x.IsCommunity != nil {
|
||||
return *x.IsCommunity
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type ListRealmResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Data []*RealmInfo `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ListRealmResponse) Reset() {
|
||||
*x = ListRealmResponse{}
|
||||
mi := &file_realm_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ListRealmResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ListRealmResponse) ProtoMessage() {}
|
||||
|
||||
func (x *ListRealmResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_realm_proto_msgTypes[4]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ListRealmResponse.ProtoReflect.Descriptor instead.
|
||||
func (*ListRealmResponse) Descriptor() ([]byte, []int) {
|
||||
return file_realm_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *ListRealmResponse) GetData() []*RealmInfo {
|
||||
if x != nil {
|
||||
return x.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type RealmMemberLookupRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
RealmId *uint64 `protobuf:"varint,1,opt,name=realm_id,json=realmId,proto3,oneof" json:"realm_id,omitempty"`
|
||||
UserId *uint64 `protobuf:"varint,2,opt,name=user_id,json=userId,proto3,oneof" json:"user_id,omitempty"`
|
||||
}
|
||||
|
||||
func (x *RealmMemberLookupRequest) Reset() {
|
||||
*x = RealmMemberLookupRequest{}
|
||||
mi := &file_realm_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *RealmMemberLookupRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RealmMemberLookupRequest) ProtoMessage() {}
|
||||
|
||||
func (x *RealmMemberLookupRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_realm_proto_msgTypes[5]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use RealmMemberLookupRequest.ProtoReflect.Descriptor instead.
|
||||
func (*RealmMemberLookupRequest) Descriptor() ([]byte, []int) {
|
||||
return file_realm_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *RealmMemberLookupRequest) GetRealmId() uint64 {
|
||||
if x != nil && x.RealmId != nil {
|
||||
return *x.RealmId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *RealmMemberLookupRequest) GetUserId() uint64 {
|
||||
if x != nil && x.UserId != nil {
|
||||
return *x.UserId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type RealmMemberInfo struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
RealmId uint64 `protobuf:"varint,1,opt,name=realm_id,json=realmId,proto3" json:"realm_id,omitempty"`
|
||||
UserId uint64 `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
|
||||
PowerLevel int32 `protobuf:"varint,3,opt,name=power_level,json=powerLevel,proto3" json:"power_level,omitempty"`
|
||||
}
|
||||
|
||||
func (x *RealmMemberInfo) Reset() {
|
||||
*x = RealmMemberInfo{}
|
||||
mi := &file_realm_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *RealmMemberInfo) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RealmMemberInfo) ProtoMessage() {}
|
||||
|
||||
func (x *RealmMemberInfo) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_realm_proto_msgTypes[6]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use RealmMemberInfo.ProtoReflect.Descriptor instead.
|
||||
func (*RealmMemberInfo) Descriptor() ([]byte, []int) {
|
||||
return file_realm_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *RealmMemberInfo) GetRealmId() uint64 {
|
||||
if x != nil {
|
||||
return x.RealmId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *RealmMemberInfo) GetUserId() uint64 {
|
||||
if x != nil {
|
||||
return x.UserId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *RealmMemberInfo) GetPowerLevel() int32 {
|
||||
if x != nil {
|
||||
return x.PowerLevel
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type ListRealmMemberResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Data []*RealmMemberInfo `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ListRealmMemberResponse) Reset() {
|
||||
*x = ListRealmMemberResponse{}
|
||||
mi := &file_realm_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ListRealmMemberResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ListRealmMemberResponse) ProtoMessage() {}
|
||||
|
||||
func (x *ListRealmMemberResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_realm_proto_msgTypes[7]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ListRealmMemberResponse.ProtoReflect.Descriptor instead.
|
||||
func (*ListRealmMemberResponse) Descriptor() ([]byte, []int) {
|
||||
return file_realm_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
func (x *ListRealmMemberResponse) GetData() []*RealmMemberInfo {
|
||||
if x != nil {
|
||||
return x.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type CheckRealmPermRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
RealmId uint64 `protobuf:"varint,1,opt,name=realm_id,json=realmId,proto3" json:"realm_id,omitempty"`
|
||||
UserId uint64 `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
|
||||
PowerLevel int32 `protobuf:"varint,3,opt,name=power_level,json=powerLevel,proto3" json:"power_level,omitempty"`
|
||||
}
|
||||
|
||||
func (x *CheckRealmPermRequest) Reset() {
|
||||
*x = CheckRealmPermRequest{}
|
||||
mi := &file_realm_proto_msgTypes[8]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *CheckRealmPermRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*CheckRealmPermRequest) ProtoMessage() {}
|
||||
|
||||
func (x *CheckRealmPermRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_realm_proto_msgTypes[8]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use CheckRealmPermRequest.ProtoReflect.Descriptor instead.
|
||||
func (*CheckRealmPermRequest) Descriptor() ([]byte, []int) {
|
||||
return file_realm_proto_rawDescGZIP(), []int{8}
|
||||
}
|
||||
|
||||
func (x *CheckRealmPermRequest) GetRealmId() uint64 {
|
||||
if x != nil {
|
||||
return x.RealmId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *CheckRealmPermRequest) GetUserId() uint64 {
|
||||
if x != nil {
|
||||
return x.UserId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *CheckRealmPermRequest) GetPowerLevel() int32 {
|
||||
if x != nil {
|
||||
return x.PowerLevel
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type CheckRealmPermResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
IsSuccess bool `protobuf:"varint,1,opt,name=is_success,json=isSuccess,proto3" json:"is_success,omitempty"`
|
||||
}
|
||||
|
||||
func (x *CheckRealmPermResponse) Reset() {
|
||||
*x = CheckRealmPermResponse{}
|
||||
mi := &file_realm_proto_msgTypes[9]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *CheckRealmPermResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*CheckRealmPermResponse) ProtoMessage() {}
|
||||
|
||||
func (x *CheckRealmPermResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_realm_proto_msgTypes[9]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use CheckRealmPermResponse.ProtoReflect.Descriptor instead.
|
||||
func (*CheckRealmPermResponse) Descriptor() ([]byte, []int) {
|
||||
return file_realm_proto_rawDescGZIP(), []int{9}
|
||||
}
|
||||
|
||||
func (x *CheckRealmPermResponse) GetIsSuccess() bool {
|
||||
if x != nil {
|
||||
return x.IsSuccess
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var File_realm_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_realm_proto_rawDesc = []byte{
|
||||
0x0a, 0x0b, 0x72, 0x65, 0x61, 0x6c, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x22, 0xfc, 0x01, 0x0a, 0x09, 0x52, 0x65, 0x61, 0x6c, 0x6d, 0x49, 0x6e,
|
||||
0x66, 0x6f, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02,
|
||||
0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x05, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65,
|
||||
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b,
|
||||
0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16,
|
||||
0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,
|
||||
0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x61, 0x6e, 0x6e, 0x65, 0x72,
|
||||
0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x62, 0x61, 0x6e, 0x6e, 0x65, 0x72, 0x12, 0x1b,
|
||||
0x0a, 0x09, 0x69, 0x73, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x18, 0x09, 0x20, 0x01, 0x28,
|
||||
0x08, 0x52, 0x08, 0x69, 0x73, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x12, 0x21, 0x0a, 0x0c, 0x69,
|
||||
0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x18, 0x0a, 0x20, 0x01, 0x28,
|
||||
0x08, 0x52, 0x0b, 0x69, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x12, 0x23,
|
||||
0x0a, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x18,
|
||||
0x0b, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x50, 0x6f, 0x6c,
|
||||
0x69, 0x63, 0x79, 0x22, 0x12, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x61, 0x6c, 0x6d,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x31, 0x0a, 0x16, 0x4c, 0x6f, 0x6f, 0x6b, 0x75,
|
||||
0x70, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x61, 0x6c, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x04, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0xbe, 0x01, 0x0a, 0x12, 0x4c,
|
||||
0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x52, 0x65, 0x61, 0x6c, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x12, 0x13, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x48, 0x00, 0x52,
|
||||
0x02, 0x69, 0x64, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x05, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x88, 0x01,
|
||||
0x01, 0x12, 0x20, 0x0a, 0x09, 0x69, 0x73, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x18, 0x03,
|
||||
0x20, 0x01, 0x28, 0x08, 0x48, 0x02, 0x52, 0x08, 0x69, 0x73, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63,
|
||||
0x88, 0x01, 0x01, 0x12, 0x26, 0x0a, 0x0c, 0x69, 0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e,
|
||||
0x69, 0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x48, 0x03, 0x52, 0x0b, 0x69, 0x73, 0x43,
|
||||
0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x88, 0x01, 0x01, 0x42, 0x05, 0x0a, 0x03, 0x5f,
|
||||
0x69, 0x64, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x42, 0x0c, 0x0a, 0x0a,
|
||||
0x5f, 0x69, 0x73, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x42, 0x0f, 0x0a, 0x0d, 0x5f, 0x69,
|
||||
0x73, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x22, 0x39, 0x0a, 0x11, 0x4c,
|
||||
0x69, 0x73, 0x74, 0x52, 0x65, 0x61, 0x6c, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x12, 0x24, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x61, 0x6c, 0x6d, 0x49, 0x6e, 0x66, 0x6f,
|
||||
0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x71, 0x0a, 0x18, 0x52, 0x65, 0x61, 0x6c, 0x6d, 0x4d,
|
||||
0x65, 0x6d, 0x62, 0x65, 0x72, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x12, 0x1e, 0x0a, 0x08, 0x72, 0x65, 0x61, 0x6c, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x04, 0x48, 0x00, 0x52, 0x07, 0x72, 0x65, 0x61, 0x6c, 0x6d, 0x49, 0x64, 0x88,
|
||||
0x01, 0x01, 0x12, 0x1c, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x04, 0x48, 0x01, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x88, 0x01, 0x01,
|
||||
0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x72, 0x65, 0x61, 0x6c, 0x6d, 0x5f, 0x69, 0x64, 0x42, 0x0a, 0x0a,
|
||||
0x08, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x22, 0x66, 0x0a, 0x0f, 0x52, 0x65, 0x61,
|
||||
0x6c, 0x6d, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x19, 0x0a, 0x08,
|
||||
0x72, 0x65, 0x61, 0x6c, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07,
|
||||
0x72, 0x65, 0x61, 0x6c, 0x6d, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f,
|
||||
0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64,
|
||||
0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18,
|
||||
0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x4c, 0x65, 0x76, 0x65,
|
||||
0x6c, 0x22, 0x45, 0x0a, 0x17, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x61, 0x6c, 0x6d, 0x4d, 0x65,
|
||||
0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x04,
|
||||
0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x2e, 0x52, 0x65, 0x61, 0x6c, 0x6d, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x49, 0x6e,
|
||||
0x66, 0x6f, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x6c, 0x0a, 0x15, 0x43, 0x68, 0x65, 0x63,
|
||||
0x6b, 0x52, 0x65, 0x61, 0x6c, 0x6d, 0x50, 0x65, 0x72, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x65, 0x61, 0x6c, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x04, 0x52, 0x07, 0x72, 0x65, 0x61, 0x6c, 0x6d, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07,
|
||||
0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x75,
|
||||
0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x5f, 0x6c,
|
||||
0x65, 0x76, 0x65, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x70, 0x6f, 0x77, 0x65,
|
||||
0x72, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x22, 0x37, 0x0a, 0x16, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52,
|
||||
0x65, 0x61, 0x6c, 0x6d, 0x50, 0x65, 0x72, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x73, 0x5f, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x73, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x32,
|
||||
0xa5, 0x04, 0x0a, 0x05, 0x52, 0x65, 0x61, 0x6c, 0x6d, 0x12, 0x49, 0x0a, 0x12, 0x4c, 0x69, 0x73,
|
||||
0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x52, 0x65, 0x61, 0x6c, 0x6d, 0x12,
|
||||
0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x61, 0x6c,
|
||||
0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x61, 0x6c, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x22, 0x00, 0x12, 0x4f, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x76, 0x61, 0x69,
|
||||
0x6c, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x65, 0x61, 0x6c, 0x6d, 0x12, 0x1d, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x61,
|
||||
0x6c, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x61, 0x6c, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4b, 0x0a, 0x0e, 0x4c, 0x69, 0x73, 0x74, 0x4f, 0x77, 0x6e,
|
||||
0x65, 0x64, 0x52, 0x65, 0x61, 0x6c, 0x6d, 0x12, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e,
|
||||
0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x61, 0x6c, 0x6d, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4c,
|
||||
0x69, 0x73, 0x74, 0x52, 0x65, 0x61, 0x6c, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x22, 0x00, 0x12, 0x39, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x52, 0x65, 0x61, 0x6c, 0x6d, 0x12, 0x19,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x52, 0x65, 0x61,
|
||||
0x6c, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x2e, 0x52, 0x65, 0x61, 0x6c, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x00, 0x12, 0x54, 0x0a,
|
||||
0x0f, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x61, 0x6c, 0x6d, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72,
|
||||
0x12, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x61, 0x6c, 0x6d, 0x4d, 0x65,
|
||||
0x6d, 0x62, 0x65, 0x72, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x1a, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65,
|
||||
0x61, 0x6c, 0x6d, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x22, 0x00, 0x12, 0x4b, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x61, 0x6c, 0x6d, 0x4d,
|
||||
0x65, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65,
|
||||
0x61, 0x6c, 0x6d, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52,
|
||||
0x65, 0x61, 0x6c, 0x6d, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x00,
|
||||
0x12, 0x55, 0x0a, 0x14, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x61, 0x6c, 0x6d, 0x4d, 0x65,
|
||||
0x6d, 0x62, 0x65, 0x72, 0x50, 0x65, 0x72, 0x6d, 0x12, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x61, 0x6c, 0x6d, 0x50, 0x65, 0x72, 0x6d, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43,
|
||||
0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x61, 0x6c, 0x6d, 0x50, 0x65, 0x72, 0x6d, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x3b, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_realm_proto_rawDescOnce sync.Once
|
||||
file_realm_proto_rawDescData = file_realm_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_realm_proto_rawDescGZIP() []byte {
|
||||
file_realm_proto_rawDescOnce.Do(func() {
|
||||
file_realm_proto_rawDescData = protoimpl.X.CompressGZIP(file_realm_proto_rawDescData)
|
||||
})
|
||||
return file_realm_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_realm_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
|
||||
var file_realm_proto_goTypes = []any{
|
||||
(*RealmInfo)(nil), // 0: proto.RealmInfo
|
||||
(*ListRealmRequest)(nil), // 1: proto.ListRealmRequest
|
||||
(*LookupUserRealmRequest)(nil), // 2: proto.LookupUserRealmRequest
|
||||
(*LookupRealmRequest)(nil), // 3: proto.LookupRealmRequest
|
||||
(*ListRealmResponse)(nil), // 4: proto.ListRealmResponse
|
||||
(*RealmMemberLookupRequest)(nil), // 5: proto.RealmMemberLookupRequest
|
||||
(*RealmMemberInfo)(nil), // 6: proto.RealmMemberInfo
|
||||
(*ListRealmMemberResponse)(nil), // 7: proto.ListRealmMemberResponse
|
||||
(*CheckRealmPermRequest)(nil), // 8: proto.CheckRealmPermRequest
|
||||
(*CheckRealmPermResponse)(nil), // 9: proto.CheckRealmPermResponse
|
||||
}
|
||||
var file_realm_proto_depIdxs = []int32{
|
||||
0, // 0: proto.ListRealmResponse.data:type_name -> proto.RealmInfo
|
||||
6, // 1: proto.ListRealmMemberResponse.data:type_name -> proto.RealmMemberInfo
|
||||
1, // 2: proto.Realm.ListCommunityRealm:input_type -> proto.ListRealmRequest
|
||||
2, // 3: proto.Realm.ListAvailableRealm:input_type -> proto.LookupUserRealmRequest
|
||||
2, // 4: proto.Realm.ListOwnedRealm:input_type -> proto.LookupUserRealmRequest
|
||||
3, // 5: proto.Realm.GetRealm:input_type -> proto.LookupRealmRequest
|
||||
5, // 6: proto.Realm.ListRealmMember:input_type -> proto.RealmMemberLookupRequest
|
||||
5, // 7: proto.Realm.GetRealmMember:input_type -> proto.RealmMemberLookupRequest
|
||||
8, // 8: proto.Realm.CheckRealmMemberPerm:input_type -> proto.CheckRealmPermRequest
|
||||
4, // 9: proto.Realm.ListCommunityRealm:output_type -> proto.ListRealmResponse
|
||||
4, // 10: proto.Realm.ListAvailableRealm:output_type -> proto.ListRealmResponse
|
||||
4, // 11: proto.Realm.ListOwnedRealm:output_type -> proto.ListRealmResponse
|
||||
0, // 12: proto.Realm.GetRealm:output_type -> proto.RealmInfo
|
||||
7, // 13: proto.Realm.ListRealmMember:output_type -> proto.ListRealmMemberResponse
|
||||
6, // 14: proto.Realm.GetRealmMember:output_type -> proto.RealmMemberInfo
|
||||
9, // 15: proto.Realm.CheckRealmMemberPerm:output_type -> proto.CheckRealmPermResponse
|
||||
9, // [9:16] is the sub-list for method output_type
|
||||
2, // [2:9] is the sub-list for method input_type
|
||||
2, // [2:2] is the sub-list for extension type_name
|
||||
2, // [2:2] is the sub-list for extension extendee
|
||||
0, // [0:2] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_realm_proto_init() }
|
||||
func file_realm_proto_init() {
|
||||
if File_realm_proto != nil {
|
||||
return
|
||||
}
|
||||
file_realm_proto_msgTypes[3].OneofWrappers = []any{}
|
||||
file_realm_proto_msgTypes[5].OneofWrappers = []any{}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_realm_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 10,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_realm_proto_goTypes,
|
||||
DependencyIndexes: file_realm_proto_depIdxs,
|
||||
MessageInfos: file_realm_proto_msgTypes,
|
||||
}.Build()
|
||||
File_realm_proto = out.File
|
||||
file_realm_proto_rawDesc = nil
|
||||
file_realm_proto_goTypes = nil
|
||||
file_realm_proto_depIdxs = nil
|
||||
}
|
70
pkg/proto/realm.proto
Normal file
70
pkg/proto/realm.proto
Normal file
@ -0,0 +1,70 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option go_package = ".;proto";
|
||||
|
||||
package proto;
|
||||
|
||||
service Realm {
|
||||
rpc ListCommunityRealm(ListRealmRequest) returns (ListRealmResponse) {}
|
||||
rpc ListAvailableRealm(LookupUserRealmRequest) returns (ListRealmResponse) {}
|
||||
rpc ListOwnedRealm(LookupUserRealmRequest) returns (ListRealmResponse) {}
|
||||
rpc GetRealm(LookupRealmRequest) returns (RealmInfo) {}
|
||||
rpc ListRealmMember(RealmMemberLookupRequest) returns (ListRealmMemberResponse) {}
|
||||
rpc GetRealmMember(RealmMemberLookupRequest) returns (RealmMemberInfo) {}
|
||||
rpc CheckRealmMemberPerm(CheckRealmPermRequest) returns (CheckRealmPermResponse) {}
|
||||
}
|
||||
|
||||
message RealmInfo {
|
||||
uint64 id = 1;
|
||||
string alias = 2;
|
||||
string name = 3;
|
||||
string description = 4;
|
||||
string avatar = 6;
|
||||
string banner = 7;
|
||||
bool is_public = 9;
|
||||
bool is_community = 10;
|
||||
bytes access_policy = 11;
|
||||
}
|
||||
|
||||
message ListRealmRequest {
|
||||
}
|
||||
|
||||
message LookupUserRealmRequest {
|
||||
uint64 user_id = 1;
|
||||
}
|
||||
|
||||
message LookupRealmRequest {
|
||||
optional uint64 id = 1;
|
||||
optional string alias = 2;
|
||||
optional bool is_public = 3;
|
||||
optional bool is_community = 4;
|
||||
}
|
||||
|
||||
message ListRealmResponse {
|
||||
repeated RealmInfo data = 1;
|
||||
}
|
||||
|
||||
message RealmMemberLookupRequest {
|
||||
optional uint64 realm_id = 1;
|
||||
optional uint64 user_id = 2;
|
||||
}
|
||||
|
||||
message RealmMemberInfo {
|
||||
uint64 realm_id = 1;
|
||||
uint64 user_id = 2;
|
||||
int32 power_level = 3;
|
||||
}
|
||||
|
||||
message ListRealmMemberResponse {
|
||||
repeated RealmMemberInfo data = 1;
|
||||
}
|
||||
|
||||
message CheckRealmPermRequest {
|
||||
uint64 realm_id = 1;
|
||||
uint64 user_id = 2;
|
||||
int32 power_level = 3;
|
||||
}
|
||||
|
||||
message CheckRealmPermResponse {
|
||||
bool is_success = 1;
|
||||
}
|
349
pkg/proto/realm_grpc.pb.go
Normal file
349
pkg/proto/realm_grpc.pb.go
Normal file
@ -0,0 +1,349 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.5.1
|
||||
// - protoc v5.28.2
|
||||
// source: realm.proto
|
||||
|
||||
package proto
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// 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 (
|
||||
Realm_ListCommunityRealm_FullMethodName = "/proto.Realm/ListCommunityRealm"
|
||||
Realm_ListAvailableRealm_FullMethodName = "/proto.Realm/ListAvailableRealm"
|
||||
Realm_ListOwnedRealm_FullMethodName = "/proto.Realm/ListOwnedRealm"
|
||||
Realm_GetRealm_FullMethodName = "/proto.Realm/GetRealm"
|
||||
Realm_ListRealmMember_FullMethodName = "/proto.Realm/ListRealmMember"
|
||||
Realm_GetRealmMember_FullMethodName = "/proto.Realm/GetRealmMember"
|
||||
Realm_CheckRealmMemberPerm_FullMethodName = "/proto.Realm/CheckRealmMemberPerm"
|
||||
)
|
||||
|
||||
// RealmClient is the client API for Realm 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 RealmClient interface {
|
||||
ListCommunityRealm(ctx context.Context, in *ListRealmRequest, opts ...grpc.CallOption) (*ListRealmResponse, error)
|
||||
ListAvailableRealm(ctx context.Context, in *LookupUserRealmRequest, opts ...grpc.CallOption) (*ListRealmResponse, error)
|
||||
ListOwnedRealm(ctx context.Context, in *LookupUserRealmRequest, opts ...grpc.CallOption) (*ListRealmResponse, error)
|
||||
GetRealm(ctx context.Context, in *LookupRealmRequest, opts ...grpc.CallOption) (*RealmInfo, error)
|
||||
ListRealmMember(ctx context.Context, in *RealmMemberLookupRequest, opts ...grpc.CallOption) (*ListRealmMemberResponse, error)
|
||||
GetRealmMember(ctx context.Context, in *RealmMemberLookupRequest, opts ...grpc.CallOption) (*RealmMemberInfo, error)
|
||||
CheckRealmMemberPerm(ctx context.Context, in *CheckRealmPermRequest, opts ...grpc.CallOption) (*CheckRealmPermResponse, error)
|
||||
}
|
||||
|
||||
type realmClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewRealmClient(cc grpc.ClientConnInterface) RealmClient {
|
||||
return &realmClient{cc}
|
||||
}
|
||||
|
||||
func (c *realmClient) ListCommunityRealm(ctx context.Context, in *ListRealmRequest, opts ...grpc.CallOption) (*ListRealmResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(ListRealmResponse)
|
||||
err := c.cc.Invoke(ctx, Realm_ListCommunityRealm_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *realmClient) ListAvailableRealm(ctx context.Context, in *LookupUserRealmRequest, opts ...grpc.CallOption) (*ListRealmResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(ListRealmResponse)
|
||||
err := c.cc.Invoke(ctx, Realm_ListAvailableRealm_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *realmClient) ListOwnedRealm(ctx context.Context, in *LookupUserRealmRequest, opts ...grpc.CallOption) (*ListRealmResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(ListRealmResponse)
|
||||
err := c.cc.Invoke(ctx, Realm_ListOwnedRealm_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *realmClient) GetRealm(ctx context.Context, in *LookupRealmRequest, opts ...grpc.CallOption) (*RealmInfo, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(RealmInfo)
|
||||
err := c.cc.Invoke(ctx, Realm_GetRealm_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *realmClient) ListRealmMember(ctx context.Context, in *RealmMemberLookupRequest, opts ...grpc.CallOption) (*ListRealmMemberResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(ListRealmMemberResponse)
|
||||
err := c.cc.Invoke(ctx, Realm_ListRealmMember_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *realmClient) GetRealmMember(ctx context.Context, in *RealmMemberLookupRequest, opts ...grpc.CallOption) (*RealmMemberInfo, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(RealmMemberInfo)
|
||||
err := c.cc.Invoke(ctx, Realm_GetRealmMember_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *realmClient) CheckRealmMemberPerm(ctx context.Context, in *CheckRealmPermRequest, opts ...grpc.CallOption) (*CheckRealmPermResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(CheckRealmPermResponse)
|
||||
err := c.cc.Invoke(ctx, Realm_CheckRealmMemberPerm_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// RealmServer is the server API for Realm service.
|
||||
// All implementations must embed UnimplementedRealmServer
|
||||
// for forward compatibility.
|
||||
type RealmServer interface {
|
||||
ListCommunityRealm(context.Context, *ListRealmRequest) (*ListRealmResponse, error)
|
||||
ListAvailableRealm(context.Context, *LookupUserRealmRequest) (*ListRealmResponse, error)
|
||||
ListOwnedRealm(context.Context, *LookupUserRealmRequest) (*ListRealmResponse, error)
|
||||
GetRealm(context.Context, *LookupRealmRequest) (*RealmInfo, error)
|
||||
ListRealmMember(context.Context, *RealmMemberLookupRequest) (*ListRealmMemberResponse, error)
|
||||
GetRealmMember(context.Context, *RealmMemberLookupRequest) (*RealmMemberInfo, error)
|
||||
CheckRealmMemberPerm(context.Context, *CheckRealmPermRequest) (*CheckRealmPermResponse, error)
|
||||
mustEmbedUnimplementedRealmServer()
|
||||
}
|
||||
|
||||
// UnimplementedRealmServer 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 UnimplementedRealmServer struct{}
|
||||
|
||||
func (UnimplementedRealmServer) ListCommunityRealm(context.Context, *ListRealmRequest) (*ListRealmResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ListCommunityRealm not implemented")
|
||||
}
|
||||
func (UnimplementedRealmServer) ListAvailableRealm(context.Context, *LookupUserRealmRequest) (*ListRealmResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ListAvailableRealm not implemented")
|
||||
}
|
||||
func (UnimplementedRealmServer) ListOwnedRealm(context.Context, *LookupUserRealmRequest) (*ListRealmResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ListOwnedRealm not implemented")
|
||||
}
|
||||
func (UnimplementedRealmServer) GetRealm(context.Context, *LookupRealmRequest) (*RealmInfo, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetRealm not implemented")
|
||||
}
|
||||
func (UnimplementedRealmServer) ListRealmMember(context.Context, *RealmMemberLookupRequest) (*ListRealmMemberResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ListRealmMember not implemented")
|
||||
}
|
||||
func (UnimplementedRealmServer) GetRealmMember(context.Context, *RealmMemberLookupRequest) (*RealmMemberInfo, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetRealmMember not implemented")
|
||||
}
|
||||
func (UnimplementedRealmServer) CheckRealmMemberPerm(context.Context, *CheckRealmPermRequest) (*CheckRealmPermResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CheckRealmMemberPerm not implemented")
|
||||
}
|
||||
func (UnimplementedRealmServer) mustEmbedUnimplementedRealmServer() {}
|
||||
func (UnimplementedRealmServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeRealmServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to RealmServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeRealmServer interface {
|
||||
mustEmbedUnimplementedRealmServer()
|
||||
}
|
||||
|
||||
func RegisterRealmServer(s grpc.ServiceRegistrar, srv RealmServer) {
|
||||
// If the following call pancis, it indicates UnimplementedRealmServer 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(&Realm_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _Realm_ListCommunityRealm_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListRealmRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(RealmServer).ListCommunityRealm(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Realm_ListCommunityRealm_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(RealmServer).ListCommunityRealm(ctx, req.(*ListRealmRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Realm_ListAvailableRealm_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(LookupUserRealmRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(RealmServer).ListAvailableRealm(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Realm_ListAvailableRealm_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(RealmServer).ListAvailableRealm(ctx, req.(*LookupUserRealmRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Realm_ListOwnedRealm_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(LookupUserRealmRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(RealmServer).ListOwnedRealm(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Realm_ListOwnedRealm_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(RealmServer).ListOwnedRealm(ctx, req.(*LookupUserRealmRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Realm_GetRealm_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(LookupRealmRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(RealmServer).GetRealm(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Realm_GetRealm_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(RealmServer).GetRealm(ctx, req.(*LookupRealmRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Realm_ListRealmMember_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(RealmMemberLookupRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(RealmServer).ListRealmMember(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Realm_ListRealmMember_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(RealmServer).ListRealmMember(ctx, req.(*RealmMemberLookupRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Realm_GetRealmMember_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(RealmMemberLookupRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(RealmServer).GetRealmMember(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Realm_GetRealmMember_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(RealmServer).GetRealmMember(ctx, req.(*RealmMemberLookupRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Realm_CheckRealmMemberPerm_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CheckRealmPermRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(RealmServer).CheckRealmMemberPerm(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Realm_CheckRealmMemberPerm_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(RealmServer).CheckRealmMemberPerm(ctx, req.(*CheckRealmPermRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Realm_ServiceDesc is the grpc.ServiceDesc for Realm service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var Realm_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "proto.Realm",
|
||||
HandlerType: (*RealmServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "ListCommunityRealm",
|
||||
Handler: _Realm_ListCommunityRealm_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ListAvailableRealm",
|
||||
Handler: _Realm_ListAvailableRealm_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ListOwnedRealm",
|
||||
Handler: _Realm_ListOwnedRealm_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetRealm",
|
||||
Handler: _Realm_GetRealm_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ListRealmMember",
|
||||
Handler: _Realm_ListRealmMember_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetRealmMember",
|
||||
Handler: _Realm_GetRealmMember_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CheckRealmMemberPerm",
|
||||
Handler: _Realm_CheckRealmMemberPerm_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "realm.proto",
|
||||
}
|
221
pkg/proto/record.pb.go
Normal file
221
pkg/proto/record.pb.go
Normal file
@ -0,0 +1,221 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.35.1
|
||||
// protoc v5.28.2
|
||||
// source: record.proto
|
||||
|
||||
package proto
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type RecordEventRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
UserId uint64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
|
||||
Action string `protobuf:"bytes,2,opt,name=action,proto3" json:"action,omitempty"`
|
||||
Target string `protobuf:"bytes,3,opt,name=target,proto3" json:"target,omitempty"`
|
||||
Ip string `protobuf:"bytes,4,opt,name=ip,proto3" json:"ip,omitempty"`
|
||||
UserAgent string `protobuf:"bytes,5,opt,name=user_agent,json=userAgent,proto3" json:"user_agent,omitempty"`
|
||||
}
|
||||
|
||||
func (x *RecordEventRequest) Reset() {
|
||||
*x = RecordEventRequest{}
|
||||
mi := &file_record_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *RecordEventRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RecordEventRequest) ProtoMessage() {}
|
||||
|
||||
func (x *RecordEventRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_record_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use RecordEventRequest.ProtoReflect.Descriptor instead.
|
||||
func (*RecordEventRequest) Descriptor() ([]byte, []int) {
|
||||
return file_record_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *RecordEventRequest) GetUserId() uint64 {
|
||||
if x != nil {
|
||||
return x.UserId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *RecordEventRequest) GetAction() string {
|
||||
if x != nil {
|
||||
return x.Action
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RecordEventRequest) GetTarget() string {
|
||||
if x != nil {
|
||||
return x.Target
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RecordEventRequest) GetIp() string {
|
||||
if x != nil {
|
||||
return x.Ip
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RecordEventRequest) GetUserAgent() string {
|
||||
if x != nil {
|
||||
return x.UserAgent
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type RecordEventResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
IsSuccess bool `protobuf:"varint,1,opt,name=is_success,json=isSuccess,proto3" json:"is_success,omitempty"`
|
||||
}
|
||||
|
||||
func (x *RecordEventResponse) Reset() {
|
||||
*x = RecordEventResponse{}
|
||||
mi := &file_record_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *RecordEventResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RecordEventResponse) ProtoMessage() {}
|
||||
|
||||
func (x *RecordEventResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_record_proto_msgTypes[1]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use RecordEventResponse.ProtoReflect.Descriptor instead.
|
||||
func (*RecordEventResponse) Descriptor() ([]byte, []int) {
|
||||
return file_record_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *RecordEventResponse) GetIsSuccess() bool {
|
||||
if x != nil {
|
||||
return x.IsSuccess
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var File_record_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_record_proto_rawDesc = []byte{
|
||||
0x0a, 0x0c, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8c, 0x01, 0x0a, 0x12, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64,
|
||||
0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07,
|
||||
0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x75,
|
||||
0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a,
|
||||
0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74,
|
||||
0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x02, 0x69, 0x70, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x61, 0x67,
|
||||
0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x73, 0x65, 0x72, 0x41,
|
||||
0x67, 0x65, 0x6e, 0x74, 0x22, 0x34, 0x0a, 0x13, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x45, 0x76,
|
||||
0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x69,
|
||||
0x73, 0x5f, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52,
|
||||
0x09, 0x69, 0x73, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x32, 0x57, 0x0a, 0x0d, 0x45, 0x76,
|
||||
0x65, 0x6e, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x46, 0x0a, 0x0b, 0x52,
|
||||
0x65, 0x63, 0x6f, 0x72, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x19, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65,
|
||||
0x63, 0x6f, 0x72, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x22, 0x00, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_record_proto_rawDescOnce sync.Once
|
||||
file_record_proto_rawDescData = file_record_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_record_proto_rawDescGZIP() []byte {
|
||||
file_record_proto_rawDescOnce.Do(func() {
|
||||
file_record_proto_rawDescData = protoimpl.X.CompressGZIP(file_record_proto_rawDescData)
|
||||
})
|
||||
return file_record_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_record_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_record_proto_goTypes = []any{
|
||||
(*RecordEventRequest)(nil), // 0: proto.RecordEventRequest
|
||||
(*RecordEventResponse)(nil), // 1: proto.RecordEventResponse
|
||||
}
|
||||
var file_record_proto_depIdxs = []int32{
|
||||
0, // 0: proto.EventRecorder.RecordEvent:input_type -> proto.RecordEventRequest
|
||||
1, // 1: proto.EventRecorder.RecordEvent:output_type -> proto.RecordEventResponse
|
||||
1, // [1:2] is the sub-list for method output_type
|
||||
0, // [0:1] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_record_proto_init() }
|
||||
func file_record_proto_init() {
|
||||
if File_record_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_record_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 2,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_record_proto_goTypes,
|
||||
DependencyIndexes: file_record_proto_depIdxs,
|
||||
MessageInfos: file_record_proto_msgTypes,
|
||||
}.Build()
|
||||
File_record_proto = out.File
|
||||
file_record_proto_rawDesc = nil
|
||||
file_record_proto_goTypes = nil
|
||||
file_record_proto_depIdxs = nil
|
||||
}
|
21
pkg/proto/record.proto
Normal file
21
pkg/proto/record.proto
Normal file
@ -0,0 +1,21 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option go_package = ".;proto";
|
||||
|
||||
package proto;
|
||||
|
||||
service EventRecorder {
|
||||
rpc RecordEvent(RecordEventRequest) returns (RecordEventResponse) {}
|
||||
}
|
||||
|
||||
message RecordEventRequest {
|
||||
uint64 user_id = 1;
|
||||
string action = 2;
|
||||
string target = 3;
|
||||
string ip = 4;
|
||||
string user_agent = 5;
|
||||
}
|
||||
|
||||
message RecordEventResponse {
|
||||
bool is_success = 1;
|
||||
}
|
121
pkg/proto/record_grpc.pb.go
Normal file
121
pkg/proto/record_grpc.pb.go
Normal file
@ -0,0 +1,121 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.5.1
|
||||
// - protoc v5.28.2
|
||||
// source: record.proto
|
||||
|
||||
package proto
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// 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 (
|
||||
EventRecorder_RecordEvent_FullMethodName = "/proto.EventRecorder/RecordEvent"
|
||||
)
|
||||
|
||||
// EventRecorderClient is the client API for EventRecorder 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 EventRecorderClient interface {
|
||||
RecordEvent(ctx context.Context, in *RecordEventRequest, opts ...grpc.CallOption) (*RecordEventResponse, error)
|
||||
}
|
||||
|
||||
type eventRecorderClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewEventRecorderClient(cc grpc.ClientConnInterface) EventRecorderClient {
|
||||
return &eventRecorderClient{cc}
|
||||
}
|
||||
|
||||
func (c *eventRecorderClient) RecordEvent(ctx context.Context, in *RecordEventRequest, opts ...grpc.CallOption) (*RecordEventResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(RecordEventResponse)
|
||||
err := c.cc.Invoke(ctx, EventRecorder_RecordEvent_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// EventRecorderServer is the server API for EventRecorder service.
|
||||
// All implementations must embed UnimplementedEventRecorderServer
|
||||
// for forward compatibility.
|
||||
type EventRecorderServer interface {
|
||||
RecordEvent(context.Context, *RecordEventRequest) (*RecordEventResponse, error)
|
||||
mustEmbedUnimplementedEventRecorderServer()
|
||||
}
|
||||
|
||||
// UnimplementedEventRecorderServer 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 UnimplementedEventRecorderServer struct{}
|
||||
|
||||
func (UnimplementedEventRecorderServer) RecordEvent(context.Context, *RecordEventRequest) (*RecordEventResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method RecordEvent not implemented")
|
||||
}
|
||||
func (UnimplementedEventRecorderServer) mustEmbedUnimplementedEventRecorderServer() {}
|
||||
func (UnimplementedEventRecorderServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeEventRecorderServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to EventRecorderServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeEventRecorderServer interface {
|
||||
mustEmbedUnimplementedEventRecorderServer()
|
||||
}
|
||||
|
||||
func RegisterEventRecorderServer(s grpc.ServiceRegistrar, srv EventRecorderServer) {
|
||||
// If the following call pancis, it indicates UnimplementedEventRecorderServer 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(&EventRecorder_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _EventRecorder_RecordEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(RecordEventRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(EventRecorderServer).RecordEvent(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: EventRecorder_RecordEvent_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(EventRecorderServer).RecordEvent(ctx, req.(*RecordEventRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// EventRecorder_ServiceDesc is the grpc.ServiceDesc for EventRecorder service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var EventRecorder_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "proto.EventRecorder",
|
||||
HandlerType: (*EventRecorderServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "RecordEvent",
|
||||
Handler: _EventRecorder_RecordEvent_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "record.proto",
|
||||
}
|
Reference in New Issue
Block a user