More and more api was included

This commit is contained in:
LittleSheep 2024-07-15 22:20:37 +08:00
parent 4e96bb2cd5
commit d7f5053fc7
12 changed files with 1958 additions and 68 deletions

View File

@ -2,64 +2,37 @@ package grpc
import (
"context"
"fmt"
"time"
"git.solsynth.dev/hydrogen/dealer/pkg/hyper"
"git.solsynth.dev/hydrogen/dealer/pkg/internal/directory"
"git.solsynth.dev/hydrogen/dealer/pkg/proto"
"google.golang.org/grpc"
)
func (v *Server) Authenticate(ctx context.Context, request *proto.AuthRequest) (*proto.AuthReply, error) {
instance := directory.GetServiceInstanceByType(hyper.ServiceTypeAuthProvider)
if instance == nil {
return &proto.AuthReply{}, fmt.Errorf("no available service %s found", hyper.ServiceTypeAuthProvider)
}
conn, err := instance.GetGrpcConn()
if err != nil {
return nil, fmt.Errorf("service is down: %v", err)
}
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
defer cancel()
out, err := proto.NewAuthClient(conn).Authenticate(ctx, request)
return out, err
return forwardInvokeRequest(
hyper.ServiceTypeAuthProvider,
func(ctx context.Context, conn *grpc.ClientConn) (*proto.AuthReply, error) {
out, err := proto.NewAuthClient(conn).Authenticate(ctx, request)
return out, err
},
)
}
func (v *Server) EnsurePermGranted(ctx context.Context, request *proto.CheckPermRequest) (*proto.CheckPermResponse, error) {
instance := directory.GetServiceInstanceByType(hyper.ServiceTypeAuthProvider)
if instance == nil {
return &proto.CheckPermResponse{}, fmt.Errorf("no available service %s found", hyper.ServiceTypeAuthProvider)
}
conn, err := instance.GetGrpcConn()
if err != nil {
return nil, fmt.Errorf("service is down: %v", err)
}
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
defer cancel()
out, err := proto.NewAuthClient(conn).EnsurePermGranted(ctx, request)
return out, err
return forwardInvokeRequest(
hyper.ServiceTypeAuthProvider,
func(ctx context.Context, conn *grpc.ClientConn) (*proto.CheckPermResponse, error) {
out, err := proto.NewAuthClient(conn).EnsurePermGranted(ctx, request)
return out, err
},
)
}
func (v *Server) EnsureUserPermGranted(ctx context.Context, request *proto.CheckUserPermRequest) (*proto.CheckUserPermResponse, error) {
instance := directory.GetServiceInstance(hyper.ServiceTypeAuthProvider)
if instance == nil {
return &proto.CheckUserPermResponse{}, fmt.Errorf("no available service %s found", hyper.ServiceTypeAuthProvider)
}
conn, err := instance.GetGrpcConn()
if err != nil {
return nil, fmt.Errorf("service is down: %v", err)
}
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
defer cancel()
out, err := proto.NewAuthClient(conn).EnsureUserPermGranted(ctx, request)
return out, err
return forwardInvokeRequest(
hyper.ServiceTypeAuthProvider,
func(ctx context.Context, conn *grpc.ClientConn) (*proto.CheckUserPermResponse, error) {
out, err := proto.NewAuthClient(conn).EnsureUserPermGranted(ctx, request)
return out, err
},
)
}

View File

@ -0,0 +1,28 @@
package grpc
import (
"context"
"fmt"
"git.solsynth.dev/hydrogen/dealer/pkg/hyper"
"git.solsynth.dev/hydrogen/dealer/pkg/internal/directory"
"google.golang.org/grpc"
"time"
)
func forwardInvokeRequest[T any](serviceType string, executor func(context.Context, *grpc.ClientConn) (T, error)) (T, error) {
var emptyResult T
instance := directory.GetServiceInstance(serviceType)
if instance == nil {
return emptyResult, fmt.Errorf("no available service %s found", hyper.ServiceTypeAuthProvider)
}
conn, err := instance.GetGrpcConn()
if err != nil {
return emptyResult, fmt.Errorf("service is down: %v", err)
}
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
defer cancel()
return executor(ctx, conn)
}

View File

@ -0,0 +1,28 @@
package grpc
import (
"context"
"git.solsynth.dev/hydrogen/dealer/pkg/hyper"
"git.solsynth.dev/hydrogen/dealer/pkg/proto"
"google.golang.org/grpc"
)
func (v *Server) NotifyUser(ctx context.Context, request *proto.NotifyUserRequest) (*proto.NotifyResponse, error) {
return forwardInvokeRequest(
hyper.ServiceTypeAuthProvider,
func(ctx context.Context, conn *grpc.ClientConn) (*proto.NotifyResponse, error) {
out, err := proto.NewNotifierClient(conn).NotifyUser(ctx, request)
return out, err
},
)
}
func (v *Server) NotifyAllUser(ctx context.Context, request *proto.NotifyRequest) (*proto.NotifyResponse, error) {
return forwardInvokeRequest(
hyper.ServiceTypeAuthProvider,
func(ctx context.Context, conn *grpc.ClientConn) (*proto.NotifyResponse, error) {
out, err := proto.NewNotifierClient(conn).NotifyAllUser(ctx, request)
return out, err
},
)
}

View File

@ -0,0 +1,78 @@
package grpc
import (
"context"
"git.solsynth.dev/hydrogen/dealer/pkg/hyper"
"git.solsynth.dev/hydrogen/dealer/pkg/proto"
"google.golang.org/grpc"
)
func (v *Server) ListCommunityRealm(ctx context.Context, request *proto.ListRealmRequest) (*proto.ListRealmResponse, error) {
return forwardInvokeRequest(
hyper.ServiceTypeAuthProvider,
func(ctx context.Context, conn *grpc.ClientConn) (*proto.ListRealmResponse, error) {
out, err := proto.NewRealmClient(conn).ListCommunityRealm(ctx, request)
return out, err
},
)
}
func (v *Server) ListAvailableRealm(ctx context.Context, request *proto.LookupUserRealmRequest) (*proto.ListRealmResponse, error) {
return forwardInvokeRequest(
hyper.ServiceTypeAuthProvider,
func(ctx context.Context, conn *grpc.ClientConn) (*proto.ListRealmResponse, error) {
out, err := proto.NewRealmClient(conn).ListAvailableRealm(ctx, request)
return out, err
},
)
}
func (v *Server) ListOwnedRealm(ctx context.Context, request *proto.LookupUserRealmRequest) (*proto.ListRealmResponse, error) {
return forwardInvokeRequest(
hyper.ServiceTypeAuthProvider,
func(ctx context.Context, conn *grpc.ClientConn) (*proto.ListRealmResponse, error) {
out, err := proto.NewRealmClient(conn).ListOwnedRealm(ctx, request)
return out, err
},
)
}
func (v *Server) GetRealm(ctx context.Context, request *proto.LookupRealmRequest) (*proto.RealmInfo, error) {
return forwardInvokeRequest(
hyper.ServiceTypeAuthProvider,
func(ctx context.Context, conn *grpc.ClientConn) (*proto.RealmInfo, error) {
out, err := proto.NewRealmClient(conn).GetRealm(ctx, request)
return out, err
},
)
}
func (v *Server) ListRealmMember(ctx context.Context, request *proto.RealmMemberLookupRequest) (*proto.ListRealmMemberResponse, error) {
return forwardInvokeRequest(
hyper.ServiceTypeAuthProvider,
func(ctx context.Context, conn *grpc.ClientConn) (*proto.ListRealmMemberResponse, error) {
out, err := proto.NewRealmClient(conn).ListRealmMember(ctx, request)
return out, err
},
)
}
func (v *Server) GetRealmMember(ctx context.Context, request *proto.RealmMemberLookupRequest) (*proto.MemberInfo, error) {
return forwardInvokeRequest(
hyper.ServiceTypeAuthProvider,
func(ctx context.Context, conn *grpc.ClientConn) (*proto.MemberInfo, error) {
out, err := proto.NewRealmClient(conn).GetRealmMember(ctx, request)
return out, err
},
)
}
func (v *Server) CheckRealmMemberPerm(ctx context.Context, request *proto.CheckRealmPermRequest) (*proto.CheckRealmPermResponse, error) {
return forwardInvokeRequest(
hyper.ServiceTypeAuthProvider,
func(ctx context.Context, conn *grpc.ClientConn) (*proto.CheckRealmPermResponse, error) {
out, err := proto.NewRealmClient(conn).CheckRealmMemberPerm(ctx, request)
return out, err
},
)
}

View File

@ -2,28 +2,17 @@ package grpc
import (
"context"
"fmt"
"time"
"git.solsynth.dev/hydrogen/dealer/pkg/hyper"
"git.solsynth.dev/hydrogen/dealer/pkg/internal/directory"
"git.solsynth.dev/hydrogen/dealer/pkg/proto"
"google.golang.org/grpc"
)
func (v *Server) RecordEvent(ctx context.Context, request *proto.RecordEventRequest) (*proto.RecordEventResponse, error) {
instance := directory.GetServiceInstance(hyper.ServiceTypeAuthProvider)
if instance == nil {
return &proto.RecordEventResponse{}, fmt.Errorf("no available service %s found", hyper.ServiceTypeAuthProvider)
}
conn, err := instance.GetGrpcConn()
if err != nil {
return nil, fmt.Errorf("service is down: %v", err)
}
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
defer cancel()
out, err := proto.NewEventRecorderClient(conn).RecordEvent(ctx, request)
return out, err
return forwardInvokeRequest(
hyper.ServiceTypeAuthProvider,
func(ctx context.Context, conn *grpc.ClientConn) (*proto.RecordEventResponse, error) {
out, err := proto.NewEventRecorderClient(conn).RecordEvent(ctx, request)
return out, err
},
)
}

View File

@ -17,6 +17,8 @@ type Server struct {
proto.UnimplementedServiceDirectoryServer
proto.UnimplementedStreamControllerServer
proto.UnimplementedEventRecorderServer
proto.UnimplementedNotifierServer
proto.UnimplementedRealmServer
proto.UnimplementedAuthServer
srv *grpc.Server
@ -30,6 +32,8 @@ func NewServer() *Server {
proto.RegisterServiceDirectoryServer(server.srv, server)
proto.RegisterStreamControllerServer(server.srv, server)
proto.RegisterEventRecorderServer(server.srv, server)
proto.RegisterNotifierServer(server.srv, server)
proto.RegisterRealmServer(server.srv, server)
proto.RegisterAuthServer(server.srv, server)
health.RegisterHealthServer(server.srv, server)

322
pkg/proto/notify.pb.go Normal file
View File

@ -0,0 +1,322 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.34.2
// protoc v5.27.1
// 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{}
if protoimpl.UnsafeEnabled {
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 protoimpl.UnsafeEnabled && 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 NotifyRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
Subtitle string `protobuf:"bytes,2,opt,name=subtitle,proto3" json:"subtitle,omitempty"`
Body string `protobuf:"bytes,3,opt,name=body,proto3" json:"body,omitempty"`
}
func (x *NotifyRequest) Reset() {
*x = NotifyRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_notify_proto_msgTypes[1]
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[1]
if protoimpl.UnsafeEnabled && 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{1}
}
func (x *NotifyRequest) GetTitle() string {
if x != nil {
return x.Title
}
return ""
}
func (x *NotifyRequest) GetSubtitle() string {
if x != nil {
return x.Subtitle
}
return ""
}
func (x *NotifyRequest) GetBody() string {
if x != nil {
return x.Body
}
return ""
}
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{}
if protoimpl.UnsafeEnabled {
mi := &file_notify_proto_msgTypes[2]
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[2]
if protoimpl.UnsafeEnabled && 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{2}
}
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, 0x55, 0x0a, 0x0d, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x75, 0x62, 0x74,
0x69, 0x74, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x75, 0x62, 0x74,
0x69, 0x74, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x03, 0x20, 0x01,
0x28, 0x09, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 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, 0x8b, 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, 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, 3)
var file_notify_proto_goTypes = []any{
(*NotifyUserRequest)(nil), // 0: proto.NotifyUserRequest
(*NotifyRequest)(nil), // 1: proto.NotifyRequest
(*NotifyResponse)(nil), // 2: proto.NotifyResponse
}
var file_notify_proto_depIdxs = []int32{
1, // 0: proto.NotifyUserRequest.notify:type_name -> proto.NotifyRequest
0, // 1: proto.Notifier.NotifyUser:input_type -> proto.NotifyUserRequest
1, // 2: proto.Notifier.NotifyAllUser:input_type -> proto.NotifyRequest
2, // 3: proto.Notifier.NotifyUser:output_type -> proto.NotifyResponse
2, // 4: proto.Notifier.NotifyAllUser:output_type -> proto.NotifyResponse
3, // [3:5] is the sub-list for method output_type
1, // [1:3] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] 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
}
if !protoimpl.UnsafeEnabled {
file_notify_proto_msgTypes[0].Exporter = func(v any, i int) any {
switch v := v.(*NotifyUserRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_notify_proto_msgTypes[1].Exporter = func(v any, i int) any {
switch v := v.(*NotifyRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_notify_proto_msgTypes[2].Exporter = func(v any, i int) any {
switch v := v.(*NotifyResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_notify_proto_rawDesc,
NumEnums: 0,
NumMessages: 3,
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
}

26
pkg/proto/notify.proto Normal file
View File

@ -0,0 +1,26 @@
syntax = "proto3";
option go_package = ".;proto";
package proto;
service Notifier {
rpc NotifyUser(NotifyUserRequest) returns (NotifyResponse) {}
rpc NotifyAllUser(NotifyRequest) returns(NotifyResponse) {}
}
message NotifyUserRequest {
uint64 user_id = 1;
NotifyRequest notify = 2;
}
message NotifyRequest {
string title = 1;
string subtitle = 2;
string body = 3;
}
message NotifyResponse {
bool is_success = 1;
int64 affected_count = 2;
}

148
pkg/proto/notify_grpc.pb.go Normal file
View File

@ -0,0 +1,148 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.4.0
// - protoc v5.27.1
// 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.62.0 or later.
const _ = grpc.SupportPackageIsVersion8
const (
Notifier_NotifyUser_FullMethodName = "/proto.Notifier/NotifyUser"
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)
NotifyAllUser(ctx context.Context, in *NotifyRequest, opts ...grpc.CallOption) (*NotifyResponse, error)
}
type notifierClient struct {
cc grpc.ClientConnInterface
}
func NewNotifierClient(cc grpc.ClientConnInterface) NotifierClient {
return &notifierClient{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) 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)
NotifyAllUser(context.Context, *NotifyRequest) (*NotifyResponse, error)
mustEmbedUnimplementedNotifierServer()
}
// UnimplementedNotifierServer must be embedded to have forward compatible implementations.
type UnimplementedNotifierServer struct {
}
func (UnimplementedNotifierServer) NotifyUser(context.Context, *NotifyUserRequest) (*NotifyResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method NotifyUser not implemented")
}
func (UnimplementedNotifierServer) NotifyAllUser(context.Context, *NotifyRequest) (*NotifyResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method NotifyAllUser not implemented")
}
func (UnimplementedNotifierServer) mustEmbedUnimplementedNotifierServer() {}
// 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) {
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_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: "NotifyAllUser",
Handler: _Notifier_NotifyAllUser_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "notify.proto",
}

887
pkg/proto/realm.pb.go Normal file
View File

@ -0,0 +1,887 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.34.2
// protoc v5.27.1
// source: realm.proto
package proto
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
_ "google.golang.org/protobuf/types/known/emptypb"
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"`
IsPublic bool `protobuf:"varint,5,opt,name=is_public,json=isPublic,proto3" json:"is_public,omitempty"`
IsCommunity bool `protobuf:"varint,6,opt,name=is_community,json=isCommunity,proto3" json:"is_community,omitempty"`
}
func (x *RealmInfo) Reset() {
*x = RealmInfo{}
if protoimpl.UnsafeEnabled {
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 protoimpl.UnsafeEnabled && 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) GetIsPublic() bool {
if x != nil {
return x.IsPublic
}
return false
}
func (x *RealmInfo) GetIsCommunity() bool {
if x != nil {
return x.IsCommunity
}
return false
}
type ListRealmRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *ListRealmRequest) Reset() {
*x = ListRealmRequest{}
if protoimpl.UnsafeEnabled {
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 protoimpl.UnsafeEnabled && 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{}
if protoimpl.UnsafeEnabled {
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 protoimpl.UnsafeEnabled && 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{}
if protoimpl.UnsafeEnabled {
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 protoimpl.UnsafeEnabled && 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{}
if protoimpl.UnsafeEnabled {
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 protoimpl.UnsafeEnabled && 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" 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{}
if protoimpl.UnsafeEnabled {
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 protoimpl.UnsafeEnabled && 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 {
return x.RealmId
}
return 0
}
func (x *RealmMemberLookupRequest) GetUserId() uint64 {
if x != nil && x.UserId != nil {
return *x.UserId
}
return 0
}
type MemberInfo 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 *MemberInfo) Reset() {
*x = MemberInfo{}
if protoimpl.UnsafeEnabled {
mi := &file_realm_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *MemberInfo) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MemberInfo) ProtoMessage() {}
func (x *MemberInfo) ProtoReflect() protoreflect.Message {
mi := &file_realm_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use MemberInfo.ProtoReflect.Descriptor instead.
func (*MemberInfo) Descriptor() ([]byte, []int) {
return file_realm_proto_rawDescGZIP(), []int{6}
}
func (x *MemberInfo) GetRealmId() uint64 {
if x != nil {
return x.RealmId
}
return 0
}
func (x *MemberInfo) GetUserId() uint64 {
if x != nil {
return x.UserId
}
return 0
}
func (x *MemberInfo) GetPowerLevel() int32 {
if x != nil {
return x.PowerLevel
}
return 0
}
type ListRealmMemberResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Data []*MemberInfo `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"`
}
func (x *ListRealmMemberResponse) Reset() {
*x = ListRealmMemberResponse{}
if protoimpl.UnsafeEnabled {
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 protoimpl.UnsafeEnabled && 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() []*MemberInfo {
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{}
if protoimpl.UnsafeEnabled {
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 protoimpl.UnsafeEnabled && 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{}
if protoimpl.UnsafeEnabled {
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 protoimpl.UnsafeEnabled && 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, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x22, 0xa7, 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, 0x1b, 0x0a, 0x09, 0x69,
0x73, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x18, 0x05, 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, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b,
0x69, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 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, 0x5f,
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, 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, 0x1c, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64,
0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x48, 0x00, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64,
0x88, 0x01, 0x01, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x22,
0x61, 0x0a, 0x0a, 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, 0x40, 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, 0x25, 0x0a,
0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x2e, 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, 0xa0, 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,
0x46, 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, 0x11, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 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
(*MemberInfo)(nil), // 6: proto.MemberInfo
(*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.MemberInfo
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.MemberInfo
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
}
if !protoimpl.UnsafeEnabled {
file_realm_proto_msgTypes[0].Exporter = func(v any, i int) any {
switch v := v.(*RealmInfo); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_realm_proto_msgTypes[1].Exporter = func(v any, i int) any {
switch v := v.(*ListRealmRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_realm_proto_msgTypes[2].Exporter = func(v any, i int) any {
switch v := v.(*LookupUserRealmRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_realm_proto_msgTypes[3].Exporter = func(v any, i int) any {
switch v := v.(*LookupRealmRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_realm_proto_msgTypes[4].Exporter = func(v any, i int) any {
switch v := v.(*ListRealmResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_realm_proto_msgTypes[5].Exporter = func(v any, i int) any {
switch v := v.(*RealmMemberLookupRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_realm_proto_msgTypes[6].Exporter = func(v any, i int) any {
switch v := v.(*MemberInfo); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_realm_proto_msgTypes[7].Exporter = func(v any, i int) any {
switch v := v.(*ListRealmMemberResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_realm_proto_msgTypes[8].Exporter = func(v any, i int) any {
switch v := v.(*CheckRealmPermRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_realm_proto_msgTypes[9].Exporter = func(v any, i int) any {
switch v := v.(*CheckRealmPermResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
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
}

69
pkg/proto/realm.proto Normal file
View File

@ -0,0 +1,69 @@
syntax = "proto3";
import "google/protobuf/empty.proto";
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 (MemberInfo) {}
rpc CheckRealmMemberPerm(CheckRealmPermRequest) returns (CheckRealmPermResponse) {}
}
message RealmInfo {
uint64 id = 1;
string alias = 2;
string name = 3;
string description = 4;
bool is_public = 5;
bool is_community = 6;
}
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 {
uint64 realm_id = 1;
optional uint64 user_id = 2;
}
message MemberInfo {
uint64 realm_id = 1;
uint64 user_id = 2;
int32 power_level = 3;
}
message ListRealmMemberResponse {
repeated MemberInfo data = 1;
}
message CheckRealmPermRequest {
uint64 realm_id = 1;
uint64 user_id = 2;
int32 power_level = 3;
}
message CheckRealmPermResponse {
bool is_success = 1;
}

338
pkg/proto/realm_grpc.pb.go Normal file
View File

@ -0,0 +1,338 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.4.0
// - protoc v5.27.1
// 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.62.0 or later.
const _ = grpc.SupportPackageIsVersion8
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) (*MemberInfo, 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) (*MemberInfo, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MemberInfo)
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) (*MemberInfo, error)
CheckRealmMemberPerm(context.Context, *CheckRealmPermRequest) (*CheckRealmPermResponse, error)
mustEmbedUnimplementedRealmServer()
}
// UnimplementedRealmServer must be embedded to have forward compatible implementations.
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) (*MemberInfo, 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() {}
// 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) {
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",
}