diff --git a/proto/plugin/notification/v1/notification.pb.go b/proto/plugin/notification/v1/notification.pb.go new file mode 100644 index 0000000..403ec57 --- /dev/null +++ b/proto/plugin/notification/v1/notification.pb.go @@ -0,0 +1,287 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.35.2 +// protoc (unknown) +// source: plugin/notification/v1/notification.proto + +package v1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type NotificationType int32 + +const ( + NotificationType_EMAIL NotificationType = 0 // Email notification + NotificationType_TEXT NotificationType = 1 // Text message notification + NotificationType_WEB NotificationType = 2 // Web notification +) + +// Enum value maps for NotificationType. +var ( + NotificationType_name = map[int32]string{ + 0: "EMAIL", + 1: "TEXT", + 2: "WEB", + } + NotificationType_value = map[string]int32{ + "EMAIL": 0, + "TEXT": 1, + "WEB": 2, + } +) + +func (x NotificationType) Enum() *NotificationType { + p := new(NotificationType) + *p = x + return p +} + +func (x NotificationType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (NotificationType) Descriptor() protoreflect.EnumDescriptor { + return file_plugin_notification_v1_notification_proto_enumTypes[0].Descriptor() +} + +func (NotificationType) Type() protoreflect.EnumType { + return &file_plugin_notification_v1_notification_proto_enumTypes[0] +} + +func (x NotificationType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use NotificationType.Descriptor instead. +func (NotificationType) EnumDescriptor() ([]byte, []int) { + return file_plugin_notification_v1_notification_proto_rawDescGZIP(), []int{0} +} + +type SendNotificationRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NotificationType NotificationType `protobuf:"varint,1,opt,name=notification_type,json=notificationType,proto3,enum=NotificationType" json:"notification_type,omitempty"` // Type of notification (e.g., Email, Text, Web) + Recipients []string `protobuf:"bytes,2,rep,name=recipients,proto3" json:"recipients,omitempty"` // List of recipient addresses + Subject string `protobuf:"bytes,3,opt,name=subject,proto3" json:"subject,omitempty"` // Subject of the notification + Body string `protobuf:"bytes,4,opt,name=body,proto3" json:"body,omitempty"` // Body of the notification (HTML or Raw) +} + +func (x *SendNotificationRequest) Reset() { + *x = SendNotificationRequest{} + mi := &file_plugin_notification_v1_notification_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SendNotificationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendNotificationRequest) ProtoMessage() {} + +func (x *SendNotificationRequest) ProtoReflect() protoreflect.Message { + mi := &file_plugin_notification_v1_notification_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 SendNotificationRequest.ProtoReflect.Descriptor instead. +func (*SendNotificationRequest) Descriptor() ([]byte, []int) { + return file_plugin_notification_v1_notification_proto_rawDescGZIP(), []int{0} +} + +func (x *SendNotificationRequest) GetNotificationType() NotificationType { + if x != nil { + return x.NotificationType + } + return NotificationType_EMAIL +} + +func (x *SendNotificationRequest) GetRecipients() []string { + if x != nil { + return x.Recipients + } + return nil +} + +func (x *SendNotificationRequest) GetSubject() string { + if x != nil { + return x.Subject + } + return "" +} + +func (x *SendNotificationRequest) GetBody() string { + if x != nil { + return x.Body + } + return "" +} + +type SendNotificationResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` // Indicates if the notification was sent successfully + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` // Additional message or error details +} + +func (x *SendNotificationResponse) Reset() { + *x = SendNotificationResponse{} + mi := &file_plugin_notification_v1_notification_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SendNotificationResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendNotificationResponse) ProtoMessage() {} + +func (x *SendNotificationResponse) ProtoReflect() protoreflect.Message { + mi := &file_plugin_notification_v1_notification_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SendNotificationResponse.ProtoReflect.Descriptor instead. +func (*SendNotificationResponse) Descriptor() ([]byte, []int) { + return file_plugin_notification_v1_notification_proto_rawDescGZIP(), []int{1} +} + +func (x *SendNotificationResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *SendNotificationResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +var File_plugin_notification_v1_notification_proto protoreflect.FileDescriptor + +var file_plugin_notification_v1_notification_proto_rawDesc = []byte{ + 0x0a, 0x29, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2f, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa7, 0x01, 0x0a, 0x17, + 0x53, 0x65, 0x6e, 0x64, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3e, 0x0a, 0x11, 0x6e, 0x6f, 0x74, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x10, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x63, 0x69, 0x70, + 0x69, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x63, + 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x62, 0x6f, 0x64, 0x79, 0x22, 0x4e, 0x0a, 0x18, 0x53, 0x65, 0x6e, 0x64, 0x4e, 0x6f, 0x74, + 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x2a, 0x30, 0x0a, 0x10, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x4d, 0x41, + 0x49, 0x4c, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x54, 0x45, 0x58, 0x54, 0x10, 0x01, 0x12, 0x07, + 0x0a, 0x03, 0x57, 0x45, 0x42, 0x10, 0x02, 0x32, 0x5e, 0x0a, 0x13, 0x4e, 0x6f, 0x74, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x47, + 0x0a, 0x10, 0x53, 0x65, 0x6e, 0x64, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x18, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x53, + 0x65, 0x6e, 0x64, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x51, 0x42, 0x11, 0x4e, 0x6f, 0x74, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3a, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x6b, + 0x63, 0x6d, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2f, 0x6e, 0x6f, 0x74, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, +} + +var ( + file_plugin_notification_v1_notification_proto_rawDescOnce sync.Once + file_plugin_notification_v1_notification_proto_rawDescData = file_plugin_notification_v1_notification_proto_rawDesc +) + +func file_plugin_notification_v1_notification_proto_rawDescGZIP() []byte { + file_plugin_notification_v1_notification_proto_rawDescOnce.Do(func() { + file_plugin_notification_v1_notification_proto_rawDescData = protoimpl.X.CompressGZIP(file_plugin_notification_v1_notification_proto_rawDescData) + }) + return file_plugin_notification_v1_notification_proto_rawDescData +} + +var file_plugin_notification_v1_notification_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_plugin_notification_v1_notification_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_plugin_notification_v1_notification_proto_goTypes = []any{ + (NotificationType)(0), // 0: NotificationType + (*SendNotificationRequest)(nil), // 1: SendNotificationRequest + (*SendNotificationResponse)(nil), // 2: SendNotificationResponse +} +var file_plugin_notification_v1_notification_proto_depIdxs = []int32{ + 0, // 0: SendNotificationRequest.notification_type:type_name -> NotificationType + 1, // 1: NotificationService.SendNotification:input_type -> SendNotificationRequest + 2, // 2: NotificationService.SendNotification:output_type -> SendNotificationResponse + 2, // [2:3] is the sub-list for method output_type + 1, // [1:2] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_plugin_notification_v1_notification_proto_init() } +func file_plugin_notification_v1_notification_proto_init() { + if File_plugin_notification_v1_notification_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_plugin_notification_v1_notification_proto_rawDesc, + NumEnums: 1, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_plugin_notification_v1_notification_proto_goTypes, + DependencyIndexes: file_plugin_notification_v1_notification_proto_depIdxs, + EnumInfos: file_plugin_notification_v1_notification_proto_enumTypes, + MessageInfos: file_plugin_notification_v1_notification_proto_msgTypes, + }.Build() + File_plugin_notification_v1_notification_proto = out.File + file_plugin_notification_v1_notification_proto_rawDesc = nil + file_plugin_notification_v1_notification_proto_goTypes = nil + file_plugin_notification_v1_notification_proto_depIdxs = nil +} diff --git a/proto/plugin/notification/v1/notification.pb.validate.go b/proto/plugin/notification/v1/notification.pb.validate.go new file mode 100644 index 0000000..6a384ba --- /dev/null +++ b/proto/plugin/notification/v1/notification.pb.validate.go @@ -0,0 +1,250 @@ +// Code generated by protoc-gen-validate. DO NOT EDIT. +// source: plugin/notification/v1/notification.proto + +package v1 + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "sort" + "strings" + "time" + "unicode/utf8" + + "google.golang.org/protobuf/types/known/anypb" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = anypb.Any{} + _ = sort.Sort +) + +// Validate checks the field values on SendNotificationRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *SendNotificationRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on SendNotificationRequest with the +// rules defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// SendNotificationRequestMultiError, or nil if none found. +func (m *SendNotificationRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *SendNotificationRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for NotificationType + + // no validation rules for Subject + + // no validation rules for Body + + if len(errors) > 0 { + return SendNotificationRequestMultiError(errors) + } + + return nil +} + +// SendNotificationRequestMultiError is an error wrapping multiple validation +// errors returned by SendNotificationRequest.ValidateAll() if the designated +// constraints aren't met. +type SendNotificationRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m SendNotificationRequestMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m SendNotificationRequestMultiError) AllErrors() []error { return m } + +// SendNotificationRequestValidationError is the validation error returned by +// SendNotificationRequest.Validate if the designated constraints aren't met. +type SendNotificationRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e SendNotificationRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e SendNotificationRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e SendNotificationRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e SendNotificationRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e SendNotificationRequestValidationError) ErrorName() string { + return "SendNotificationRequestValidationError" +} + +// Error satisfies the builtin error interface +func (e SendNotificationRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sSendNotificationRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = SendNotificationRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = SendNotificationRequestValidationError{} + +// Validate checks the field values on SendNotificationResponse with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *SendNotificationResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on SendNotificationResponse with the +// rules defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// SendNotificationResponseMultiError, or nil if none found. +func (m *SendNotificationResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *SendNotificationResponse) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Success + + // no validation rules for Message + + if len(errors) > 0 { + return SendNotificationResponseMultiError(errors) + } + + return nil +} + +// SendNotificationResponseMultiError is an error wrapping multiple validation +// errors returned by SendNotificationResponse.ValidateAll() if the designated +// constraints aren't met. +type SendNotificationResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m SendNotificationResponseMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m SendNotificationResponseMultiError) AllErrors() []error { return m } + +// SendNotificationResponseValidationError is the validation error returned by +// SendNotificationResponse.Validate if the designated constraints aren't met. +type SendNotificationResponseValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e SendNotificationResponseValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e SendNotificationResponseValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e SendNotificationResponseValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e SendNotificationResponseValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e SendNotificationResponseValidationError) ErrorName() string { + return "SendNotificationResponseValidationError" +} + +// Error satisfies the builtin error interface +func (e SendNotificationResponseValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sSendNotificationResponse.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = SendNotificationResponseValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = SendNotificationResponseValidationError{} diff --git a/proto/plugin/notification/v1/notification.proto b/proto/plugin/notification/v1/notification.proto new file mode 100644 index 0000000..169284a --- /dev/null +++ b/proto/plugin/notification/v1/notification.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; +package plugin.notification.v1; + +service NotificationService { + // SendNotification sends a notification to the specified recipients + rpc SendNotification(SendNotificationRequest) returns (SendNotificationResponse); +} + +message SendNotificationRequest { + NotificationType notification_type = 1; // Type of notification (e.g., Email, Text, Web) + repeated string recipients = 2; // List of recipient addresses + string subject = 3; // Subject of the notification + string body = 4; // Body of the notification (HTML or Raw) +} + +enum NotificationType { + NOTIFICATION_TYPE_UNSPECIFIED = 0; // Unspecified notification type + NOTIFICATION_TYPE_EMAIL = 1; // Email notification + NOTIFICATION_TYPE_TEXT = 2; // Text message notification + NOTIFICATION_TYPE_WEB = 3; // Web notification +} + +message SendNotificationResponse { + bool success = 1; // Indicates if the notification was sent successfully + string message = 2; // Additional message or error details +} diff --git a/proto/plugin/notification/v1/notification_ext_plugin.pb.go b/proto/plugin/notification/v1/notification_ext_plugin.pb.go new file mode 100644 index 0000000..b605e46 --- /dev/null +++ b/proto/plugin/notification/v1/notification_ext_plugin.pb.go @@ -0,0 +1,55 @@ +// Code generated by protoc-gen-go-extension. DO NOT EDIT. + +package v1 + +import ( + api "github.com/openkcm/plugin-sdk/api" + grpc "google.golang.org/grpc" +) + +const ( + Type = "NotificationService" + GRPCServiceFullName = "NotificationService" +) + +func NotificationServicePluginServer(server NotificationServiceServer) api.PluginServer { + return notificationServicePluginServer{NotificationServiceServer: server} +} + +type notificationServicePluginServer struct { + NotificationServiceServer +} + +func (s notificationServicePluginServer) Type() string { + return Type +} + +func (s notificationServicePluginServer) GRPCServiceName() string { + return GRPCServiceFullName +} + +func (s notificationServicePluginServer) RegisterServer(server *grpc.Server) any { + RegisterNotificationServiceServer(server, s.NotificationServiceServer) + return s.NotificationServiceServer +} + +type NotificationServicePluginClient struct { + NotificationServiceClient +} + +func (s NotificationServicePluginClient) Type() string { + return Type +} + +func (c *NotificationServicePluginClient) IsInitialized() bool { + return c.NotificationServiceClient != nil +} + +func (c *NotificationServicePluginClient) GRPCServiceName() string { + return GRPCServiceFullName +} + +func (c *NotificationServicePluginClient) InitClient(conn grpc.ClientConnInterface) any { + c.NotificationServiceClient = NewNotificationServiceClient(conn) + return c.NotificationServiceClient +} diff --git a/proto/plugin/notification/v1/notification_grpc.pb.go b/proto/plugin/notification/v1/notification_grpc.pb.go new file mode 100644 index 0000000..0980f8a --- /dev/null +++ b/proto/plugin/notification/v1/notification_grpc.pb.go @@ -0,0 +1,111 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: plugin/notification/v1/notification.proto + +package v1 + +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 + +const ( + NotificationService_SendNotification_FullMethodName = "/NotificationService/SendNotification" +) + +// NotificationServiceClient is the client API for NotificationService 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 NotificationServiceClient interface { + // SendNotification sends a notification to the specified recipients + SendNotification(ctx context.Context, in *SendNotificationRequest, opts ...grpc.CallOption) (*SendNotificationResponse, error) +} + +type notificationServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewNotificationServiceClient(cc grpc.ClientConnInterface) NotificationServiceClient { + return ¬ificationServiceClient{cc} +} + +func (c *notificationServiceClient) SendNotification(ctx context.Context, in *SendNotificationRequest, opts ...grpc.CallOption) (*SendNotificationResponse, error) { + out := new(SendNotificationResponse) + err := c.cc.Invoke(ctx, NotificationService_SendNotification_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// NotificationServiceServer is the server API for NotificationService service. +// All implementations must embed UnimplementedNotificationServiceServer +// for forward compatibility +type NotificationServiceServer interface { + // SendNotification sends a notification to the specified recipients + SendNotification(context.Context, *SendNotificationRequest) (*SendNotificationResponse, error) + mustEmbedUnimplementedNotificationServiceServer() +} + +// UnimplementedNotificationServiceServer must be embedded to have forward compatible implementations. +type UnimplementedNotificationServiceServer struct { +} + +func (UnimplementedNotificationServiceServer) SendNotification(context.Context, *SendNotificationRequest) (*SendNotificationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SendNotification not implemented") +} +func (UnimplementedNotificationServiceServer) mustEmbedUnimplementedNotificationServiceServer() {} + +// UnsafeNotificationServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to NotificationServiceServer will +// result in compilation errors. +type UnsafeNotificationServiceServer interface { + mustEmbedUnimplementedNotificationServiceServer() +} + +func RegisterNotificationServiceServer(s grpc.ServiceRegistrar, srv NotificationServiceServer) { + s.RegisterService(&NotificationService_ServiceDesc, srv) +} + +func _NotificationService_SendNotification_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SendNotificationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NotificationServiceServer).SendNotification(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: NotificationService_SendNotification_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NotificationServiceServer).SendNotification(ctx, req.(*SendNotificationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// NotificationService_ServiceDesc is the grpc.ServiceDesc for NotificationService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var NotificationService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "NotificationService", + HandlerType: (*NotificationServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "SendNotification", + Handler: _NotificationService_SendNotification_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "plugin/notification/v1/notification.proto", +}