366 lines
16 KiB
Go
366 lines
16 KiB
Go
// Code generated by protoc-gen-triple. DO NOT EDIT.
|
|
//
|
|
// Source: notification.proto
|
|
package notification
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
import (
|
|
"dubbo.apache.org/dubbo-go/v3"
|
|
"dubbo.apache.org/dubbo-go/v3/client"
|
|
"dubbo.apache.org/dubbo-go/v3/common"
|
|
"dubbo.apache.org/dubbo-go/v3/common/constant"
|
|
"dubbo.apache.org/dubbo-go/v3/protocol/triple/triple_protocol"
|
|
"dubbo.apache.org/dubbo-go/v3/server"
|
|
)
|
|
|
|
// This is a compile-time assertion to ensure that this generated file and the Triple package
|
|
// are compatible. If you get a compiler error that this constant is not defined, this code was
|
|
// generated with a version of Triple newer than the one compiled into your binary. You can fix the
|
|
// problem by either regenerating this code with an older version of Triple or updating the Triple
|
|
// version compiled into your binary.
|
|
const _ = triple_protocol.IsAtLeastVersion0_1_0
|
|
|
|
const (
|
|
// NotificationServiceName is the fully-qualified name of the NotificationService service.
|
|
NotificationServiceName = "topfans.notification.NotificationService"
|
|
)
|
|
|
|
// These constants are the fully-qualified names of the RPCs defined in this package. They're
|
|
// exposed at runtime as procedure and as the final two segments of the HTTP route.
|
|
//
|
|
// Note that these are different from the fully-qualified method names used by
|
|
// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
|
|
// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
|
|
// period.
|
|
const (
|
|
// NotificationServiceCreateNotificationProcedure is the fully-qualified name of the NotificationService's CreateNotification RPC.
|
|
NotificationServiceCreateNotificationProcedure = "/topfans.notification.NotificationService/CreateNotification"
|
|
// NotificationServiceGetNotificationsProcedure is the fully-qualified name of the NotificationService's GetNotifications RPC.
|
|
NotificationServiceGetNotificationsProcedure = "/topfans.notification.NotificationService/GetNotifications"
|
|
// NotificationServiceGetUnreadCountProcedure is the fully-qualified name of the NotificationService's GetUnreadCount RPC.
|
|
NotificationServiceGetUnreadCountProcedure = "/topfans.notification.NotificationService/GetUnreadCount"
|
|
// NotificationServiceMarkAsReadProcedure is the fully-qualified name of the NotificationService's MarkAsRead RPC.
|
|
NotificationServiceMarkAsReadProcedure = "/topfans.notification.NotificationService/MarkAsRead"
|
|
// NotificationServiceMarkAsReadByTargetProcedure is the fully-qualified name of the NotificationService's MarkAsReadByTarget RPC.
|
|
NotificationServiceMarkAsReadByTargetProcedure = "/topfans.notification.NotificationService/MarkAsReadByTarget"
|
|
// NotificationServiceMarkAllAsReadProcedure is the fully-qualified name of the NotificationService's MarkAllAsRead RPC.
|
|
NotificationServiceMarkAllAsReadProcedure = "/topfans.notification.NotificationService/MarkAllAsRead"
|
|
// NotificationServiceDeleteNotificationProcedure is the fully-qualified name of the NotificationService's DeleteNotification RPC.
|
|
NotificationServiceDeleteNotificationProcedure = "/topfans.notification.NotificationService/DeleteNotification"
|
|
// NotificationServiceDeleteByTargetProcedure is the fully-qualified name of the NotificationService's DeleteByTarget RPC.
|
|
NotificationServiceDeleteByTargetProcedure = "/topfans.notification.NotificationService/DeleteByTarget"
|
|
// NotificationServiceRegisterDeviceProcedure is the fully-qualified name of the NotificationService's RegisterDevice RPC.
|
|
NotificationServiceRegisterDeviceProcedure = "/topfans.notification.NotificationService/RegisterDevice"
|
|
// NotificationServiceUnregisterDeviceProcedure is the fully-qualified name of the NotificationService's UnregisterDevice RPC.
|
|
NotificationServiceUnregisterDeviceProcedure = "/topfans.notification.NotificationService/UnregisterDevice"
|
|
)
|
|
|
|
var (
|
|
_ NotificationService = (*NotificationServiceImpl)(nil)
|
|
)
|
|
|
|
// NotificationService is a client for the topfans.notification.NotificationService service.
|
|
type NotificationService interface {
|
|
CreateNotification(ctx context.Context, req *CreateNotificationRequest, opts ...client.CallOption) (*CreateNotificationResponse, error)
|
|
GetNotifications(ctx context.Context, req *GetNotificationsRequest, opts ...client.CallOption) (*GetNotificationsResponse, error)
|
|
GetUnreadCount(ctx context.Context, req *GetUnreadCountRequest, opts ...client.CallOption) (*GetUnreadCountResponse, error)
|
|
MarkAsRead(ctx context.Context, req *MarkAsReadRequest, opts ...client.CallOption) (*MarkAsReadResponse, error)
|
|
MarkAsReadByTarget(ctx context.Context, req *MarkAsReadByTargetRequest, opts ...client.CallOption) (*MarkAsReadByTargetResponse, error)
|
|
MarkAllAsRead(ctx context.Context, req *MarkAllAsReadRequest, opts ...client.CallOption) (*MarkAllAsReadResponse, error)
|
|
DeleteNotification(ctx context.Context, req *DeleteNotificationRequest, opts ...client.CallOption) (*DeleteNotificationResponse, error)
|
|
DeleteByTarget(ctx context.Context, req *DeleteByTargetRequest, opts ...client.CallOption) (*DeleteByTargetResponse, error)
|
|
RegisterDevice(ctx context.Context, req *RegisterDeviceRequest, opts ...client.CallOption) (*RegisterDeviceResponse, error)
|
|
UnregisterDevice(ctx context.Context, req *UnregisterDeviceRequest, opts ...client.CallOption) (*UnregisterDeviceResponse, error)
|
|
}
|
|
|
|
// NewNotificationService constructs a client for the notification.NotificationService service.
|
|
func NewNotificationService(cli *client.Client, opts ...client.ReferenceOption) (NotificationService, error) {
|
|
conn, err := cli.DialWithInfo("topfans.notification.NotificationService", &NotificationService_ClientInfo, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &NotificationServiceImpl{
|
|
conn: conn,
|
|
}, nil
|
|
}
|
|
|
|
func SetConsumerNotificationService(srv common.RPCService) {
|
|
dubbo.SetConsumerServiceWithInfo(srv, &NotificationService_ClientInfo)
|
|
}
|
|
|
|
// NotificationServiceImpl implements NotificationService.
|
|
type NotificationServiceImpl struct {
|
|
conn *client.Connection
|
|
}
|
|
|
|
func (c *NotificationServiceImpl) CreateNotification(ctx context.Context, req *CreateNotificationRequest, opts ...client.CallOption) (*CreateNotificationResponse, error) {
|
|
resp := new(CreateNotificationResponse)
|
|
if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "CreateNotification", opts...); err != nil {
|
|
return nil, err
|
|
}
|
|
return resp, nil
|
|
}
|
|
|
|
func (c *NotificationServiceImpl) GetNotifications(ctx context.Context, req *GetNotificationsRequest, opts ...client.CallOption) (*GetNotificationsResponse, error) {
|
|
resp := new(GetNotificationsResponse)
|
|
if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "GetNotifications", opts...); err != nil {
|
|
return nil, err
|
|
}
|
|
return resp, nil
|
|
}
|
|
|
|
func (c *NotificationServiceImpl) GetUnreadCount(ctx context.Context, req *GetUnreadCountRequest, opts ...client.CallOption) (*GetUnreadCountResponse, error) {
|
|
resp := new(GetUnreadCountResponse)
|
|
if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "GetUnreadCount", opts...); err != nil {
|
|
return nil, err
|
|
}
|
|
return resp, nil
|
|
}
|
|
|
|
func (c *NotificationServiceImpl) MarkAsRead(ctx context.Context, req *MarkAsReadRequest, opts ...client.CallOption) (*MarkAsReadResponse, error) {
|
|
resp := new(MarkAsReadResponse)
|
|
if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "MarkAsRead", opts...); err != nil {
|
|
return nil, err
|
|
}
|
|
return resp, nil
|
|
}
|
|
|
|
func (c *NotificationServiceImpl) MarkAsReadByTarget(ctx context.Context, req *MarkAsReadByTargetRequest, opts ...client.CallOption) (*MarkAsReadByTargetResponse, error) {
|
|
resp := new(MarkAsReadByTargetResponse)
|
|
if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "MarkAsReadByTarget", opts...); err != nil {
|
|
return nil, err
|
|
}
|
|
return resp, nil
|
|
}
|
|
|
|
func (c *NotificationServiceImpl) MarkAllAsRead(ctx context.Context, req *MarkAllAsReadRequest, opts ...client.CallOption) (*MarkAllAsReadResponse, error) {
|
|
resp := new(MarkAllAsReadResponse)
|
|
if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "MarkAllAsRead", opts...); err != nil {
|
|
return nil, err
|
|
}
|
|
return resp, nil
|
|
}
|
|
|
|
func (c *NotificationServiceImpl) DeleteNotification(ctx context.Context, req *DeleteNotificationRequest, opts ...client.CallOption) (*DeleteNotificationResponse, error) {
|
|
resp := new(DeleteNotificationResponse)
|
|
if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "DeleteNotification", opts...); err != nil {
|
|
return nil, err
|
|
}
|
|
return resp, nil
|
|
}
|
|
|
|
func (c *NotificationServiceImpl) DeleteByTarget(ctx context.Context, req *DeleteByTargetRequest, opts ...client.CallOption) (*DeleteByTargetResponse, error) {
|
|
resp := new(DeleteByTargetResponse)
|
|
if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "DeleteByTarget", opts...); err != nil {
|
|
return nil, err
|
|
}
|
|
return resp, nil
|
|
}
|
|
|
|
func (c *NotificationServiceImpl) RegisterDevice(ctx context.Context, req *RegisterDeviceRequest, opts ...client.CallOption) (*RegisterDeviceResponse, error) {
|
|
resp := new(RegisterDeviceResponse)
|
|
if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "RegisterDevice", opts...); err != nil {
|
|
return nil, err
|
|
}
|
|
return resp, nil
|
|
}
|
|
|
|
func (c *NotificationServiceImpl) UnregisterDevice(ctx context.Context, req *UnregisterDeviceRequest, opts ...client.CallOption) (*UnregisterDeviceResponse, error) {
|
|
resp := new(UnregisterDeviceResponse)
|
|
if err := c.conn.CallUnary(ctx, []interface{}{req}, resp, "UnregisterDevice", opts...); err != nil {
|
|
return nil, err
|
|
}
|
|
return resp, nil
|
|
}
|
|
|
|
var NotificationService_ClientInfo = client.ClientInfo{
|
|
InterfaceName: "topfans.notification.NotificationService",
|
|
MethodNames: []string{"CreateNotification", "GetNotifications", "GetUnreadCount", "MarkAsRead", "MarkAsReadByTarget", "MarkAllAsRead", "DeleteNotification", "DeleteByTarget", "RegisterDevice", "UnregisterDevice"},
|
|
ConnectionInjectFunc: func(dubboCliRaw interface{}, conn *client.Connection) {
|
|
dubboCli := dubboCliRaw.(*NotificationServiceImpl)
|
|
dubboCli.conn = conn
|
|
},
|
|
}
|
|
|
|
// NotificationServiceHandler is an implementation of the topfans.notification.NotificationService service.
|
|
type NotificationServiceHandler interface {
|
|
CreateNotification(context.Context, *CreateNotificationRequest) (*CreateNotificationResponse, error)
|
|
GetNotifications(context.Context, *GetNotificationsRequest) (*GetNotificationsResponse, error)
|
|
GetUnreadCount(context.Context, *GetUnreadCountRequest) (*GetUnreadCountResponse, error)
|
|
MarkAsRead(context.Context, *MarkAsReadRequest) (*MarkAsReadResponse, error)
|
|
MarkAsReadByTarget(context.Context, *MarkAsReadByTargetRequest) (*MarkAsReadByTargetResponse, error)
|
|
MarkAllAsRead(context.Context, *MarkAllAsReadRequest) (*MarkAllAsReadResponse, error)
|
|
DeleteNotification(context.Context, *DeleteNotificationRequest) (*DeleteNotificationResponse, error)
|
|
DeleteByTarget(context.Context, *DeleteByTargetRequest) (*DeleteByTargetResponse, error)
|
|
RegisterDevice(context.Context, *RegisterDeviceRequest) (*RegisterDeviceResponse, error)
|
|
UnregisterDevice(context.Context, *UnregisterDeviceRequest) (*UnregisterDeviceResponse, error)
|
|
}
|
|
|
|
func RegisterNotificationServiceHandler(srv *server.Server, hdlr NotificationServiceHandler, opts ...server.ServiceOption) error {
|
|
return srv.Register(hdlr, &NotificationService_ServiceInfo, opts...)
|
|
}
|
|
|
|
func SetProviderNotificationService(srv common.RPCService) {
|
|
dubbo.SetProviderServiceWithInfo(srv, &NotificationService_ServiceInfo)
|
|
}
|
|
|
|
var NotificationService_ServiceInfo = server.ServiceInfo{
|
|
InterfaceName: "topfans.notification.NotificationService",
|
|
ServiceType: (*NotificationServiceHandler)(nil),
|
|
Methods: []server.MethodInfo{
|
|
{
|
|
Name: "CreateNotification",
|
|
Type: constant.CallUnary,
|
|
ReqInitFunc: func() interface{} {
|
|
return new(CreateNotificationRequest)
|
|
},
|
|
MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) {
|
|
req := args[0].(*CreateNotificationRequest)
|
|
res, err := handler.(NotificationServiceHandler).CreateNotification(ctx, req)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return triple_protocol.NewResponse(res), nil
|
|
},
|
|
},
|
|
{
|
|
Name: "GetNotifications",
|
|
Type: constant.CallUnary,
|
|
ReqInitFunc: func() interface{} {
|
|
return new(GetNotificationsRequest)
|
|
},
|
|
MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) {
|
|
req := args[0].(*GetNotificationsRequest)
|
|
res, err := handler.(NotificationServiceHandler).GetNotifications(ctx, req)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return triple_protocol.NewResponse(res), nil
|
|
},
|
|
},
|
|
{
|
|
Name: "GetUnreadCount",
|
|
Type: constant.CallUnary,
|
|
ReqInitFunc: func() interface{} {
|
|
return new(GetUnreadCountRequest)
|
|
},
|
|
MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) {
|
|
req := args[0].(*GetUnreadCountRequest)
|
|
res, err := handler.(NotificationServiceHandler).GetUnreadCount(ctx, req)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return triple_protocol.NewResponse(res), nil
|
|
},
|
|
},
|
|
{
|
|
Name: "MarkAsRead",
|
|
Type: constant.CallUnary,
|
|
ReqInitFunc: func() interface{} {
|
|
return new(MarkAsReadRequest)
|
|
},
|
|
MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) {
|
|
req := args[0].(*MarkAsReadRequest)
|
|
res, err := handler.(NotificationServiceHandler).MarkAsRead(ctx, req)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return triple_protocol.NewResponse(res), nil
|
|
},
|
|
},
|
|
{
|
|
Name: "MarkAsReadByTarget",
|
|
Type: constant.CallUnary,
|
|
ReqInitFunc: func() interface{} {
|
|
return new(MarkAsReadByTargetRequest)
|
|
},
|
|
MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) {
|
|
req := args[0].(*MarkAsReadByTargetRequest)
|
|
res, err := handler.(NotificationServiceHandler).MarkAsReadByTarget(ctx, req)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return triple_protocol.NewResponse(res), nil
|
|
},
|
|
},
|
|
{
|
|
Name: "MarkAllAsRead",
|
|
Type: constant.CallUnary,
|
|
ReqInitFunc: func() interface{} {
|
|
return new(MarkAllAsReadRequest)
|
|
},
|
|
MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) {
|
|
req := args[0].(*MarkAllAsReadRequest)
|
|
res, err := handler.(NotificationServiceHandler).MarkAllAsRead(ctx, req)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return triple_protocol.NewResponse(res), nil
|
|
},
|
|
},
|
|
{
|
|
Name: "DeleteNotification",
|
|
Type: constant.CallUnary,
|
|
ReqInitFunc: func() interface{} {
|
|
return new(DeleteNotificationRequest)
|
|
},
|
|
MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) {
|
|
req := args[0].(*DeleteNotificationRequest)
|
|
res, err := handler.(NotificationServiceHandler).DeleteNotification(ctx, req)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return triple_protocol.NewResponse(res), nil
|
|
},
|
|
},
|
|
{
|
|
Name: "DeleteByTarget",
|
|
Type: constant.CallUnary,
|
|
ReqInitFunc: func() interface{} {
|
|
return new(DeleteByTargetRequest)
|
|
},
|
|
MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) {
|
|
req := args[0].(*DeleteByTargetRequest)
|
|
res, err := handler.(NotificationServiceHandler).DeleteByTarget(ctx, req)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return triple_protocol.NewResponse(res), nil
|
|
},
|
|
},
|
|
{
|
|
Name: "RegisterDevice",
|
|
Type: constant.CallUnary,
|
|
ReqInitFunc: func() interface{} {
|
|
return new(RegisterDeviceRequest)
|
|
},
|
|
MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) {
|
|
req := args[0].(*RegisterDeviceRequest)
|
|
res, err := handler.(NotificationServiceHandler).RegisterDevice(ctx, req)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return triple_protocol.NewResponse(res), nil
|
|
},
|
|
},
|
|
{
|
|
Name: "UnregisterDevice",
|
|
Type: constant.CallUnary,
|
|
ReqInitFunc: func() interface{} {
|
|
return new(UnregisterDeviceRequest)
|
|
},
|
|
MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) {
|
|
req := args[0].(*UnregisterDeviceRequest)
|
|
res, err := handler.(NotificationServiceHandler).UnregisterDevice(ctx, req)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return triple_protocol.NewResponse(res), nil
|
|
},
|
|
},
|
|
},
|
|
}
|