Documentation ¶
Overview ¶
Package api is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterBackendServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterBackendServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client BackendServiceClient) error
- func RegisterBackendServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterBackendServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server BackendServiceServer) error
- func RegisterBackendServiceServer(s grpc.ServiceRegistrar, srv BackendServiceServer)
- type BackendServiceClient
- type BackendServiceServer
- type FeedInfo
- func (*FeedInfo) Descriptor() ([]byte, []int)deprecated
- func (x *FeedInfo) GetFeedId() int64
- func (x *FeedInfo) GetFeedName() string
- func (x *FeedInfo) GetSummary() string
- func (*FeedInfo) ProtoMessage()
- func (x *FeedInfo) ProtoReflect() protoreflect.Message
- func (x *FeedInfo) Reset()
- func (x *FeedInfo) String() string
- type Request
- type Response
- func (*Response) Descriptor() ([]byte, []int)deprecated
- func (x *Response) GetFeedInfos() []*FeedInfo
- func (x *Response) GetRequestId() string
- func (x *Response) GetUserId() string
- func (*Response) ProtoMessage()
- func (x *Response) ProtoReflect() protoreflect.Message
- func (x *Response) Reset()
- func (x *Response) String() string
- type UnimplementedBackendServiceServer
- type UnsafeBackendServiceServer
- type UserPrefRequest
- func (*UserPrefRequest) Descriptor() ([]byte, []int)deprecated
- func (x *UserPrefRequest) GetRequestId() string
- func (x *UserPrefRequest) GetUserId() string
- func (*UserPrefRequest) ProtoMessage()
- func (x *UserPrefRequest) ProtoReflect() protoreflect.Message
- func (x *UserPrefRequest) Reset()
- func (x *UserPrefRequest) String() string
- type UserPrefResponse
- func (*UserPrefResponse) Descriptor() ([]byte, []int)deprecated
- func (x *UserPrefResponse) GetRequestId() string
- func (x *UserPrefResponse) GetUserId() string
- func (x *UserPrefResponse) GetUserPref() []string
- func (*UserPrefResponse) ProtoMessage()
- func (x *UserPrefResponse) ProtoReflect() protoreflect.Message
- func (x *UserPrefResponse) Reset()
- func (x *UserPrefResponse) String() string
Constants ¶
This section is empty.
Variables ¶
var BackendService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "recsys.BackendService", HandlerType: (*BackendServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "RecSys", Handler: _BackendService_RecSys_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "backend.proto", }
BackendService_ServiceDesc is the grpc.ServiceDesc for BackendService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_backend_proto protoreflect.FileDescriptor
var File_common_proto protoreflect.FileDescriptor
Functions ¶
func RegisterBackendServiceHandler ¶
func RegisterBackendServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterBackendServiceHandler registers the http handlers for service BackendService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterBackendServiceHandlerClient ¶
func RegisterBackendServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client BackendServiceClient) error
RegisterBackendServiceHandlerClient registers the http handlers for service BackendService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "BackendServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "BackendServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "BackendServiceClient" to call the correct interceptors.
func RegisterBackendServiceHandlerFromEndpoint ¶
func RegisterBackendServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterBackendServiceHandlerFromEndpoint is same as RegisterBackendServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterBackendServiceHandlerServer ¶
func RegisterBackendServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server BackendServiceServer) error
RegisterBackendServiceHandlerServer registers the http handlers for service BackendService to "mux". UnaryRPC :call BackendServiceServer 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 RegisterBackendServiceHandlerFromEndpoint instead.
func RegisterBackendServiceServer ¶
func RegisterBackendServiceServer(s grpc.ServiceRegistrar, srv BackendServiceServer)
Types ¶
type BackendServiceClient ¶
type BackendServiceClient interface {
RecSys(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
}
BackendServiceClient is the client API for BackendService 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 NewBackendServiceClient ¶
func NewBackendServiceClient(cc grpc.ClientConnInterface) BackendServiceClient
type BackendServiceServer ¶
type BackendServiceServer interface { RecSys(context.Context, *Request) (*Response, error) // contains filtered or unexported methods }
BackendServiceServer is the server API for BackendService service. All implementations must embed UnimplementedBackendServiceServer for forward compatibility
type FeedInfo ¶
type FeedInfo struct { FeedId int64 `protobuf:"varint,1,opt,name=feed_id,json=FeedId,proto3" json:"feed_id,omitempty"` FeedName string `protobuf:"bytes,2,opt,name=feed_name,json=FeedName,proto3" json:"feed_name,omitempty"` Summary string `protobuf:"bytes,3,opt,name=summary,json=Summary,proto3" json:"summary,omitempty"` // contains filtered or unexported fields }
func (*FeedInfo) Descriptor
deprecated
func (*FeedInfo) GetFeedName ¶
func (*FeedInfo) GetSummary ¶
func (*FeedInfo) ProtoMessage ¶
func (*FeedInfo) ProtoMessage()
func (*FeedInfo) ProtoReflect ¶
func (x *FeedInfo) ProtoReflect() protoreflect.Message
type Request ¶
type Request struct { RequestId string `protobuf:"bytes,1,opt,name=request_id,json=RequestId,proto3" json:"request_id,omitempty"` UserId string `protobuf:"bytes,2,opt,name=user_id,json=UserId,proto3" json:"user_id,omitempty"` // contains filtered or unexported fields }
func (*Request) Descriptor
deprecated
func (*Request) GetRequestId ¶
func (*Request) ProtoMessage ¶
func (*Request) ProtoMessage()
func (*Request) ProtoReflect ¶
func (x *Request) ProtoReflect() protoreflect.Message
type Response ¶
type Response struct { RequestId string `protobuf:"bytes,1,opt,name=request_id,json=RequestId,proto3" json:"request_id,omitempty"` UserId string `protobuf:"bytes,2,opt,name=user_id,json=UserId,proto3" json:"user_id,omitempty"` FeedInfos []*FeedInfo `protobuf:"bytes,3,rep,name=feed_infos,json=FeedInfos,proto3" json:"feed_infos,omitempty"` // contains filtered or unexported fields }
func (*Response) Descriptor
deprecated
func (*Response) GetFeedInfos ¶
func (*Response) GetRequestId ¶
func (*Response) ProtoMessage ¶
func (*Response) ProtoMessage()
func (*Response) ProtoReflect ¶
func (x *Response) ProtoReflect() protoreflect.Message
type UnimplementedBackendServiceServer ¶
type UnimplementedBackendServiceServer struct { }
UnimplementedBackendServiceServer must be embedded to have forward compatible implementations.
type UnsafeBackendServiceServer ¶
type UnsafeBackendServiceServer interface {
// contains filtered or unexported methods
}
UnsafeBackendServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to BackendServiceServer will result in compilation errors.
type UserPrefRequest ¶
type UserPrefRequest struct { RequestId string `protobuf:"bytes,1,opt,name=request_id,json=RequestId,proto3" json:"request_id,omitempty"` UserId string `protobuf:"bytes,2,opt,name=user_id,json=UserId,proto3" json:"user_id,omitempty"` // contains filtered or unexported fields }
func (*UserPrefRequest) Descriptor
deprecated
func (*UserPrefRequest) Descriptor() ([]byte, []int)
Deprecated: Use UserPrefRequest.ProtoReflect.Descriptor instead.
func (*UserPrefRequest) GetRequestId ¶
func (x *UserPrefRequest) GetRequestId() string
func (*UserPrefRequest) GetUserId ¶
func (x *UserPrefRequest) GetUserId() string
func (*UserPrefRequest) ProtoMessage ¶
func (*UserPrefRequest) ProtoMessage()
func (*UserPrefRequest) ProtoReflect ¶
func (x *UserPrefRequest) ProtoReflect() protoreflect.Message
func (*UserPrefRequest) Reset ¶
func (x *UserPrefRequest) Reset()
func (*UserPrefRequest) String ¶
func (x *UserPrefRequest) String() string
type UserPrefResponse ¶
type UserPrefResponse struct { RequestId string `protobuf:"bytes,1,opt,name=request_id,json=RequestId,proto3" json:"request_id,omitempty"` UserId string `protobuf:"bytes,2,opt,name=user_id,json=UserId,proto3" json:"user_id,omitempty"` UserPref []string `protobuf:"bytes,3,rep,name=user_pref,json=UserPref,proto3" json:"user_pref,omitempty"` // contains filtered or unexported fields }
func (*UserPrefResponse) Descriptor
deprecated
func (*UserPrefResponse) Descriptor() ([]byte, []int)
Deprecated: Use UserPrefResponse.ProtoReflect.Descriptor instead.
func (*UserPrefResponse) GetRequestId ¶
func (x *UserPrefResponse) GetRequestId() string
func (*UserPrefResponse) GetUserId ¶
func (x *UserPrefResponse) GetUserId() string
func (*UserPrefResponse) GetUserPref ¶
func (x *UserPrefResponse) GetUserPref() []string
func (*UserPrefResponse) ProtoMessage ¶
func (*UserPrefResponse) ProtoMessage()
func (*UserPrefResponse) ProtoReflect ¶
func (x *UserPrefResponse) ProtoReflect() protoreflect.Message
func (*UserPrefResponse) Reset ¶
func (x *UserPrefResponse) Reset()
func (*UserPrefResponse) String ¶
func (x *UserPrefResponse) String() string