Files
services/chat/proto/chat.pb.micro.go
Janos Dobronszki 40b71a9cf9 Autogenerate services.m3o.com (#37)
* Autogenerate services.m3o.com

* Openapi for all

* Gen

* Fix

* Whaat

* Fix dep

* Fix

* Hmm

* Install make

* Debug

* Debug 1

* Location -> locations

* Fix

* Intall protoc gen micro

* F

* F

* F

* Push

* Rename secret

* Fix npm install

* Fix script

* Fix v2

* Ignore errors

* Ignore v2

* F

* F

* F

* Docs index

* Add hugo theme

* Hugo tania fixes

* Change gen

* Change gen 2

* Install hugo

* Change gen

* Gen fix

* Change hugo install

* Change hugo install

* CNAME

* Change articles wording

* Tiny fix

* Fix gen

* Redoc it all

* Fix gen

* Fixing up protos

* Fix proto

* Fix gen

* Fix

* Trigger build

* Fix copy

* Openapi docs

* Flatten

* Changes

* No date vol2

* Changes

* Add make to chat

* Fixes

* Change

* api spec

* replace RSS

* fix link

* Dont continue on error

* increase the width

* use micro at master

* change box colours

* move some things

* Pushing new readmes to see how they look like

* Add skip file

* Readmes

* Nicer api link

* Remove stutter

* FIx mistake

* set service font weight

* Messages readme fix

* add other font bold

* Notes

* Remove post from url

* Revert "Remove post from url"

This reverts commit 5fea2c23d0bafa910f5dc4d4cc63f71f578530e3.

* move exampleSite to site

* replace exampleSite with site

* update readme

* use filename for post

* update index

* Add source urls

* set source as params

* set source as params

* Fix entries

* Generator in go

* Fixes to generator

* F

* Change doc gen

* FIx cname

* Fixing protos

* Change to makefiles

* Fix gen script

Co-authored-by: Asim Aslam <asim@aslam.me>
2021-01-19 16:59:25 +00:00

245 lines
7.2 KiB
Go

// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: proto/chat.proto
package chat
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 Chat service
func NewChatEndpoints() []*api.Endpoint {
return []*api.Endpoint{}
}
// Client API for Chat service
type ChatService interface {
// New creates a chat for a group of users. The RPC is idempotent so if it's called multiple times
// for the same users, the same response will be returned. It's good practice to design APIs as
// idempotent since this enables safe retries.
New(ctx context.Context, in *NewRequest, opts ...client.CallOption) (*NewResponse, error)
// History returns the historical messages in a chat
History(ctx context.Context, in *HistoryRequest, opts ...client.CallOption) (*HistoryResponse, error)
// Send a single message to the chat
Send(ctx context.Context, in *SendRequest, opts ...client.CallOption) (*SendResponse, error)
// Connect to a chat using a bidirectional stream enabling the client to send and recieve messages
// over a single RPC. When a message is sent on the stream, it will be added to the chat history
// and sent to the other connected users. When opening the connection, the client should provide
// the chat_id and user_id in the context so the server knows which messages to stream.
Connect(ctx context.Context, opts ...client.CallOption) (Chat_ConnectService, error)
}
type chatService struct {
c client.Client
name string
}
func NewChatService(name string, c client.Client) ChatService {
return &chatService{
c: c,
name: name,
}
}
func (c *chatService) New(ctx context.Context, in *NewRequest, opts ...client.CallOption) (*NewResponse, error) {
req := c.c.NewRequest(c.name, "Chat.New", in)
out := new(NewResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *chatService) History(ctx context.Context, in *HistoryRequest, opts ...client.CallOption) (*HistoryResponse, error) {
req := c.c.NewRequest(c.name, "Chat.History", in)
out := new(HistoryResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *chatService) Send(ctx context.Context, in *SendRequest, opts ...client.CallOption) (*SendResponse, error) {
req := c.c.NewRequest(c.name, "Chat.Send", in)
out := new(SendResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *chatService) Connect(ctx context.Context, opts ...client.CallOption) (Chat_ConnectService, error) {
req := c.c.NewRequest(c.name, "Chat.Connect", &Message{})
stream, err := c.c.Stream(ctx, req, opts...)
if err != nil {
return nil, err
}
return &chatServiceConnect{stream}, nil
}
type Chat_ConnectService interface {
Context() context.Context
SendMsg(interface{}) error
RecvMsg(interface{}) error
Close() error
Send(*Message) error
Recv() (*Message, error)
}
type chatServiceConnect struct {
stream client.Stream
}
func (x *chatServiceConnect) Close() error {
return x.stream.Close()
}
func (x *chatServiceConnect) Context() context.Context {
return x.stream.Context()
}
func (x *chatServiceConnect) SendMsg(m interface{}) error {
return x.stream.Send(m)
}
func (x *chatServiceConnect) RecvMsg(m interface{}) error {
return x.stream.Recv(m)
}
func (x *chatServiceConnect) Send(m *Message) error {
return x.stream.Send(m)
}
func (x *chatServiceConnect) Recv() (*Message, error) {
m := new(Message)
err := x.stream.Recv(m)
if err != nil {
return nil, err
}
return m, nil
}
// Server API for Chat service
type ChatHandler interface {
// New creates a chat for a group of users. The RPC is idempotent so if it's called multiple times
// for the same users, the same response will be returned. It's good practice to design APIs as
// idempotent since this enables safe retries.
New(context.Context, *NewRequest, *NewResponse) error
// History returns the historical messages in a chat
History(context.Context, *HistoryRequest, *HistoryResponse) error
// Send a single message to the chat
Send(context.Context, *SendRequest, *SendResponse) error
// Connect to a chat using a bidirectional stream enabling the client to send and recieve messages
// over a single RPC. When a message is sent on the stream, it will be added to the chat history
// and sent to the other connected users. When opening the connection, the client should provide
// the chat_id and user_id in the context so the server knows which messages to stream.
Connect(context.Context, Chat_ConnectStream) error
}
func RegisterChatHandler(s server.Server, hdlr ChatHandler, opts ...server.HandlerOption) error {
type chat interface {
New(ctx context.Context, in *NewRequest, out *NewResponse) error
History(ctx context.Context, in *HistoryRequest, out *HistoryResponse) error
Send(ctx context.Context, in *SendRequest, out *SendResponse) error
Connect(ctx context.Context, stream server.Stream) error
}
type Chat struct {
chat
}
h := &chatHandler{hdlr}
return s.Handle(s.NewHandler(&Chat{h}, opts...))
}
type chatHandler struct {
ChatHandler
}
func (h *chatHandler) New(ctx context.Context, in *NewRequest, out *NewResponse) error {
return h.ChatHandler.New(ctx, in, out)
}
func (h *chatHandler) History(ctx context.Context, in *HistoryRequest, out *HistoryResponse) error {
return h.ChatHandler.History(ctx, in, out)
}
func (h *chatHandler) Send(ctx context.Context, in *SendRequest, out *SendResponse) error {
return h.ChatHandler.Send(ctx, in, out)
}
func (h *chatHandler) Connect(ctx context.Context, stream server.Stream) error {
return h.ChatHandler.Connect(ctx, &chatConnectStream{stream})
}
type Chat_ConnectStream interface {
Context() context.Context
SendMsg(interface{}) error
RecvMsg(interface{}) error
Close() error
Send(*Message) error
Recv() (*Message, error)
}
type chatConnectStream struct {
stream server.Stream
}
func (x *chatConnectStream) Close() error {
return x.stream.Close()
}
func (x *chatConnectStream) Context() context.Context {
return x.stream.Context()
}
func (x *chatConnectStream) SendMsg(m interface{}) error {
return x.stream.Send(m)
}
func (x *chatConnectStream) RecvMsg(m interface{}) error {
return x.stream.Recv(m)
}
func (x *chatConnectStream) Send(m *Message) error {
return x.stream.Send(m)
}
func (x *chatConnectStream) Recv() (*Message, error) {
m := new(Message)
if err := x.stream.Recv(m); err != nil {
return nil, err
}
return m, nil
}