Compare commits
6 Commits
285ba7f94b
...
a383304f78
Author | SHA1 | Date | |
---|---|---|---|
a383304f78 | |||
decb5c661b | |||
32cb34f76a | |||
79873bdd8c | |||
21f87d049a | |||
ef361c44d1 |
2
.gitmodules
vendored
2
.gitmodules
vendored
@ -1,4 +1,4 @@
|
|||||||
[submodule "third_party/grpc-proto"]
|
[submodule "third_party/grpc-proto"]
|
||||||
path = third_party/grpc-proto
|
path = third_party/grpc-proto
|
||||||
url = https://git.dragse.it/anthrove/grpc-proto.git
|
url = https://git.dragse.it/anthrove/grpc-proto.git
|
||||||
branch = release/v3.0.0
|
branch = release/v3.2.0
|
@ -294,6 +294,7 @@ type PlugTaskCreation struct {
|
|||||||
UserSourceName string `protobuf:"bytes,2,opt,name=user_source_name,json=userSourceName,proto3" json:"user_source_name,omitempty"`
|
UserSourceName string `protobuf:"bytes,2,opt,name=user_source_name,json=userSourceName,proto3" json:"user_source_name,omitempty"`
|
||||||
DeepScrape bool `protobuf:"varint,3,opt,name=deep_scrape,json=deepScrape,proto3" json:"deep_scrape,omitempty"`
|
DeepScrape bool `protobuf:"varint,3,opt,name=deep_scrape,json=deepScrape,proto3" json:"deep_scrape,omitempty"`
|
||||||
ApiKey string `protobuf:"bytes,4,opt,name=api_key,json=apiKey,proto3" json:"api_key,omitempty"`
|
ApiKey string `protobuf:"bytes,4,opt,name=api_key,json=apiKey,proto3" json:"api_key,omitempty"`
|
||||||
|
UserSourceId string `protobuf:"bytes,5,opt,name=user_source_id,json=userSourceId,proto3" json:"user_source_id,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *PlugTaskCreation) Reset() {
|
func (x *PlugTaskCreation) Reset() {
|
||||||
@ -356,13 +357,21 @@ func (x *PlugTaskCreation) GetApiKey() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *PlugTaskCreation) GetUserSourceId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.UserSourceId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
type SendMessageRequest struct {
|
type SendMessageRequest struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
|
UserSourceId string `protobuf:"bytes,1,opt,name=user_source_id,json=userSourceId,proto3" json:"user_source_id,omitempty"`
|
||||||
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
|
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
|
||||||
|
UserSourceName string `protobuf:"bytes,3,opt,name=user_source_name,json=userSourceName,proto3" json:"user_source_name,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *SendMessageRequest) Reset() {
|
func (x *SendMessageRequest) Reset() {
|
||||||
@ -397,9 +406,9 @@ func (*SendMessageRequest) Descriptor() ([]byte, []int) {
|
|||||||
return file_plug_proto_rawDescGZIP(), []int{5}
|
return file_plug_proto_rawDescGZIP(), []int{5}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *SendMessageRequest) GetUserId() string {
|
func (x *SendMessageRequest) GetUserSourceId() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.UserId
|
return x.UserSourceId
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
@ -411,6 +420,13 @@ func (x *SendMessageRequest) GetMessage() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *SendMessageRequest) GetUserSourceName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.UserSourceName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
type SendMessageResponse struct {
|
type SendMessageResponse struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
@ -458,6 +474,187 @@ func (x *SendMessageResponse) GetSuccess() bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type GetMessagesRequest struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
UserSourceId string `protobuf:"bytes,1,opt,name=user_source_id,json=userSourceId,proto3" json:"user_source_id,omitempty"`
|
||||||
|
UserSourceName string `protobuf:"bytes,2,opt,name=user_source_name,json=userSourceName,proto3" json:"user_source_name,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetMessagesRequest) Reset() {
|
||||||
|
*x = GetMessagesRequest{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_plug_proto_msgTypes[7]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetMessagesRequest) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*GetMessagesRequest) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *GetMessagesRequest) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_plug_proto_msgTypes[7]
|
||||||
|
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 GetMessagesRequest.ProtoReflect.Descriptor instead.
|
||||||
|
func (*GetMessagesRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return file_plug_proto_rawDescGZIP(), []int{7}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetMessagesRequest) GetUserSourceId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.UserSourceId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetMessagesRequest) GetUserSourceName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.UserSourceName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetMessagesResponse struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Messages []*Message `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetMessagesResponse) Reset() {
|
||||||
|
*x = GetMessagesResponse{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_plug_proto_msgTypes[8]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetMessagesResponse) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*GetMessagesResponse) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *GetMessagesResponse) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_plug_proto_msgTypes[8]
|
||||||
|
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 GetMessagesResponse.ProtoReflect.Descriptor instead.
|
||||||
|
func (*GetMessagesResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return file_plug_proto_rawDescGZIP(), []int{8}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetMessagesResponse) GetMessages() []*Message {
|
||||||
|
if x != nil {
|
||||||
|
return x.Messages
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type Message struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
FromUserSourceId string `protobuf:"bytes,1,opt,name=from_user_source_id,json=fromUserSourceId,proto3" json:"from_user_source_id,omitempty"`
|
||||||
|
FromUserSourceName string `protobuf:"bytes,2,opt,name=from_user_source_name,json=fromUserSourceName,proto3" json:"from_user_source_name,omitempty"`
|
||||||
|
CreatedAt *timestamp.Timestamp `protobuf:"bytes,3,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
|
||||||
|
Body string `protobuf:"bytes,4,opt,name=body,proto3" json:"body,omitempty"`
|
||||||
|
Title string `protobuf:"bytes,5,opt,name=title,proto3" json:"title,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Message) Reset() {
|
||||||
|
*x = Message{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_plug_proto_msgTypes[9]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Message) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Message) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *Message) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_plug_proto_msgTypes[9]
|
||||||
|
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 Message.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Message) Descriptor() ([]byte, []int) {
|
||||||
|
return file_plug_proto_rawDescGZIP(), []int{9}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Message) GetFromUserSourceId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.FromUserSourceId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Message) GetFromUserSourceName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.FromUserSourceName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Message) GetCreatedAt() *timestamp.Timestamp {
|
||||||
|
if x != nil {
|
||||||
|
return x.CreatedAt
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Message) GetBody() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Body
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Message) GetTitle() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Title
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
var File_plug_proto protoreflect.FileDescriptor
|
var File_plug_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_plug_proto_rawDesc = []byte{
|
var file_plug_proto_rawDesc = []byte{
|
||||||
@ -484,7 +681,7 @@ var file_plug_proto_rawDesc = []byte{
|
|||||||
0x61, 0x74, 0x65, 0x52, 0x09, 0x74, 0x61, 0x73, 0x6b, 0x53, 0x74, 0x61, 0x74, 0x65, 0x22, 0x23,
|
0x61, 0x74, 0x65, 0x52, 0x09, 0x74, 0x61, 0x73, 0x6b, 0x53, 0x74, 0x61, 0x74, 0x65, 0x22, 0x23,
|
||||||
0x0a, 0x08, 0x50, 0x6c, 0x75, 0x67, 0x54, 0x61, 0x73, 0x6b, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x61,
|
0x0a, 0x08, 0x50, 0x6c, 0x75, 0x67, 0x54, 0x61, 0x73, 0x6b, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x61,
|
||||||
0x73, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x73,
|
0x73, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x73,
|
||||||
0x6b, 0x49, 0x64, 0x22, 0x8f, 0x01, 0x0a, 0x10, 0x50, 0x6c, 0x75, 0x67, 0x54, 0x61, 0x73, 0x6b,
|
0x6b, 0x49, 0x64, 0x22, 0xb5, 0x01, 0x0a, 0x10, 0x50, 0x6c, 0x75, 0x67, 0x54, 0x61, 0x73, 0x6b,
|
||||||
0x43, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72,
|
0x43, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72,
|
||||||
0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49,
|
0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49,
|
||||||
0x64, 0x12, 0x28, 0x0a, 0x10, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
|
0x64, 0x12, 0x28, 0x0a, 0x10, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
|
||||||
@ -493,38 +690,71 @@ var file_plug_proto_rawDesc = []byte{
|
|||||||
0x65, 0x65, 0x70, 0x5f, 0x73, 0x63, 0x72, 0x61, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08,
|
0x65, 0x65, 0x70, 0x5f, 0x73, 0x63, 0x72, 0x61, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08,
|
||||||
0x52, 0x0a, 0x64, 0x65, 0x65, 0x70, 0x53, 0x63, 0x72, 0x61, 0x70, 0x65, 0x12, 0x17, 0x0a, 0x07,
|
0x52, 0x0a, 0x64, 0x65, 0x65, 0x70, 0x53, 0x63, 0x72, 0x61, 0x70, 0x65, 0x12, 0x17, 0x0a, 0x07,
|
||||||
0x61, 0x70, 0x69, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61,
|
0x61, 0x70, 0x69, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61,
|
||||||
0x70, 0x69, 0x4b, 0x65, 0x79, 0x22, 0x47, 0x0a, 0x12, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73,
|
0x70, 0x69, 0x4b, 0x65, 0x79, 0x12, 0x24, 0x0a, 0x0e, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x6f,
|
||||||
0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x75,
|
0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x75,
|
||||||
0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73,
|
0x73, 0x65, 0x72, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, 0x22, 0x7e, 0x0a, 0x12, 0x53,
|
||||||
0x65, 0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18,
|
0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||||
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x2f,
|
0x74, 0x12, 0x24, 0x0a, 0x0e, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
|
||||||
0x0a, 0x13, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73,
|
0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x75, 0x73, 0x65, 0x72, 0x53,
|
||||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73,
|
0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61,
|
||||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x2a,
|
0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67,
|
||||||
0x43, 0x0a, 0x0d, 0x50, 0x6c, 0x75, 0x67, 0x54, 0x61, 0x73, 0x6b, 0x53, 0x74, 0x61, 0x74, 0x65,
|
0x65, 0x12, 0x28, 0x0a, 0x10, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
|
||||||
0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0b, 0x0a,
|
0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x75, 0x73, 0x65,
|
||||||
0x07, 0x53, 0x54, 0x41, 0x52, 0x54, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x55,
|
0x72, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x2f, 0x0a, 0x13, 0x53,
|
||||||
0x4e, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x54, 0x4f, 0x50, 0x50,
|
0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||||
0x45, 0x44, 0x10, 0x03, 0x32, 0xf3, 0x01, 0x0a, 0x0d, 0x50, 0x6c, 0x75, 0x67, 0x43, 0x6f, 0x6e,
|
0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20,
|
||||||
0x6e, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x2f, 0x0a, 0x09, 0x54, 0x61, 0x73, 0x6b, 0x53, 0x74,
|
0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x22, 0x64, 0x0a, 0x12,
|
||||||
0x61, 0x72, 0x74, 0x12, 0x11, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x54, 0x61, 0x73, 0x6b, 0x43, 0x72,
|
0x47, 0x65, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||||
0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x0f, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x54, 0x61, 0x73,
|
0x73, 0x74, 0x12, 0x24, 0x0a, 0x0e, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63,
|
||||||
0x6b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x28, 0x0a, 0x0a, 0x54, 0x61, 0x73, 0x6b, 0x53,
|
0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x75, 0x73, 0x65, 0x72,
|
||||||
0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x09, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x54, 0x61, 0x73, 0x6b,
|
0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, 0x12, 0x28, 0x0a, 0x10, 0x75, 0x73, 0x65, 0x72,
|
||||||
0x1a, 0x0f, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x54, 0x61, 0x73, 0x6b, 0x53, 0x74, 0x61, 0x74, 0x75,
|
0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01,
|
||||||
0x73, 0x12, 0x28, 0x0a, 0x0a, 0x54, 0x61, 0x73, 0x6b, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x12,
|
0x28, 0x09, 0x52, 0x0e, 0x75, 0x73, 0x65, 0x72, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61,
|
||||||
0x09, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x54, 0x61, 0x73, 0x6b, 0x1a, 0x0f, 0x2e, 0x50, 0x6c, 0x75,
|
0x6d, 0x65, 0x22, 0x3b, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
|
||||||
0x67, 0x54, 0x61, 0x73, 0x6b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x23, 0x0a, 0x04, 0x50,
|
0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x08, 0x6d, 0x65, 0x73,
|
||||||
0x69, 0x6e, 0x67, 0x12, 0x0c, 0x2e, 0x50, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x4d, 0x65,
|
||||||
0x74, 0x1a, 0x0d, 0x2e, 0x50, 0x6f, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x22,
|
||||||
0x12, 0x38, 0x0a, 0x0b, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12,
|
0xd0, 0x01, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x2d, 0x0a, 0x13, 0x66,
|
||||||
0x13, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71,
|
0x72, 0x6f, 0x6d, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f,
|
||||||
0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61,
|
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x66, 0x72, 0x6f, 0x6d, 0x55, 0x73,
|
||||||
0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x33, 0x5a, 0x31, 0x67, 0x69,
|
0x65, 0x72, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, 0x12, 0x31, 0x0a, 0x15, 0x66, 0x72,
|
||||||
0x74, 0x2e, 0x64, 0x72, 0x61, 0x67, 0x73, 0x65, 0x2e, 0x69, 0x74, 0x2f, 0x61, 0x6e, 0x74, 0x68,
|
0x6f, 0x6d, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6e,
|
||||||
0x72, 0x6f, 0x76, 0x65, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x2d, 0x5b, 0x52, 0x45, 0x50, 0x4c, 0x41,
|
0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x66, 0x72, 0x6f, 0x6d, 0x55,
|
||||||
0x43, 0x45, 0x5f, 0x4d, 0x45, 0x5d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x52, 0x50, 0x43, 0x62,
|
0x73, 0x65, 0x72, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x39, 0x0a,
|
||||||
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28,
|
||||||
|
0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||||
|
0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x63,
|
||||||
|
0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79,
|
||||||
|
0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x14, 0x0a, 0x05,
|
||||||
|
0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74,
|
||||||
|
0x6c, 0x65, 0x2a, 0x43, 0x0a, 0x0d, 0x50, 0x6c, 0x75, 0x67, 0x54, 0x61, 0x73, 0x6b, 0x53, 0x74,
|
||||||
|
0x61, 0x74, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00,
|
||||||
|
0x12, 0x0b, 0x0a, 0x07, 0x53, 0x54, 0x41, 0x52, 0x54, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0b, 0x0a,
|
||||||
|
0x07, 0x52, 0x55, 0x4e, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x54,
|
||||||
|
0x4f, 0x50, 0x50, 0x45, 0x44, 0x10, 0x03, 0x32, 0xb1, 0x02, 0x0a, 0x0d, 0x50, 0x6c, 0x75, 0x67,
|
||||||
|
0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x2f, 0x0a, 0x09, 0x54, 0x61, 0x73,
|
||||||
|
0x6b, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x11, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x54, 0x61, 0x73,
|
||||||
|
0x6b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x0f, 0x2e, 0x50, 0x6c, 0x75, 0x67,
|
||||||
|
0x54, 0x61, 0x73, 0x6b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x28, 0x0a, 0x0a, 0x54, 0x61,
|
||||||
|
0x73, 0x6b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x09, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x54,
|
||||||
|
0x61, 0x73, 0x6b, 0x1a, 0x0f, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x54, 0x61, 0x73, 0x6b, 0x53, 0x74,
|
||||||
|
0x61, 0x74, 0x75, 0x73, 0x12, 0x28, 0x0a, 0x0a, 0x54, 0x61, 0x73, 0x6b, 0x43, 0x61, 0x6e, 0x63,
|
||||||
|
0x65, 0x6c, 0x12, 0x09, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x54, 0x61, 0x73, 0x6b, 0x1a, 0x0f, 0x2e,
|
||||||
|
0x50, 0x6c, 0x75, 0x67, 0x54, 0x61, 0x73, 0x6b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x23,
|
||||||
|
0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x0c, 0x2e, 0x50, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71,
|
||||||
|
0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x50, 0x6f, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||||
|
0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x0b, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61,
|
||||||
|
0x67, 0x65, 0x12, 0x13, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
|
||||||
|
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65,
|
||||||
|
0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a,
|
||||||
|
0x0f, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73,
|
||||||
|
0x12, 0x13, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65,
|
||||||
|
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61,
|
||||||
|
0x67, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x33, 0x5a, 0x31, 0x67,
|
||||||
|
0x69, 0x74, 0x2e, 0x64, 0x72, 0x61, 0x67, 0x73, 0x65, 0x2e, 0x69, 0x74, 0x2f, 0x61, 0x6e, 0x74,
|
||||||
|
0x68, 0x72, 0x6f, 0x76, 0x65, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x2d, 0x5b, 0x52, 0x45, 0x50, 0x4c,
|
||||||
|
0x41, 0x43, 0x45, 0x5f, 0x4d, 0x45, 0x5d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x52, 0x50, 0x43,
|
||||||
|
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -540,7 +770,7 @@ func file_plug_proto_rawDescGZIP() []byte {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var file_plug_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
var file_plug_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||||
var file_plug_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
|
var file_plug_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
|
||||||
var file_plug_proto_goTypes = []interface{}{
|
var file_plug_proto_goTypes = []interface{}{
|
||||||
(PlugTaskState)(0), // 0: PlugTaskState
|
(PlugTaskState)(0), // 0: PlugTaskState
|
||||||
(*PingRequest)(nil), // 1: PingRequest
|
(*PingRequest)(nil), // 1: PingRequest
|
||||||
@ -550,27 +780,34 @@ var file_plug_proto_goTypes = []interface{}{
|
|||||||
(*PlugTaskCreation)(nil), // 5: PlugTaskCreation
|
(*PlugTaskCreation)(nil), // 5: PlugTaskCreation
|
||||||
(*SendMessageRequest)(nil), // 6: SendMessageRequest
|
(*SendMessageRequest)(nil), // 6: SendMessageRequest
|
||||||
(*SendMessageResponse)(nil), // 7: SendMessageResponse
|
(*SendMessageResponse)(nil), // 7: SendMessageResponse
|
||||||
(*timestamp.Timestamp)(nil), // 8: google.protobuf.Timestamp
|
(*GetMessagesRequest)(nil), // 8: GetMessagesRequest
|
||||||
|
(*GetMessagesResponse)(nil), // 9: GetMessagesResponse
|
||||||
|
(*Message)(nil), // 10: Message
|
||||||
|
(*timestamp.Timestamp)(nil), // 11: google.protobuf.Timestamp
|
||||||
}
|
}
|
||||||
var file_plug_proto_depIdxs = []int32{
|
var file_plug_proto_depIdxs = []int32{
|
||||||
8, // 0: PingRequest.timestamp:type_name -> google.protobuf.Timestamp
|
11, // 0: PingRequest.timestamp:type_name -> google.protobuf.Timestamp
|
||||||
8, // 1: PongResponse.timestamp:type_name -> google.protobuf.Timestamp
|
11, // 1: PongResponse.timestamp:type_name -> google.protobuf.Timestamp
|
||||||
0, // 2: PlugTaskStatus.task_state:type_name -> PlugTaskState
|
0, // 2: PlugTaskStatus.task_state:type_name -> PlugTaskState
|
||||||
5, // 3: PlugConnector.TaskStart:input_type -> PlugTaskCreation
|
10, // 3: GetMessagesResponse.messages:type_name -> Message
|
||||||
4, // 4: PlugConnector.TaskStatus:input_type -> PlugTask
|
11, // 4: Message.created_at:type_name -> google.protobuf.Timestamp
|
||||||
4, // 5: PlugConnector.TaskCancel:input_type -> PlugTask
|
5, // 5: PlugConnector.TaskStart:input_type -> PlugTaskCreation
|
||||||
1, // 6: PlugConnector.Ping:input_type -> PingRequest
|
4, // 6: PlugConnector.TaskStatus:input_type -> PlugTask
|
||||||
6, // 7: PlugConnector.SendMessage:input_type -> SendMessageRequest
|
4, // 7: PlugConnector.TaskCancel:input_type -> PlugTask
|
||||||
3, // 8: PlugConnector.TaskStart:output_type -> PlugTaskStatus
|
1, // 8: PlugConnector.Ping:input_type -> PingRequest
|
||||||
3, // 9: PlugConnector.TaskStatus:output_type -> PlugTaskStatus
|
6, // 9: PlugConnector.SendMessage:input_type -> SendMessageRequest
|
||||||
3, // 10: PlugConnector.TaskCancel:output_type -> PlugTaskStatus
|
8, // 10: PlugConnector.GetUserMessages:input_type -> GetMessagesRequest
|
||||||
2, // 11: PlugConnector.Ping:output_type -> PongResponse
|
3, // 11: PlugConnector.TaskStart:output_type -> PlugTaskStatus
|
||||||
7, // 12: PlugConnector.SendMessage:output_type -> SendMessageResponse
|
3, // 12: PlugConnector.TaskStatus:output_type -> PlugTaskStatus
|
||||||
8, // [8:13] is the sub-list for method output_type
|
3, // 13: PlugConnector.TaskCancel:output_type -> PlugTaskStatus
|
||||||
3, // [3:8] is the sub-list for method input_type
|
2, // 14: PlugConnector.Ping:output_type -> PongResponse
|
||||||
3, // [3:3] is the sub-list for extension type_name
|
7, // 15: PlugConnector.SendMessage:output_type -> SendMessageResponse
|
||||||
3, // [3:3] is the sub-list for extension extendee
|
9, // 16: PlugConnector.GetUserMessages:output_type -> GetMessagesResponse
|
||||||
0, // [0:3] is the sub-list for field type_name
|
11, // [11:17] is the sub-list for method output_type
|
||||||
|
5, // [5:11] is the sub-list for method input_type
|
||||||
|
5, // [5:5] is the sub-list for extension type_name
|
||||||
|
5, // [5:5] is the sub-list for extension extendee
|
||||||
|
0, // [0:5] is the sub-list for field type_name
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_plug_proto_init() }
|
func init() { file_plug_proto_init() }
|
||||||
@ -663,6 +900,42 @@ func file_plug_proto_init() {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
file_plug_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*GetMessagesRequest); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_plug_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*GetMessagesResponse); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_plug_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*Message); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
type x struct{}
|
type x struct{}
|
||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
@ -670,7 +943,7 @@ func file_plug_proto_init() {
|
|||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_plug_proto_rawDesc,
|
RawDescriptor: file_plug_proto_rawDesc,
|
||||||
NumEnums: 1,
|
NumEnums: 1,
|
||||||
NumMessages: 7,
|
NumMessages: 10,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 1,
|
NumServices: 1,
|
||||||
},
|
},
|
||||||
|
@ -27,6 +27,7 @@ type PlugConnectorClient interface {
|
|||||||
TaskCancel(ctx context.Context, in *PlugTask, opts ...grpc.CallOption) (*PlugTaskStatus, error)
|
TaskCancel(ctx context.Context, in *PlugTask, opts ...grpc.CallOption) (*PlugTaskStatus, error)
|
||||||
Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PongResponse, error)
|
Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PongResponse, error)
|
||||||
SendMessage(ctx context.Context, in *SendMessageRequest, opts ...grpc.CallOption) (*SendMessageResponse, error)
|
SendMessage(ctx context.Context, in *SendMessageRequest, opts ...grpc.CallOption) (*SendMessageResponse, error)
|
||||||
|
GetUserMessages(ctx context.Context, in *GetMessagesRequest, opts ...grpc.CallOption) (*GetMessagesResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type plugConnectorClient struct {
|
type plugConnectorClient struct {
|
||||||
@ -82,6 +83,15 @@ func (c *plugConnectorClient) SendMessage(ctx context.Context, in *SendMessageRe
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *plugConnectorClient) GetUserMessages(ctx context.Context, in *GetMessagesRequest, opts ...grpc.CallOption) (*GetMessagesResponse, error) {
|
||||||
|
out := new(GetMessagesResponse)
|
||||||
|
err := c.cc.Invoke(ctx, "/PlugConnector/GetUserMessages", in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
// PlugConnectorServer is the server API for PlugConnector service.
|
// PlugConnectorServer is the server API for PlugConnector service.
|
||||||
// All implementations must embed UnimplementedPlugConnectorServer
|
// All implementations must embed UnimplementedPlugConnectorServer
|
||||||
// for forward compatibility
|
// for forward compatibility
|
||||||
@ -91,6 +101,7 @@ type PlugConnectorServer interface {
|
|||||||
TaskCancel(context.Context, *PlugTask) (*PlugTaskStatus, error)
|
TaskCancel(context.Context, *PlugTask) (*PlugTaskStatus, error)
|
||||||
Ping(context.Context, *PingRequest) (*PongResponse, error)
|
Ping(context.Context, *PingRequest) (*PongResponse, error)
|
||||||
SendMessage(context.Context, *SendMessageRequest) (*SendMessageResponse, error)
|
SendMessage(context.Context, *SendMessageRequest) (*SendMessageResponse, error)
|
||||||
|
GetUserMessages(context.Context, *GetMessagesRequest) (*GetMessagesResponse, error)
|
||||||
mustEmbedUnimplementedPlugConnectorServer()
|
mustEmbedUnimplementedPlugConnectorServer()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,6 +124,9 @@ func (UnimplementedPlugConnectorServer) Ping(context.Context, *PingRequest) (*Po
|
|||||||
func (UnimplementedPlugConnectorServer) SendMessage(context.Context, *SendMessageRequest) (*SendMessageResponse, error) {
|
func (UnimplementedPlugConnectorServer) SendMessage(context.Context, *SendMessageRequest) (*SendMessageResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method SendMessage not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method SendMessage not implemented")
|
||||||
}
|
}
|
||||||
|
func (UnimplementedPlugConnectorServer) GetUserMessages(context.Context, *GetMessagesRequest) (*GetMessagesResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method GetUserMessages not implemented")
|
||||||
|
}
|
||||||
func (UnimplementedPlugConnectorServer) mustEmbedUnimplementedPlugConnectorServer() {}
|
func (UnimplementedPlugConnectorServer) mustEmbedUnimplementedPlugConnectorServer() {}
|
||||||
|
|
||||||
// UnsafePlugConnectorServer may be embedded to opt out of forward compatibility for this service.
|
// UnsafePlugConnectorServer may be embedded to opt out of forward compatibility for this service.
|
||||||
@ -216,6 +230,24 @@ func _PlugConnector_SendMessage_Handler(srv interface{}, ctx context.Context, de
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _PlugConnector_GetUserMessages_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(GetMessagesRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(PlugConnectorServer).GetUserMessages(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/PlugConnector/GetUserMessages",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(PlugConnectorServer).GetUserMessages(ctx, req.(*GetMessagesRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
// PlugConnector_ServiceDesc is the grpc.ServiceDesc for PlugConnector service.
|
// PlugConnector_ServiceDesc is the grpc.ServiceDesc for PlugConnector service.
|
||||||
// It's only intended for direct use with grpc.RegisterService,
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
// and not to be introspected or modified (even as a copy)
|
// and not to be introspected or modified (even as a copy)
|
||||||
@ -243,6 +275,10 @@ var PlugConnector_ServiceDesc = grpc.ServiceDesc{
|
|||||||
MethodName: "SendMessage",
|
MethodName: "SendMessage",
|
||||||
Handler: _PlugConnector_SendMessage_Handler,
|
Handler: _PlugConnector_SendMessage_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "GetUserMessages",
|
||||||
|
Handler: _PlugConnector_GetUserMessages_Handler,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc.StreamDesc{},
|
Streams: []grpc.StreamDesc{},
|
||||||
Metadata: "plug.proto",
|
Metadata: "plug.proto",
|
||||||
|
@ -18,14 +18,16 @@ type server struct {
|
|||||||
database database.OtterSpace
|
database database.OtterSpace
|
||||||
taskExecutionFunction TaskExecution
|
taskExecutionFunction TaskExecution
|
||||||
sendMessageExecution SendMessageExecution
|
sendMessageExecution SendMessageExecution
|
||||||
|
getMessageExecution GetMessageExecution
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewGrpcServer(database database.OtterSpace, taskExecutionFunction TaskExecution, sendMessageExecution SendMessageExecution) gRPC.PlugConnectorServer {
|
func NewGrpcServer(database database.OtterSpace, taskExecutionFunction TaskExecution, sendMessageExecution SendMessageExecution, getMessageExecution GetMessageExecution) gRPC.PlugConnectorServer {
|
||||||
return &server{
|
return &server{
|
||||||
ctx: make(map[string]context.CancelFunc),
|
ctx: make(map[string]context.CancelFunc),
|
||||||
database: database,
|
database: database,
|
||||||
taskExecutionFunction: taskExecutionFunction,
|
taskExecutionFunction: taskExecutionFunction,
|
||||||
sendMessageExecution: sendMessageExecution,
|
sendMessageExecution: sendMessageExecution,
|
||||||
|
getMessageExecution: getMessageExecution,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,10 +110,31 @@ func (s *server) Ping(_ context.Context, request *gRPC.PingRequest) (*gRPC.PongR
|
|||||||
func (s *server) SendMessage(ctx context.Context, request *gRPC.SendMessageRequest) (*gRPC.SendMessageResponse, error) {
|
func (s *server) SendMessage(ctx context.Context, request *gRPC.SendMessageRequest) (*gRPC.SendMessageResponse, error) {
|
||||||
messageResponse := gRPC.SendMessageResponse{Success: true}
|
messageResponse := gRPC.SendMessageResponse{Success: true}
|
||||||
|
|
||||||
err := s.sendMessageExecution(ctx, request.UserId, request.Message)
|
err := s.sendMessageExecution(ctx, request.UserSourceId, request.UserSourceName, request.Message)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return &messageResponse, nil
|
return &messageResponse, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *server) GetUserMessages(ctx context.Context, request *gRPC.GetMessagesRequest) (*gRPC.GetMessagesResponse, error) {
|
||||||
|
messageResponse := gRPC.GetMessagesResponse{}
|
||||||
|
|
||||||
|
messages, err := s.getMessageExecution(ctx, request.UserSourceId, request.UserSourceName)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, message := range messages {
|
||||||
|
messageResponse.Messages = append(messageResponse.Messages, &gRPC.Message{
|
||||||
|
FromUserSourceId: request.UserSourceId,
|
||||||
|
FromUserSourceName: request.UserSourceName,
|
||||||
|
CreatedAt: message.createdAt,
|
||||||
|
Body: message.body,
|
||||||
|
Title: message.title,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return &messageResponse, nil
|
||||||
|
}
|
||||||
|
@ -4,19 +4,26 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"git.dragse.it/anthrove/otter-space-sdk/v2/pkg/database"
|
||||||
otterError "git.dragse.it/anthrove/otter-space-sdk/v2/pkg/error"
|
otterError "git.dragse.it/anthrove/otter-space-sdk/v2/pkg/error"
|
||||||
|
"git.dragse.it/anthrove/otter-space-sdk/v2/pkg/models"
|
||||||
|
"github.com/golang/protobuf/ptypes/timestamp"
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
"git.dragse.it/anthrove/otter-space-sdk/v2/pkg/database"
|
|
||||||
"git.dragse.it/anthrove/otter-space-sdk/v2/pkg/models"
|
|
||||||
|
|
||||||
pb "git.dragse.it/anthrove/plug-sdk/v2/pkg/grpc"
|
pb "git.dragse.it/anthrove/plug-sdk/v2/pkg/grpc"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
)
|
)
|
||||||
|
|
||||||
type TaskExecution func(ctx context.Context, database database.OtterSpace, sourceUsername string, anthroveUser models.User, deepScrape bool, apiKey string, cancelFunction func()) error
|
type Message struct {
|
||||||
type SendMessageExecution func(ctx context.Context, userSourceID string, message string) error
|
title string
|
||||||
|
body string
|
||||||
|
createdAt *timestamp.Timestamp
|
||||||
|
}
|
||||||
|
|
||||||
|
type TaskExecution func(ctx context.Context, database database.OtterSpace, userSourceUsername string, anthroveUser models.User, deepScrape bool, apiKey string, cancelFunction func()) error
|
||||||
|
type SendMessageExecution func(ctx context.Context, userSourceID string, userSourceUsername string, message string) error
|
||||||
|
type GetMessageExecution func(ctx context.Context, userSourceID string, userSourceUsername string) ([]Message, error)
|
||||||
|
|
||||||
type Plug struct {
|
type Plug struct {
|
||||||
address string
|
address string
|
||||||
@ -25,6 +32,7 @@ type Plug struct {
|
|||||||
database database.OtterSpace
|
database database.OtterSpace
|
||||||
taskExecutionFunction TaskExecution
|
taskExecutionFunction TaskExecution
|
||||||
sendMessageExecution SendMessageExecution
|
sendMessageExecution SendMessageExecution
|
||||||
|
getMessageExecution GetMessageExecution
|
||||||
source models.Source
|
source models.Source
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,7 +63,7 @@ func (p *Plug) Listen() error {
|
|||||||
|
|
||||||
grpcServer := grpc.NewServer()
|
grpcServer := grpc.NewServer()
|
||||||
|
|
||||||
pb.RegisterPlugConnectorServer(grpcServer, NewGrpcServer(p.database, p.taskExecutionFunction, p.sendMessageExecution))
|
pb.RegisterPlugConnectorServer(grpcServer, NewGrpcServer(p.database, p.taskExecutionFunction, p.sendMessageExecution, p.getMessageExecution))
|
||||||
|
|
||||||
err = grpcServer.Serve(lis)
|
err = grpcServer.Serve(lis)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -76,3 +84,7 @@ func (p *Plug) TaskExecutionFunction(function TaskExecution) {
|
|||||||
func (p *Plug) SendMessageExecution(function SendMessageExecution) {
|
func (p *Plug) SendMessageExecution(function SendMessageExecution) {
|
||||||
p.sendMessageExecution = function
|
p.sendMessageExecution = function
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *Plug) GetMessageExecution(function GetMessageExecution) {
|
||||||
|
p.getMessageExecution = function
|
||||||
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
export PATH="$PATH:$(go env GOPATH)/bin"
|
||||||
|
|
||||||
mkdir -p "pkg/grpc"
|
mkdir -p "pkg/grpc"
|
||||||
|
|
||||||
protoc \
|
protoc \
|
||||||
|
2
third_party/grpc-proto
vendored
2
third_party/grpc-proto
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 9cd117f2c2cd0fcbe58325700c1074d73470387e
|
Subproject commit 241db7ceabcf9469e1121334c0803b3cdb4f99ad
|
Reference in New Issue
Block a user