proto

package
v0.0.0-...-7712202 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: BSD-3-Clause Imports: 18 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

View Source
var File_tracker_proto protoreflect.FileDescriptor
View Source
var Tracker_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "proto.Tracker",
	HandlerType: (*TrackerServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Login",
			Handler:    _Tracker_Login_Handler,
		},
		{
			MethodName: "Search",
			Handler:    _Tracker_Search_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "SearchBatch",
			Handler:       _Tracker_SearchBatch_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "tracker.proto",
}

Tracker_ServiceDesc is the grpc.ServiceDesc for Tracker service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterTrackerHandler

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

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

func RegisterTrackerHandlerClient

func RegisterTrackerHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TrackerClient) error

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

func RegisterTrackerHandlerFromEndpoint

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

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

func RegisterTrackerHandlerServer

func RegisterTrackerHandlerServer(ctx context.Context, mux *runtime.ServeMux, server TrackerServer) error

RegisterTrackerHandlerServer registers the http handlers for service Tracker to "mux". UnaryRPC :call TrackerServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterTrackerHandlerFromEndpoint instead.

func RegisterTrackerServer

func RegisterTrackerServer(s grpc.ServiceRegistrar, srv TrackerServer)

Types

type Credentials

type Credentials struct {
	User string `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
	Pass string `protobuf:"bytes,2,opt,name=pass,proto3" json:"pass,omitempty"`
	// contains filtered or unexported fields
}

func (*Credentials) Descriptor deprecated

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

Deprecated: Use Credentials.ProtoReflect.Descriptor instead.

func (*Credentials) GetPass

func (x *Credentials) GetPass() string

func (*Credentials) GetUser

func (x *Credentials) GetUser() string

func (*Credentials) ProtoMessage

func (*Credentials) ProtoMessage()

func (*Credentials) ProtoReflect

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

func (*Credentials) Reset

func (x *Credentials) Reset()

func (*Credentials) String

func (x *Credentials) String() string

type Event

type Event struct {
	Date   *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=date,proto3" json:"date,omitempty"`
	Status string                 `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"`
	Place  string                 `protobuf:"bytes,3,opt,name=place,proto3" json:"place,omitempty"`
	// contains filtered or unexported fields
}

Event doc...

func (*Event) Descriptor deprecated

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

Deprecated: Use Event.ProtoReflect.Descriptor instead.

func (*Event) GetDate

func (x *Event) GetDate() *timestamppb.Timestamp

func (*Event) GetPlace

func (x *Event) GetPlace() string

func (*Event) GetStatus

func (x *Event) GetStatus() 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 SearchBatchRequest

type SearchBatchRequest struct {
	TrackingCodes []string `protobuf:"bytes,1,rep,name=tracking_codes,json=trackingCodes,proto3" json:"tracking_codes,omitempty"`
	// contains filtered or unexported fields
}

func (*SearchBatchRequest) Descriptor deprecated

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

Deprecated: Use SearchBatchRequest.ProtoReflect.Descriptor instead.

func (*SearchBatchRequest) GetTrackingCodes

func (x *SearchBatchRequest) GetTrackingCodes() []string

func (*SearchBatchRequest) ProtoMessage

func (*SearchBatchRequest) ProtoMessage()

func (*SearchBatchRequest) ProtoReflect

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

func (*SearchBatchRequest) Reset

func (x *SearchBatchRequest) Reset()

func (*SearchBatchRequest) String

func (x *SearchBatchRequest) String() string

type SearchRequest

type SearchRequest struct {
	TrackingCode string `protobuf:"bytes,1,opt,name=tracking_code,json=trackingCode,proto3" json:"tracking_code,omitempty"`
	// contains filtered or unexported fields
}

func (*SearchRequest) Descriptor deprecated

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

Deprecated: Use SearchRequest.ProtoReflect.Descriptor instead.

func (*SearchRequest) GetTrackingCode

func (x *SearchRequest) GetTrackingCode() string

func (*SearchRequest) ProtoMessage

func (*SearchRequest) ProtoMessage()

func (*SearchRequest) ProtoReflect

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

func (*SearchRequest) Reset

func (x *SearchRequest) Reset()

func (*SearchRequest) String

func (x *SearchRequest) String() string

type SearchResponse

type SearchResponse struct {
	TrackingCode string   `protobuf:"bytes,1,opt,name=tracking_code,json=trackingCode,proto3" json:"tracking_code,omitempty"`
	Events       []*Event `protobuf:"bytes,2,rep,name=events,proto3" json:"events,omitempty"`
	// contains filtered or unexported fields
}

func (*SearchResponse) Descriptor deprecated

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

Deprecated: Use SearchResponse.ProtoReflect.Descriptor instead.

func (*SearchResponse) GetEvents

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

func (*SearchResponse) GetTrackingCode

func (x *SearchResponse) GetTrackingCode() string

func (*SearchResponse) ProtoMessage

func (*SearchResponse) ProtoMessage()

func (*SearchResponse) ProtoReflect

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

func (*SearchResponse) Reset

func (x *SearchResponse) Reset()

func (*SearchResponse) String

func (x *SearchResponse) String() string

type Token

type Token struct {
	Value     string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
	ExpiresIn int64  `protobuf:"varint,2,opt,name=expires_in,json=expiresIn,proto3" json:"expires_in,omitempty"`
	// contains filtered or unexported fields
}

func (*Token) Descriptor deprecated

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

Deprecated: Use Token.ProtoReflect.Descriptor instead.

func (*Token) GetExpiresIn

func (x *Token) GetExpiresIn() int64

func (*Token) GetValue

func (x *Token) GetValue() string

func (*Token) ProtoMessage

func (*Token) ProtoMessage()

func (*Token) ProtoReflect

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

func (*Token) Reset

func (x *Token) Reset()

func (*Token) String

func (x *Token) String() string

type TrackerClient

type TrackerClient interface {
	// This comment is used to document the stub generated by gRPC
	// and also the openAPI auto generated.
	//
	// Login authenticates a user and return an access token.
	Login(ctx context.Context, in *Credentials, opts ...grpc.CallOption) (*Token, error)
	// Search searches by a tracking code and returns it's events.
	Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*SearchResponse, error)
	// SearchBatch searches one or more tracking codes and returns a stream of
	// SearchResponses.
	SearchBatch(ctx context.Context, in *SearchBatchRequest, opts ...grpc.CallOption) (Tracker_SearchBatchClient, error)
}

TrackerClient is the client API for Tracker service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewTrackerClient

func NewTrackerClient(cc grpc.ClientConnInterface) TrackerClient

type TrackerServer

type TrackerServer interface {
	// This comment is used to document the stub generated by gRPC
	// and also the openAPI auto generated.
	//
	// Login authenticates a user and return an access token.
	Login(context.Context, *Credentials) (*Token, error)
	// Search searches by a tracking code and returns it's events.
	Search(context.Context, *SearchRequest) (*SearchResponse, error)
	// SearchBatch searches one or more tracking codes and returns a stream of
	// SearchResponses.
	SearchBatch(*SearchBatchRequest, Tracker_SearchBatchServer) error
	// contains filtered or unexported methods
}

TrackerServer is the server API for Tracker service. All implementations must embed UnimplementedTrackerServer for forward compatibility

type Tracker_SearchBatchClient

type Tracker_SearchBatchClient interface {
	Recv() (*SearchResponse, error)
	grpc.ClientStream
}

type Tracker_SearchBatchServer

type Tracker_SearchBatchServer interface {
	Send(*SearchResponse) error
	grpc.ServerStream
}

type UnimplementedTrackerServer

type UnimplementedTrackerServer struct {
}

UnimplementedTrackerServer must be embedded to have forward compatible implementations.

func (UnimplementedTrackerServer) Login

func (UnimplementedTrackerServer) Search

func (UnimplementedTrackerServer) SearchBatch

type UnsafeTrackerServer

type UnsafeTrackerServer interface {
	// contains filtered or unexported methods
}

UnsafeTrackerServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to TrackerServer will result in compilation errors.

Jump to

Keyboard shortcuts

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