feat: initial commit
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
// Package scoreboardv1 contains the generated gRPC/protobuf code for the
|
||||
// scoreboard service.
|
||||
//
|
||||
// Regenerate with `go generate ./...` (requires protoc, protoc-gen-go and
|
||||
// protoc-gen-go-grpc on PATH — install the latter two with:
|
||||
//
|
||||
// go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
|
||||
// go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
|
||||
package scoreboardv1
|
||||
|
||||
//go:generate protoc --proto_path=../../../proto --go_out=../../.. --go_opt=module=git.mkz.me/mycroft/root-me-api --go-grpc_out=../../.. --go-grpc_opt=module=git.mkz.me/mycroft/root-me-api scoreboard/v1/scoreboard.proto
|
||||
@@ -0,0 +1,399 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.11
|
||||
// protoc v7.35.0
|
||||
// source: scoreboard/v1/scoreboard.proto
|
||||
|
||||
package scoreboardv1
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
unsafe "unsafe"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// Entry is a single scoreboard row.
|
||||
type Entry struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Rank int32 `protobuf:"varint,1,opt,name=rank,proto3" json:"rank,omitempty"`
|
||||
Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"`
|
||||
ProfilePath string `protobuf:"bytes,3,opt,name=profile_path,json=profilePath,proto3" json:"profile_path,omitempty"`
|
||||
Country string `protobuf:"bytes,4,opt,name=country,proto3" json:"country,omitempty"`
|
||||
Grade string `protobuf:"bytes,5,opt,name=grade,proto3" json:"grade,omitempty"`
|
||||
Score int32 `protobuf:"varint,6,opt,name=score,proto3" json:"score,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *Entry) Reset() {
|
||||
*x = Entry{}
|
||||
mi := &file_scoreboard_v1_scoreboard_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *Entry) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Entry) ProtoMessage() {}
|
||||
|
||||
func (x *Entry) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_scoreboard_v1_scoreboard_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Entry.ProtoReflect.Descriptor instead.
|
||||
func (*Entry) Descriptor() ([]byte, []int) {
|
||||
return file_scoreboard_v1_scoreboard_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *Entry) GetRank() int32 {
|
||||
if x != nil {
|
||||
return x.Rank
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Entry) GetUsername() string {
|
||||
if x != nil {
|
||||
return x.Username
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Entry) GetProfilePath() string {
|
||||
if x != nil {
|
||||
return x.ProfilePath
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Entry) GetCountry() string {
|
||||
if x != nil {
|
||||
return x.Country
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Entry) GetGrade() string {
|
||||
if x != nil {
|
||||
return x.Grade
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Entry) GetScore() int32 {
|
||||
if x != nil {
|
||||
return x.Score
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type ListScoreboardRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// Zero-based offset into the ranked list.
|
||||
Offset int32 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"`
|
||||
// Maximum entries to return; 0 means "all from offset".
|
||||
Limit int32 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ListScoreboardRequest) Reset() {
|
||||
*x = ListScoreboardRequest{}
|
||||
mi := &file_scoreboard_v1_scoreboard_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ListScoreboardRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ListScoreboardRequest) ProtoMessage() {}
|
||||
|
||||
func (x *ListScoreboardRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_scoreboard_v1_scoreboard_proto_msgTypes[1]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ListScoreboardRequest.ProtoReflect.Descriptor instead.
|
||||
func (*ListScoreboardRequest) Descriptor() ([]byte, []int) {
|
||||
return file_scoreboard_v1_scoreboard_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *ListScoreboardRequest) GetOffset() int32 {
|
||||
if x != nil {
|
||||
return x.Offset
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ListScoreboardRequest) GetLimit() int32 {
|
||||
if x != nil {
|
||||
return x.Limit
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type ListScoreboardResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Entries []*Entry `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"`
|
||||
// Total entries in the current snapshot.
|
||||
Total int32 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"`
|
||||
// Snapshot time (unix seconds) the data was fetched.
|
||||
FetchedAt int64 `protobuf:"varint,3,opt,name=fetched_at,json=fetchedAt,proto3" json:"fetched_at,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ListScoreboardResponse) Reset() {
|
||||
*x = ListScoreboardResponse{}
|
||||
mi := &file_scoreboard_v1_scoreboard_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ListScoreboardResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ListScoreboardResponse) ProtoMessage() {}
|
||||
|
||||
func (x *ListScoreboardResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_scoreboard_v1_scoreboard_proto_msgTypes[2]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ListScoreboardResponse.ProtoReflect.Descriptor instead.
|
||||
func (*ListScoreboardResponse) Descriptor() ([]byte, []int) {
|
||||
return file_scoreboard_v1_scoreboard_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *ListScoreboardResponse) GetEntries() []*Entry {
|
||||
if x != nil {
|
||||
return x.Entries
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ListScoreboardResponse) GetTotal() int32 {
|
||||
if x != nil {
|
||||
return x.Total
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ListScoreboardResponse) GetFetchedAt() int64 {
|
||||
if x != nil {
|
||||
return x.FetchedAt
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type GetByRankRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Rank int32 `protobuf:"varint,1,opt,name=rank,proto3" json:"rank,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GetByRankRequest) Reset() {
|
||||
*x = GetByRankRequest{}
|
||||
mi := &file_scoreboard_v1_scoreboard_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetByRankRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetByRankRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetByRankRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_scoreboard_v1_scoreboard_proto_msgTypes[3]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetByRankRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetByRankRequest) Descriptor() ([]byte, []int) {
|
||||
return file_scoreboard_v1_scoreboard_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *GetByRankRequest) GetRank() int32 {
|
||||
if x != nil {
|
||||
return x.Rank
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type GetByUsernameRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GetByUsernameRequest) Reset() {
|
||||
*x = GetByUsernameRequest{}
|
||||
mi := &file_scoreboard_v1_scoreboard_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetByUsernameRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetByUsernameRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetByUsernameRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_scoreboard_v1_scoreboard_proto_msgTypes[4]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetByUsernameRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetByUsernameRequest) Descriptor() ([]byte, []int) {
|
||||
return file_scoreboard_v1_scoreboard_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *GetByUsernameRequest) GetUsername() string {
|
||||
if x != nil {
|
||||
return x.Username
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_scoreboard_v1_scoreboard_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_scoreboard_v1_scoreboard_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\x1escoreboard/v1/scoreboard.proto\x12\rscoreboard.v1\"\xa0\x01\n" +
|
||||
"\x05Entry\x12\x12\n" +
|
||||
"\x04rank\x18\x01 \x01(\x05R\x04rank\x12\x1a\n" +
|
||||
"\busername\x18\x02 \x01(\tR\busername\x12!\n" +
|
||||
"\fprofile_path\x18\x03 \x01(\tR\vprofilePath\x12\x18\n" +
|
||||
"\acountry\x18\x04 \x01(\tR\acountry\x12\x14\n" +
|
||||
"\x05grade\x18\x05 \x01(\tR\x05grade\x12\x14\n" +
|
||||
"\x05score\x18\x06 \x01(\x05R\x05score\"E\n" +
|
||||
"\x15ListScoreboardRequest\x12\x16\n" +
|
||||
"\x06offset\x18\x01 \x01(\x05R\x06offset\x12\x14\n" +
|
||||
"\x05limit\x18\x02 \x01(\x05R\x05limit\"}\n" +
|
||||
"\x16ListScoreboardResponse\x12.\n" +
|
||||
"\aentries\x18\x01 \x03(\v2\x14.scoreboard.v1.EntryR\aentries\x12\x14\n" +
|
||||
"\x05total\x18\x02 \x01(\x05R\x05total\x12\x1d\n" +
|
||||
"\n" +
|
||||
"fetched_at\x18\x03 \x01(\x03R\tfetchedAt\"&\n" +
|
||||
"\x10GetByRankRequest\x12\x12\n" +
|
||||
"\x04rank\x18\x01 \x01(\x05R\x04rank\"2\n" +
|
||||
"\x14GetByUsernameRequest\x12\x1a\n" +
|
||||
"\busername\x18\x01 \x01(\tR\busername2\x82\x02\n" +
|
||||
"\x11ScoreboardService\x12]\n" +
|
||||
"\x0eListScoreboard\x12$.scoreboard.v1.ListScoreboardRequest\x1a%.scoreboard.v1.ListScoreboardResponse\x12B\n" +
|
||||
"\tGetByRank\x12\x1f.scoreboard.v1.GetByRankRequest\x1a\x14.scoreboard.v1.Entry\x12J\n" +
|
||||
"\rGetByUsername\x12#.scoreboard.v1.GetByUsernameRequest\x1a\x14.scoreboard.v1.EntryBBZ@git.mkz.me/mycroft/scoreboard-api/gen/scoreboard/v1;scoreboardv1b\x06proto3"
|
||||
|
||||
var (
|
||||
file_scoreboard_v1_scoreboard_proto_rawDescOnce sync.Once
|
||||
file_scoreboard_v1_scoreboard_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_scoreboard_v1_scoreboard_proto_rawDescGZIP() []byte {
|
||||
file_scoreboard_v1_scoreboard_proto_rawDescOnce.Do(func() {
|
||||
file_scoreboard_v1_scoreboard_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_scoreboard_v1_scoreboard_proto_rawDesc), len(file_scoreboard_v1_scoreboard_proto_rawDesc)))
|
||||
})
|
||||
return file_scoreboard_v1_scoreboard_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_scoreboard_v1_scoreboard_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
|
||||
var file_scoreboard_v1_scoreboard_proto_goTypes = []any{
|
||||
(*Entry)(nil), // 0: scoreboard.v1.Entry
|
||||
(*ListScoreboardRequest)(nil), // 1: scoreboard.v1.ListScoreboardRequest
|
||||
(*ListScoreboardResponse)(nil), // 2: scoreboard.v1.ListScoreboardResponse
|
||||
(*GetByRankRequest)(nil), // 3: scoreboard.v1.GetByRankRequest
|
||||
(*GetByUsernameRequest)(nil), // 4: scoreboard.v1.GetByUsernameRequest
|
||||
}
|
||||
var file_scoreboard_v1_scoreboard_proto_depIdxs = []int32{
|
||||
0, // 0: scoreboard.v1.ListScoreboardResponse.entries:type_name -> scoreboard.v1.Entry
|
||||
1, // 1: scoreboard.v1.ScoreboardService.ListScoreboard:input_type -> scoreboard.v1.ListScoreboardRequest
|
||||
3, // 2: scoreboard.v1.ScoreboardService.GetByRank:input_type -> scoreboard.v1.GetByRankRequest
|
||||
4, // 3: scoreboard.v1.ScoreboardService.GetByUsername:input_type -> scoreboard.v1.GetByUsernameRequest
|
||||
2, // 4: scoreboard.v1.ScoreboardService.ListScoreboard:output_type -> scoreboard.v1.ListScoreboardResponse
|
||||
0, // 5: scoreboard.v1.ScoreboardService.GetByRank:output_type -> scoreboard.v1.Entry
|
||||
0, // 6: scoreboard.v1.ScoreboardService.GetByUsername:output_type -> scoreboard.v1.Entry
|
||||
4, // [4:7] is the sub-list for method output_type
|
||||
1, // [1:4] is the sub-list for method input_type
|
||||
1, // [1:1] is the sub-list for extension type_name
|
||||
1, // [1:1] is the sub-list for extension extendee
|
||||
0, // [0:1] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_scoreboard_v1_scoreboard_proto_init() }
|
||||
func file_scoreboard_v1_scoreboard_proto_init() {
|
||||
if File_scoreboard_v1_scoreboard_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_scoreboard_v1_scoreboard_proto_rawDesc), len(file_scoreboard_v1_scoreboard_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 5,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_scoreboard_v1_scoreboard_proto_goTypes,
|
||||
DependencyIndexes: file_scoreboard_v1_scoreboard_proto_depIdxs,
|
||||
MessageInfos: file_scoreboard_v1_scoreboard_proto_msgTypes,
|
||||
}.Build()
|
||||
File_scoreboard_v1_scoreboard_proto = out.File
|
||||
file_scoreboard_v1_scoreboard_proto_goTypes = nil
|
||||
file_scoreboard_v1_scoreboard_proto_depIdxs = nil
|
||||
}
|
||||
@@ -0,0 +1,207 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.6.2
|
||||
// - protoc v7.35.0
|
||||
// source: scoreboard/v1/scoreboard.proto
|
||||
|
||||
package scoreboardv1
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.64.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
ScoreboardService_ListScoreboard_FullMethodName = "/scoreboard.v1.ScoreboardService/ListScoreboard"
|
||||
ScoreboardService_GetByRank_FullMethodName = "/scoreboard.v1.ScoreboardService/GetByRank"
|
||||
ScoreboardService_GetByUsername_FullMethodName = "/scoreboard.v1.ScoreboardService/GetByUsername"
|
||||
)
|
||||
|
||||
// ScoreboardServiceClient is the client API for ScoreboardService 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.
|
||||
//
|
||||
// ScoreboardService serves the cached root-me.org scoreboard.
|
||||
type ScoreboardServiceClient interface {
|
||||
// ListScoreboard returns a page of entries ordered by rank.
|
||||
ListScoreboard(ctx context.Context, in *ListScoreboardRequest, opts ...grpc.CallOption) (*ListScoreboardResponse, error)
|
||||
// GetByRank returns the entry at the given canonical rank.
|
||||
GetByRank(ctx context.Context, in *GetByRankRequest, opts ...grpc.CallOption) (*Entry, error)
|
||||
// GetByUsername returns the entry for a username (case-insensitive).
|
||||
GetByUsername(ctx context.Context, in *GetByUsernameRequest, opts ...grpc.CallOption) (*Entry, error)
|
||||
}
|
||||
|
||||
type scoreboardServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewScoreboardServiceClient(cc grpc.ClientConnInterface) ScoreboardServiceClient {
|
||||
return &scoreboardServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *scoreboardServiceClient) ListScoreboard(ctx context.Context, in *ListScoreboardRequest, opts ...grpc.CallOption) (*ListScoreboardResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(ListScoreboardResponse)
|
||||
err := c.cc.Invoke(ctx, ScoreboardService_ListScoreboard_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *scoreboardServiceClient) GetByRank(ctx context.Context, in *GetByRankRequest, opts ...grpc.CallOption) (*Entry, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(Entry)
|
||||
err := c.cc.Invoke(ctx, ScoreboardService_GetByRank_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *scoreboardServiceClient) GetByUsername(ctx context.Context, in *GetByUsernameRequest, opts ...grpc.CallOption) (*Entry, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(Entry)
|
||||
err := c.cc.Invoke(ctx, ScoreboardService_GetByUsername_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// ScoreboardServiceServer is the server API for ScoreboardService service.
|
||||
// All implementations must embed UnimplementedScoreboardServiceServer
|
||||
// for forward compatibility.
|
||||
//
|
||||
// ScoreboardService serves the cached root-me.org scoreboard.
|
||||
type ScoreboardServiceServer interface {
|
||||
// ListScoreboard returns a page of entries ordered by rank.
|
||||
ListScoreboard(context.Context, *ListScoreboardRequest) (*ListScoreboardResponse, error)
|
||||
// GetByRank returns the entry at the given canonical rank.
|
||||
GetByRank(context.Context, *GetByRankRequest) (*Entry, error)
|
||||
// GetByUsername returns the entry for a username (case-insensitive).
|
||||
GetByUsername(context.Context, *GetByUsernameRequest) (*Entry, error)
|
||||
mustEmbedUnimplementedScoreboardServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedScoreboardServiceServer must be embedded to have
|
||||
// forward compatible implementations.
|
||||
//
|
||||
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedScoreboardServiceServer struct{}
|
||||
|
||||
func (UnimplementedScoreboardServiceServer) ListScoreboard(context.Context, *ListScoreboardRequest) (*ListScoreboardResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method ListScoreboard not implemented")
|
||||
}
|
||||
func (UnimplementedScoreboardServiceServer) GetByRank(context.Context, *GetByRankRequest) (*Entry, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method GetByRank not implemented")
|
||||
}
|
||||
func (UnimplementedScoreboardServiceServer) GetByUsername(context.Context, *GetByUsernameRequest) (*Entry, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method GetByUsername not implemented")
|
||||
}
|
||||
func (UnimplementedScoreboardServiceServer) mustEmbedUnimplementedScoreboardServiceServer() {}
|
||||
func (UnimplementedScoreboardServiceServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeScoreboardServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to ScoreboardServiceServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeScoreboardServiceServer interface {
|
||||
mustEmbedUnimplementedScoreboardServiceServer()
|
||||
}
|
||||
|
||||
func RegisterScoreboardServiceServer(s grpc.ServiceRegistrar, srv ScoreboardServiceServer) {
|
||||
// If the following call panics, it indicates UnimplementedScoreboardServiceServer was
|
||||
// embedded by pointer and is nil. This will cause panics if an
|
||||
// unimplemented method is ever invoked, so we test this at initialization
|
||||
// time to prevent it from happening at runtime later due to I/O.
|
||||
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||||
t.testEmbeddedByValue()
|
||||
}
|
||||
s.RegisterService(&ScoreboardService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _ScoreboardService_ListScoreboard_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListScoreboardRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ScoreboardServiceServer).ListScoreboard(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ScoreboardService_ListScoreboard_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ScoreboardServiceServer).ListScoreboard(ctx, req.(*ListScoreboardRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ScoreboardService_GetByRank_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetByRankRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ScoreboardServiceServer).GetByRank(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ScoreboardService_GetByRank_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ScoreboardServiceServer).GetByRank(ctx, req.(*GetByRankRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ScoreboardService_GetByUsername_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetByUsernameRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ScoreboardServiceServer).GetByUsername(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ScoreboardService_GetByUsername_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ScoreboardServiceServer).GetByUsername(ctx, req.(*GetByUsernameRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// ScoreboardService_ServiceDesc is the grpc.ServiceDesc for ScoreboardService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var ScoreboardService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "scoreboard.v1.ScoreboardService",
|
||||
HandlerType: (*ScoreboardServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "ListScoreboard",
|
||||
Handler: _ScoreboardService_ListScoreboard_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetByRank",
|
||||
Handler: _ScoreboardService_GetByRank_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetByUsername",
|
||||
Handler: _ScoreboardService_GetByUsername_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "scoreboard/v1/scoreboard.proto",
|
||||
}
|
||||
Reference in New Issue
Block a user