feat(messaging): serve MessagingService.Deliver and deliver chat schedules through it

This commit is contained in:
sam committed 2026-10-05 18:01:33 +11:00
1 parent 4245c4320d
commit 463f4cd92a
22 files changed
+689 -46

No files matched your search

@@ -0,0 +1,185 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc (unknown)
// source: messaging/v1/messaging.proto
package messagingv1
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
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 DeliverRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
// channel names the channel, such as "telegram".
Channel string `protobuf:"bytes,1,opt,name=channel,proto3" json:"channel,omitempty"`
// chat_id is the channel-native chat identifier.
ChatId string `protobuf:"bytes,2,opt,name=chat_id,json=chatId,proto3" json:"chat_id,omitempty"`
Text string `protobuf:"bytes,3,opt,name=text,proto3" json:"text,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *DeliverRequest) Reset() {
*x = DeliverRequest{}
mi := &file_messaging_v1_messaging_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *DeliverRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeliverRequest) ProtoMessage() {}
func (x *DeliverRequest) ProtoReflect() protoreflect.Message {
mi := &file_messaging_v1_messaging_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 DeliverRequest.ProtoReflect.Descriptor instead.
func (*DeliverRequest) Descriptor() ([]byte, []int) {
return file_messaging_v1_messaging_proto_rawDescGZIP(), []int{0}
}
func (x *DeliverRequest) GetChannel() string {
if x != nil {
return x.Channel
}
return ""
}
func (x *DeliverRequest) GetChatId() string {
if x != nil {
return x.ChatId
}
return ""
}
func (x *DeliverRequest) GetText() string {
if x != nil {
return x.Text
}
return ""
}
type DeliverResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *DeliverResponse) Reset() {
*x = DeliverResponse{}
mi := &file_messaging_v1_messaging_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *DeliverResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeliverResponse) ProtoMessage() {}
func (x *DeliverResponse) ProtoReflect() protoreflect.Message {
mi := &file_messaging_v1_messaging_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 DeliverResponse.ProtoReflect.Descriptor instead.
func (*DeliverResponse) Descriptor() ([]byte, []int) {
return file_messaging_v1_messaging_proto_rawDescGZIP(), []int{1}
}
var File_messaging_v1_messaging_proto protoreflect.FileDescriptor
const file_messaging_v1_messaging_proto_rawDesc = "" +
"\n" +
"\x1cmessaging/v1/messaging.proto\x12\fmessaging.v1\"W\n" +
"\x0eDeliverRequest\x12\x18\n" +
"\achannel\x18\x01 \x01(\tR\achannel\x12\x17\n" +
"\achat_id\x18\x02 \x01(\tR\x06chatId\x12\x12\n" +
"\x04text\x18\x03 \x01(\tR\x04text\"\x11\n" +
"\x0fDeliverResponse2Z\n" +
"\x10MessagingService\x12F\n" +
"\aDeliver\x12\x1c.messaging.v1.DeliverRequest\x1a\x1d.messaging.v1.DeliverResponseB\xc4\x01\n" +
"\x10com.messaging.v1B\x0eMessagingProtoP\x01ZOgithub.com/samcharles93/archie-core/internal/contracts/messaging/v1;messagingv1\xa2\x02\x03MXX\xaa\x02\fMessaging.V1\xca\x02\fMessaging\\V1\xe2\x02\x18Messaging\\V1\\GPBMetadata\xea\x02\rMessaging::V1b\x06proto3"
var (
file_messaging_v1_messaging_proto_rawDescOnce sync.Once
file_messaging_v1_messaging_proto_rawDescData []byte
)
func file_messaging_v1_messaging_proto_rawDescGZIP() []byte {
file_messaging_v1_messaging_proto_rawDescOnce.Do(func() {
file_messaging_v1_messaging_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_messaging_v1_messaging_proto_rawDesc), len(file_messaging_v1_messaging_proto_rawDesc)))
})
return file_messaging_v1_messaging_proto_rawDescData
}
var file_messaging_v1_messaging_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_messaging_v1_messaging_proto_goTypes = []any{
(*DeliverRequest)(nil), // 0: messaging.v1.DeliverRequest
(*DeliverResponse)(nil), // 1: messaging.v1.DeliverResponse
}
var file_messaging_v1_messaging_proto_depIdxs = []int32{
0, // 0: messaging.v1.MessagingService.Deliver:input_type -> messaging.v1.DeliverRequest
1, // 1: messaging.v1.MessagingService.Deliver:output_type -> messaging.v1.DeliverResponse
1, // [1:2] is the sub-list for method output_type
0, // [0:1] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_messaging_v1_messaging_proto_init() }
func file_messaging_v1_messaging_proto_init() {
if File_messaging_v1_messaging_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_messaging_v1_messaging_proto_rawDesc), len(file_messaging_v1_messaging_proto_rawDesc)),
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_messaging_v1_messaging_proto_goTypes,
DependencyIndexes: file_messaging_v1_messaging_proto_depIdxs,
MessageInfos: file_messaging_v1_messaging_proto_msgTypes,
}.Build()
File_messaging_v1_messaging_proto = out.File
file_messaging_v1_messaging_proto_goTypes = nil
file_messaging_v1_messaging_proto_depIdxs = nil
}
@@ -0,0 +1,133 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.2
// - protoc (unknown)
// source: messaging/v1/messaging.proto
package messagingv1
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.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
MessagingService_Deliver_FullMethodName = "/messaging.v1.MessagingService/Deliver"
)
// MessagingServiceClient is the client API for MessagingService 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.
//
// MessagingService is the Messaging Service's contract: the process that holds
// the chat channel transports. Other services send outbound messages through
// it rather than holding channel credentials themselves.
type MessagingServiceClient interface {
// Deliver sends text to one chat on one channel. FAILED_PRECONDITION means
// the channel is not running or cannot send; the caller may retry later.
Deliver(ctx context.Context, in *DeliverRequest, opts ...grpc.CallOption) (*DeliverResponse, error)
}
type messagingServiceClient struct {
cc grpc.ClientConnInterface
}
func NewMessagingServiceClient(cc grpc.ClientConnInterface) MessagingServiceClient {
return &messagingServiceClient{cc}
}
func (c *messagingServiceClient) Deliver(ctx context.Context, in *DeliverRequest, opts ...grpc.CallOption) (*DeliverResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(DeliverResponse)
err := c.cc.Invoke(ctx, MessagingService_Deliver_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// MessagingServiceServer is the server API for MessagingService service.
// All implementations must embed UnimplementedMessagingServiceServer
// for forward compatibility.
//
// MessagingService is the Messaging Service's contract: the process that holds
// the chat channel transports. Other services send outbound messages through
// it rather than holding channel credentials themselves.
type MessagingServiceServer interface {
// Deliver sends text to one chat on one channel. FAILED_PRECONDITION means
// the channel is not running or cannot send; the caller may retry later.
Deliver(context.Context, *DeliverRequest) (*DeliverResponse, error)
mustEmbedUnimplementedMessagingServiceServer()
}
// UnimplementedMessagingServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedMessagingServiceServer struct{}
func (UnimplementedMessagingServiceServer) Deliver(context.Context, *DeliverRequest) (*DeliverResponse, error) {
return nil, status.Error(codes.Unimplemented, "method Deliver not implemented")
}
func (UnimplementedMessagingServiceServer) mustEmbedUnimplementedMessagingServiceServer() {}
func (UnimplementedMessagingServiceServer) testEmbeddedByValue() {}
// UnsafeMessagingServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to MessagingServiceServer will
// result in compilation errors.
type UnsafeMessagingServiceServer interface {
mustEmbedUnimplementedMessagingServiceServer()
}
func RegisterMessagingServiceServer(s grpc.ServiceRegistrar, srv MessagingServiceServer) {
// If the following call panics, it indicates UnimplementedMessagingServiceServer 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(&MessagingService_ServiceDesc, srv)
}
func _MessagingService_Deliver_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeliverRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MessagingServiceServer).Deliver(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: MessagingService_Deliver_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MessagingServiceServer).Deliver(ctx, req.(*DeliverRequest))
}
return interceptor(ctx, in, info, handler)
}
// MessagingService_ServiceDesc is the grpc.ServiceDesc for MessagingService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var MessagingService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "messaging.v1.MessagingService",
HandlerType: (*MessagingServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Deliver",
Handler: _MessagingService_Deliver_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "messaging/v1/messaging.proto",
}