Inbox Proto

This commit is contained in:
Ben Toogood
2020-10-15 15:23:09 +01:00
parent 4eb8479f9f
commit 62918d0537
5 changed files with 693 additions and 297 deletions

491
inbox/proto/inbox.pb.go Normal file
View File

@@ -0,0 +1,491 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: github.com/micro/services/inbox/proto/inbox.proto
package inbox
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
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 CreateRequest struct {
ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"`
SenderId string `protobuf:"bytes,2,opt,name=sender_id,json=senderId,proto3" json:"sender_id,omitempty"`
RecipientId string `protobuf:"bytes,3,opt,name=recipient_id,json=recipientId,proto3" json:"recipient_id,omitempty"`
Subject string `protobuf:"bytes,4,opt,name=subject,proto3" json:"subject,omitempty"`
Text string `protobuf:"bytes,5,opt,name=text,proto3" json:"text,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *CreateRequest) Reset() { *m = CreateRequest{} }
func (m *CreateRequest) String() string { return proto.CompactTextString(m) }
func (*CreateRequest) ProtoMessage() {}
func (*CreateRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_a44292e43b10b54b, []int{0}
}
func (m *CreateRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreateRequest.Unmarshal(m, b)
}
func (m *CreateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CreateRequest.Marshal(b, m, deterministic)
}
func (m *CreateRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_CreateRequest.Merge(m, src)
}
func (m *CreateRequest) XXX_Size() int {
return xxx_messageInfo_CreateRequest.Size(m)
}
func (m *CreateRequest) XXX_DiscardUnknown() {
xxx_messageInfo_CreateRequest.DiscardUnknown(m)
}
var xxx_messageInfo_CreateRequest proto.InternalMessageInfo
func (m *CreateRequest) GetClientId() string {
if m != nil {
return m.ClientId
}
return ""
}
func (m *CreateRequest) GetSenderId() string {
if m != nil {
return m.SenderId
}
return ""
}
func (m *CreateRequest) GetRecipientId() string {
if m != nil {
return m.RecipientId
}
return ""
}
func (m *CreateRequest) GetSubject() string {
if m != nil {
return m.Subject
}
return ""
}
func (m *CreateRequest) GetText() string {
if m != nil {
return m.Text
}
return ""
}
type CreateResponse struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *CreateResponse) Reset() { *m = CreateResponse{} }
func (m *CreateResponse) String() string { return proto.CompactTextString(m) }
func (*CreateResponse) ProtoMessage() {}
func (*CreateResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_a44292e43b10b54b, []int{1}
}
func (m *CreateResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreateResponse.Unmarshal(m, b)
}
func (m *CreateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_CreateResponse.Marshal(b, m, deterministic)
}
func (m *CreateResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_CreateResponse.Merge(m, src)
}
func (m *CreateResponse) XXX_Size() int {
return xxx_messageInfo_CreateResponse.Size(m)
}
func (m *CreateResponse) XXX_DiscardUnknown() {
xxx_messageInfo_CreateResponse.DiscardUnknown(m)
}
var xxx_messageInfo_CreateResponse proto.InternalMessageInfo
type ReadRequest struct {
RecipientId string `protobuf:"bytes,1,opt,name=recipient_id,json=recipientId,proto3" json:"recipient_id,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ReadRequest) Reset() { *m = ReadRequest{} }
func (m *ReadRequest) String() string { return proto.CompactTextString(m) }
func (*ReadRequest) ProtoMessage() {}
func (*ReadRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_a44292e43b10b54b, []int{2}
}
func (m *ReadRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReadRequest.Unmarshal(m, b)
}
func (m *ReadRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReadRequest.Marshal(b, m, deterministic)
}
func (m *ReadRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReadRequest.Merge(m, src)
}
func (m *ReadRequest) XXX_Size() int {
return xxx_messageInfo_ReadRequest.Size(m)
}
func (m *ReadRequest) XXX_DiscardUnknown() {
xxx_messageInfo_ReadRequest.DiscardUnknown(m)
}
var xxx_messageInfo_ReadRequest proto.InternalMessageInfo
func (m *ReadRequest) GetRecipientId() string {
if m != nil {
return m.RecipientId
}
return ""
}
type Message struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
ClientId string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"`
SenderId string `protobuf:"bytes,3,opt,name=sender_id,json=senderId,proto3" json:"sender_id,omitempty"`
RecipientId string `protobuf:"bytes,4,opt,name=recipient_id,json=recipientId,proto3" json:"recipient_id,omitempty"`
Subject string `protobuf:"bytes,5,opt,name=subject,proto3" json:"subject,omitempty"`
Text string `protobuf:"bytes,6,opt,name=text,proto3" json:"text,omitempty"`
SentAt int64 `protobuf:"varint,7,opt,name=sent_at,json=sentAt,proto3" json:"sent_at,omitempty"`
Seen bool `protobuf:"varint,8,opt,name=seen,proto3" json:"seen,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_a44292e43b10b54b, []int{3}
}
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) GetClientId() string {
if m != nil {
return m.ClientId
}
return ""
}
func (m *Message) GetSenderId() string {
if m != nil {
return m.SenderId
}
return ""
}
func (m *Message) GetRecipientId() string {
if m != nil {
return m.RecipientId
}
return ""
}
func (m *Message) GetSubject() string {
if m != nil {
return m.Subject
}
return ""
}
func (m *Message) GetText() string {
if m != nil {
return m.Text
}
return ""
}
func (m *Message) GetSentAt() int64 {
if m != nil {
return m.SentAt
}
return 0
}
func (m *Message) GetSeen() bool {
if m != nil {
return m.Seen
}
return false
}
type ReadResponse struct {
Message []*Message `protobuf:"bytes,1,rep,name=message,proto3" json:"message,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ReadResponse) Reset() { *m = ReadResponse{} }
func (m *ReadResponse) String() string { return proto.CompactTextString(m) }
func (*ReadResponse) ProtoMessage() {}
func (*ReadResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_a44292e43b10b54b, []int{4}
}
func (m *ReadResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReadResponse.Unmarshal(m, b)
}
func (m *ReadResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReadResponse.Marshal(b, m, deterministic)
}
func (m *ReadResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReadResponse.Merge(m, src)
}
func (m *ReadResponse) XXX_Size() int {
return xxx_messageInfo_ReadResponse.Size(m)
}
func (m *ReadResponse) XXX_DiscardUnknown() {
xxx_messageInfo_ReadResponse.DiscardUnknown(m)
}
var xxx_messageInfo_ReadResponse proto.InternalMessageInfo
func (m *ReadResponse) GetMessage() []*Message {
if m != nil {
return m.Message
}
return nil
}
type UpdateRequest struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Seen bool `protobuf:"varint,2,opt,name=seen,proto3" json:"seen,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *UpdateRequest) Reset() { *m = UpdateRequest{} }
func (m *UpdateRequest) String() string { return proto.CompactTextString(m) }
func (*UpdateRequest) ProtoMessage() {}
func (*UpdateRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_a44292e43b10b54b, []int{5}
}
func (m *UpdateRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UpdateRequest.Unmarshal(m, b)
}
func (m *UpdateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_UpdateRequest.Marshal(b, m, deterministic)
}
func (m *UpdateRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_UpdateRequest.Merge(m, src)
}
func (m *UpdateRequest) XXX_Size() int {
return xxx_messageInfo_UpdateRequest.Size(m)
}
func (m *UpdateRequest) XXX_DiscardUnknown() {
xxx_messageInfo_UpdateRequest.DiscardUnknown(m)
}
var xxx_messageInfo_UpdateRequest proto.InternalMessageInfo
func (m *UpdateRequest) GetId() string {
if m != nil {
return m.Id
}
return ""
}
func (m *UpdateRequest) GetSeen() bool {
if m != nil {
return m.Seen
}
return false
}
type UpdateResponse struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *UpdateResponse) Reset() { *m = UpdateResponse{} }
func (m *UpdateResponse) String() string { return proto.CompactTextString(m) }
func (*UpdateResponse) ProtoMessage() {}
func (*UpdateResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_a44292e43b10b54b, []int{6}
}
func (m *UpdateResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UpdateResponse.Unmarshal(m, b)
}
func (m *UpdateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_UpdateResponse.Marshal(b, m, deterministic)
}
func (m *UpdateResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_UpdateResponse.Merge(m, src)
}
func (m *UpdateResponse) XXX_Size() int {
return xxx_messageInfo_UpdateResponse.Size(m)
}
func (m *UpdateResponse) XXX_DiscardUnknown() {
xxx_messageInfo_UpdateResponse.DiscardUnknown(m)
}
var xxx_messageInfo_UpdateResponse proto.InternalMessageInfo
type DeleteRequest 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 *DeleteRequest) Reset() { *m = DeleteRequest{} }
func (m *DeleteRequest) String() string { return proto.CompactTextString(m) }
func (*DeleteRequest) ProtoMessage() {}
func (*DeleteRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_a44292e43b10b54b, []int{7}
}
func (m *DeleteRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DeleteRequest.Unmarshal(m, b)
}
func (m *DeleteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_DeleteRequest.Marshal(b, m, deterministic)
}
func (m *DeleteRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_DeleteRequest.Merge(m, src)
}
func (m *DeleteRequest) XXX_Size() int {
return xxx_messageInfo_DeleteRequest.Size(m)
}
func (m *DeleteRequest) XXX_DiscardUnknown() {
xxx_messageInfo_DeleteRequest.DiscardUnknown(m)
}
var xxx_messageInfo_DeleteRequest proto.InternalMessageInfo
func (m *DeleteRequest) GetId() string {
if m != nil {
return m.Id
}
return ""
}
type DeleteResponse struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *DeleteResponse) Reset() { *m = DeleteResponse{} }
func (m *DeleteResponse) String() string { return proto.CompactTextString(m) }
func (*DeleteResponse) ProtoMessage() {}
func (*DeleteResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_a44292e43b10b54b, []int{8}
}
func (m *DeleteResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DeleteResponse.Unmarshal(m, b)
}
func (m *DeleteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_DeleteResponse.Marshal(b, m, deterministic)
}
func (m *DeleteResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_DeleteResponse.Merge(m, src)
}
func (m *DeleteResponse) XXX_Size() int {
return xxx_messageInfo_DeleteResponse.Size(m)
}
func (m *DeleteResponse) XXX_DiscardUnknown() {
xxx_messageInfo_DeleteResponse.DiscardUnknown(m)
}
var xxx_messageInfo_DeleteResponse proto.InternalMessageInfo
func init() {
proto.RegisterType((*CreateRequest)(nil), "inbox.CreateRequest")
proto.RegisterType((*CreateResponse)(nil), "inbox.CreateResponse")
proto.RegisterType((*ReadRequest)(nil), "inbox.ReadRequest")
proto.RegisterType((*Message)(nil), "inbox.Message")
proto.RegisterType((*ReadResponse)(nil), "inbox.ReadResponse")
proto.RegisterType((*UpdateRequest)(nil), "inbox.UpdateRequest")
proto.RegisterType((*UpdateResponse)(nil), "inbox.UpdateResponse")
proto.RegisterType((*DeleteRequest)(nil), "inbox.DeleteRequest")
proto.RegisterType((*DeleteResponse)(nil), "inbox.DeleteResponse")
}
func init() {
proto.RegisterFile("github.com/micro/services/inbox/proto/inbox.proto", fileDescriptor_a44292e43b10b54b)
}
var fileDescriptor_a44292e43b10b54b = []byte{
// 420 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xcd, 0x8e, 0xd3, 0x30,
0x10, 0xc7, 0xe5, 0x7c, 0x76, 0xa7, 0xdb, 0x68, 0x65, 0x40, 0x44, 0xcb, 0x81, 0x90, 0x53, 0x24,
0x44, 0x03, 0xbb, 0x5a, 0x09, 0x89, 0x13, 0x1f, 0x97, 0x1c, 0xb8, 0x44, 0xe2, 0xc2, 0x05, 0x25,
0xf1, 0x68, 0x31, 0x6a, 0x93, 0x10, 0xbb, 0xa8, 0xcf, 0xc2, 0x5b, 0xf1, 0x00, 0xbc, 0x0b, 0xb2,
0x1d, 0x87, 0xa6, 0x40, 0xd9, 0xdb, 0xcc, 0xfc, 0xfd, 0xcf, 0xcc, 0xcf, 0xe3, 0xc0, 0x8b, 0x5b,
0x2e, 0x3f, 0xef, 0xea, 0x75, 0xd3, 0x6d, 0xf3, 0x2d, 0x6f, 0x86, 0x2e, 0x17, 0x38, 0x7c, 0xe3,
0x0d, 0x8a, 0x9c, 0xb7, 0x75, 0xb7, 0xcf, 0xfb, 0xa1, 0x93, 0x9d, 0x89, 0xd7, 0x3a, 0xa6, 0xbe,
0x4e, 0xd2, 0xef, 0x04, 0x56, 0x6f, 0x07, 0xac, 0x24, 0x96, 0xf8, 0x75, 0x87, 0x42, 0xd2, 0x47,
0x70, 0xd6, 0x6c, 0x38, 0xb6, 0xf2, 0x13, 0x67, 0x31, 0x49, 0x48, 0x76, 0x56, 0x2e, 0x4c, 0xa1,
0x60, 0x4a, 0x14, 0xd8, 0x32, 0x1c, 0x94, 0xe8, 0x18, 0xd1, 0x14, 0x0a, 0x46, 0x9f, 0xc0, 0xf9,
0x80, 0x0d, 0xef, 0xad, 0xd9, 0xd5, 0xfa, 0x72, 0xaa, 0x15, 0x8c, 0xc6, 0x10, 0x8a, 0x5d, 0xfd,
0x05, 0x1b, 0x19, 0x7b, 0x5a, 0xb5, 0x29, 0xa5, 0xe0, 0x49, 0xdc, 0xcb, 0xd8, 0xd7, 0x65, 0x1d,
0xa7, 0x17, 0x10, 0xd9, 0xd9, 0x44, 0xdf, 0xb5, 0x02, 0xd3, 0xe7, 0xb0, 0x2c, 0xb1, 0x62, 0x76,
0xd6, 0xe3, 0x8e, 0xe4, 0x8f, 0x8e, 0xe9, 0x0f, 0x02, 0xe1, 0x7b, 0x14, 0xa2, 0xba, 0x45, 0x1a,
0x81, 0x33, 0x1d, 0x72, 0x38, 0x9b, 0xa3, 0x3a, 0xa7, 0x50, 0xdd, 0xff, 0xa0, 0x7a, 0x27, 0x51,
0xfd, 0xbf, 0xa3, 0x06, 0xbf, 0x51, 0xe9, 0x43, 0x08, 0x85, 0xfa, 0x56, 0x25, 0xe3, 0x30, 0x21,
0x99, 0x5b, 0x06, 0x2a, 0x7d, 0xad, 0x0f, 0x0b, 0xc4, 0x36, 0x5e, 0x24, 0x24, 0x5b, 0x94, 0x3a,
0x4e, 0x5f, 0xc2, 0xb9, 0xb9, 0x05, 0x73, 0x2b, 0x34, 0x83, 0x70, 0x6b, 0x10, 0x63, 0x92, 0xb8,
0xd9, 0xf2, 0x2a, 0x5a, 0x9b, 0x55, 0x8f, 0xe0, 0xa5, 0x95, 0xd3, 0x6b, 0x58, 0x7d, 0xe8, 0xd9,
0xc1, 0xb6, 0x8f, 0xaf, 0xc4, 0xb6, 0x73, 0x0e, 0xda, 0x5d, 0x40, 0x64, 0x4d, 0xe3, 0x1a, 0x1e,
0xc3, 0xea, 0x1d, 0x6e, 0xf0, 0x9f, 0x9f, 0x51, 0x16, 0x7b, 0xc0, 0x58, 0xae, 0x7e, 0x12, 0xf0,
0x0b, 0x35, 0x14, 0xbd, 0x81, 0xc0, 0x6c, 0x95, 0xde, 0x1f, 0xc7, 0x9c, 0x3d, 0xc0, 0xcb, 0x07,
0x47, 0xd5, 0x11, 0x32, 0x07, 0x4f, 0x41, 0x53, 0x3a, 0xca, 0x07, 0xef, 0xe0, 0xf2, 0xde, 0xac,
0x36, 0x1a, 0x6e, 0x20, 0x30, 0x63, 0x4f, 0x7d, 0x66, 0xe8, 0x53, 0x9f, 0x39, 0x9b, 0xb2, 0x99,
0xd1, 0x27, 0xdb, 0x0c, 0x75, 0xb2, 0xcd, 0xf9, 0xde, 0x3c, 0xfb, 0xf8, 0xf4, 0x4e, 0x3f, 0xe1,
0x2b, 0x1d, 0xd7, 0x81, 0x4e, 0xae, 0x7f, 0x05, 0x00, 0x00, 0xff, 0xff, 0x16, 0xc5, 0xf8, 0x0d,
0xba, 0x03, 0x00, 0x00,
}

View File

@@ -0,0 +1,144 @@
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: github.com/micro/services/inbox/proto/inbox.proto
package inbox
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
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 Inbox service
func NewInboxEndpoints() []*api.Endpoint {
return []*api.Endpoint{}
}
// Client API for Inbox service
type InboxService interface {
Create(ctx context.Context, in *CreateRequest, opts ...client.CallOption) (*CreateResponse, error)
Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error)
Update(ctx context.Context, in *UpdateRequest, opts ...client.CallOption) (*UpdateResponse, error)
Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error)
}
type inboxService struct {
c client.Client
name string
}
func NewInboxService(name string, c client.Client) InboxService {
return &inboxService{
c: c,
name: name,
}
}
func (c *inboxService) Create(ctx context.Context, in *CreateRequest, opts ...client.CallOption) (*CreateResponse, error) {
req := c.c.NewRequest(c.name, "Inbox.Create", in)
out := new(CreateResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *inboxService) Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error) {
req := c.c.NewRequest(c.name, "Inbox.Read", in)
out := new(ReadResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *inboxService) Update(ctx context.Context, in *UpdateRequest, opts ...client.CallOption) (*UpdateResponse, error) {
req := c.c.NewRequest(c.name, "Inbox.Update", in)
out := new(UpdateResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *inboxService) Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error) {
req := c.c.NewRequest(c.name, "Inbox.Delete", in)
out := new(DeleteResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for Inbox service
type InboxHandler interface {
Create(context.Context, *CreateRequest, *CreateResponse) error
Read(context.Context, *ReadRequest, *ReadResponse) error
Update(context.Context, *UpdateRequest, *UpdateResponse) error
Delete(context.Context, *DeleteRequest, *DeleteResponse) error
}
func RegisterInboxHandler(s server.Server, hdlr InboxHandler, opts ...server.HandlerOption) error {
type inbox interface {
Create(ctx context.Context, in *CreateRequest, out *CreateResponse) error
Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error
Update(ctx context.Context, in *UpdateRequest, out *UpdateResponse) error
Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error
}
type Inbox struct {
inbox
}
h := &inboxHandler{hdlr}
return s.Handle(s.NewHandler(&Inbox{h}, opts...))
}
type inboxHandler struct {
InboxHandler
}
func (h *inboxHandler) Create(ctx context.Context, in *CreateRequest, out *CreateResponse) error {
return h.InboxHandler.Create(ctx, in, out)
}
func (h *inboxHandler) Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error {
return h.InboxHandler.Read(ctx, in, out)
}
func (h *inboxHandler) Update(ctx context.Context, in *UpdateRequest, out *UpdateResponse) error {
return h.InboxHandler.Update(ctx, in, out)
}
func (h *inboxHandler) Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error {
return h.InboxHandler.Delete(ctx, in, out)
}

53
inbox/proto/inbox.proto Normal file
View File

@@ -0,0 +1,53 @@
syntax = "proto3";
package inbox;
option go_package = "github.com/micro/services/inbox/proto;inbox";
service Inbox {
rpc Create(CreateRequest) returns (CreateResponse);
rpc Read(ReadRequest) returns (ReadResponse);
rpc Update(UpdateRequest) returns (UpdateResponse);
rpc Delete(DeleteRequest) returns (DeleteResponse);
}
message CreateRequest {
string client_id = 1;
string sender_id = 2;
string recipient_id = 3;
string subject = 4;
string text = 5;
}
message CreateResponse {}
message ReadRequest {
string recipient_id = 1;
}
message Message {
string id = 1;
string client_id = 2;
string sender_id = 3;
string recipient_id = 4;
string subject = 5;
string text = 6;
int64 sent_at = 7;
bool seen = 8;
}
message ReadResponse {
repeated Message message = 1;
}
message UpdateRequest {
string id = 1;
bool seen = 2;
}
message UpdateResponse {}
message DeleteRequest {
string id = 1;
}
message DeleteResponse {}