pb

package
v0.0.0-...-e5bd9e3 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2021 License: MIT Imports: 10 Imported by: 0

README

News service gRPC contract

This directory contains the news.proto file that defines the gRPC contract of the news service. Whenever you change it run the following commands:

protoc news.proto --go_out=plugins=grpc:.
python -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. news.proto

The first command generates news.pb.go that the news service imports.

The second command generates two Python modules for Python consumers of the service.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EventType_name = map[int32]string{
		0: "LINK_ADDED",
		1: "LINK_UPDATED",
		2: "LINK_DELETED",
	}
	EventType_value = map[string]int32{
		"LINK_ADDED":   0,
		"LINK_UPDATED": 1,
		"LINK_DELETED": 2,
	}
)

Enum value maps for EventType.

Functions

func RegisterNewsServer

func RegisterNewsServer(s *grpc.Server, srv NewsServer)

Types

type Event

type Event struct {
	EventType EventType            `protobuf:"varint,1,opt,name=eventType,proto3,enum=pb.EventType" json:"eventType,omitempty"`
	Username  string               `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"`
	Url       string               `protobuf:"bytes,3,opt,name=url,proto3" json:"url,omitempty"`
	Timestamp *timestamp.Timestamp `protobuf:"bytes,4,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	// contains filtered or unexported fields
}

func (*Event) Descriptor deprecated

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

Deprecated: Use Event.ProtoReflect.Descriptor instead.

func (*Event) GetEventType

func (x *Event) GetEventType() EventType

func (*Event) GetTimestamp

func (x *Event) GetTimestamp() *timestamp.Timestamp

func (*Event) GetUrl

func (x *Event) GetUrl() string

func (*Event) GetUsername

func (x *Event) GetUsername() string

func (*Event) ProtoMessage

func (*Event) ProtoMessage()

func (*Event) ProtoReflect

func (x *Event) ProtoReflect() protoreflect.Message

func (*Event) Reset

func (x *Event) Reset()

func (*Event) String

func (x *Event) String() string

type EventType

type EventType int32
const (
	EventType_LINK_ADDED   EventType = 0
	EventType_LINK_UPDATED EventType = 1
	EventType_LINK_DELETED EventType = 2
)

func (EventType) Descriptor

func (EventType) Descriptor() protoreflect.EnumDescriptor

func (EventType) Enum

func (x EventType) Enum() *EventType

func (EventType) EnumDescriptor deprecated

func (EventType) EnumDescriptor() ([]byte, []int)

Deprecated: Use EventType.Descriptor instead.

func (EventType) Number

func (x EventType) Number() protoreflect.EnumNumber

func (EventType) String

func (x EventType) String() string

func (EventType) Type

type GetNewsRequest

type GetNewsRequest struct {
	Username   string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
	StartToken string `protobuf:"bytes,2,opt,name=startToken,proto3" json:"startToken,omitempty"`
	// contains filtered or unexported fields
}

func (*GetNewsRequest) Descriptor deprecated

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

Deprecated: Use GetNewsRequest.ProtoReflect.Descriptor instead.

func (*GetNewsRequest) GetStartToken

func (x *GetNewsRequest) GetStartToken() string

func (*GetNewsRequest) GetUsername

func (x *GetNewsRequest) GetUsername() string

func (*GetNewsRequest) ProtoMessage

func (*GetNewsRequest) ProtoMessage()

func (*GetNewsRequest) ProtoReflect

func (x *GetNewsRequest) ProtoReflect() protoreflect.Message

func (*GetNewsRequest) Reset

func (x *GetNewsRequest) Reset()

func (*GetNewsRequest) String

func (x *GetNewsRequest) String() string

type GetNewsResponse

type GetNewsResponse struct {
	Events    []*Event `protobuf:"bytes,1,rep,name=events,proto3" json:"events,omitempty"`
	NextToken string   `protobuf:"bytes,2,opt,name=nextToken,proto3" json:"nextToken,omitempty"`
	Err       string   `protobuf:"bytes,3,opt,name=err,proto3" json:"err,omitempty"`
	// contains filtered or unexported fields
}

func (*GetNewsResponse) Descriptor deprecated

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

Deprecated: Use GetNewsResponse.ProtoReflect.Descriptor instead.

func (*GetNewsResponse) GetErr

func (x *GetNewsResponse) GetErr() string

func (*GetNewsResponse) GetEvents

func (x *GetNewsResponse) GetEvents() []*Event

func (*GetNewsResponse) GetNextToken

func (x *GetNewsResponse) GetNextToken() string

func (*GetNewsResponse) ProtoMessage

func (*GetNewsResponse) ProtoMessage()

func (*GetNewsResponse) ProtoReflect

func (x *GetNewsResponse) ProtoReflect() protoreflect.Message

func (*GetNewsResponse) Reset

func (x *GetNewsResponse) Reset()

func (*GetNewsResponse) String

func (x *GetNewsResponse) String() string

type NewsClient

type NewsClient interface {
	GetNews(ctx context.Context, in *GetNewsRequest, opts ...grpc.CallOption) (*GetNewsResponse, error)
}

NewsClient is the client API for News service.

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

func NewNewsClient

func NewNewsClient(cc grpc.ClientConnInterface) NewsClient

type NewsServer

type NewsServer interface {
	GetNews(context.Context, *GetNewsRequest) (*GetNewsResponse, error)
}

NewsServer is the server API for News service.

type UnimplementedNewsServer

type UnimplementedNewsServer struct {
}

UnimplementedNewsServer can be embedded to have forward compatible implementations.

func (*UnimplementedNewsServer) GetNews

Jump to

Keyboard shortcuts

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