proto

package
v0.0.0-...-40a7325 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 3, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package proto is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterBotioHandler

func RegisterBotioHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterBotioHandler registers the http handlers for service Botio to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterBotioHandlerClient

func RegisterBotioHandlerClient(ctx context.Context, mux *runtime.ServeMux, client BotioClient) error

RegisterBotioHandlerClient registers the http handlers for service Botio to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "BotioClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "BotioClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "BotioClient" to call the correct interceptors.

func RegisterBotioHandlerFromEndpoint

func RegisterBotioHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterBotioHandlerFromEndpoint is same as RegisterBotioHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterBotioHandlerServer

func RegisterBotioHandlerServer(ctx context.Context, mux *runtime.ServeMux, server BotioServer) error

RegisterBotioHandlerServer registers the http handlers for service Botio to "mux". UnaryRPC :call BotioServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.

func RegisterBotioServer

func RegisterBotioServer(s *grpc.Server, srv BotioServer)

Types

type BotCommand

type BotCommand struct {
	Cmd                  *Command  `protobuf:"bytes,1,opt,name=cmd,proto3" json:"cmd,omitempty"`
	Resp                 *Response `protobuf:"bytes,2,opt,name=resp,proto3" json:"resp,omitempty"`
	XXX_NoUnkeyedLiteral struct{}  `json:"-"`
	XXX_unrecognized     []byte    `json:"-"`
	XXX_sizecache        int32     `json:"-"`
}

BotCommand is a encapsulates a command's name and his response.

func (*BotCommand) Descriptor

func (*BotCommand) Descriptor() ([]byte, []int)

func (*BotCommand) GetCmd

func (m *BotCommand) GetCmd() *Command

func (*BotCommand) GetResp

func (m *BotCommand) GetResp() *Response

func (*BotCommand) ProtoMessage

func (*BotCommand) ProtoMessage()

func (*BotCommand) Reset

func (m *BotCommand) Reset()

func (*BotCommand) String

func (m *BotCommand) String() string

func (*BotCommand) XXX_DiscardUnknown

func (m *BotCommand) XXX_DiscardUnknown()

func (*BotCommand) XXX_Marshal

func (m *BotCommand) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*BotCommand) XXX_Merge

func (m *BotCommand) XXX_Merge(src proto.Message)

func (*BotCommand) XXX_Size

func (m *BotCommand) XXX_Size() int

func (*BotCommand) XXX_Unmarshal

func (m *BotCommand) XXX_Unmarshal(b []byte) error

type BotCommands

type BotCommands struct {
	Commands             []*BotCommand `protobuf:"bytes,1,rep,name=commands,proto3" json:"commands,omitempty"`
	XXX_NoUnkeyedLiteral struct{}      `json:"-"`
	XXX_unrecognized     []byte        `json:"-"`
	XXX_sizecache        int32         `json:"-"`
}

BotCommands represents a list of BotCommands.

func (*BotCommands) Descriptor

func (*BotCommands) Descriptor() ([]byte, []int)

func (*BotCommands) GetCommands

func (m *BotCommands) GetCommands() []*BotCommand

func (*BotCommands) ProtoMessage

func (*BotCommands) ProtoMessage()

func (*BotCommands) Reset

func (m *BotCommands) Reset()

func (*BotCommands) String

func (m *BotCommands) String() string

func (*BotCommands) XXX_DiscardUnknown

func (m *BotCommands) XXX_DiscardUnknown()

func (*BotCommands) XXX_Marshal

func (m *BotCommands) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*BotCommands) XXX_Merge

func (m *BotCommands) XXX_Merge(src proto.Message)

func (*BotCommands) XXX_Size

func (m *BotCommands) XXX_Size() int

func (*BotCommands) XXX_Unmarshal

func (m *BotCommands) XXX_Unmarshal(b []byte) error

type BotioClient

type BotioClient interface {
	AddCommand(ctx context.Context, in *BotCommand, opts ...grpc.CallOption) (*empty.Empty, error)
	GetCommand(ctx context.Context, in *Command, opts ...grpc.CallOption) (*BotCommand, error)
	ListCommands(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*BotCommands, error)
	UpdateCommand(ctx context.Context, in *BotCommand, opts ...grpc.CallOption) (*empty.Empty, error)
	DeleteCommand(ctx context.Context, in *Command, opts ...grpc.CallOption) (*empty.Empty, error)
}

BotioClient is the client API for Botio service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewBotioClient

func NewBotioClient(cc *grpc.ClientConn) BotioClient

type BotioServer

type BotioServer interface {
	AddCommand(context.Context, *BotCommand) (*empty.Empty, error)
	GetCommand(context.Context, *Command) (*BotCommand, error)
	ListCommands(context.Context, *empty.Empty) (*BotCommands, error)
	UpdateCommand(context.Context, *BotCommand) (*empty.Empty, error)
	DeleteCommand(context.Context, *Command) (*empty.Empty, error)
}

BotioServer is the server API for Botio service.

type Command

type Command struct {
	Command              string   `protobuf:"bytes,1,opt,name=command,proto3" json:"command,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Command represents a command's name.

func (*Command) Descriptor

func (*Command) Descriptor() ([]byte, []int)

func (*Command) GetCommand

func (m *Command) GetCommand() string

func (*Command) ProtoMessage

func (*Command) ProtoMessage()

func (*Command) Reset

func (m *Command) Reset()

func (*Command) String

func (m *Command) String() string

func (*Command) XXX_DiscardUnknown

func (m *Command) XXX_DiscardUnknown()

func (*Command) XXX_Marshal

func (m *Command) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Command) XXX_Merge

func (m *Command) XXX_Merge(src proto.Message)

func (*Command) XXX_Size

func (m *Command) XXX_Size() int

func (*Command) XXX_Unmarshal

func (m *Command) XXX_Unmarshal(b []byte) error

type Response

type Response struct {
	Response             string   `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Response represents a commnad's response.

func (*Response) Descriptor

func (*Response) Descriptor() ([]byte, []int)

func (*Response) GetResponse

func (m *Response) GetResponse() string

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) Reset

func (m *Response) Reset()

func (*Response) String

func (m *Response) String() string

func (*Response) XXX_DiscardUnknown

func (m *Response) XXX_DiscardUnknown()

func (*Response) XXX_Marshal

func (m *Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Response) XXX_Merge

func (m *Response) XXX_Merge(src proto.Message)

func (*Response) XXX_Size

func (m *Response) XXX_Size() int

func (*Response) XXX_Unmarshal

func (m *Response) XXX_Unmarshal(b []byte) error

type UnimplementedBotioServer

type UnimplementedBotioServer struct {
}

UnimplementedBotioServer can be embedded to have forward compatible implementations.

func (*UnimplementedBotioServer) AddCommand

func (*UnimplementedBotioServer) AddCommand(ctx context.Context, req *BotCommand) (*empty.Empty, error)

func (*UnimplementedBotioServer) DeleteCommand

func (*UnimplementedBotioServer) DeleteCommand(ctx context.Context, req *Command) (*empty.Empty, error)

func (*UnimplementedBotioServer) GetCommand

func (*UnimplementedBotioServer) GetCommand(ctx context.Context, req *Command) (*BotCommand, error)

func (*UnimplementedBotioServer) ListCommands

func (*UnimplementedBotioServer) ListCommands(ctx context.Context, req *empty.Empty) (*BotCommands, error)

func (*UnimplementedBotioServer) UpdateCommand

func (*UnimplementedBotioServer) UpdateCommand(ctx context.Context, req *BotCommand) (*empty.Empty, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL