add logic to delete and srore sub
This commit is contained in:
parent
ffa341b13d
commit
1ce72b2f88
|
@ -2,17 +2,17 @@
|
|||
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.28.0
|
||||
// protoc v3.19.4
|
||||
// protoc-gen-go v1.28.1
|
||||
// protoc v3.12.4
|
||||
// source: agenda.proto
|
||||
|
||||
package grpcapi
|
||||
|
||||
import (
|
||||
_struct "github.com/golang/protobuf/ptypes/struct"
|
||||
timestamp "github.com/golang/protobuf/ptypes/timestamp"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
structpb "google.golang.org/protobuf/types/known/structpb"
|
||||
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
@ -311,9 +311,9 @@ type GetEventsRequest struct {
|
|||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Namespaces []string `protobuf:"bytes,10,rep,name=namespaces,proto3" json:"namespaces,omitempty"`
|
||||
Mindate *timestamppb.Timestamp `protobuf:"bytes,11,opt,name=mindate,proto3" json:"mindate,omitempty"`
|
||||
Maxdate *timestamppb.Timestamp `protobuf:"bytes,12,opt,name=maxdate,proto3" json:"maxdate,omitempty"`
|
||||
Namespaces []string `protobuf:"bytes,10,rep,name=namespaces,proto3" json:"namespaces,omitempty"`
|
||||
Mindate *timestamp.Timestamp `protobuf:"bytes,11,opt,name=mindate,proto3" json:"mindate,omitempty"`
|
||||
Maxdate *timestamp.Timestamp `protobuf:"bytes,12,opt,name=maxdate,proto3" json:"maxdate,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetEventsRequest) Reset() {
|
||||
|
@ -355,14 +355,14 @@ func (x *GetEventsRequest) GetNamespaces() []string {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (x *GetEventsRequest) GetMindate() *timestamppb.Timestamp {
|
||||
func (x *GetEventsRequest) GetMindate() *timestamp.Timestamp {
|
||||
if x != nil {
|
||||
return x.Mindate
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *GetEventsRequest) GetMaxdate() *timestamppb.Timestamp {
|
||||
func (x *GetEventsRequest) GetMaxdate() *timestamp.Timestamp {
|
||||
if x != nil {
|
||||
return x.Maxdate
|
||||
}
|
||||
|
@ -421,9 +421,9 @@ type SubscribeEventRequest struct {
|
|||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Subscriber string `protobuf:"bytes,20,opt,name=subscriber,proto3" json:"subscriber,omitempty"`
|
||||
Eventid string `protobuf:"bytes,21,opt,name=eventid,proto3" json:"eventid,omitempty"`
|
||||
Data *structpb.Struct `protobuf:"bytes,22,opt,name=data,proto3" json:"data,omitempty"`
|
||||
Subscriber string `protobuf:"bytes,20,opt,name=subscriber,proto3" json:"subscriber,omitempty"`
|
||||
Eventid string `protobuf:"bytes,21,opt,name=eventid,proto3" json:"eventid,omitempty"`
|
||||
Data *_struct.Struct `protobuf:"bytes,22,opt,name=data,proto3" json:"data,omitempty"`
|
||||
}
|
||||
|
||||
func (x *SubscribeEventRequest) Reset() {
|
||||
|
@ -472,7 +472,7 @@ func (x *SubscribeEventRequest) GetEventid() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
func (x *SubscribeEventRequest) GetData() *structpb.Struct {
|
||||
func (x *SubscribeEventRequest) GetData() *_struct.Struct {
|
||||
if x != nil {
|
||||
return x.Data
|
||||
}
|
||||
|
@ -628,6 +628,116 @@ func (x *UnsubscribeEventResponse) GetOk() bool {
|
|||
return false
|
||||
}
|
||||
|
||||
type DeleteSubscriptionRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Subscriber string `protobuf:"bytes,32,opt,name=subscriber,proto3" json:"subscriber,omitempty"`
|
||||
Eventid string `protobuf:"bytes,33,opt,name=eventid,proto3" json:"eventid,omitempty"`
|
||||
Data *_struct.Struct `protobuf:"bytes,34,opt,name=data,proto3" json:"data,omitempty"`
|
||||
}
|
||||
|
||||
func (x *DeleteSubscriptionRequest) Reset() {
|
||||
*x = DeleteSubscriptionRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_agenda_proto_msgTypes[12]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *DeleteSubscriptionRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DeleteSubscriptionRequest) ProtoMessage() {}
|
||||
|
||||
func (x *DeleteSubscriptionRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_agenda_proto_msgTypes[12]
|
||||
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 DeleteSubscriptionRequest.ProtoReflect.Descriptor instead.
|
||||
func (*DeleteSubscriptionRequest) Descriptor() ([]byte, []int) {
|
||||
return file_agenda_proto_rawDescGZIP(), []int{12}
|
||||
}
|
||||
|
||||
func (x *DeleteSubscriptionRequest) GetSubscriber() string {
|
||||
if x != nil {
|
||||
return x.Subscriber
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DeleteSubscriptionRequest) GetEventid() string {
|
||||
if x != nil {
|
||||
return x.Eventid
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DeleteSubscriptionRequest) GetData() *_struct.Struct {
|
||||
if x != nil {
|
||||
return x.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type DeleteSubscriptionResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Ok bool `protobuf:"varint,41,opt,name=ok,proto3" json:"ok,omitempty"`
|
||||
}
|
||||
|
||||
func (x *DeleteSubscriptionResponse) Reset() {
|
||||
*x = DeleteSubscriptionResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_agenda_proto_msgTypes[13]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *DeleteSubscriptionResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DeleteSubscriptionResponse) ProtoMessage() {}
|
||||
|
||||
func (x *DeleteSubscriptionResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_agenda_proto_msgTypes[13]
|
||||
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 DeleteSubscriptionResponse.ProtoReflect.Descriptor instead.
|
||||
func (*DeleteSubscriptionResponse) Descriptor() ([]byte, []int) {
|
||||
return file_agenda_proto_rawDescGZIP(), []int{13}
|
||||
}
|
||||
|
||||
func (x *DeleteSubscriptionResponse) GetOk() bool {
|
||||
if x != nil {
|
||||
return x.Ok
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var File_agenda_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_agenda_proto_rawDesc = []byte{
|
||||
|
@ -685,34 +795,50 @@ var file_agenda_proto_rawDesc = []byte{
|
|||
0x28, 0x09, 0x52, 0x07, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x69, 0x64, 0x22, 0x2a, 0x0a, 0x18, 0x55,
|
||||
0x6e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x6f, 0x6b, 0x18, 0x27, 0x20,
|
||||
0x01, 0x28, 0x08, 0x52, 0x02, 0x6f, 0x6b, 0x32, 0xf9, 0x02, 0x0a, 0x06, 0x41, 0x67, 0x65, 0x6e,
|
||||
0x64, 0x61, 0x12, 0x3a, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e,
|
||||
0x74, 0x12, 0x13, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45,
|
||||
0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x31,
|
||||
0x0a, 0x08, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x10, 0x2e, 0x47, 0x65, 0x74,
|
||||
0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x47,
|
||||
0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
|
||||
0x00, 0x12, 0x34, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x11,
|
||||
0x2e, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x1a, 0x12, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0b, 0x44, 0x65, 0x6c, 0x65, 0x74,
|
||||
0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x13, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x45,
|
||||
0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x44, 0x65,
|
||||
0x6c, 0x65, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x0e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65,
|
||||
0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62,
|
||||
0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e,
|
||||
0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x49, 0x0a, 0x10, 0x55, 0x6e, 0x73, 0x75,
|
||||
0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x18, 0x2e, 0x55,
|
||||
0x6e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x55, 0x6e, 0x73, 0x75, 0x62, 0x73, 0x63,
|
||||
0x72, 0x69, 0x62, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x22, 0x00, 0x42, 0x2e, 0x5a, 0x2c, 0x67, 0x69, 0x74, 0x2e, 0x63, 0x6f, 0x6f, 0x70, 0x67,
|
||||
0x6f, 0x2e, 0x69, 0x6f, 0x2f, 0x63, 0x6f, 0x6f, 0x70, 0x67, 0x6f, 0x2d, 0x70, 0x6c, 0x61, 0x74,
|
||||
0x66, 0x6f, 0x72, 0x6d, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x64, 0x61, 0x2f, 0x67, 0x72, 0x70, 0x63,
|
||||
0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x01, 0x28, 0x08, 0x52, 0x02, 0x6f, 0x6b, 0x22, 0x82, 0x01, 0x0a, 0x19, 0x44, 0x65, 0x6c, 0x65,
|
||||
0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69,
|
||||
0x62, 0x65, 0x72, 0x18, 0x20, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x75, 0x62, 0x73, 0x63,
|
||||
0x72, 0x69, 0x62, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x69, 0x64,
|
||||
0x18, 0x21, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x69, 0x64, 0x12,
|
||||
0x2b, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x22, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e,
|
||||
0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
|
||||
0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x2c, 0x0a, 0x1a,
|
||||
0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x6f, 0x6b,
|
||||
0x18, 0x29, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, 0x6f, 0x6b, 0x32, 0xca, 0x03, 0x0a, 0x06, 0x41,
|
||||
0x67, 0x65, 0x6e, 0x64, 0x61, 0x12, 0x3a, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45,
|
||||
0x76, 0x65, 0x6e, 0x74, 0x12, 0x13, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65,
|
||||
0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x43, 0x72, 0x65, 0x61,
|
||||
0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
|
||||
0x00, 0x12, 0x31, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x10, 0x2e,
|
||||
0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||
0x11, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x22, 0x00, 0x12, 0x34, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74,
|
||||
0x73, 0x12, 0x11, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0b, 0x44, 0x65,
|
||||
0x6c, 0x65, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x13, 0x2e, 0x44, 0x65, 0x6c, 0x65,
|
||||
0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14,
|
||||
0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70,
|
||||
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x0e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72,
|
||||
0x69, 0x62, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63,
|
||||
0x72, 0x69, 0x62, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x1a, 0x17, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x45, 0x76, 0x65, 0x6e,
|
||||
0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x49, 0x0a, 0x10, 0x55,
|
||||
0x6e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12,
|
||||
0x18, 0x2e, 0x55, 0x6e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x45, 0x76, 0x65,
|
||||
0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x55, 0x6e, 0x73, 0x75,
|
||||
0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70,
|
||||
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4f, 0x0a, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65,
|
||||
0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x2e, 0x44,
|
||||
0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74,
|
||||
0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x2e, 0x5a, 0x2c, 0x67, 0x69, 0x74, 0x2e, 0x63,
|
||||
0x6f, 0x6f, 0x70, 0x67, 0x6f, 0x2e, 0x69, 0x6f, 0x2f, 0x63, 0x6f, 0x6f, 0x70, 0x67, 0x6f, 0x2d,
|
||||
0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x64, 0x61, 0x2f,
|
||||
0x67, 0x72, 0x70, 0x63, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -727,49 +853,54 @@ func file_agenda_proto_rawDescGZIP() []byte {
|
|||
return file_agenda_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_agenda_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
|
||||
var file_agenda_proto_msgTypes = make([]protoimpl.MessageInfo, 14)
|
||||
var file_agenda_proto_goTypes = []interface{}{
|
||||
(*CreateEventRequest)(nil), // 0: CreateEventRequest
|
||||
(*CreateEventResponse)(nil), // 1: CreateEventResponse
|
||||
(*GetEventRequest)(nil), // 2: GetEventRequest
|
||||
(*GetEventResponse)(nil), // 3: GetEventResponse
|
||||
(*DeleteEventRequest)(nil), // 4: DeleteEventRequest
|
||||
(*DeleteEventResponse)(nil), // 5: DeleteEventResponse
|
||||
(*GetEventsRequest)(nil), // 6: GetEventsRequest
|
||||
(*GetEventsResponse)(nil), // 7: GetEventsResponse
|
||||
(*SubscribeEventRequest)(nil), // 8: SubscribeEventRequest
|
||||
(*SubscribeEventResponse)(nil), // 9: SubscribeEventResponse
|
||||
(*UnsubscribeEventRequest)(nil), // 10: UnsubscribeEventRequest
|
||||
(*UnsubscribeEventResponse)(nil), // 11: UnsubscribeEventResponse
|
||||
(*Event)(nil), // 12: Event
|
||||
(*timestamppb.Timestamp)(nil), // 13: google.protobuf.Timestamp
|
||||
(*structpb.Struct)(nil), // 14: google.protobuf.Struct
|
||||
(*CreateEventRequest)(nil), // 0: CreateEventRequest
|
||||
(*CreateEventResponse)(nil), // 1: CreateEventResponse
|
||||
(*GetEventRequest)(nil), // 2: GetEventRequest
|
||||
(*GetEventResponse)(nil), // 3: GetEventResponse
|
||||
(*DeleteEventRequest)(nil), // 4: DeleteEventRequest
|
||||
(*DeleteEventResponse)(nil), // 5: DeleteEventResponse
|
||||
(*GetEventsRequest)(nil), // 6: GetEventsRequest
|
||||
(*GetEventsResponse)(nil), // 7: GetEventsResponse
|
||||
(*SubscribeEventRequest)(nil), // 8: SubscribeEventRequest
|
||||
(*SubscribeEventResponse)(nil), // 9: SubscribeEventResponse
|
||||
(*UnsubscribeEventRequest)(nil), // 10: UnsubscribeEventRequest
|
||||
(*UnsubscribeEventResponse)(nil), // 11: UnsubscribeEventResponse
|
||||
(*DeleteSubscriptionRequest)(nil), // 12: DeleteSubscriptionRequest
|
||||
(*DeleteSubscriptionResponse)(nil), // 13: DeleteSubscriptionResponse
|
||||
(*Event)(nil), // 14: Event
|
||||
(*timestamp.Timestamp)(nil), // 15: google.protobuf.Timestamp
|
||||
(*_struct.Struct)(nil), // 16: google.protobuf.Struct
|
||||
}
|
||||
var file_agenda_proto_depIdxs = []int32{
|
||||
12, // 0: CreateEventRequest.event:type_name -> Event
|
||||
12, // 1: CreateEventResponse.event:type_name -> Event
|
||||
12, // 2: GetEventResponse.event:type_name -> Event
|
||||
13, // 3: GetEventsRequest.mindate:type_name -> google.protobuf.Timestamp
|
||||
13, // 4: GetEventsRequest.maxdate:type_name -> google.protobuf.Timestamp
|
||||
12, // 5: GetEventsResponse.events:type_name -> Event
|
||||
14, // 6: SubscribeEventRequest.data:type_name -> google.protobuf.Struct
|
||||
0, // 7: Agenda.CreateEvent:input_type -> CreateEventRequest
|
||||
2, // 8: Agenda.GetEvent:input_type -> GetEventRequest
|
||||
6, // 9: Agenda.GetEvents:input_type -> GetEventsRequest
|
||||
4, // 10: Agenda.DeleteEvent:input_type -> DeleteEventRequest
|
||||
8, // 11: Agenda.SubscribeEvent:input_type -> SubscribeEventRequest
|
||||
10, // 12: Agenda.UnsubscribeEvent:input_type -> UnsubscribeEventRequest
|
||||
1, // 13: Agenda.CreateEvent:output_type -> CreateEventResponse
|
||||
3, // 14: Agenda.GetEvent:output_type -> GetEventResponse
|
||||
7, // 15: Agenda.GetEvents:output_type -> GetEventsResponse
|
||||
5, // 16: Agenda.DeleteEvent:output_type -> DeleteEventResponse
|
||||
9, // 17: Agenda.SubscribeEvent:output_type -> SubscribeEventResponse
|
||||
11, // 18: Agenda.UnsubscribeEvent:output_type -> UnsubscribeEventResponse
|
||||
13, // [13:19] is the sub-list for method output_type
|
||||
7, // [7:13] is the sub-list for method input_type
|
||||
7, // [7:7] is the sub-list for extension type_name
|
||||
7, // [7:7] is the sub-list for extension extendee
|
||||
0, // [0:7] is the sub-list for field type_name
|
||||
14, // 0: CreateEventRequest.event:type_name -> Event
|
||||
14, // 1: CreateEventResponse.event:type_name -> Event
|
||||
14, // 2: GetEventResponse.event:type_name -> Event
|
||||
15, // 3: GetEventsRequest.mindate:type_name -> google.protobuf.Timestamp
|
||||
15, // 4: GetEventsRequest.maxdate:type_name -> google.protobuf.Timestamp
|
||||
14, // 5: GetEventsResponse.events:type_name -> Event
|
||||
16, // 6: SubscribeEventRequest.data:type_name -> google.protobuf.Struct
|
||||
16, // 7: DeleteSubscriptionRequest.data:type_name -> google.protobuf.Struct
|
||||
0, // 8: Agenda.CreateEvent:input_type -> CreateEventRequest
|
||||
2, // 9: Agenda.GetEvent:input_type -> GetEventRequest
|
||||
6, // 10: Agenda.GetEvents:input_type -> GetEventsRequest
|
||||
4, // 11: Agenda.DeleteEvent:input_type -> DeleteEventRequest
|
||||
8, // 12: Agenda.SubscribeEvent:input_type -> SubscribeEventRequest
|
||||
10, // 13: Agenda.UnsubscribeEvent:input_type -> UnsubscribeEventRequest
|
||||
12, // 14: Agenda.DeleteSubscription:input_type -> DeleteSubscriptionRequest
|
||||
1, // 15: Agenda.CreateEvent:output_type -> CreateEventResponse
|
||||
3, // 16: Agenda.GetEvent:output_type -> GetEventResponse
|
||||
7, // 17: Agenda.GetEvents:output_type -> GetEventsResponse
|
||||
5, // 18: Agenda.DeleteEvent:output_type -> DeleteEventResponse
|
||||
9, // 19: Agenda.SubscribeEvent:output_type -> SubscribeEventResponse
|
||||
11, // 20: Agenda.UnsubscribeEvent:output_type -> UnsubscribeEventResponse
|
||||
13, // 21: Agenda.DeleteSubscription:output_type -> DeleteSubscriptionResponse
|
||||
15, // [15:22] is the sub-list for method output_type
|
||||
8, // [8:15] is the sub-list for method input_type
|
||||
8, // [8:8] is the sub-list for extension type_name
|
||||
8, // [8:8] is the sub-list for extension extendee
|
||||
0, // [0:8] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_agenda_proto_init() }
|
||||
|
@ -923,6 +1054,30 @@ func file_agenda_proto_init() {
|
|||
return nil
|
||||
}
|
||||
}
|
||||
file_agenda_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DeleteSubscriptionRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_agenda_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DeleteSubscriptionResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
|
@ -930,7 +1085,7 @@ func file_agenda_proto_init() {
|
|||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_agenda_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 12,
|
||||
NumMessages: 14,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
|
|
|
@ -16,6 +16,7 @@ service Agenda {
|
|||
|
||||
rpc SubscribeEvent(SubscribeEventRequest) returns (SubscribeEventResponse) {}
|
||||
rpc UnsubscribeEvent(UnsubscribeEventRequest) returns (UnsubscribeEventResponse) {}
|
||||
rpc DeleteSubscription(DeleteSubscriptionRequest) returns (DeleteSubscriptionResponse) {}
|
||||
}
|
||||
|
||||
message CreateEventRequest {
|
||||
|
@ -71,3 +72,13 @@ message UnsubscribeEventRequest {
|
|||
message UnsubscribeEventResponse {
|
||||
bool ok = 39;
|
||||
}
|
||||
|
||||
message DeleteSubscriptionRequest {
|
||||
string subscriber = 32;
|
||||
string eventid = 33;
|
||||
google.protobuf.Struct data = 34;
|
||||
}
|
||||
|
||||
message DeleteSubscriptionResponse {
|
||||
bool ok = 41;
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.2.0
|
||||
// - protoc v3.19.4
|
||||
// - protoc v3.12.4
|
||||
// source: agenda.proto
|
||||
|
||||
package grpcapi
|
||||
|
@ -28,6 +28,7 @@ type AgendaClient interface {
|
|||
DeleteEvent(ctx context.Context, in *DeleteEventRequest, opts ...grpc.CallOption) (*DeleteEventResponse, error)
|
||||
SubscribeEvent(ctx context.Context, in *SubscribeEventRequest, opts ...grpc.CallOption) (*SubscribeEventResponse, error)
|
||||
UnsubscribeEvent(ctx context.Context, in *UnsubscribeEventRequest, opts ...grpc.CallOption) (*UnsubscribeEventResponse, error)
|
||||
DeleteSubscription(ctx context.Context, in *DeleteSubscriptionRequest, opts ...grpc.CallOption) (*DeleteSubscriptionResponse, error)
|
||||
}
|
||||
|
||||
type agendaClient struct {
|
||||
|
@ -92,6 +93,15 @@ func (c *agendaClient) UnsubscribeEvent(ctx context.Context, in *UnsubscribeEven
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (c *agendaClient) DeleteSubscription(ctx context.Context, in *DeleteSubscriptionRequest, opts ...grpc.CallOption) (*DeleteSubscriptionResponse, error) {
|
||||
out := new(DeleteSubscriptionResponse)
|
||||
err := c.cc.Invoke(ctx, "/Agenda/DeleteSubscription", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// AgendaServer is the server API for Agenda service.
|
||||
// All implementations must embed UnimplementedAgendaServer
|
||||
// for forward compatibility
|
||||
|
@ -102,6 +112,7 @@ type AgendaServer interface {
|
|||
DeleteEvent(context.Context, *DeleteEventRequest) (*DeleteEventResponse, error)
|
||||
SubscribeEvent(context.Context, *SubscribeEventRequest) (*SubscribeEventResponse, error)
|
||||
UnsubscribeEvent(context.Context, *UnsubscribeEventRequest) (*UnsubscribeEventResponse, error)
|
||||
DeleteSubscription(context.Context, *DeleteSubscriptionRequest) (*DeleteSubscriptionResponse, error)
|
||||
mustEmbedUnimplementedAgendaServer()
|
||||
}
|
||||
|
||||
|
@ -127,6 +138,9 @@ func (UnimplementedAgendaServer) SubscribeEvent(context.Context, *SubscribeEvent
|
|||
func (UnimplementedAgendaServer) UnsubscribeEvent(context.Context, *UnsubscribeEventRequest) (*UnsubscribeEventResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UnsubscribeEvent not implemented")
|
||||
}
|
||||
func (UnimplementedAgendaServer) DeleteSubscription(context.Context, *DeleteSubscriptionRequest) (*DeleteSubscriptionResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DeleteSubscription not implemented")
|
||||
}
|
||||
func (UnimplementedAgendaServer) mustEmbedUnimplementedAgendaServer() {}
|
||||
|
||||
// UnsafeAgendaServer may be embedded to opt out of forward compatibility for this service.
|
||||
|
@ -248,6 +262,24 @@ func _Agenda_UnsubscribeEvent_Handler(srv interface{}, ctx context.Context, dec
|
|||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Agenda_DeleteSubscription_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DeleteSubscriptionRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AgendaServer).DeleteSubscription(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/Agenda/DeleteSubscription",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AgendaServer).DeleteSubscription(ctx, req.(*DeleteSubscriptionRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Agenda_ServiceDesc is the grpc.ServiceDesc for Agenda service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
|
@ -279,6 +311,10 @@ var Agenda_ServiceDesc = grpc.ServiceDesc{
|
|||
MethodName: "UnsubscribeEvent",
|
||||
Handler: _Agenda_UnsubscribeEvent_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DeleteSubscription",
|
||||
Handler: _Agenda_DeleteSubscription_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "agenda.proto",
|
||||
|
|
|
@ -94,6 +94,17 @@ func (s AgendaServerImpl) SubscribeEvent(ctx context.Context, req *SubscribeEven
|
|||
func (s AgendaServerImpl) UnsubscribeEvent(context.Context, *UnsubscribeEventRequest) (*UnsubscribeEventResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Unsubscribe not implemented")
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
func (s AgendaServerImpl) DeleteSubscription(ctx context.Context, req *DeleteSubscriptionRequest) (*DeleteSubscriptionResponse, error) {
|
||||
err := s.handler.DeleteSubscription(req.Eventid, req.Subscriber, req.Data.AsMap())
|
||||
return &DeleteSubscriptionResponse{
|
||||
Ok: err != nil,
|
||||
}, err
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
func (s AgendaServerImpl) mustEmbedUnimplementedAgendaServer() {}
|
||||
|
||||
func Run(done chan error, cfg *viper.Viper, handler handlers.AgendaHandler) {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,321 @@
|
|||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.2.0
|
||||
// - protoc v3.12.4
|
||||
// source: agenda.proto
|
||||
|
||||
package grpcapi
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.32.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
// AgendaClient is the client API for Agenda service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type AgendaClient interface {
|
||||
CreateEvent(ctx context.Context, in *CreateEventRequest, opts ...grpc.CallOption) (*CreateEventResponse, error)
|
||||
GetEvent(ctx context.Context, in *GetEventRequest, opts ...grpc.CallOption) (*GetEventResponse, error)
|
||||
GetEvents(ctx context.Context, in *GetEventsRequest, opts ...grpc.CallOption) (*GetEventsResponse, error)
|
||||
DeleteEvent(ctx context.Context, in *DeleteEventRequest, opts ...grpc.CallOption) (*DeleteEventResponse, error)
|
||||
SubscribeEvent(ctx context.Context, in *SubscribeEventRequest, opts ...grpc.CallOption) (*SubscribeEventResponse, error)
|
||||
UnsubscribeEvent(ctx context.Context, in *UnsubscribeEventRequest, opts ...grpc.CallOption) (*UnsubscribeEventResponse, error)
|
||||
DeleteSubscription(ctx context.Context, in *DeleteSubscriptionRequest, opts ...grpc.CallOption) (*DeleteSubscriptionResponse, error)
|
||||
}
|
||||
|
||||
type agendaClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewAgendaClient(cc grpc.ClientConnInterface) AgendaClient {
|
||||
return &agendaClient{cc}
|
||||
}
|
||||
|
||||
func (c *agendaClient) CreateEvent(ctx context.Context, in *CreateEventRequest, opts ...grpc.CallOption) (*CreateEventResponse, error) {
|
||||
out := new(CreateEventResponse)
|
||||
err := c.cc.Invoke(ctx, "/Agenda/CreateEvent", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *agendaClient) GetEvent(ctx context.Context, in *GetEventRequest, opts ...grpc.CallOption) (*GetEventResponse, error) {
|
||||
out := new(GetEventResponse)
|
||||
err := c.cc.Invoke(ctx, "/Agenda/GetEvent", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *agendaClient) GetEvents(ctx context.Context, in *GetEventsRequest, opts ...grpc.CallOption) (*GetEventsResponse, error) {
|
||||
out := new(GetEventsResponse)
|
||||
err := c.cc.Invoke(ctx, "/Agenda/GetEvents", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *agendaClient) DeleteEvent(ctx context.Context, in *DeleteEventRequest, opts ...grpc.CallOption) (*DeleteEventResponse, error) {
|
||||
out := new(DeleteEventResponse)
|
||||
err := c.cc.Invoke(ctx, "/Agenda/DeleteEvent", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *agendaClient) SubscribeEvent(ctx context.Context, in *SubscribeEventRequest, opts ...grpc.CallOption) (*SubscribeEventResponse, error) {
|
||||
out := new(SubscribeEventResponse)
|
||||
err := c.cc.Invoke(ctx, "/Agenda/SubscribeEvent", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *agendaClient) UnsubscribeEvent(ctx context.Context, in *UnsubscribeEventRequest, opts ...grpc.CallOption) (*UnsubscribeEventResponse, error) {
|
||||
out := new(UnsubscribeEventResponse)
|
||||
err := c.cc.Invoke(ctx, "/Agenda/UnsubscribeEvent", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *agendaClient) DeleteSubscription(ctx context.Context, in *DeleteSubscriptionRequest, opts ...grpc.CallOption) (*DeleteSubscriptionResponse, error) {
|
||||
out := new(DeleteSubscriptionResponse)
|
||||
err := c.cc.Invoke(ctx, "/Agenda/DeleteSubscription", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// AgendaServer is the server API for Agenda service.
|
||||
// All implementations must embed UnimplementedAgendaServer
|
||||
// for forward compatibility
|
||||
type AgendaServer interface {
|
||||
CreateEvent(context.Context, *CreateEventRequest) (*CreateEventResponse, error)
|
||||
GetEvent(context.Context, *GetEventRequest) (*GetEventResponse, error)
|
||||
GetEvents(context.Context, *GetEventsRequest) (*GetEventsResponse, error)
|
||||
DeleteEvent(context.Context, *DeleteEventRequest) (*DeleteEventResponse, error)
|
||||
SubscribeEvent(context.Context, *SubscribeEventRequest) (*SubscribeEventResponse, error)
|
||||
UnsubscribeEvent(context.Context, *UnsubscribeEventRequest) (*UnsubscribeEventResponse, error)
|
||||
DeleteSubscription(context.Context, *DeleteSubscriptionRequest) (*DeleteSubscriptionResponse, error)
|
||||
mustEmbedUnimplementedAgendaServer()
|
||||
}
|
||||
|
||||
// UnimplementedAgendaServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedAgendaServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedAgendaServer) CreateEvent(context.Context, *CreateEventRequest) (*CreateEventResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateEvent not implemented")
|
||||
}
|
||||
func (UnimplementedAgendaServer) GetEvent(context.Context, *GetEventRequest) (*GetEventResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetEvent not implemented")
|
||||
}
|
||||
func (UnimplementedAgendaServer) GetEvents(context.Context, *GetEventsRequest) (*GetEventsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetEvents not implemented")
|
||||
}
|
||||
func (UnimplementedAgendaServer) DeleteEvent(context.Context, *DeleteEventRequest) (*DeleteEventResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DeleteEvent not implemented")
|
||||
}
|
||||
func (UnimplementedAgendaServer) SubscribeEvent(context.Context, *SubscribeEventRequest) (*SubscribeEventResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SubscribeEvent not implemented")
|
||||
}
|
||||
func (UnimplementedAgendaServer) UnsubscribeEvent(context.Context, *UnsubscribeEventRequest) (*UnsubscribeEventResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UnsubscribeEvent not implemented")
|
||||
}
|
||||
func (UnimplementedAgendaServer) DeleteSubscription(context.Context, *DeleteSubscriptionRequest) (*DeleteSubscriptionResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DeleteSubscription not implemented")
|
||||
}
|
||||
func (UnimplementedAgendaServer) mustEmbedUnimplementedAgendaServer() {}
|
||||
|
||||
// UnsafeAgendaServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to AgendaServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeAgendaServer interface {
|
||||
mustEmbedUnimplementedAgendaServer()
|
||||
}
|
||||
|
||||
func RegisterAgendaServer(s grpc.ServiceRegistrar, srv AgendaServer) {
|
||||
s.RegisterService(&Agenda_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _Agenda_CreateEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CreateEventRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AgendaServer).CreateEvent(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/Agenda/CreateEvent",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AgendaServer).CreateEvent(ctx, req.(*CreateEventRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Agenda_GetEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetEventRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AgendaServer).GetEvent(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/Agenda/GetEvent",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AgendaServer).GetEvent(ctx, req.(*GetEventRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Agenda_GetEvents_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetEventsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AgendaServer).GetEvents(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/Agenda/GetEvents",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AgendaServer).GetEvents(ctx, req.(*GetEventsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Agenda_DeleteEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DeleteEventRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AgendaServer).DeleteEvent(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/Agenda/DeleteEvent",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AgendaServer).DeleteEvent(ctx, req.(*DeleteEventRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Agenda_SubscribeEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SubscribeEventRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AgendaServer).SubscribeEvent(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/Agenda/SubscribeEvent",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AgendaServer).SubscribeEvent(ctx, req.(*SubscribeEventRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Agenda_UnsubscribeEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(UnsubscribeEventRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AgendaServer).UnsubscribeEvent(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/Agenda/UnsubscribeEvent",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AgendaServer).UnsubscribeEvent(ctx, req.(*UnsubscribeEventRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Agenda_DeleteSubscription_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DeleteSubscriptionRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AgendaServer).DeleteSubscription(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/Agenda/DeleteSubscription",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AgendaServer).DeleteSubscription(ctx, req.(*DeleteSubscriptionRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Agenda_ServiceDesc is the grpc.ServiceDesc for Agenda service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var Agenda_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "Agenda",
|
||||
HandlerType: (*AgendaServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "CreateEvent",
|
||||
Handler: _Agenda_CreateEvent_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetEvent",
|
||||
Handler: _Agenda_GetEvent_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetEvents",
|
||||
Handler: _Agenda_GetEvents_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DeleteEvent",
|
||||
Handler: _Agenda_DeleteEvent_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SubscribeEvent",
|
||||
Handler: _Agenda_SubscribeEvent_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UnsubscribeEvent",
|
||||
Handler: _Agenda_UnsubscribeEvent_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DeleteSubscription",
|
||||
Handler: _Agenda_DeleteSubscription_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "agenda.proto",
|
||||
}
|
|
@ -70,3 +70,24 @@ func (h AgendaHandler) SubscribeEvent(eventid string, subscriber string, data ma
|
|||
err = h.storage.AddSubscription(eventid, subscription)
|
||||
return
|
||||
}
|
||||
|
||||
func (h AgendaHandler) DeleteSubscription(eventid string, subscriber string, data map[string]any) (err error) {
|
||||
if eventid == "" || subscriber == "" {
|
||||
return errors.New("missing eventid or subscriber")
|
||||
}
|
||||
now := time.Now()
|
||||
id := uuid.NewString()
|
||||
deletesubscription := storage.Subscription{
|
||||
ID: id,
|
||||
Subscriber: subscriber,
|
||||
Tags: []string{},
|
||||
CreatedAt: now,
|
||||
Data: map[string]any{},
|
||||
}
|
||||
// Initiate data map
|
||||
for k, v := range data {
|
||||
deletesubscription.Data[k] = v
|
||||
}
|
||||
err = h.storage.UpdateSubscription(eventid, subscriber, deletesubscription)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -3,21 +3,22 @@ package storage
|
|||
import "time"
|
||||
|
||||
type Event struct {
|
||||
ID string `json:"id" bson:"_id"`
|
||||
Namespace string `json:"namespace"`
|
||||
Owners []string `json:"owners"`
|
||||
RestrictedTo []string `json:"restricted_to"`
|
||||
Type string `json:"type"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Startdate time.Time `json:"startdate"`
|
||||
Enddate time.Time `json:"enddate"`
|
||||
Starttime string `json:"starttime"`
|
||||
Endtime string `json:"endtime"`
|
||||
Allday bool `json:"allday"`
|
||||
MaxSubscribers int64 `json:"max_subscribers"`
|
||||
Subscriptions []Subscription `json:"subscriptions" bson:"subscriptions,omitempty"`
|
||||
Data map[string]any `json:"data"`
|
||||
ID string `json:"id" bson:"_id"`
|
||||
Namespace string `json:"namespace"`
|
||||
Owners []string `json:"owners"`
|
||||
RestrictedTo []string `json:"restricted_to"`
|
||||
Type string `json:"type"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Startdate time.Time `json:"startdate"`
|
||||
Enddate time.Time `json:"enddate"`
|
||||
Starttime string `json:"starttime"`
|
||||
Endtime string `json:"endtime"`
|
||||
Allday bool `json:"allday"`
|
||||
MaxSubscribers int64 `json:"max_subscribers"`
|
||||
Subscriptions []Subscription `json:"subscriptions" bson:"subscriptions,omitempty"`
|
||||
DeletedSubscription []Subscription `json:"deletedsubscriptions" bson:"deletedsubscriptions,omitempty"`
|
||||
Data map[string]any `json:"data"`
|
||||
}
|
||||
|
||||
type Subscription struct {
|
||||
|
|
|
@ -121,12 +121,25 @@ func (s MongoDBStorage) AddSubscription(eventid string, subscription Subscriptio
|
|||
return err
|
||||
}
|
||||
|
||||
func (s MongoDBStorage) RemoveSubscription(subscriptionid string, subscription Subscription) error {
|
||||
func (s MongoDBStorage) UpdateSubscription(eventid string, subscriber string, deletesubscription Subscription) error {
|
||||
collection := s.Client.Database(s.DbName).Collection(s.Collections["events"])
|
||||
|
||||
filter := bson.M{"_id": subscriptionid}
|
||||
push := bson.M{"$pull": bson.M{"subscriptions": subscription}}
|
||||
event := &Event{}
|
||||
if errr := collection.FindOne(context.TODO(), bson.M{"_id": eventid}).Decode(event); errr != nil {
|
||||
return errr
|
||||
}
|
||||
|
||||
_, err := collection.UpdateOne(context.TODO(), filter, push)
|
||||
return err
|
||||
for i := range event.Subscriptions {
|
||||
if event.Subscriptions[i].Subscriber == subscriber {
|
||||
filter := bson.M{"_id": eventid}
|
||||
push := bson.M{"$push": bson.M{"deletesubscriptions": deletesubscription}}
|
||||
pull := bson.M{"$pull": bson.M{"subscriptions": bson.M{"subscriber": subscriber}}}
|
||||
_, er := collection.UpdateOne(context.TODO(), filter, push)
|
||||
if _, err := collection.UpdateOne(context.TODO(), filter, pull); err != nil {
|
||||
return err
|
||||
}
|
||||
return er
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ type Storage interface {
|
|||
GetEvent(string) (*Event, error)
|
||||
GetEvents(namespaces []string) ([]Event, error)
|
||||
AddSubscription(eventid string, subscription Subscription) error
|
||||
UpdateSubscription(eventid string, subscriber string, deletesubscription Subscription) error
|
||||
}
|
||||
type StorageImpl struct {
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue