Rename streams to threads (#55)

This commit is contained in:
Asim Aslam
2021-01-29 14:11:04 +00:00
committed by GitHub
parent bdc63a699c
commit 253c153706
32 changed files with 1047 additions and 1597 deletions

911
threads/proto/threads.pb.go Normal file
View File

@@ -0,0 +1,911 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: proto/threads.proto
package threads
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
timestamp "github.com/golang/protobuf/ptypes/timestamp"
wrappers "github.com/golang/protobuf/ptypes/wrappers"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type Conversation struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
GroupId string `protobuf:"bytes,2,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"`
Topic string `protobuf:"bytes,3,opt,name=topic,proto3" json:"topic,omitempty"`
CreatedAt *timestamp.Timestamp `protobuf:"bytes,4,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Conversation) Reset() { *m = Conversation{} }
func (m *Conversation) String() string { return proto.CompactTextString(m) }
func (*Conversation) ProtoMessage() {}
func (*Conversation) Descriptor() ([]byte, []int) {
return fileDescriptor_78fcd0275ccaea0d, []int{0}
}
func (m *Conversation) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Conversation.Unmarshal(m, b)
}
func (m *Conversation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Conversation.Marshal(b, m, deterministic)
}
func (m *Conversation) XXX_Merge(src proto.Message) {
xxx_messageInfo_Conversation.Merge(m, src)
}
func (m *Conversation) XXX_Size() int {
return xxx_messageInfo_Conversation.Size(m)
}
func (m *Conversation) XXX_DiscardUnknown() {
xxx_messageInfo_Conversation.DiscardUnknown(m)
}
var xxx_messageInfo_Conversation proto.InternalMessageInfo
func (m *Conversation) GetId() string {
if m != nil {
return m.Id
}
return ""
}
func (m *Conversation) GetGroupId() string {
if m != nil {
return m.GroupId
}
return ""
}
func (m *Conversation) GetTopic() string {
if m != nil {
return m.Topic
}
return ""
}
func (m *Conversation) GetCreatedAt() *timestamp.Timestamp {
if m != nil {
return m.CreatedAt
}
return nil
}
type Message struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
AuthorId string `protobuf:"bytes,2,opt,name=author_id,json=authorId,proto3" json:"author_id,omitempty"`
ConversationId string `protobuf:"bytes,3,opt,name=conversation_id,json=conversationId,proto3" json:"conversation_id,omitempty"`
Text string `protobuf:"bytes,4,opt,name=text,proto3" json:"text,omitempty"`
SentAt *timestamp.Timestamp `protobuf:"bytes,5,opt,name=sent_at,json=sentAt,proto3" json:"sent_at,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Message) Reset() { *m = Message{} }
func (m *Message) String() string { return proto.CompactTextString(m) }
func (*Message) ProtoMessage() {}
func (*Message) Descriptor() ([]byte, []int) {
return fileDescriptor_78fcd0275ccaea0d, []int{1}
}
func (m *Message) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Message.Unmarshal(m, b)
}
func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Message.Marshal(b, m, deterministic)
}
func (m *Message) XXX_Merge(src proto.Message) {
xxx_messageInfo_Message.Merge(m, src)
}
func (m *Message) XXX_Size() int {
return xxx_messageInfo_Message.Size(m)
}
func (m *Message) XXX_DiscardUnknown() {
xxx_messageInfo_Message.DiscardUnknown(m)
}
var xxx_messageInfo_Message proto.InternalMessageInfo
func (m *Message) GetId() string {
if m != nil {
return m.Id
}
return ""
}
func (m *Message) GetAuthorId() string {
if m != nil {
return m.AuthorId
}
return ""
}
func (m *Message) GetConversationId() string {
if m != nil {
return m.ConversationId
}
return ""
}
func (m *Message) GetText() string {
if m != nil {
return m.Text
}
return ""
}
func (m *Message) GetSentAt() *timestamp.Timestamp {
if m != nil {
return m.SentAt
}
return nil
}
type CreateConversationRequest struct {
GroupId string `protobuf:"bytes,1,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"`
Topic string `protobuf:"bytes,2,opt,name=topic,proto3" json:"topic,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *CreateConversationRequest) Reset() { *m = CreateConversationRequest{} }
func (m *CreateConversationRequest) String() string { return proto.CompactTextString(m) }
func (*CreateConversationRequest) ProtoMessage() {}
func (*CreateConversationRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_78fcd0275ccaea0d, []int{2}
}
func (m *CreateConversationRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreateConversationRequest.Unmarshal(m, b)
}
func (m *CreateConversationRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CreateConversationRequest.Marshal(b, m, deterministic)
}
func (m *CreateConversationRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_CreateConversationRequest.Merge(m, src)
}
func (m *CreateConversationRequest) XXX_Size() int {
return xxx_messageInfo_CreateConversationRequest.Size(m)
}
func (m *CreateConversationRequest) XXX_DiscardUnknown() {
xxx_messageInfo_CreateConversationRequest.DiscardUnknown(m)
}
var xxx_messageInfo_CreateConversationRequest proto.InternalMessageInfo
func (m *CreateConversationRequest) GetGroupId() string {
if m != nil {
return m.GroupId
}
return ""
}
func (m *CreateConversationRequest) GetTopic() string {
if m != nil {
return m.Topic
}
return ""
}
type CreateConversationResponse struct {
Conversation *Conversation `protobuf:"bytes,1,opt,name=conversation,proto3" json:"conversation,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *CreateConversationResponse) Reset() { *m = CreateConversationResponse{} }
func (m *CreateConversationResponse) String() string { return proto.CompactTextString(m) }
func (*CreateConversationResponse) ProtoMessage() {}
func (*CreateConversationResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_78fcd0275ccaea0d, []int{3}
}
func (m *CreateConversationResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreateConversationResponse.Unmarshal(m, b)
}
func (m *CreateConversationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CreateConversationResponse.Marshal(b, m, deterministic)
}
func (m *CreateConversationResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_CreateConversationResponse.Merge(m, src)
}
func (m *CreateConversationResponse) XXX_Size() int {
return xxx_messageInfo_CreateConversationResponse.Size(m)
}
func (m *CreateConversationResponse) XXX_DiscardUnknown() {
xxx_messageInfo_CreateConversationResponse.DiscardUnknown(m)
}
var xxx_messageInfo_CreateConversationResponse proto.InternalMessageInfo
func (m *CreateConversationResponse) GetConversation() *Conversation {
if m != nil {
return m.Conversation
}
return nil
}
type ReadConversationRequest struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
GroupId *wrappers.StringValue `protobuf:"bytes,2,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ReadConversationRequest) Reset() { *m = ReadConversationRequest{} }
func (m *ReadConversationRequest) String() string { return proto.CompactTextString(m) }
func (*ReadConversationRequest) ProtoMessage() {}
func (*ReadConversationRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_78fcd0275ccaea0d, []int{4}
}
func (m *ReadConversationRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReadConversationRequest.Unmarshal(m, b)
}
func (m *ReadConversationRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReadConversationRequest.Marshal(b, m, deterministic)
}
func (m *ReadConversationRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReadConversationRequest.Merge(m, src)
}
func (m *ReadConversationRequest) XXX_Size() int {
return xxx_messageInfo_ReadConversationRequest.Size(m)
}
func (m *ReadConversationRequest) XXX_DiscardUnknown() {
xxx_messageInfo_ReadConversationRequest.DiscardUnknown(m)
}
var xxx_messageInfo_ReadConversationRequest proto.InternalMessageInfo
func (m *ReadConversationRequest) GetId() string {
if m != nil {
return m.Id
}
return ""
}
func (m *ReadConversationRequest) GetGroupId() *wrappers.StringValue {
if m != nil {
return m.GroupId
}
return nil
}
type ReadConversationResponse struct {
Conversation *Conversation `protobuf:"bytes,1,opt,name=conversation,proto3" json:"conversation,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ReadConversationResponse) Reset() { *m = ReadConversationResponse{} }
func (m *ReadConversationResponse) String() string { return proto.CompactTextString(m) }
func (*ReadConversationResponse) ProtoMessage() {}
func (*ReadConversationResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_78fcd0275ccaea0d, []int{5}
}
func (m *ReadConversationResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReadConversationResponse.Unmarshal(m, b)
}
func (m *ReadConversationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReadConversationResponse.Marshal(b, m, deterministic)
}
func (m *ReadConversationResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReadConversationResponse.Merge(m, src)
}
func (m *ReadConversationResponse) XXX_Size() int {
return xxx_messageInfo_ReadConversationResponse.Size(m)
}
func (m *ReadConversationResponse) XXX_DiscardUnknown() {
xxx_messageInfo_ReadConversationResponse.DiscardUnknown(m)
}
var xxx_messageInfo_ReadConversationResponse proto.InternalMessageInfo
func (m *ReadConversationResponse) GetConversation() *Conversation {
if m != nil {
return m.Conversation
}
return nil
}
type ListConversationsRequest struct {
GroupId string `protobuf:"bytes,1,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ListConversationsRequest) Reset() { *m = ListConversationsRequest{} }
func (m *ListConversationsRequest) String() string { return proto.CompactTextString(m) }
func (*ListConversationsRequest) ProtoMessage() {}
func (*ListConversationsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_78fcd0275ccaea0d, []int{6}
}
func (m *ListConversationsRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListConversationsRequest.Unmarshal(m, b)
}
func (m *ListConversationsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ListConversationsRequest.Marshal(b, m, deterministic)
}
func (m *ListConversationsRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_ListConversationsRequest.Merge(m, src)
}
func (m *ListConversationsRequest) XXX_Size() int {
return xxx_messageInfo_ListConversationsRequest.Size(m)
}
func (m *ListConversationsRequest) XXX_DiscardUnknown() {
xxx_messageInfo_ListConversationsRequest.DiscardUnknown(m)
}
var xxx_messageInfo_ListConversationsRequest proto.InternalMessageInfo
func (m *ListConversationsRequest) GetGroupId() string {
if m != nil {
return m.GroupId
}
return ""
}
type ListConversationsResponse struct {
Conversations []*Conversation `protobuf:"bytes,1,rep,name=conversations,proto3" json:"conversations,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ListConversationsResponse) Reset() { *m = ListConversationsResponse{} }
func (m *ListConversationsResponse) String() string { return proto.CompactTextString(m) }
func (*ListConversationsResponse) ProtoMessage() {}
func (*ListConversationsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_78fcd0275ccaea0d, []int{7}
}
func (m *ListConversationsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListConversationsResponse.Unmarshal(m, b)
}
func (m *ListConversationsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ListConversationsResponse.Marshal(b, m, deterministic)
}
func (m *ListConversationsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_ListConversationsResponse.Merge(m, src)
}
func (m *ListConversationsResponse) XXX_Size() int {
return xxx_messageInfo_ListConversationsResponse.Size(m)
}
func (m *ListConversationsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_ListConversationsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_ListConversationsResponse proto.InternalMessageInfo
func (m *ListConversationsResponse) GetConversations() []*Conversation {
if m != nil {
return m.Conversations
}
return nil
}
type UpdateConversationRequest struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Topic string `protobuf:"bytes,2,opt,name=topic,proto3" json:"topic,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *UpdateConversationRequest) Reset() { *m = UpdateConversationRequest{} }
func (m *UpdateConversationRequest) String() string { return proto.CompactTextString(m) }
func (*UpdateConversationRequest) ProtoMessage() {}
func (*UpdateConversationRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_78fcd0275ccaea0d, []int{8}
}
func (m *UpdateConversationRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UpdateConversationRequest.Unmarshal(m, b)
}
func (m *UpdateConversationRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_UpdateConversationRequest.Marshal(b, m, deterministic)
}
func (m *UpdateConversationRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_UpdateConversationRequest.Merge(m, src)
}
func (m *UpdateConversationRequest) XXX_Size() int {
return xxx_messageInfo_UpdateConversationRequest.Size(m)
}
func (m *UpdateConversationRequest) XXX_DiscardUnknown() {
xxx_messageInfo_UpdateConversationRequest.DiscardUnknown(m)
}
var xxx_messageInfo_UpdateConversationRequest proto.InternalMessageInfo
func (m *UpdateConversationRequest) GetId() string {
if m != nil {
return m.Id
}
return ""
}
func (m *UpdateConversationRequest) GetTopic() string {
if m != nil {
return m.Topic
}
return ""
}
type UpdateConversationResponse struct {
Conversation *Conversation `protobuf:"bytes,1,opt,name=conversation,proto3" json:"conversation,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *UpdateConversationResponse) Reset() { *m = UpdateConversationResponse{} }
func (m *UpdateConversationResponse) String() string { return proto.CompactTextString(m) }
func (*UpdateConversationResponse) ProtoMessage() {}
func (*UpdateConversationResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_78fcd0275ccaea0d, []int{9}
}
func (m *UpdateConversationResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UpdateConversationResponse.Unmarshal(m, b)
}
func (m *UpdateConversationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_UpdateConversationResponse.Marshal(b, m, deterministic)
}
func (m *UpdateConversationResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_UpdateConversationResponse.Merge(m, src)
}
func (m *UpdateConversationResponse) XXX_Size() int {
return xxx_messageInfo_UpdateConversationResponse.Size(m)
}
func (m *UpdateConversationResponse) XXX_DiscardUnknown() {
xxx_messageInfo_UpdateConversationResponse.DiscardUnknown(m)
}
var xxx_messageInfo_UpdateConversationResponse proto.InternalMessageInfo
func (m *UpdateConversationResponse) GetConversation() *Conversation {
if m != nil {
return m.Conversation
}
return nil
}
type DeleteConversationRequest struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *DeleteConversationRequest) Reset() { *m = DeleteConversationRequest{} }
func (m *DeleteConversationRequest) String() string { return proto.CompactTextString(m) }
func (*DeleteConversationRequest) ProtoMessage() {}
func (*DeleteConversationRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_78fcd0275ccaea0d, []int{10}
}
func (m *DeleteConversationRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DeleteConversationRequest.Unmarshal(m, b)
}
func (m *DeleteConversationRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_DeleteConversationRequest.Marshal(b, m, deterministic)
}
func (m *DeleteConversationRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_DeleteConversationRequest.Merge(m, src)
}
func (m *DeleteConversationRequest) XXX_Size() int {
return xxx_messageInfo_DeleteConversationRequest.Size(m)
}
func (m *DeleteConversationRequest) XXX_DiscardUnknown() {
xxx_messageInfo_DeleteConversationRequest.DiscardUnknown(m)
}
var xxx_messageInfo_DeleteConversationRequest proto.InternalMessageInfo
func (m *DeleteConversationRequest) GetId() string {
if m != nil {
return m.Id
}
return ""
}
type DeleteConversationResponse struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *DeleteConversationResponse) Reset() { *m = DeleteConversationResponse{} }
func (m *DeleteConversationResponse) String() string { return proto.CompactTextString(m) }
func (*DeleteConversationResponse) ProtoMessage() {}
func (*DeleteConversationResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_78fcd0275ccaea0d, []int{11}
}
func (m *DeleteConversationResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DeleteConversationResponse.Unmarshal(m, b)
}
func (m *DeleteConversationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_DeleteConversationResponse.Marshal(b, m, deterministic)
}
func (m *DeleteConversationResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_DeleteConversationResponse.Merge(m, src)
}
func (m *DeleteConversationResponse) XXX_Size() int {
return xxx_messageInfo_DeleteConversationResponse.Size(m)
}
func (m *DeleteConversationResponse) XXX_DiscardUnknown() {
xxx_messageInfo_DeleteConversationResponse.DiscardUnknown(m)
}
var xxx_messageInfo_DeleteConversationResponse proto.InternalMessageInfo
type CreateMessageRequest struct {
ConversationId string `protobuf:"bytes,1,opt,name=conversation_id,json=conversationId,proto3" json:"conversation_id,omitempty"`
AuthorId string `protobuf:"bytes,2,opt,name=author_id,json=authorId,proto3" json:"author_id,omitempty"`
Text string `protobuf:"bytes,3,opt,name=text,proto3" json:"text,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *CreateMessageRequest) Reset() { *m = CreateMessageRequest{} }
func (m *CreateMessageRequest) String() string { return proto.CompactTextString(m) }
func (*CreateMessageRequest) ProtoMessage() {}
func (*CreateMessageRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_78fcd0275ccaea0d, []int{12}
}
func (m *CreateMessageRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreateMessageRequest.Unmarshal(m, b)
}
func (m *CreateMessageRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CreateMessageRequest.Marshal(b, m, deterministic)
}
func (m *CreateMessageRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_CreateMessageRequest.Merge(m, src)
}
func (m *CreateMessageRequest) XXX_Size() int {
return xxx_messageInfo_CreateMessageRequest.Size(m)
}
func (m *CreateMessageRequest) XXX_DiscardUnknown() {
xxx_messageInfo_CreateMessageRequest.DiscardUnknown(m)
}
var xxx_messageInfo_CreateMessageRequest proto.InternalMessageInfo
func (m *CreateMessageRequest) GetConversationId() string {
if m != nil {
return m.ConversationId
}
return ""
}
func (m *CreateMessageRequest) GetAuthorId() string {
if m != nil {
return m.AuthorId
}
return ""
}
func (m *CreateMessageRequest) GetText() string {
if m != nil {
return m.Text
}
return ""
}
type CreateMessageResponse struct {
Message *Message `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *CreateMessageResponse) Reset() { *m = CreateMessageResponse{} }
func (m *CreateMessageResponse) String() string { return proto.CompactTextString(m) }
func (*CreateMessageResponse) ProtoMessage() {}
func (*CreateMessageResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_78fcd0275ccaea0d, []int{13}
}
func (m *CreateMessageResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreateMessageResponse.Unmarshal(m, b)
}
func (m *CreateMessageResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CreateMessageResponse.Marshal(b, m, deterministic)
}
func (m *CreateMessageResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_CreateMessageResponse.Merge(m, src)
}
func (m *CreateMessageResponse) XXX_Size() int {
return xxx_messageInfo_CreateMessageResponse.Size(m)
}
func (m *CreateMessageResponse) XXX_DiscardUnknown() {
xxx_messageInfo_CreateMessageResponse.DiscardUnknown(m)
}
var xxx_messageInfo_CreateMessageResponse proto.InternalMessageInfo
func (m *CreateMessageResponse) GetMessage() *Message {
if m != nil {
return m.Message
}
return nil
}
type ListMessagesRequest struct {
ConversationId string `protobuf:"bytes,1,opt,name=conversation_id,json=conversationId,proto3" json:"conversation_id,omitempty"`
SentBefore *timestamp.Timestamp `protobuf:"bytes,2,opt,name=sent_before,json=sentBefore,proto3" json:"sent_before,omitempty"`
Limit *wrappers.Int32Value `protobuf:"bytes,3,opt,name=limit,proto3" json:"limit,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ListMessagesRequest) Reset() { *m = ListMessagesRequest{} }
func (m *ListMessagesRequest) String() string { return proto.CompactTextString(m) }
func (*ListMessagesRequest) ProtoMessage() {}
func (*ListMessagesRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_78fcd0275ccaea0d, []int{14}
}
func (m *ListMessagesRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListMessagesRequest.Unmarshal(m, b)
}
func (m *ListMessagesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ListMessagesRequest.Marshal(b, m, deterministic)
}
func (m *ListMessagesRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_ListMessagesRequest.Merge(m, src)
}
func (m *ListMessagesRequest) XXX_Size() int {
return xxx_messageInfo_ListMessagesRequest.Size(m)
}
func (m *ListMessagesRequest) XXX_DiscardUnknown() {
xxx_messageInfo_ListMessagesRequest.DiscardUnknown(m)
}
var xxx_messageInfo_ListMessagesRequest proto.InternalMessageInfo
func (m *ListMessagesRequest) GetConversationId() string {
if m != nil {
return m.ConversationId
}
return ""
}
func (m *ListMessagesRequest) GetSentBefore() *timestamp.Timestamp {
if m != nil {
return m.SentBefore
}
return nil
}
func (m *ListMessagesRequest) GetLimit() *wrappers.Int32Value {
if m != nil {
return m.Limit
}
return nil
}
type ListMessagesResponse struct {
Messages []*Message `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ListMessagesResponse) Reset() { *m = ListMessagesResponse{} }
func (m *ListMessagesResponse) String() string { return proto.CompactTextString(m) }
func (*ListMessagesResponse) ProtoMessage() {}
func (*ListMessagesResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_78fcd0275ccaea0d, []int{15}
}
func (m *ListMessagesResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListMessagesResponse.Unmarshal(m, b)
}
func (m *ListMessagesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ListMessagesResponse.Marshal(b, m, deterministic)
}
func (m *ListMessagesResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_ListMessagesResponse.Merge(m, src)
}
func (m *ListMessagesResponse) XXX_Size() int {
return xxx_messageInfo_ListMessagesResponse.Size(m)
}
func (m *ListMessagesResponse) XXX_DiscardUnknown() {
xxx_messageInfo_ListMessagesResponse.DiscardUnknown(m)
}
var xxx_messageInfo_ListMessagesResponse proto.InternalMessageInfo
func (m *ListMessagesResponse) GetMessages() []*Message {
if m != nil {
return m.Messages
}
return nil
}
type RecentMessagesRequest struct {
ConversationIds []string `protobuf:"bytes,1,rep,name=conversation_ids,json=conversationIds,proto3" json:"conversation_ids,omitempty"`
LimitPerConversation *wrappers.Int32Value `protobuf:"bytes,2,opt,name=limit_per_conversation,json=limitPerConversation,proto3" json:"limit_per_conversation,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *RecentMessagesRequest) Reset() { *m = RecentMessagesRequest{} }
func (m *RecentMessagesRequest) String() string { return proto.CompactTextString(m) }
func (*RecentMessagesRequest) ProtoMessage() {}
func (*RecentMessagesRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_78fcd0275ccaea0d, []int{16}
}
func (m *RecentMessagesRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RecentMessagesRequest.Unmarshal(m, b)
}
func (m *RecentMessagesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_RecentMessagesRequest.Marshal(b, m, deterministic)
}
func (m *RecentMessagesRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_RecentMessagesRequest.Merge(m, src)
}
func (m *RecentMessagesRequest) XXX_Size() int {
return xxx_messageInfo_RecentMessagesRequest.Size(m)
}
func (m *RecentMessagesRequest) XXX_DiscardUnknown() {
xxx_messageInfo_RecentMessagesRequest.DiscardUnknown(m)
}
var xxx_messageInfo_RecentMessagesRequest proto.InternalMessageInfo
func (m *RecentMessagesRequest) GetConversationIds() []string {
if m != nil {
return m.ConversationIds
}
return nil
}
func (m *RecentMessagesRequest) GetLimitPerConversation() *wrappers.Int32Value {
if m != nil {
return m.LimitPerConversation
}
return nil
}
type RecentMessagesResponse struct {
Messages []*Message `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *RecentMessagesResponse) Reset() { *m = RecentMessagesResponse{} }
func (m *RecentMessagesResponse) String() string { return proto.CompactTextString(m) }
func (*RecentMessagesResponse) ProtoMessage() {}
func (*RecentMessagesResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_78fcd0275ccaea0d, []int{17}
}
func (m *RecentMessagesResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RecentMessagesResponse.Unmarshal(m, b)
}
func (m *RecentMessagesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_RecentMessagesResponse.Marshal(b, m, deterministic)
}
func (m *RecentMessagesResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_RecentMessagesResponse.Merge(m, src)
}
func (m *RecentMessagesResponse) XXX_Size() int {
return xxx_messageInfo_RecentMessagesResponse.Size(m)
}
func (m *RecentMessagesResponse) XXX_DiscardUnknown() {
xxx_messageInfo_RecentMessagesResponse.DiscardUnknown(m)
}
var xxx_messageInfo_RecentMessagesResponse proto.InternalMessageInfo
func (m *RecentMessagesResponse) GetMessages() []*Message {
if m != nil {
return m.Messages
}
return nil
}
func init() {
proto.RegisterType((*Conversation)(nil), "threads.Conversation")
proto.RegisterType((*Message)(nil), "threads.Message")
proto.RegisterType((*CreateConversationRequest)(nil), "threads.CreateConversationRequest")
proto.RegisterType((*CreateConversationResponse)(nil), "threads.CreateConversationResponse")
proto.RegisterType((*ReadConversationRequest)(nil), "threads.ReadConversationRequest")
proto.RegisterType((*ReadConversationResponse)(nil), "threads.ReadConversationResponse")
proto.RegisterType((*ListConversationsRequest)(nil), "threads.ListConversationsRequest")
proto.RegisterType((*ListConversationsResponse)(nil), "threads.ListConversationsResponse")
proto.RegisterType((*UpdateConversationRequest)(nil), "threads.UpdateConversationRequest")
proto.RegisterType((*UpdateConversationResponse)(nil), "threads.UpdateConversationResponse")
proto.RegisterType((*DeleteConversationRequest)(nil), "threads.DeleteConversationRequest")
proto.RegisterType((*DeleteConversationResponse)(nil), "threads.DeleteConversationResponse")
proto.RegisterType((*CreateMessageRequest)(nil), "threads.CreateMessageRequest")
proto.RegisterType((*CreateMessageResponse)(nil), "threads.CreateMessageResponse")
proto.RegisterType((*ListMessagesRequest)(nil), "threads.ListMessagesRequest")
proto.RegisterType((*ListMessagesResponse)(nil), "threads.ListMessagesResponse")
proto.RegisterType((*RecentMessagesRequest)(nil), "threads.RecentMessagesRequest")
proto.RegisterType((*RecentMessagesResponse)(nil), "threads.RecentMessagesResponse")
}
func init() { proto.RegisterFile("proto/threads.proto", fileDescriptor_78fcd0275ccaea0d) }
var fileDescriptor_78fcd0275ccaea0d = []byte{
// 749 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xdb, 0x6e, 0xd3, 0x4a,
0x14, 0x95, 0xd3, 0xa6, 0x69, 0x76, 0x7a, 0x3b, 0xd3, 0xb4, 0xc7, 0x71, 0x6f, 0x39, 0x73, 0x1e,
0x4e, 0x0f, 0xa0, 0x54, 0xa4, 0x42, 0xa8, 0xea, 0x53, 0x2f, 0x42, 0x8a, 0x28, 0x88, 0x9a, 0x96,
0xa2, 0x4a, 0x55, 0xe4, 0xc4, 0xd3, 0xd4, 0x52, 0x62, 0x1b, 0xcf, 0x04, 0xf8, 0x06, 0xde, 0xf9,
0x07, 0x9e, 0xf8, 0x11, 0x7e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0x17, 0x35,
0x31, 0x6a, 0xfd, 0x33, 0x05, 0x21, 0x0b, 0xdf, 0x00, 0xca, 0xba, 0x5e, 0xe1, 0xad, 0x4d, 0x15,
0x85, 0xf7, 0x94, 0xd8, 0xb8, 0x01, 0x94, 0xb5, 0xb3, 0x52, 0x5e, 0x1b, 0x0c, 0x4a, 0x79, 0x7d,
0x1e, 0xa0, 0x6b, 0xf8, 0x2b, 0x13, 0xa8, 0x68, 0xa2, 0x5a, 0x97, 0xd1, 0x16, 0x9e, 0x06, 0x91,
0xb5, 0x5f, 0xc3, 0x62, 0xc2, 0xf9, 0x68, 0x2b, 0xf5, 0x50, 0xc9, 0x0c, 0xb2, 0xb6, 0x75, 0xc7,
0xb2, 0xde, 0x4b, 0x58, 0x50, 0x3d, 0x85, 0x36, 0x13, 0x1c, 0x52, 0x0e, 0xb1, 0xb6, 0x34, 0xa7,
0xb2, 0xd8, 0x39, 0x2c, 0x25, 0x47, 0x18, 0x6d, 0x2b, 0x6f, 0x9d, 0x63, 0x39, 0x6b, 0x47, 0x7b,
0x2e, 0x4a, 0x1e, 0x2f, 0x5f, 0x2f, 0x72, 0x0b, 0x1d, 0x4a, 0x5c, 0x67, 0x8e, 0x2f, 0xf7, 0x7f,
0x06, 0x00, 0x00, 0xff, 0xff, 0x8c, 0xab, 0xc6, 0xc8, 0xe6, 0x09, 0x00, 0x00,
}

View File

@@ -0,0 +1,236 @@
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: proto/threads.proto
package threads
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
_ "github.com/golang/protobuf/ptypes/timestamp"
_ "github.com/golang/protobuf/ptypes/wrappers"
math "math"
)
import (
context "context"
api "github.com/micro/micro/v3/service/api"
client "github.com/micro/micro/v3/service/client"
server "github.com/micro/micro/v3/service/server"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// Reference imports to suppress errors if they are not otherwise used.
var _ api.Endpoint
var _ context.Context
var _ client.Option
var _ server.Option
// Api Endpoints for Threads service
func NewThreadsEndpoints() []*api.Endpoint {
return []*api.Endpoint{}
}
// Client API for Threads service
type ThreadsService interface {
// Create a conversation
CreateConversation(ctx context.Context, in *CreateConversationRequest, opts ...client.CallOption) (*CreateConversationResponse, error)
// Read a conversation using its ID, can filter using group ID if provided
ReadConversation(ctx context.Context, in *ReadConversationRequest, opts ...client.CallOption) (*ReadConversationResponse, error)
// Update a conversations topic
UpdateConversation(ctx context.Context, in *UpdateConversationRequest, opts ...client.CallOption) (*UpdateConversationResponse, error)
// Delete a conversation and all the messages within
DeleteConversation(ctx context.Context, in *DeleteConversationRequest, opts ...client.CallOption) (*DeleteConversationResponse, error)
// List all the conversations for a group
ListConversations(ctx context.Context, in *ListConversationsRequest, opts ...client.CallOption) (*ListConversationsResponse, error)
// Create a message within a conversation
CreateMessage(ctx context.Context, in *CreateMessageRequest, opts ...client.CallOption) (*CreateMessageResponse, error)
// List the messages within a conversation in reverse chronological order, using sent_before to
// offset as older messages need to be loaded
ListMessages(ctx context.Context, in *ListMessagesRequest, opts ...client.CallOption) (*ListMessagesResponse, error)
// RecentMessages returns the most recent messages in a group of conversations. By default the
// most messages retrieved per conversation is 25, however this can be overriden using the
// limit_per_conversation option
RecentMessages(ctx context.Context, in *RecentMessagesRequest, opts ...client.CallOption) (*RecentMessagesResponse, error)
}
type threadsService struct {
c client.Client
name string
}
func NewThreadsService(name string, c client.Client) ThreadsService {
return &threadsService{
c: c,
name: name,
}
}
func (c *threadsService) CreateConversation(ctx context.Context, in *CreateConversationRequest, opts ...client.CallOption) (*CreateConversationResponse, error) {
req := c.c.NewRequest(c.name, "Threads.CreateConversation", in)
out := new(CreateConversationResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *threadsService) ReadConversation(ctx context.Context, in *ReadConversationRequest, opts ...client.CallOption) (*ReadConversationResponse, error) {
req := c.c.NewRequest(c.name, "Threads.ReadConversation", in)
out := new(ReadConversationResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *threadsService) UpdateConversation(ctx context.Context, in *UpdateConversationRequest, opts ...client.CallOption) (*UpdateConversationResponse, error) {
req := c.c.NewRequest(c.name, "Threads.UpdateConversation", in)
out := new(UpdateConversationResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *threadsService) DeleteConversation(ctx context.Context, in *DeleteConversationRequest, opts ...client.CallOption) (*DeleteConversationResponse, error) {
req := c.c.NewRequest(c.name, "Threads.DeleteConversation", in)
out := new(DeleteConversationResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *threadsService) ListConversations(ctx context.Context, in *ListConversationsRequest, opts ...client.CallOption) (*ListConversationsResponse, error) {
req := c.c.NewRequest(c.name, "Threads.ListConversations", in)
out := new(ListConversationsResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *threadsService) CreateMessage(ctx context.Context, in *CreateMessageRequest, opts ...client.CallOption) (*CreateMessageResponse, error) {
req := c.c.NewRequest(c.name, "Threads.CreateMessage", in)
out := new(CreateMessageResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *threadsService) ListMessages(ctx context.Context, in *ListMessagesRequest, opts ...client.CallOption) (*ListMessagesResponse, error) {
req := c.c.NewRequest(c.name, "Threads.ListMessages", in)
out := new(ListMessagesResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *threadsService) RecentMessages(ctx context.Context, in *RecentMessagesRequest, opts ...client.CallOption) (*RecentMessagesResponse, error) {
req := c.c.NewRequest(c.name, "Threads.RecentMessages", in)
out := new(RecentMessagesResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for Threads service
type ThreadsHandler interface {
// Create a conversation
CreateConversation(context.Context, *CreateConversationRequest, *CreateConversationResponse) error
// Read a conversation using its ID, can filter using group ID if provided
ReadConversation(context.Context, *ReadConversationRequest, *ReadConversationResponse) error
// Update a conversations topic
UpdateConversation(context.Context, *UpdateConversationRequest, *UpdateConversationResponse) error
// Delete a conversation and all the messages within
DeleteConversation(context.Context, *DeleteConversationRequest, *DeleteConversationResponse) error
// List all the conversations for a group
ListConversations(context.Context, *ListConversationsRequest, *ListConversationsResponse) error
// Create a message within a conversation
CreateMessage(context.Context, *CreateMessageRequest, *CreateMessageResponse) error
// List the messages within a conversation in reverse chronological order, using sent_before to
// offset as older messages need to be loaded
ListMessages(context.Context, *ListMessagesRequest, *ListMessagesResponse) error
// RecentMessages returns the most recent messages in a group of conversations. By default the
// most messages retrieved per conversation is 25, however this can be overriden using the
// limit_per_conversation option
RecentMessages(context.Context, *RecentMessagesRequest, *RecentMessagesResponse) error
}
func RegisterThreadsHandler(s server.Server, hdlr ThreadsHandler, opts ...server.HandlerOption) error {
type threads interface {
CreateConversation(ctx context.Context, in *CreateConversationRequest, out *CreateConversationResponse) error
ReadConversation(ctx context.Context, in *ReadConversationRequest, out *ReadConversationResponse) error
UpdateConversation(ctx context.Context, in *UpdateConversationRequest, out *UpdateConversationResponse) error
DeleteConversation(ctx context.Context, in *DeleteConversationRequest, out *DeleteConversationResponse) error
ListConversations(ctx context.Context, in *ListConversationsRequest, out *ListConversationsResponse) error
CreateMessage(ctx context.Context, in *CreateMessageRequest, out *CreateMessageResponse) error
ListMessages(ctx context.Context, in *ListMessagesRequest, out *ListMessagesResponse) error
RecentMessages(ctx context.Context, in *RecentMessagesRequest, out *RecentMessagesResponse) error
}
type Threads struct {
threads
}
h := &threadsHandler{hdlr}
return s.Handle(s.NewHandler(&Threads{h}, opts...))
}
type threadsHandler struct {
ThreadsHandler
}
func (h *threadsHandler) CreateConversation(ctx context.Context, in *CreateConversationRequest, out *CreateConversationResponse) error {
return h.ThreadsHandler.CreateConversation(ctx, in, out)
}
func (h *threadsHandler) ReadConversation(ctx context.Context, in *ReadConversationRequest, out *ReadConversationResponse) error {
return h.ThreadsHandler.ReadConversation(ctx, in, out)
}
func (h *threadsHandler) UpdateConversation(ctx context.Context, in *UpdateConversationRequest, out *UpdateConversationResponse) error {
return h.ThreadsHandler.UpdateConversation(ctx, in, out)
}
func (h *threadsHandler) DeleteConversation(ctx context.Context, in *DeleteConversationRequest, out *DeleteConversationResponse) error {
return h.ThreadsHandler.DeleteConversation(ctx, in, out)
}
func (h *threadsHandler) ListConversations(ctx context.Context, in *ListConversationsRequest, out *ListConversationsResponse) error {
return h.ThreadsHandler.ListConversations(ctx, in, out)
}
func (h *threadsHandler) CreateMessage(ctx context.Context, in *CreateMessageRequest, out *CreateMessageResponse) error {
return h.ThreadsHandler.CreateMessage(ctx, in, out)
}
func (h *threadsHandler) ListMessages(ctx context.Context, in *ListMessagesRequest, out *ListMessagesResponse) error {
return h.ThreadsHandler.ListMessages(ctx, in, out)
}
func (h *threadsHandler) RecentMessages(ctx context.Context, in *RecentMessagesRequest, out *RecentMessagesResponse) error {
return h.ThreadsHandler.RecentMessages(ctx, in, out)
}

113
threads/proto/threads.proto Normal file
View File

@@ -0,0 +1,113 @@
syntax = "proto3";
package threads;
option go_package = "proto;threads";
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
service Threads {
// Create a conversation
rpc CreateConversation(CreateConversationRequest) returns (CreateConversationResponse);
// Read a conversation using its ID, can filter using group ID if provided
rpc ReadConversation(ReadConversationRequest) returns (ReadConversationResponse);
// Update a conversations topic
rpc UpdateConversation(UpdateConversationRequest) returns (UpdateConversationResponse);
// Delete a conversation and all the messages within
rpc DeleteConversation(DeleteConversationRequest) returns (DeleteConversationResponse);
// List all the conversations for a group
rpc ListConversations(ListConversationsRequest) returns (ListConversationsResponse);
// Create a message within a conversation
rpc CreateMessage(CreateMessageRequest) returns (CreateMessageResponse);
// List the messages within a conversation in reverse chronological order, using sent_before to
// offset as older messages need to be loaded
rpc ListMessages(ListMessagesRequest) returns (ListMessagesResponse);
// RecentMessages returns the most recent messages in a group of conversations. By default the
// most messages retrieved per conversation is 25, however this can be overriden using the
// limit_per_conversation option
rpc RecentMessages(RecentMessagesRequest) returns (RecentMessagesResponse);
}
message Conversation {
string id = 1;
string group_id = 2;
string topic = 3;
google.protobuf.Timestamp created_at = 4;
}
message Message {
string id = 1;
string author_id = 2;
string conversation_id = 3;
string text = 4;
google.protobuf.Timestamp sent_at = 5;
}
message CreateConversationRequest {
string group_id = 1;
string topic = 2;
}
message CreateConversationResponse {
Conversation conversation = 1;
}
message ReadConversationRequest {
string id = 1;
google.protobuf.StringValue group_id = 2;
}
message ReadConversationResponse {
Conversation conversation = 1;
}
message ListConversationsRequest {
string group_id = 1;
}
message ListConversationsResponse {
repeated Conversation conversations = 1;
}
message UpdateConversationRequest {
string id = 1;
string topic = 2;
}
message UpdateConversationResponse {
Conversation conversation = 1;
}
message DeleteConversationRequest {
string id = 1;
}
message DeleteConversationResponse {}
message CreateMessageRequest {
string conversation_id = 1;
string author_id = 2;
string text = 3;
}
message CreateMessageResponse {
Message message = 1;
}
message ListMessagesRequest {
string conversation_id = 1;
google.protobuf.Timestamp sent_before = 2;
google.protobuf.Int32Value limit = 3;
}
message ListMessagesResponse {
repeated Message messages = 1;
}
message RecentMessagesRequest {
repeated string conversation_ids = 1;
google.protobuf.Int32Value limit_per_conversation = 2;
}
message RecentMessagesResponse {
repeated Message messages = 1;
}