🧑‍💻 Improve DX by extending authkit

This commit is contained in:
LittleSheep 2024-10-31 21:26:25 +08:00
parent 8326c716e3
commit 39ac016b46
13 changed files with 454 additions and 601 deletions

20
.idea/workspace.xml generated
View File

@ -4,23 +4,19 @@
<option name="autoReloadType" value="ALL" /> <option name="autoReloadType" value="ALL" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":truck: Update package name from Hypdrogen to Hypernet"> <list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":sparkles: Support users related rpc calls">
<change afterPath="$PROJECT_DIR$/pkg/internal/grpc/user.go" afterDir="false" /> <change afterPath="$PROJECT_DIR$/pkg/authkit/audit.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/pkg/authkit/notify.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/go.mod" beforeDir="false" afterPath="$PROJECT_DIR$/go.mod" afterDir="false" /> <change beforePath="$PROJECT_DIR$/pkg/authkit/models/notifications.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/authkit/models/notifications.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/go.sum" beforeDir="false" afterPath="$PROJECT_DIR$/go.sum" afterDir="false" /> <change beforePath="$PROJECT_DIR$/pkg/internal/grpc/notify.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/grpc/notify.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/authkit/models/accounts.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/authkit/models/accounts.go" afterDir="false" /> <change beforePath="$PROJECT_DIR$/pkg/internal/services/notifications.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/notifications.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/internal/grpc/auth.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/grpc/auth.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/internal/grpc/notifier.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/grpc/notify.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/internal/grpc/server.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/grpc/server.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/proto/notify.pb.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/proto/notify.pb.go" afterDir="false" /> <change beforePath="$PROJECT_DIR$/pkg/proto/notify.pb.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/proto/notify.pb.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/proto/notify.proto" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/proto/notify.proto" afterDir="false" /> <change beforePath="$PROJECT_DIR$/pkg/proto/notify.proto" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/proto/notify.proto" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/proto/notify_grpc.pb.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/proto/notify_grpc.pb.go" afterDir="false" /> <change beforePath="$PROJECT_DIR$/pkg/proto/notify_grpc.pb.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/proto/notify_grpc.pb.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/proto/realm.pb.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/proto/realm.pb.go" afterDir="false" /> <change beforePath="$PROJECT_DIR$/pkg/proto/realm.pb.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/proto/realm.pb.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/proto/realm.proto" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/proto/realm.proto" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/proto/realm_grpc.pb.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/proto/realm_grpc.pb.go" afterDir="false" /> <change beforePath="$PROJECT_DIR$/pkg/proto/realm_grpc.pb.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/proto/realm_grpc.pb.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/proto/record.pb.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/proto/record.pb.go" afterDir="false" /> <change beforePath="$PROJECT_DIR$/pkg/proto/record.pb.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/proto/record.pb.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/proto/record.proto" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/proto/record.proto" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/proto/record_grpc.pb.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/proto/record_grpc.pb.go" afterDir="false" /> <change beforePath="$PROJECT_DIR$/pkg/proto/record_grpc.pb.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/proto/record_grpc.pb.go" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
@ -169,7 +165,6 @@
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" /> <option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
<MESSAGE value=":bug: Trying to prevent send same notification to the same user in batch" />
<MESSAGE value=":sparkles: Allow user view and remove notification subscriptions" /> <MESSAGE value=":sparkles: Allow user view and remove notification subscriptions" />
<MESSAGE value=":recycle: Improve notifications mark read system" /> <MESSAGE value=":recycle: Improve notifications mark read system" />
<MESSAGE value=":bug: Bug fixes on multi-factors based authentication" /> <MESSAGE value=":bug: Bug fixes on multi-factors based authentication" />
@ -194,7 +189,8 @@
<MESSAGE value="Revert &quot;:recycle: Move models.Account to sec.UserInfo&quot;&#10;&#10;This reverts commit 8fbb7960" /> <MESSAGE value="Revert &quot;:recycle: Move models.Account to sec.UserInfo&quot;&#10;&#10;This reverts commit 8fbb7960" />
<MESSAGE value=":rewind: Revert &quot;:recycle: Move models.Account to sec.UserInfo&quot; for a better solution&#10;&#10;This reverts commit 8fbb7960" /> <MESSAGE value=":rewind: Revert &quot;:recycle: Move models.Account to sec.UserInfo&quot; for a better solution&#10;&#10;This reverts commit 8fbb7960" />
<MESSAGE value=":truck: Update package name from Hypdrogen to Hypernet" /> <MESSAGE value=":truck: Update package name from Hypdrogen to Hypernet" />
<option name="LAST_COMMIT_MESSAGE" value=":truck: Update package name from Hypdrogen to Hypernet" /> <MESSAGE value=":sparkles: Support users related rpc calls" />
<option name="LAST_COMMIT_MESSAGE" value=":sparkles: Support users related rpc calls" />
<option name="GROUP_MULTIFILE_MERGE_BY_DIRECTORY" value="true" /> <option name="GROUP_MULTIFILE_MERGE_BY_DIRECTORY" value="true" />
</component> </component>
<component name="VgoProject"> <component name="VgoProject">

44
pkg/authkit/audit.go Normal file
View File

@ -0,0 +1,44 @@
package authkit
import (
"fmt"
"git.solsynth.dev/hypernet/nexus/pkg/nex"
"git.solsynth.dev/hypernet/nexus/pkg/nex/sec"
"git.solsynth.dev/hypernet/passport/pkg/proto"
"github.com/gofiber/fiber/v2"
)
func AddEvent(nx *nex.Conn, userId uint, action, target, ip, ua string) error {
conn, err := nx.GetClientGrpcConn(nex.ServiceTypeAuth)
if err != nil {
return fmt.Errorf("failed to get auth service client: %v", err)
}
_, err = proto.NewAuditServiceClient(conn).RecordEvent(nil, &proto.RecordEventRequest{
UserId: uint64(userId),
Action: action,
Target: target,
Ip: ip,
UserAgent: ua,
})
return err
}
func AddEventExt(nx *nex.Conn, action, target string, c *fiber.Ctx) error {
user, ok := c.Locals("nex_user").(*sec.UserInfo)
if !ok {
return fmt.Errorf("failed to get user info, make sure you call this method behind the ContextMiddleware")
}
conn, err := nx.GetClientGrpcConn(nex.ServiceTypeAuth)
if err != nil {
return fmt.Errorf("failed to get auth service client: %v", err)
}
_, err = proto.NewAuditServiceClient(conn).RecordEvent(nil, &proto.RecordEventRequest{
UserId: uint64(user.ID),
Action: action,
Target: target,
Ip: c.IP(),
UserAgent: c.Get(fiber.HeaderUserAgent),
})
return err
}

View File

@ -1,6 +1,7 @@
package models package models
import ( import (
"git.solsynth.dev/hypernet/pusher/pkg/pushkit"
"gorm.io/datatypes" "gorm.io/datatypes"
"time" "time"
) )
@ -20,8 +21,29 @@ type Notification struct {
AccountID uint `json:"account_id"` AccountID uint `json:"account_id"`
ReadAt *time.Time `json:"read_at"` ReadAt *time.Time `json:"read_at"`
}
IsRealtime bool `json:"is_realtime" gorm:"-"` func (v Notification) EncodeToPushkit() pushkit.Notification {
return pushkit.Notification{
Topic: v.Topic,
Title: v.Title,
Subtitle: v.Subtitle,
Body: v.Body,
Metadata: v.Metadata,
Priority: v.Priority,
}
}
func NewNotificationFromPushkit(pk pushkit.Notification) Notification {
return Notification{
Topic: pk.Topic,
Title: pk.Title,
Subtitle: pk.Subtitle,
Body: pk.Body,
Metadata: pk.Metadata,
Priority: pk.Priority,
SenderID: nil,
}
} }
const ( const (

47
pkg/authkit/notify.go Normal file
View File

@ -0,0 +1,47 @@
package authkit
import (
"fmt"
"git.solsynth.dev/hypernet/nexus/pkg/nex"
"git.solsynth.dev/hypernet/passport/pkg/proto"
"git.solsynth.dev/hypernet/pusher/pkg/pushkit"
"github.com/goccy/go-json"
)
func NotifyUser(nx *nex.Conn, userId uint64, notify pushkit.Notification, unsaved ...bool) error {
conn, err := nx.GetClientGrpcConn(nex.ServiceTypeAuth)
if err != nil {
return fmt.Errorf("failed to get auth service client: %v", err)
}
raw, _ := json.Marshal(notify)
if len(unsaved) == 0 {
unsaved = append(unsaved, false)
}
_, err = proto.NewNotifyServiceClient(conn).NotifyUser(nil, &proto.NotifyUserRequest{
UserId: userId,
Notify: &proto.NotifyInfo{
Unsaved: unsaved[0],
Data: raw,
},
})
return err
}
func NotifyUserBatch(nx *nex.Conn, userId []uint64, notify pushkit.Notification, unsaved ...bool) error {
conn, err := nx.GetClientGrpcConn(nex.ServiceTypeAuth)
if err != nil {
return fmt.Errorf("failed to get auth service client: %v", err)
}
raw, _ := json.Marshal(notify)
if len(unsaved) == 0 {
unsaved = append(unsaved, false)
}
_, err = proto.NewNotifyServiceClient(conn).NotifyUserBatch(nil, &proto.NotifyUserBatchRequest{
UserId: userId,
Notify: &proto.NotifyInfo{
Unsaved: unsaved[0],
Data: raw,
},
})
return err
}

View File

@ -3,8 +3,9 @@ package grpc
import ( import (
"context" "context"
"fmt" "fmt"
"git.solsynth.dev/hypernet/nexus/pkg/nex"
"git.solsynth.dev/hypernet/passport/pkg/authkit/models" "git.solsynth.dev/hypernet/passport/pkg/authkit/models"
"git.solsynth.dev/hypernet/pusher/pkg/pushkit"
"github.com/goccy/go-json"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"git.solsynth.dev/hypernet/passport/pkg/internal/database" "git.solsynth.dev/hypernet/passport/pkg/internal/database"
@ -21,23 +22,18 @@ func (v *App) NotifyUser(_ context.Context, in *proto.NotifyUserRequest) (*proto
return nil, fmt.Errorf("unable to get account: %v", err) return nil, fmt.Errorf("unable to get account: %v", err)
} }
metadata := nex.DecodeMap(in.GetNotify().GetMetadata()) var nty pushkit.Notification
if err = json.Unmarshal(in.GetNotify().GetData(), &nty); err != nil {
notification := models.Notification{ return nil, fmt.Errorf("unable to unmarshal notification: %v", err)
Topic: in.GetNotify().GetTopic(),
Title: in.GetNotify().GetTitle(),
Subtitle: in.GetNotify().GetSubtitle(),
Body: in.GetNotify().GetBody(),
Metadata: metadata,
Priority: int(in.GetNotify().GetPriority()),
IsRealtime: in.GetNotify().GetIsRealtime(),
Account: user,
AccountID: user.ID,
} }
notification := models.NewNotificationFromPushkit(nty)
notification.Account = user
notification.AccountID = user.ID
log.Debug().Str("topic", notification.Topic).Uint("uid", notification.AccountID).Msg("Notifying user...") log.Debug().Str("topic", notification.Topic).Uint("uid", notification.AccountID).Msg("Notifying user...")
if notification.IsRealtime { if in.GetNotify().GetUnsaved() {
if err := services.PushNotification(notification); err != nil { if err := services.PushNotification(notification); err != nil {
return nil, err return nil, err
} }
@ -61,7 +57,10 @@ func (v *App) NotifyUserBatch(_ context.Context, in *proto.NotifyUserBatchReques
return nil, fmt.Errorf("unable to get account: %v", err) return nil, fmt.Errorf("unable to get account: %v", err)
} }
metadata := nex.DecodeMap(in.GetNotify().GetMetadata()) var nty pushkit.Notification
if err = json.Unmarshal(in.GetNotify().GetData(), &nty); err != nil {
return nil, fmt.Errorf("unable to unmarshal notification: %v", err)
}
var checklist = make(map[uint]bool, len(users)) var checklist = make(map[uint]bool, len(users))
var notifications []models.Notification var notifications []models.Notification
@ -70,17 +69,9 @@ func (v *App) NotifyUserBatch(_ context.Context, in *proto.NotifyUserBatchReques
continue continue
} }
notification := models.Notification{ notification := models.NewNotificationFromPushkit(nty)
Topic: in.GetNotify().GetTopic(), notification.Account = user
Title: in.GetNotify().GetTitle(), notification.AccountID = user.ID
Subtitle: in.GetNotify().GetSubtitle(),
Body: in.GetNotify().GetBody(),
Metadata: metadata,
Priority: int(in.GetNotify().GetPriority()),
IsRealtime: in.GetNotify().GetIsRealtime(),
Account: user,
AccountID: user.ID,
}
checklist[user.ID] = true checklist[user.ID] = true
notifications = append(notifications, notification) notifications = append(notifications, notification)
@ -88,7 +79,7 @@ func (v *App) NotifyUserBatch(_ context.Context, in *proto.NotifyUserBatchReques
log.Debug().Str("topic", notifications[0].Topic).Any("uid", lo.Keys(checklist)).Msg("Notifying users...") log.Debug().Str("topic", notifications[0].Topic).Any("uid", lo.Keys(checklist)).Msg("Notifying users...")
if in.GetNotify().GetIsRealtime() { if in.GetNotify().GetUnsaved() {
services.PushNotificationBatch(notifications) services.PushNotificationBatch(notifications)
} else { } else {
if err := services.NewNotificationBatch(notifications); err != nil { if err := services.NewNotificationBatch(notifications); err != nil {
@ -101,13 +92,16 @@ func (v *App) NotifyUserBatch(_ context.Context, in *proto.NotifyUserBatchReques
}, nil }, nil
} }
func (v *App) NotifyAllUser(_ context.Context, in *proto.NotifyRequest) (*proto.NotifyResponse, error) { func (v *App) NotifyAllUser(_ context.Context, in *proto.NotifyInfo) (*proto.NotifyResponse, error) {
var users []models.Account var users []models.Account
if err := database.C.Find(&users).Error; err != nil { if err := database.C.Find(&users).Error; err != nil {
return nil, fmt.Errorf("unable to get account: %v", err) return nil, fmt.Errorf("unable to get account: %v", err)
} }
metadata := nex.DecodeMap(in.GetMetadata()) var nty pushkit.Notification
if err := json.Unmarshal(in.GetData(), &nty); err != nil {
return nil, fmt.Errorf("unable to unmarshal notification: %v", err)
}
var checklist = make(map[uint]bool, len(users)) var checklist = make(map[uint]bool, len(users))
var notifications []models.Notification var notifications []models.Notification
@ -116,17 +110,9 @@ func (v *App) NotifyAllUser(_ context.Context, in *proto.NotifyRequest) (*proto.
continue continue
} }
notification := models.Notification{ notification := models.NewNotificationFromPushkit(nty)
Topic: in.GetTopic(), notification.Account = user
Title: in.GetTitle(), notification.AccountID = user.ID
Subtitle: in.GetSubtitle(),
Body: in.GetBody(),
Metadata: metadata,
Priority: int(in.GetPriority()),
IsRealtime: in.GetIsRealtime(),
Account: user,
AccountID: user.ID,
}
checklist[user.ID] = true checklist[user.ID] = true
notifications = append(notifications, notification) notifications = append(notifications, notification)
@ -134,7 +120,7 @@ func (v *App) NotifyAllUser(_ context.Context, in *proto.NotifyRequest) (*proto.
log.Debug().Str("topic", notifications[0].Topic).Any("uid", lo.Keys(checklist)).Msg("Notifying users...") log.Debug().Str("topic", notifications[0].Topic).Any("uid", lo.Keys(checklist)).Msg("Notifying users...")
if in.GetIsRealtime() { if in.GetUnsaved() {
services.PushNotificationBatch(notifications) services.PushNotificationBatch(notifications)
} else { } else {
if err := services.NewNotificationBatch(notifications); err != nil { if err := services.NewNotificationBatch(notifications); err != nil {

View File

@ -134,13 +134,7 @@ func PushNotification(notification models.Notification, skipNotifiableCheck ...b
err = gap.Px.PushNotifyBatch(pushkit.NotificationPushBatchRequest{ err = gap.Px.PushNotifyBatch(pushkit.NotificationPushBatchRequest{
Providers: providers, Providers: providers,
Tokens: tokens, Tokens: tokens,
Notification: pushkit.Notification{ Notification: notification.EncodeToPushkit(),
Topic: notification.Topic,
Title: notification.Title,
Subtitle: notification.Subtitle,
Body: notification.Body,
Metadata: notification.Metadata,
},
}) })
return err return err
@ -210,13 +204,7 @@ func PushNotificationBatch(notifications []models.Notification, skipNotifiableCh
_ = gap.Px.PushNotifyBatch(pushkit.NotificationPushBatchRequest{ _ = gap.Px.PushNotifyBatch(pushkit.NotificationPushBatchRequest{
Providers: providers, Providers: providers,
Tokens: tokens, Tokens: tokens,
Notification: pushkit.Notification{ Notification: notification.EncodeToPushkit(),
Topic: notification.Topic,
Title: notification.Title,
Subtitle: notification.Subtitle,
Body: notification.Body,
Metadata: notification.Metadata,
},
}) })
cancel() cancel()
} }

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.28.1 // protoc-gen-go v1.35.1
// protoc v5.28.2 // protoc v5.28.2
// source: notify.proto // source: notify.proto
@ -20,22 +20,75 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
) )
type NotifyInfo struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// This bytes is directly encoded from pushkit.Notification
// Which is passed to the pusher service, we don't need to care about the content
Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
Unsaved bool `protobuf:"varint,2,opt,name=unsaved,proto3" json:"unsaved,omitempty"`
}
func (x *NotifyInfo) Reset() {
*x = NotifyInfo{}
mi := &file_notify_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *NotifyInfo) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*NotifyInfo) ProtoMessage() {}
func (x *NotifyInfo) 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 NotifyInfo.ProtoReflect.Descriptor instead.
func (*NotifyInfo) Descriptor() ([]byte, []int) {
return file_notify_proto_rawDescGZIP(), []int{0}
}
func (x *NotifyInfo) GetData() []byte {
if x != nil {
return x.Data
}
return nil
}
func (x *NotifyInfo) GetUnsaved() bool {
if x != nil {
return x.Unsaved
}
return false
}
type NotifyUserRequest struct { type NotifyUserRequest struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
UserId uint64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` 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"` Notify *NotifyInfo `protobuf:"bytes,2,opt,name=notify,proto3" json:"notify,omitempty"`
} }
func (x *NotifyUserRequest) Reset() { func (x *NotifyUserRequest) Reset() {
*x = NotifyUserRequest{} *x = NotifyUserRequest{}
if protoimpl.UnsafeEnabled { mi := &file_notify_proto_msgTypes[1]
mi := &file_notify_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
}
} }
func (x *NotifyUserRequest) String() string { func (x *NotifyUserRequest) String() string {
@ -45,8 +98,8 @@ func (x *NotifyUserRequest) String() string {
func (*NotifyUserRequest) ProtoMessage() {} func (*NotifyUserRequest) ProtoMessage() {}
func (x *NotifyUserRequest) ProtoReflect() protoreflect.Message { func (x *NotifyUserRequest) ProtoReflect() protoreflect.Message {
mi := &file_notify_proto_msgTypes[0] mi := &file_notify_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -58,7 +111,7 @@ func (x *NotifyUserRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use NotifyUserRequest.ProtoReflect.Descriptor instead. // Deprecated: Use NotifyUserRequest.ProtoReflect.Descriptor instead.
func (*NotifyUserRequest) Descriptor() ([]byte, []int) { func (*NotifyUserRequest) Descriptor() ([]byte, []int) {
return file_notify_proto_rawDescGZIP(), []int{0} return file_notify_proto_rawDescGZIP(), []int{1}
} }
func (x *NotifyUserRequest) GetUserId() uint64 { func (x *NotifyUserRequest) GetUserId() uint64 {
@ -68,7 +121,7 @@ func (x *NotifyUserRequest) GetUserId() uint64 {
return 0 return 0
} }
func (x *NotifyUserRequest) GetNotify() *NotifyRequest { func (x *NotifyUserRequest) GetNotify() *NotifyInfo {
if x != nil { if x != nil {
return x.Notify return x.Notify
} }
@ -81,16 +134,14 @@ type NotifyUserBatchRequest struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
UserId []uint64 `protobuf:"varint,1,rep,packed,name=user_id,json=userId,proto3" json:"user_id,omitempty"` 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"` Notify *NotifyInfo `protobuf:"bytes,2,opt,name=notify,proto3" json:"notify,omitempty"`
} }
func (x *NotifyUserBatchRequest) Reset() { func (x *NotifyUserBatchRequest) Reset() {
*x = NotifyUserBatchRequest{} *x = NotifyUserBatchRequest{}
if protoimpl.UnsafeEnabled { mi := &file_notify_proto_msgTypes[2]
mi := &file_notify_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
}
} }
func (x *NotifyUserBatchRequest) String() string { func (x *NotifyUserBatchRequest) String() string {
@ -100,8 +151,8 @@ func (x *NotifyUserBatchRequest) String() string {
func (*NotifyUserBatchRequest) ProtoMessage() {} func (*NotifyUserBatchRequest) ProtoMessage() {}
func (x *NotifyUserBatchRequest) ProtoReflect() protoreflect.Message { func (x *NotifyUserBatchRequest) ProtoReflect() protoreflect.Message {
mi := &file_notify_proto_msgTypes[1] mi := &file_notify_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -113,7 +164,7 @@ func (x *NotifyUserBatchRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use NotifyUserBatchRequest.ProtoReflect.Descriptor instead. // Deprecated: Use NotifyUserBatchRequest.ProtoReflect.Descriptor instead.
func (*NotifyUserBatchRequest) Descriptor() ([]byte, []int) { func (*NotifyUserBatchRequest) Descriptor() ([]byte, []int) {
return file_notify_proto_rawDescGZIP(), []int{1} return file_notify_proto_rawDescGZIP(), []int{2}
} }
func (x *NotifyUserBatchRequest) GetUserId() []uint64 { func (x *NotifyUserBatchRequest) GetUserId() []uint64 {
@ -123,124 +174,26 @@ func (x *NotifyUserBatchRequest) GetUserId() []uint64 {
return nil return nil
} }
func (x *NotifyUserBatchRequest) GetNotify() *NotifyRequest { func (x *NotifyUserBatchRequest) GetNotify() *NotifyInfo {
if x != nil { if x != nil {
return x.Notify return x.Notify
} }
return nil 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"`
Priority int64 `protobuf:"varint,6,opt,name=priority,proto3" json:"priority,omitempty"`
IsRealtime bool `protobuf:"varint,8,opt,name=is_realtime,json=isRealtime,proto3" json:"is_realtime,omitempty"`
}
func (x *NotifyRequest) Reset() {
*x = NotifyRequest{}
if protoimpl.UnsafeEnabled {
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 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{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) GetPriority() int64 {
if x != nil {
return x.Priority
}
return 0
}
func (x *NotifyRequest) GetIsRealtime() bool {
if x != nil {
return x.IsRealtime
}
return false
}
type NotifyResponse struct { type NotifyResponse struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
IsSuccess bool `protobuf:"varint,1,opt,name=is_success,json=isSuccess,proto3" json:"is_success,omitempty"` 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() { func (x *NotifyResponse) Reset() {
*x = NotifyResponse{} *x = NotifyResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_notify_proto_msgTypes[3] mi := &file_notify_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
}
} }
func (x *NotifyResponse) String() string { func (x *NotifyResponse) String() string {
@ -251,7 +204,7 @@ func (*NotifyResponse) ProtoMessage() {}
func (x *NotifyResponse) ProtoReflect() protoreflect.Message { func (x *NotifyResponse) ProtoReflect() protoreflect.Message {
mi := &file_notify_proto_msgTypes[3] mi := &file_notify_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -273,64 +226,44 @@ func (x *NotifyResponse) GetIsSuccess() bool {
return false 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 protoreflect.FileDescriptor
var file_notify_proto_rawDesc = []byte{ var file_notify_proto_rawDesc = []byte{
0x0a, 0x0c, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 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, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3a, 0x0a, 0x0a, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x49,
0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28,
0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x75, 0x73, 0x65, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x75, 0x6e, 0x73, 0x61, 0x76,
0x72, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x06, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x18, 0x02, 0x20, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x75, 0x6e, 0x73, 0x61, 0x76, 0x65,
0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x64, 0x22, 0x57, 0x0a, 0x11, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x55, 0x73, 0x65, 0x72, 0x52,
0x66, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x06, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69,
0x79, 0x22, 0x5f, 0x0a, 0x16, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x55, 0x73, 0x65, 0x72, 0x42, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12,
0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x29, 0x0a, 0x06, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28, 0x04, 0x52, 0x06, 0x75, 0x73, 0x11, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x49, 0x6e,
0x65, 0x72, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x06, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x18, 0x02, 0x66, 0x6f, 0x52, 0x06, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x22, 0x5c, 0x0a, 0x16, 0x4e, 0x6f,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4e, 0x6f, 0x74, 0x74, 0x69, 0x66, 0x79, 0x55, 0x73, 0x65, 0x72, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71,
0x69, 0x66, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x06, 0x6e, 0x6f, 0x74, 0x69, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18,
0x66, 0x79, 0x22, 0xd6, 0x01, 0x0a, 0x0d, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x52, 0x65, 0x71, 0x01, 0x20, 0x03, 0x28, 0x04, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x29, 0x0a,
0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x01, 0x20, 0x06, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e,
0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x49, 0x6e, 0x66, 0x6f,
0x74, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x52, 0x06, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x22, 0x2f, 0x0a, 0x0e, 0x4e, 0x6f, 0x74, 0x69,
0x12, 0x1f, 0x0a, 0x08, 0x73, 0x75, 0x62, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x66, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x73,
0x28, 0x09, 0x48, 0x00, 0x52, 0x08, 0x73, 0x75, 0x62, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x88, 0x01, 0x5f, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09,
0x01, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x69, 0x73, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x32, 0xd8, 0x01, 0x0a, 0x0d, 0x4e, 0x6f,
0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x74, 0x69, 0x66, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3f, 0x0a, 0x0a, 0x4e,
0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x55, 0x73, 0x65, 0x72, 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x61, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x06, 0x20, 0x6f, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75,
0x01, 0x28, 0x03, 0x52, 0x08, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x1f, 0x0a, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4e, 0x6f, 0x74, 0x69,
0x0b, 0x69, 0x73, 0x5f, 0x72, 0x65, 0x61, 0x6c, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x66, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x49, 0x0a, 0x0f,
0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x52, 0x65, 0x61, 0x6c, 0x74, 0x69, 0x6d, 0x65, 0x42, 0x0b, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x55, 0x73, 0x65, 0x72, 0x42, 0x61, 0x74, 0x63, 0x68, 0x12,
0x0a, 0x09, 0x5f, 0x73, 0x75, 0x62, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x22, 0x56, 0x0a, 0x0e, 0x4e, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x55, 0x73,
0x6f, 0x74, 0x69, 0x66, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x65, 0x72, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15,
0x0a, 0x69, 0x73, 0x5f, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x52, 0x65, 0x73,
0x08, 0x52, 0x09, 0x69, 0x73, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3b, 0x0a, 0x0d, 0x4e, 0x6f, 0x74, 0x69, 0x66,
0x61, 0x66, 0x66, 0x65, 0x63, 0x74, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x79, 0x41, 0x6c, 0x6c, 0x55, 0x73, 0x65, 0x72, 0x12, 0x11, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x61, 0x66, 0x66, 0x65, 0x63, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x1a, 0x15, 0x2e, 0x70, 0x72,
0x75, 0x6e, 0x74, 0x32, 0xdb, 0x01, 0x0a, 0x0d, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x53, 0x65, 0x6f, 0x74, 0x6f, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3f, 0x0a, 0x0a, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x55, 0x73, 0x65, 0x22, 0x00, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
0x73, 0x65, 0x72, 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
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 ( var (
@ -346,18 +279,18 @@ func file_notify_proto_rawDescGZIP() []byte {
} }
var file_notify_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_notify_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_notify_proto_goTypes = []interface{}{ var file_notify_proto_goTypes = []any{
(*NotifyUserRequest)(nil), // 0: proto.NotifyUserRequest (*NotifyInfo)(nil), // 0: proto.NotifyInfo
(*NotifyUserBatchRequest)(nil), // 1: proto.NotifyUserBatchRequest (*NotifyUserRequest)(nil), // 1: proto.NotifyUserRequest
(*NotifyRequest)(nil), // 2: proto.NotifyRequest (*NotifyUserBatchRequest)(nil), // 2: proto.NotifyUserBatchRequest
(*NotifyResponse)(nil), // 3: proto.NotifyResponse (*NotifyResponse)(nil), // 3: proto.NotifyResponse
} }
var file_notify_proto_depIdxs = []int32{ var file_notify_proto_depIdxs = []int32{
2, // 0: proto.NotifyUserRequest.notify:type_name -> proto.NotifyRequest 0, // 0: proto.NotifyUserRequest.notify:type_name -> proto.NotifyInfo
2, // 1: proto.NotifyUserBatchRequest.notify:type_name -> proto.NotifyRequest 0, // 1: proto.NotifyUserBatchRequest.notify:type_name -> proto.NotifyInfo
0, // 2: proto.NotifyService.NotifyUser:input_type -> proto.NotifyUserRequest 1, // 2: proto.NotifyService.NotifyUser:input_type -> proto.NotifyUserRequest
1, // 3: proto.NotifyService.NotifyUserBatch:input_type -> proto.NotifyUserBatchRequest 2, // 3: proto.NotifyService.NotifyUserBatch:input_type -> proto.NotifyUserBatchRequest
2, // 4: proto.NotifyService.NotifyAllUser:input_type -> proto.NotifyRequest 0, // 4: proto.NotifyService.NotifyAllUser:input_type -> proto.NotifyInfo
3, // 5: proto.NotifyService.NotifyUser:output_type -> proto.NotifyResponse 3, // 5: proto.NotifyService.NotifyUser:output_type -> proto.NotifyResponse
3, // 6: proto.NotifyService.NotifyUserBatch:output_type -> proto.NotifyResponse 3, // 6: proto.NotifyService.NotifyUserBatch:output_type -> proto.NotifyResponse
3, // 7: proto.NotifyService.NotifyAllUser:output_type -> proto.NotifyResponse 3, // 7: proto.NotifyService.NotifyAllUser:output_type -> proto.NotifyResponse
@ -373,57 +306,6 @@ func file_notify_proto_init() {
if File_notify_proto != nil { if File_notify_proto != nil {
return return
} }
if !protoimpl.UnsafeEnabled {
file_notify_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
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 interface{}, i int) interface{} {
switch v := v.(*NotifyUserBatchRequest); 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 interface{}, i int) interface{} {
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[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*NotifyResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
file_notify_proto_msgTypes[2].OneofWrappers = []interface{}{}
type x struct{} type x struct{}
out := protoimpl.TypeBuilder{ out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{ File: protoimpl.DescBuilder{

View File

@ -7,30 +7,26 @@ package proto;
service NotifyService { service NotifyService {
rpc NotifyUser(NotifyUserRequest) returns (NotifyResponse) {} rpc NotifyUser(NotifyUserRequest) returns (NotifyResponse) {}
rpc NotifyUserBatch(NotifyUserBatchRequest) returns (NotifyResponse) {} rpc NotifyUserBatch(NotifyUserBatchRequest) returns (NotifyResponse) {}
rpc NotifyAllUser(NotifyRequest) returns(NotifyResponse) {} rpc NotifyAllUser(NotifyInfo) returns(NotifyResponse) {}
}
message NotifyInfo {
// This bytes is directly encoded from pushkit.Notification
// Which is passed to the pusher service, we don't need to care about the content
bytes data = 1;
bool unsaved = 2;
} }
message NotifyUserRequest { message NotifyUserRequest {
uint64 user_id = 1; uint64 user_id = 1;
NotifyRequest notify = 2; NotifyInfo notify = 2;
} }
message NotifyUserBatchRequest { message NotifyUserBatchRequest {
repeated uint64 user_id = 1; repeated uint64 user_id = 1;
NotifyRequest notify = 2; NotifyInfo notify = 2;
}
message NotifyRequest {
string topic = 1;
string title = 2;
optional string subtitle = 3;
string body = 4;
bytes metadata = 5;
int64 priority = 6;
bool is_realtime = 8;
} }
message NotifyResponse { message NotifyResponse {
bool is_success = 1; bool is_success = 1;
int64 affected_count = 2;
} }

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions: // versions:
// - protoc-gen-go-grpc v1.2.0 // - protoc-gen-go-grpc v1.5.1
// - protoc v5.28.2 // - protoc v5.28.2
// source: notify.proto // source: notify.proto
@ -15,8 +15,14 @@ import (
// This is a compile-time assertion to ensure that this generated file // This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against. // is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later. // Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion7 const _ = grpc.SupportPackageIsVersion9
const (
NotifyService_NotifyUser_FullMethodName = "/proto.NotifyService/NotifyUser"
NotifyService_NotifyUserBatch_FullMethodName = "/proto.NotifyService/NotifyUserBatch"
NotifyService_NotifyAllUser_FullMethodName = "/proto.NotifyService/NotifyAllUser"
)
// NotifyServiceClient is the client API for NotifyService service. // NotifyServiceClient is the client API for NotifyService service.
// //
@ -24,7 +30,7 @@ const _ = grpc.SupportPackageIsVersion7
type NotifyServiceClient interface { type NotifyServiceClient interface {
NotifyUser(ctx context.Context, in *NotifyUserRequest, opts ...grpc.CallOption) (*NotifyResponse, error) NotifyUser(ctx context.Context, in *NotifyUserRequest, opts ...grpc.CallOption) (*NotifyResponse, error)
NotifyUserBatch(ctx context.Context, in *NotifyUserBatchRequest, 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) NotifyAllUser(ctx context.Context, in *NotifyInfo, opts ...grpc.CallOption) (*NotifyResponse, error)
} }
type notifyServiceClient struct { type notifyServiceClient struct {
@ -36,8 +42,9 @@ func NewNotifyServiceClient(cc grpc.ClientConnInterface) NotifyServiceClient {
} }
func (c *notifyServiceClient) NotifyUser(ctx context.Context, in *NotifyUserRequest, opts ...grpc.CallOption) (*NotifyResponse, error) { func (c *notifyServiceClient) NotifyUser(ctx context.Context, in *NotifyUserRequest, opts ...grpc.CallOption) (*NotifyResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(NotifyResponse) out := new(NotifyResponse)
err := c.cc.Invoke(ctx, "/proto.NotifyService/NotifyUser", in, out, opts...) err := c.cc.Invoke(ctx, NotifyService_NotifyUser_FullMethodName, in, out, cOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -45,17 +52,19 @@ func (c *notifyServiceClient) NotifyUser(ctx context.Context, in *NotifyUserRequ
} }
func (c *notifyServiceClient) NotifyUserBatch(ctx context.Context, in *NotifyUserBatchRequest, opts ...grpc.CallOption) (*NotifyResponse, error) { func (c *notifyServiceClient) NotifyUserBatch(ctx context.Context, in *NotifyUserBatchRequest, opts ...grpc.CallOption) (*NotifyResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(NotifyResponse) out := new(NotifyResponse)
err := c.cc.Invoke(ctx, "/proto.NotifyService/NotifyUserBatch", in, out, opts...) err := c.cc.Invoke(ctx, NotifyService_NotifyUserBatch_FullMethodName, in, out, cOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return out, nil return out, nil
} }
func (c *notifyServiceClient) NotifyAllUser(ctx context.Context, in *NotifyRequest, opts ...grpc.CallOption) (*NotifyResponse, error) { func (c *notifyServiceClient) NotifyAllUser(ctx context.Context, in *NotifyInfo, opts ...grpc.CallOption) (*NotifyResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(NotifyResponse) out := new(NotifyResponse)
err := c.cc.Invoke(ctx, "/proto.NotifyService/NotifyAllUser", in, out, opts...) err := c.cc.Invoke(ctx, NotifyService_NotifyAllUser_FullMethodName, in, out, cOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -64,17 +73,20 @@ func (c *notifyServiceClient) NotifyAllUser(ctx context.Context, in *NotifyReque
// NotifyServiceServer is the server API for NotifyService service. // NotifyServiceServer is the server API for NotifyService service.
// All implementations must embed UnimplementedNotifyServiceServer // All implementations must embed UnimplementedNotifyServiceServer
// for forward compatibility // for forward compatibility.
type NotifyServiceServer interface { type NotifyServiceServer interface {
NotifyUser(context.Context, *NotifyUserRequest) (*NotifyResponse, error) NotifyUser(context.Context, *NotifyUserRequest) (*NotifyResponse, error)
NotifyUserBatch(context.Context, *NotifyUserBatchRequest) (*NotifyResponse, error) NotifyUserBatch(context.Context, *NotifyUserBatchRequest) (*NotifyResponse, error)
NotifyAllUser(context.Context, *NotifyRequest) (*NotifyResponse, error) NotifyAllUser(context.Context, *NotifyInfo) (*NotifyResponse, error)
mustEmbedUnimplementedNotifyServiceServer() mustEmbedUnimplementedNotifyServiceServer()
} }
// UnimplementedNotifyServiceServer must be embedded to have forward compatible implementations. // UnimplementedNotifyServiceServer must be embedded to have
type UnimplementedNotifyServiceServer struct { // forward compatible implementations.
} //
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedNotifyServiceServer struct{}
func (UnimplementedNotifyServiceServer) NotifyUser(context.Context, *NotifyUserRequest) (*NotifyResponse, error) { func (UnimplementedNotifyServiceServer) NotifyUser(context.Context, *NotifyUserRequest) (*NotifyResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method NotifyUser not implemented") return nil, status.Errorf(codes.Unimplemented, "method NotifyUser not implemented")
@ -82,10 +94,11 @@ func (UnimplementedNotifyServiceServer) NotifyUser(context.Context, *NotifyUserR
func (UnimplementedNotifyServiceServer) NotifyUserBatch(context.Context, *NotifyUserBatchRequest) (*NotifyResponse, error) { func (UnimplementedNotifyServiceServer) NotifyUserBatch(context.Context, *NotifyUserBatchRequest) (*NotifyResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method NotifyUserBatch not implemented") return nil, status.Errorf(codes.Unimplemented, "method NotifyUserBatch not implemented")
} }
func (UnimplementedNotifyServiceServer) NotifyAllUser(context.Context, *NotifyRequest) (*NotifyResponse, error) { func (UnimplementedNotifyServiceServer) NotifyAllUser(context.Context, *NotifyInfo) (*NotifyResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method NotifyAllUser not implemented") return nil, status.Errorf(codes.Unimplemented, "method NotifyAllUser not implemented")
} }
func (UnimplementedNotifyServiceServer) mustEmbedUnimplementedNotifyServiceServer() {} func (UnimplementedNotifyServiceServer) mustEmbedUnimplementedNotifyServiceServer() {}
func (UnimplementedNotifyServiceServer) testEmbeddedByValue() {}
// UnsafeNotifyServiceServer may be embedded to opt out of forward compatibility for this service. // UnsafeNotifyServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to NotifyServiceServer will // Use of this interface is not recommended, as added methods to NotifyServiceServer will
@ -95,6 +108,13 @@ type UnsafeNotifyServiceServer interface {
} }
func RegisterNotifyServiceServer(s grpc.ServiceRegistrar, srv NotifyServiceServer) { func RegisterNotifyServiceServer(s grpc.ServiceRegistrar, srv NotifyServiceServer) {
// If the following call pancis, it indicates UnimplementedNotifyServiceServer 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(&NotifyService_ServiceDesc, srv) s.RegisterService(&NotifyService_ServiceDesc, srv)
} }
@ -108,7 +128,7 @@ func _NotifyService_NotifyUser_Handler(srv interface{}, ctx context.Context, dec
} }
info := &grpc.UnaryServerInfo{ info := &grpc.UnaryServerInfo{
Server: srv, Server: srv,
FullMethod: "/proto.NotifyService/NotifyUser", FullMethod: NotifyService_NotifyUser_FullMethodName,
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(NotifyServiceServer).NotifyUser(ctx, req.(*NotifyUserRequest)) return srv.(NotifyServiceServer).NotifyUser(ctx, req.(*NotifyUserRequest))
@ -126,7 +146,7 @@ func _NotifyService_NotifyUserBatch_Handler(srv interface{}, ctx context.Context
} }
info := &grpc.UnaryServerInfo{ info := &grpc.UnaryServerInfo{
Server: srv, Server: srv,
FullMethod: "/proto.NotifyService/NotifyUserBatch", FullMethod: NotifyService_NotifyUserBatch_FullMethodName,
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(NotifyServiceServer).NotifyUserBatch(ctx, req.(*NotifyUserBatchRequest)) return srv.(NotifyServiceServer).NotifyUserBatch(ctx, req.(*NotifyUserBatchRequest))
@ -135,7 +155,7 @@ func _NotifyService_NotifyUserBatch_Handler(srv interface{}, ctx context.Context
} }
func _NotifyService_NotifyAllUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _NotifyService_NotifyAllUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(NotifyRequest) in := new(NotifyInfo)
if err := dec(in); err != nil { if err := dec(in); err != nil {
return nil, err return nil, err
} }
@ -144,10 +164,10 @@ func _NotifyService_NotifyAllUser_Handler(srv interface{}, ctx context.Context,
} }
info := &grpc.UnaryServerInfo{ info := &grpc.UnaryServerInfo{
Server: srv, Server: srv,
FullMethod: "/proto.NotifyService/NotifyAllUser", FullMethod: NotifyService_NotifyAllUser_FullMethodName,
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(NotifyServiceServer).NotifyAllUser(ctx, req.(*NotifyRequest)) return srv.(NotifyServiceServer).NotifyAllUser(ctx, req.(*NotifyInfo))
} }
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.28.1 // protoc-gen-go v1.35.1
// protoc v5.28.2 // protoc v5.28.2
// source: realm.proto // source: realm.proto
@ -38,11 +38,9 @@ type RealmInfo struct {
func (x *RealmInfo) Reset() { func (x *RealmInfo) Reset() {
*x = RealmInfo{} *x = RealmInfo{}
if protoimpl.UnsafeEnabled {
mi := &file_realm_proto_msgTypes[0] mi := &file_realm_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
}
} }
func (x *RealmInfo) String() string { func (x *RealmInfo) String() string {
@ -53,7 +51,7 @@ func (*RealmInfo) ProtoMessage() {}
func (x *RealmInfo) ProtoReflect() protoreflect.Message { func (x *RealmInfo) ProtoReflect() protoreflect.Message {
mi := &file_realm_proto_msgTypes[0] mi := &file_realm_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -139,11 +137,9 @@ type ListRealmRequest struct {
func (x *ListRealmRequest) Reset() { func (x *ListRealmRequest) Reset() {
*x = ListRealmRequest{} *x = ListRealmRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_realm_proto_msgTypes[1] mi := &file_realm_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
}
} }
func (x *ListRealmRequest) String() string { func (x *ListRealmRequest) String() string {
@ -154,7 +150,7 @@ func (*ListRealmRequest) ProtoMessage() {}
func (x *ListRealmRequest) ProtoReflect() protoreflect.Message { func (x *ListRealmRequest) ProtoReflect() protoreflect.Message {
mi := &file_realm_proto_msgTypes[1] mi := &file_realm_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -179,11 +175,9 @@ type LookupUserRealmRequest struct {
func (x *LookupUserRealmRequest) Reset() { func (x *LookupUserRealmRequest) Reset() {
*x = LookupUserRealmRequest{} *x = LookupUserRealmRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_realm_proto_msgTypes[2] mi := &file_realm_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
}
} }
func (x *LookupUserRealmRequest) String() string { func (x *LookupUserRealmRequest) String() string {
@ -194,7 +188,7 @@ func (*LookupUserRealmRequest) ProtoMessage() {}
func (x *LookupUserRealmRequest) ProtoReflect() protoreflect.Message { func (x *LookupUserRealmRequest) ProtoReflect() protoreflect.Message {
mi := &file_realm_proto_msgTypes[2] mi := &file_realm_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -229,11 +223,9 @@ type LookupRealmRequest struct {
func (x *LookupRealmRequest) Reset() { func (x *LookupRealmRequest) Reset() {
*x = LookupRealmRequest{} *x = LookupRealmRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_realm_proto_msgTypes[3] mi := &file_realm_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
}
} }
func (x *LookupRealmRequest) String() string { func (x *LookupRealmRequest) String() string {
@ -244,7 +236,7 @@ func (*LookupRealmRequest) ProtoMessage() {}
func (x *LookupRealmRequest) ProtoReflect() protoreflect.Message { func (x *LookupRealmRequest) ProtoReflect() protoreflect.Message {
mi := &file_realm_proto_msgTypes[3] mi := &file_realm_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -297,11 +289,9 @@ type ListRealmResponse struct {
func (x *ListRealmResponse) Reset() { func (x *ListRealmResponse) Reset() {
*x = ListRealmResponse{} *x = ListRealmResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_realm_proto_msgTypes[4] mi := &file_realm_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
}
} }
func (x *ListRealmResponse) String() string { func (x *ListRealmResponse) String() string {
@ -312,7 +302,7 @@ func (*ListRealmResponse) ProtoMessage() {}
func (x *ListRealmResponse) ProtoReflect() protoreflect.Message { func (x *ListRealmResponse) ProtoReflect() protoreflect.Message {
mi := &file_realm_proto_msgTypes[4] mi := &file_realm_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -345,11 +335,9 @@ type RealmMemberLookupRequest struct {
func (x *RealmMemberLookupRequest) Reset() { func (x *RealmMemberLookupRequest) Reset() {
*x = RealmMemberLookupRequest{} *x = RealmMemberLookupRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_realm_proto_msgTypes[5] mi := &file_realm_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
}
} }
func (x *RealmMemberLookupRequest) String() string { func (x *RealmMemberLookupRequest) String() string {
@ -360,7 +348,7 @@ func (*RealmMemberLookupRequest) ProtoMessage() {}
func (x *RealmMemberLookupRequest) ProtoReflect() protoreflect.Message { func (x *RealmMemberLookupRequest) ProtoReflect() protoreflect.Message {
mi := &file_realm_proto_msgTypes[5] mi := &file_realm_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -401,11 +389,9 @@ type RealmMemberInfo struct {
func (x *RealmMemberInfo) Reset() { func (x *RealmMemberInfo) Reset() {
*x = RealmMemberInfo{} *x = RealmMemberInfo{}
if protoimpl.UnsafeEnabled {
mi := &file_realm_proto_msgTypes[6] mi := &file_realm_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
}
} }
func (x *RealmMemberInfo) String() string { func (x *RealmMemberInfo) String() string {
@ -416,7 +402,7 @@ func (*RealmMemberInfo) ProtoMessage() {}
func (x *RealmMemberInfo) ProtoReflect() protoreflect.Message { func (x *RealmMemberInfo) ProtoReflect() protoreflect.Message {
mi := &file_realm_proto_msgTypes[6] mi := &file_realm_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -462,11 +448,9 @@ type ListRealmMemberResponse struct {
func (x *ListRealmMemberResponse) Reset() { func (x *ListRealmMemberResponse) Reset() {
*x = ListRealmMemberResponse{} *x = ListRealmMemberResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_realm_proto_msgTypes[7] mi := &file_realm_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
}
} }
func (x *ListRealmMemberResponse) String() string { func (x *ListRealmMemberResponse) String() string {
@ -477,7 +461,7 @@ func (*ListRealmMemberResponse) ProtoMessage() {}
func (x *ListRealmMemberResponse) ProtoReflect() protoreflect.Message { func (x *ListRealmMemberResponse) ProtoReflect() protoreflect.Message {
mi := &file_realm_proto_msgTypes[7] mi := &file_realm_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -511,11 +495,9 @@ type CheckRealmPermRequest struct {
func (x *CheckRealmPermRequest) Reset() { func (x *CheckRealmPermRequest) Reset() {
*x = CheckRealmPermRequest{} *x = CheckRealmPermRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_realm_proto_msgTypes[8] mi := &file_realm_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
}
} }
func (x *CheckRealmPermRequest) String() string { func (x *CheckRealmPermRequest) String() string {
@ -526,7 +508,7 @@ func (*CheckRealmPermRequest) ProtoMessage() {}
func (x *CheckRealmPermRequest) ProtoReflect() protoreflect.Message { func (x *CheckRealmPermRequest) ProtoReflect() protoreflect.Message {
mi := &file_realm_proto_msgTypes[8] mi := &file_realm_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -572,11 +554,9 @@ type CheckRealmPermResponse struct {
func (x *CheckRealmPermResponse) Reset() { func (x *CheckRealmPermResponse) Reset() {
*x = CheckRealmPermResponse{} *x = CheckRealmPermResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_realm_proto_msgTypes[9] mi := &file_realm_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
}
} }
func (x *CheckRealmPermResponse) String() string { func (x *CheckRealmPermResponse) String() string {
@ -587,7 +567,7 @@ func (*CheckRealmPermResponse) ProtoMessage() {}
func (x *CheckRealmPermResponse) ProtoReflect() protoreflect.Message { func (x *CheckRealmPermResponse) ProtoReflect() protoreflect.Message {
mi := &file_realm_proto_msgTypes[9] mi := &file_realm_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -730,7 +710,7 @@ func file_realm_proto_rawDescGZIP() []byte {
} }
var file_realm_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_realm_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
var file_realm_proto_goTypes = []interface{}{ var file_realm_proto_goTypes = []any{
(*RealmInfo)(nil), // 0: proto.RealmInfo (*RealmInfo)(nil), // 0: proto.RealmInfo
(*ListRealmRequest)(nil), // 1: proto.ListRealmRequest (*ListRealmRequest)(nil), // 1: proto.ListRealmRequest
(*LookupUserRealmRequest)(nil), // 2: proto.LookupUserRealmRequest (*LookupUserRealmRequest)(nil), // 2: proto.LookupUserRealmRequest
@ -771,130 +751,8 @@ func file_realm_proto_init() {
if File_realm_proto != nil { if File_realm_proto != nil {
return return
} }
if !protoimpl.UnsafeEnabled { file_realm_proto_msgTypes[3].OneofWrappers = []any{}
file_realm_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { file_realm_proto_msgTypes[5].OneofWrappers = []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 interface{}, i int) interface{} {
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 interface{}, i int) interface{} {
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 interface{}, i int) interface{} {
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 interface{}, i int) interface{} {
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 interface{}, i int) interface{} {
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 interface{}, i int) interface{} {
switch v := v.(*RealmMemberInfo); 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 interface{}, i int) interface{} {
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 interface{}, i int) interface{} {
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 interface{}, i int) interface{} {
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 = []interface{}{}
file_realm_proto_msgTypes[5].OneofWrappers = []interface{}{}
type x struct{} type x struct{}
out := protoimpl.TypeBuilder{ out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{ File: protoimpl.DescBuilder{

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions: // versions:
// - protoc-gen-go-grpc v1.2.0 // - protoc-gen-go-grpc v1.5.1
// - protoc v5.28.2 // - protoc v5.28.2
// source: realm.proto // source: realm.proto
@ -15,8 +15,18 @@ import (
// This is a compile-time assertion to ensure that this generated file // This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against. // is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later. // Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion7 const _ = grpc.SupportPackageIsVersion9
const (
RealmService_ListCommunityRealm_FullMethodName = "/proto.RealmService/ListCommunityRealm"
RealmService_ListAvailableRealm_FullMethodName = "/proto.RealmService/ListAvailableRealm"
RealmService_ListOwnedRealm_FullMethodName = "/proto.RealmService/ListOwnedRealm"
RealmService_GetRealm_FullMethodName = "/proto.RealmService/GetRealm"
RealmService_ListRealmMember_FullMethodName = "/proto.RealmService/ListRealmMember"
RealmService_GetRealmMember_FullMethodName = "/proto.RealmService/GetRealmMember"
RealmService_CheckRealmMemberPerm_FullMethodName = "/proto.RealmService/CheckRealmMemberPerm"
)
// RealmServiceClient is the client API for RealmService service. // RealmServiceClient is the client API for RealmService service.
// //
@ -40,8 +50,9 @@ func NewRealmServiceClient(cc grpc.ClientConnInterface) RealmServiceClient {
} }
func (c *realmServiceClient) ListCommunityRealm(ctx context.Context, in *ListRealmRequest, opts ...grpc.CallOption) (*ListRealmResponse, error) { func (c *realmServiceClient) ListCommunityRealm(ctx context.Context, in *ListRealmRequest, opts ...grpc.CallOption) (*ListRealmResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListRealmResponse) out := new(ListRealmResponse)
err := c.cc.Invoke(ctx, "/proto.RealmService/ListCommunityRealm", in, out, opts...) err := c.cc.Invoke(ctx, RealmService_ListCommunityRealm_FullMethodName, in, out, cOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -49,8 +60,9 @@ func (c *realmServiceClient) ListCommunityRealm(ctx context.Context, in *ListRea
} }
func (c *realmServiceClient) ListAvailableRealm(ctx context.Context, in *LookupUserRealmRequest, opts ...grpc.CallOption) (*ListRealmResponse, error) { func (c *realmServiceClient) ListAvailableRealm(ctx context.Context, in *LookupUserRealmRequest, opts ...grpc.CallOption) (*ListRealmResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListRealmResponse) out := new(ListRealmResponse)
err := c.cc.Invoke(ctx, "/proto.RealmService/ListAvailableRealm", in, out, opts...) err := c.cc.Invoke(ctx, RealmService_ListAvailableRealm_FullMethodName, in, out, cOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -58,8 +70,9 @@ func (c *realmServiceClient) ListAvailableRealm(ctx context.Context, in *LookupU
} }
func (c *realmServiceClient) ListOwnedRealm(ctx context.Context, in *LookupUserRealmRequest, opts ...grpc.CallOption) (*ListRealmResponse, error) { func (c *realmServiceClient) ListOwnedRealm(ctx context.Context, in *LookupUserRealmRequest, opts ...grpc.CallOption) (*ListRealmResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListRealmResponse) out := new(ListRealmResponse)
err := c.cc.Invoke(ctx, "/proto.RealmService/ListOwnedRealm", in, out, opts...) err := c.cc.Invoke(ctx, RealmService_ListOwnedRealm_FullMethodName, in, out, cOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -67,8 +80,9 @@ func (c *realmServiceClient) ListOwnedRealm(ctx context.Context, in *LookupUserR
} }
func (c *realmServiceClient) GetRealm(ctx context.Context, in *LookupRealmRequest, opts ...grpc.CallOption) (*RealmInfo, error) { func (c *realmServiceClient) GetRealm(ctx context.Context, in *LookupRealmRequest, opts ...grpc.CallOption) (*RealmInfo, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(RealmInfo) out := new(RealmInfo)
err := c.cc.Invoke(ctx, "/proto.RealmService/GetRealm", in, out, opts...) err := c.cc.Invoke(ctx, RealmService_GetRealm_FullMethodName, in, out, cOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -76,8 +90,9 @@ func (c *realmServiceClient) GetRealm(ctx context.Context, in *LookupRealmReques
} }
func (c *realmServiceClient) ListRealmMember(ctx context.Context, in *RealmMemberLookupRequest, opts ...grpc.CallOption) (*ListRealmMemberResponse, error) { func (c *realmServiceClient) ListRealmMember(ctx context.Context, in *RealmMemberLookupRequest, opts ...grpc.CallOption) (*ListRealmMemberResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListRealmMemberResponse) out := new(ListRealmMemberResponse)
err := c.cc.Invoke(ctx, "/proto.RealmService/ListRealmMember", in, out, opts...) err := c.cc.Invoke(ctx, RealmService_ListRealmMember_FullMethodName, in, out, cOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -85,8 +100,9 @@ func (c *realmServiceClient) ListRealmMember(ctx context.Context, in *RealmMembe
} }
func (c *realmServiceClient) GetRealmMember(ctx context.Context, in *RealmMemberLookupRequest, opts ...grpc.CallOption) (*RealmMemberInfo, error) { func (c *realmServiceClient) GetRealmMember(ctx context.Context, in *RealmMemberLookupRequest, opts ...grpc.CallOption) (*RealmMemberInfo, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(RealmMemberInfo) out := new(RealmMemberInfo)
err := c.cc.Invoke(ctx, "/proto.RealmService/GetRealmMember", in, out, opts...) err := c.cc.Invoke(ctx, RealmService_GetRealmMember_FullMethodName, in, out, cOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -94,8 +110,9 @@ func (c *realmServiceClient) GetRealmMember(ctx context.Context, in *RealmMember
} }
func (c *realmServiceClient) CheckRealmMemberPerm(ctx context.Context, in *CheckRealmPermRequest, opts ...grpc.CallOption) (*CheckRealmPermResponse, error) { func (c *realmServiceClient) CheckRealmMemberPerm(ctx context.Context, in *CheckRealmPermRequest, opts ...grpc.CallOption) (*CheckRealmPermResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CheckRealmPermResponse) out := new(CheckRealmPermResponse)
err := c.cc.Invoke(ctx, "/proto.RealmService/CheckRealmMemberPerm", in, out, opts...) err := c.cc.Invoke(ctx, RealmService_CheckRealmMemberPerm_FullMethodName, in, out, cOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -104,7 +121,7 @@ func (c *realmServiceClient) CheckRealmMemberPerm(ctx context.Context, in *Check
// RealmServiceServer is the server API for RealmService service. // RealmServiceServer is the server API for RealmService service.
// All implementations must embed UnimplementedRealmServiceServer // All implementations must embed UnimplementedRealmServiceServer
// for forward compatibility // for forward compatibility.
type RealmServiceServer interface { type RealmServiceServer interface {
ListCommunityRealm(context.Context, *ListRealmRequest) (*ListRealmResponse, error) ListCommunityRealm(context.Context, *ListRealmRequest) (*ListRealmResponse, error)
ListAvailableRealm(context.Context, *LookupUserRealmRequest) (*ListRealmResponse, error) ListAvailableRealm(context.Context, *LookupUserRealmRequest) (*ListRealmResponse, error)
@ -116,9 +133,12 @@ type RealmServiceServer interface {
mustEmbedUnimplementedRealmServiceServer() mustEmbedUnimplementedRealmServiceServer()
} }
// UnimplementedRealmServiceServer must be embedded to have forward compatible implementations. // UnimplementedRealmServiceServer must be embedded to have
type UnimplementedRealmServiceServer struct { // forward compatible implementations.
} //
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedRealmServiceServer struct{}
func (UnimplementedRealmServiceServer) ListCommunityRealm(context.Context, *ListRealmRequest) (*ListRealmResponse, error) { func (UnimplementedRealmServiceServer) ListCommunityRealm(context.Context, *ListRealmRequest) (*ListRealmResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListCommunityRealm not implemented") return nil, status.Errorf(codes.Unimplemented, "method ListCommunityRealm not implemented")
@ -142,6 +162,7 @@ func (UnimplementedRealmServiceServer) CheckRealmMemberPerm(context.Context, *Ch
return nil, status.Errorf(codes.Unimplemented, "method CheckRealmMemberPerm not implemented") return nil, status.Errorf(codes.Unimplemented, "method CheckRealmMemberPerm not implemented")
} }
func (UnimplementedRealmServiceServer) mustEmbedUnimplementedRealmServiceServer() {} func (UnimplementedRealmServiceServer) mustEmbedUnimplementedRealmServiceServer() {}
func (UnimplementedRealmServiceServer) testEmbeddedByValue() {}
// UnsafeRealmServiceServer may be embedded to opt out of forward compatibility for this service. // UnsafeRealmServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to RealmServiceServer will // Use of this interface is not recommended, as added methods to RealmServiceServer will
@ -151,6 +172,13 @@ type UnsafeRealmServiceServer interface {
} }
func RegisterRealmServiceServer(s grpc.ServiceRegistrar, srv RealmServiceServer) { func RegisterRealmServiceServer(s grpc.ServiceRegistrar, srv RealmServiceServer) {
// If the following call pancis, it indicates UnimplementedRealmServiceServer 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(&RealmService_ServiceDesc, srv) s.RegisterService(&RealmService_ServiceDesc, srv)
} }
@ -164,7 +192,7 @@ func _RealmService_ListCommunityRealm_Handler(srv interface{}, ctx context.Conte
} }
info := &grpc.UnaryServerInfo{ info := &grpc.UnaryServerInfo{
Server: srv, Server: srv,
FullMethod: "/proto.RealmService/ListCommunityRealm", FullMethod: RealmService_ListCommunityRealm_FullMethodName,
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RealmServiceServer).ListCommunityRealm(ctx, req.(*ListRealmRequest)) return srv.(RealmServiceServer).ListCommunityRealm(ctx, req.(*ListRealmRequest))
@ -182,7 +210,7 @@ func _RealmService_ListAvailableRealm_Handler(srv interface{}, ctx context.Conte
} }
info := &grpc.UnaryServerInfo{ info := &grpc.UnaryServerInfo{
Server: srv, Server: srv,
FullMethod: "/proto.RealmService/ListAvailableRealm", FullMethod: RealmService_ListAvailableRealm_FullMethodName,
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RealmServiceServer).ListAvailableRealm(ctx, req.(*LookupUserRealmRequest)) return srv.(RealmServiceServer).ListAvailableRealm(ctx, req.(*LookupUserRealmRequest))
@ -200,7 +228,7 @@ func _RealmService_ListOwnedRealm_Handler(srv interface{}, ctx context.Context,
} }
info := &grpc.UnaryServerInfo{ info := &grpc.UnaryServerInfo{
Server: srv, Server: srv,
FullMethod: "/proto.RealmService/ListOwnedRealm", FullMethod: RealmService_ListOwnedRealm_FullMethodName,
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RealmServiceServer).ListOwnedRealm(ctx, req.(*LookupUserRealmRequest)) return srv.(RealmServiceServer).ListOwnedRealm(ctx, req.(*LookupUserRealmRequest))
@ -218,7 +246,7 @@ func _RealmService_GetRealm_Handler(srv interface{}, ctx context.Context, dec fu
} }
info := &grpc.UnaryServerInfo{ info := &grpc.UnaryServerInfo{
Server: srv, Server: srv,
FullMethod: "/proto.RealmService/GetRealm", FullMethod: RealmService_GetRealm_FullMethodName,
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RealmServiceServer).GetRealm(ctx, req.(*LookupRealmRequest)) return srv.(RealmServiceServer).GetRealm(ctx, req.(*LookupRealmRequest))
@ -236,7 +264,7 @@ func _RealmService_ListRealmMember_Handler(srv interface{}, ctx context.Context,
} }
info := &grpc.UnaryServerInfo{ info := &grpc.UnaryServerInfo{
Server: srv, Server: srv,
FullMethod: "/proto.RealmService/ListRealmMember", FullMethod: RealmService_ListRealmMember_FullMethodName,
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RealmServiceServer).ListRealmMember(ctx, req.(*RealmMemberLookupRequest)) return srv.(RealmServiceServer).ListRealmMember(ctx, req.(*RealmMemberLookupRequest))
@ -254,7 +282,7 @@ func _RealmService_GetRealmMember_Handler(srv interface{}, ctx context.Context,
} }
info := &grpc.UnaryServerInfo{ info := &grpc.UnaryServerInfo{
Server: srv, Server: srv,
FullMethod: "/proto.RealmService/GetRealmMember", FullMethod: RealmService_GetRealmMember_FullMethodName,
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RealmServiceServer).GetRealmMember(ctx, req.(*RealmMemberLookupRequest)) return srv.(RealmServiceServer).GetRealmMember(ctx, req.(*RealmMemberLookupRequest))
@ -272,7 +300,7 @@ func _RealmService_CheckRealmMemberPerm_Handler(srv interface{}, ctx context.Con
} }
info := &grpc.UnaryServerInfo{ info := &grpc.UnaryServerInfo{
Server: srv, Server: srv,
FullMethod: "/proto.RealmService/CheckRealmMemberPerm", FullMethod: RealmService_CheckRealmMemberPerm_FullMethodName,
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RealmServiceServer).CheckRealmMemberPerm(ctx, req.(*CheckRealmPermRequest)) return srv.(RealmServiceServer).CheckRealmMemberPerm(ctx, req.(*CheckRealmPermRequest))

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.28.1 // protoc-gen-go v1.35.1
// protoc v5.28.2 // protoc v5.28.2
// source: record.proto // source: record.proto
@ -34,11 +34,9 @@ type RecordEventRequest struct {
func (x *RecordEventRequest) Reset() { func (x *RecordEventRequest) Reset() {
*x = RecordEventRequest{} *x = RecordEventRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_record_proto_msgTypes[0] mi := &file_record_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
}
} }
func (x *RecordEventRequest) String() string { func (x *RecordEventRequest) String() string {
@ -49,7 +47,7 @@ func (*RecordEventRequest) ProtoMessage() {}
func (x *RecordEventRequest) ProtoReflect() protoreflect.Message { func (x *RecordEventRequest) ProtoReflect() protoreflect.Message {
mi := &file_record_proto_msgTypes[0] mi := &file_record_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -109,11 +107,9 @@ type RecordEventResponse struct {
func (x *RecordEventResponse) Reset() { func (x *RecordEventResponse) Reset() {
*x = RecordEventResponse{} *x = RecordEventResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_record_proto_msgTypes[1] mi := &file_record_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
}
} }
func (x *RecordEventResponse) String() string { func (x *RecordEventResponse) String() string {
@ -124,7 +120,7 @@ func (*RecordEventResponse) ProtoMessage() {}
func (x *RecordEventResponse) ProtoReflect() protoreflect.Message { func (x *RecordEventResponse) ProtoReflect() protoreflect.Message {
mi := &file_record_proto_msgTypes[1] mi := &file_record_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
@ -185,7 +181,7 @@ func file_record_proto_rawDescGZIP() []byte {
} }
var file_record_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_record_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_record_proto_goTypes = []interface{}{ var file_record_proto_goTypes = []any{
(*RecordEventRequest)(nil), // 0: proto.RecordEventRequest (*RecordEventRequest)(nil), // 0: proto.RecordEventRequest
(*RecordEventResponse)(nil), // 1: proto.RecordEventResponse (*RecordEventResponse)(nil), // 1: proto.RecordEventResponse
} }
@ -204,32 +200,6 @@ func file_record_proto_init() {
if File_record_proto != nil { if File_record_proto != nil {
return return
} }
if !protoimpl.UnsafeEnabled {
file_record_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RecordEventRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_record_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RecordEventResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{} type x struct{}
out := protoimpl.TypeBuilder{ out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{ File: protoimpl.DescBuilder{

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions: // versions:
// - protoc-gen-go-grpc v1.2.0 // - protoc-gen-go-grpc v1.5.1
// - protoc v5.28.2 // - protoc v5.28.2
// source: record.proto // source: record.proto
@ -15,8 +15,12 @@ import (
// This is a compile-time assertion to ensure that this generated file // This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against. // is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later. // Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion7 const _ = grpc.SupportPackageIsVersion9
const (
AuditService_RecordEvent_FullMethodName = "/proto.AuditService/RecordEvent"
)
// AuditServiceClient is the client API for AuditService service. // AuditServiceClient is the client API for AuditService service.
// //
@ -34,8 +38,9 @@ func NewAuditServiceClient(cc grpc.ClientConnInterface) AuditServiceClient {
} }
func (c *auditServiceClient) RecordEvent(ctx context.Context, in *RecordEventRequest, opts ...grpc.CallOption) (*RecordEventResponse, error) { func (c *auditServiceClient) RecordEvent(ctx context.Context, in *RecordEventRequest, opts ...grpc.CallOption) (*RecordEventResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(RecordEventResponse) out := new(RecordEventResponse)
err := c.cc.Invoke(ctx, "/proto.AuditService/RecordEvent", in, out, opts...) err := c.cc.Invoke(ctx, AuditService_RecordEvent_FullMethodName, in, out, cOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -44,20 +49,24 @@ func (c *auditServiceClient) RecordEvent(ctx context.Context, in *RecordEventReq
// AuditServiceServer is the server API for AuditService service. // AuditServiceServer is the server API for AuditService service.
// All implementations must embed UnimplementedAuditServiceServer // All implementations must embed UnimplementedAuditServiceServer
// for forward compatibility // for forward compatibility.
type AuditServiceServer interface { type AuditServiceServer interface {
RecordEvent(context.Context, *RecordEventRequest) (*RecordEventResponse, error) RecordEvent(context.Context, *RecordEventRequest) (*RecordEventResponse, error)
mustEmbedUnimplementedAuditServiceServer() mustEmbedUnimplementedAuditServiceServer()
} }
// UnimplementedAuditServiceServer must be embedded to have forward compatible implementations. // UnimplementedAuditServiceServer must be embedded to have
type UnimplementedAuditServiceServer struct { // forward compatible implementations.
} //
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedAuditServiceServer struct{}
func (UnimplementedAuditServiceServer) RecordEvent(context.Context, *RecordEventRequest) (*RecordEventResponse, error) { func (UnimplementedAuditServiceServer) RecordEvent(context.Context, *RecordEventRequest) (*RecordEventResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method RecordEvent not implemented") return nil, status.Errorf(codes.Unimplemented, "method RecordEvent not implemented")
} }
func (UnimplementedAuditServiceServer) mustEmbedUnimplementedAuditServiceServer() {} func (UnimplementedAuditServiceServer) mustEmbedUnimplementedAuditServiceServer() {}
func (UnimplementedAuditServiceServer) testEmbeddedByValue() {}
// UnsafeAuditServiceServer may be embedded to opt out of forward compatibility for this service. // UnsafeAuditServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to AuditServiceServer will // Use of this interface is not recommended, as added methods to AuditServiceServer will
@ -67,6 +76,13 @@ type UnsafeAuditServiceServer interface {
} }
func RegisterAuditServiceServer(s grpc.ServiceRegistrar, srv AuditServiceServer) { func RegisterAuditServiceServer(s grpc.ServiceRegistrar, srv AuditServiceServer) {
// If the following call pancis, it indicates UnimplementedAuditServiceServer 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(&AuditService_ServiceDesc, srv) s.RegisterService(&AuditService_ServiceDesc, srv)
} }
@ -80,7 +96,7 @@ func _AuditService_RecordEvent_Handler(srv interface{}, ctx context.Context, dec
} }
info := &grpc.UnaryServerInfo{ info := &grpc.UnaryServerInfo{
Server: srv, Server: srv,
FullMethod: "/proto.AuditService/RecordEvent", FullMethod: AuditService_RecordEvent_FullMethodName,
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AuditServiceServer).RecordEvent(ctx, req.(*RecordEventRequest)) return srv.(AuditServiceServer).RecordEvent(ctx, req.(*RecordEventRequest))