api

package
v0.0.0-...-862ea22 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package api is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
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)

View Source
var File_backend_proto protoreflect.FileDescriptor
View Source
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.

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) Descriptor() ([]byte, []int)

Deprecated: Use FeedInfo.ProtoReflect.Descriptor instead.

func (*FeedInfo) GetFeedId

func (x *FeedInfo) GetFeedId() int64

func (*FeedInfo) GetFeedName

func (x *FeedInfo) GetFeedName() string

func (*FeedInfo) GetSummary

func (x *FeedInfo) GetSummary() string

func (*FeedInfo) ProtoMessage

func (*FeedInfo) ProtoMessage()

func (*FeedInfo) ProtoReflect

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

func (*FeedInfo) Reset

func (x *FeedInfo) Reset()

func (*FeedInfo) String

func (x *FeedInfo) String() string

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) Descriptor() ([]byte, []int)

Deprecated: Use Request.ProtoReflect.Descriptor instead.

func (*Request) GetRequestId

func (x *Request) GetRequestId() string

func (*Request) GetUserId

func (x *Request) GetUserId() string

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) ProtoReflect

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

func (*Request) Reset

func (x *Request) Reset()

func (*Request) String

func (x *Request) String() string

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) Descriptor() ([]byte, []int)

Deprecated: Use Response.ProtoReflect.Descriptor instead.

func (*Response) GetFeedInfos

func (x *Response) GetFeedInfos() []*FeedInfo

func (*Response) GetRequestId

func (x *Response) GetRequestId() string

func (*Response) GetUserId

func (x *Response) GetUserId() string

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) ProtoReflect

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

func (*Response) Reset

func (x *Response) Reset()

func (*Response) String

func (x *Response) String() string

type UnimplementedBackendServiceServer

type UnimplementedBackendServiceServer struct {
}

UnimplementedBackendServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedBackendServiceServer) RecSys

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

Jump to

Keyboard shortcuts

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