This commit is contained in:
2026-10-11 02:23:22 +07:00
parent 9d46fc0e13
commit 62b623d3ca
9 changed files with 1089 additions and 716 deletions
+781 -712
View File
File diff suppressed because it is too large Load Diff
+66
View File
@@ -2053,6 +2053,33 @@ func local_request_EveningDetectiveServer_GetGame_0(ctx context.Context, marshal
return msg, metadata, err
}
func request_EveningDetectiveServer_ImportGame_0(ctx context.Context, marshaler runtime.Marshaler, client EveningDetectiveServerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq httpbody.HttpBody
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if req.Body != nil {
_, _ = io.Copy(io.Discard, req.Body)
}
msg, err := client.ImportGame(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_EveningDetectiveServer_ImportGame_0(ctx context.Context, marshaler runtime.Marshaler, server EveningDetectiveServerServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq httpbody.HttpBody
metadata runtime.ServerMetadata
)
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.ImportGame(ctx, &protoReq)
return msg, metadata, err
}
func request_EveningDetectiveServer_StartGameExport_0(ctx context.Context, marshaler runtime.Marshaler, client EveningDetectiveServerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var (
protoReq StartGameExportReq
@@ -5264,6 +5291,26 @@ func RegisterEveningDetectiveServerHandlerServer(ctx context.Context, mux *runti
}
forward_EveningDetectiveServer_GetGame_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_EveningDetectiveServer_ImportGame_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/crabs.evening_detective_server.EveningDetectiveServer/ImportGame", runtime.WithHTTPPathPattern("/api/games/import"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_EveningDetectiveServer_ImportGame_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_EveningDetectiveServer_ImportGame_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_EveningDetectiveServer_StartGameExport_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -7253,6 +7300,23 @@ func RegisterEveningDetectiveServerHandlerClient(ctx context.Context, mux *runti
}
forward_EveningDetectiveServer_GetGame_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_EveningDetectiveServer_ImportGame_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/crabs.evening_detective_server.EveningDetectiveServer/ImportGame", runtime.WithHTTPPathPattern("/api/games/import"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_EveningDetectiveServer_ImportGame_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_EveningDetectiveServer_ImportGame_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle(http.MethodPost, pattern_EveningDetectiveServer_StartGameExport_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -8147,6 +8211,7 @@ var (
pattern_EveningDetectiveServer_AddGame_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"api", "games"}, ""))
pattern_EveningDetectiveServer_GetGames_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"api", "games"}, ""))
pattern_EveningDetectiveServer_GetGame_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"api", "games", "ID"}, ""))
pattern_EveningDetectiveServer_ImportGame_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "games", "import"}, ""))
pattern_EveningDetectiveServer_StartGameExport_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"api", "games", "ID", "export"}, ""))
pattern_EveningDetectiveServer_GetGameExport_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"api", "games", "ID", "export"}, ""))
pattern_EveningDetectiveServer_IssueGameTickets_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"api", "games", "gameID", "tickets"}, ""))
@@ -8256,6 +8321,7 @@ var (
forward_EveningDetectiveServer_AddGame_0 = runtime.ForwardResponseMessage
forward_EveningDetectiveServer_GetGames_0 = runtime.ForwardResponseMessage
forward_EveningDetectiveServer_GetGame_0 = runtime.ForwardResponseMessage
forward_EveningDetectiveServer_ImportGame_0 = runtime.ForwardResponseMessage
forward_EveningDetectiveServer_StartGameExport_0 = runtime.ForwardResponseMessage
forward_EveningDetectiveServer_GetGameExport_0 = runtime.ForwardResponseMessage
forward_EveningDetectiveServer_IssueGameTickets_0 = runtime.ForwardResponseMessage
+40
View File
@@ -83,6 +83,7 @@ const (
EveningDetectiveServer_AddGame_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/AddGame"
EveningDetectiveServer_GetGames_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/GetGames"
EveningDetectiveServer_GetGame_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/GetGame"
EveningDetectiveServer_ImportGame_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/ImportGame"
EveningDetectiveServer_StartGameExport_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/StartGameExport"
EveningDetectiveServer_GetGameExport_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/GetGameExport"
EveningDetectiveServer_IssueGameTickets_FullMethodName = "/crabs.evening_detective_server.EveningDetectiveServer/IssueGameTickets"
@@ -199,6 +200,8 @@ type EveningDetectiveServerClient interface {
AddGame(ctx context.Context, in *AddGameReq, opts ...grpc.CallOption) (*AddGameRsp, error)
GetGames(ctx context.Context, in *GetGamesReq, opts ...grpc.CallOption) (*GetGamesRsp, error)
GetGame(ctx context.Context, in *GetGameReq, opts ...grpc.CallOption) (*GetGameRsp, error)
// HTTP uploads are streamed by a dedicated handler, bypassing gRPC message limits.
ImportGame(ctx context.Context, in *httpbody.HttpBody, opts ...grpc.CallOption) (*GameImportRsp, error)
StartGameExport(ctx context.Context, in *StartGameExportReq, opts ...grpc.CallOption) (*GameExportRsp, error)
GetGameExport(ctx context.Context, in *GetGameExportReq, opts ...grpc.CallOption) (*GameExportRsp, error)
IssueGameTickets(ctx context.Context, in *IssueGameTicketsReq, opts ...grpc.CallOption) (*IssueGameTicketsRsp, error)
@@ -834,6 +837,16 @@ func (c *eveningDetectiveServerClient) GetGame(ctx context.Context, in *GetGameR
return out, nil
}
func (c *eveningDetectiveServerClient) ImportGame(ctx context.Context, in *httpbody.HttpBody, opts ...grpc.CallOption) (*GameImportRsp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GameImportRsp)
err := c.cc.Invoke(ctx, EveningDetectiveServer_ImportGame_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *eveningDetectiveServerClient) StartGameExport(ctx context.Context, in *StartGameExportReq, opts ...grpc.CallOption) (*GameExportRsp, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(GameExportRsp)
@@ -1389,6 +1402,8 @@ type EveningDetectiveServerServer interface {
AddGame(context.Context, *AddGameReq) (*AddGameRsp, error)
GetGames(context.Context, *GetGamesReq) (*GetGamesRsp, error)
GetGame(context.Context, *GetGameReq) (*GetGameRsp, error)
// HTTP uploads are streamed by a dedicated handler, bypassing gRPC message limits.
ImportGame(context.Context, *httpbody.HttpBody) (*GameImportRsp, error)
StartGameExport(context.Context, *StartGameExportReq) (*GameExportRsp, error)
GetGameExport(context.Context, *GetGameExportReq) (*GameExportRsp, error)
IssueGameTickets(context.Context, *IssueGameTicketsReq) (*IssueGameTicketsRsp, error)
@@ -1625,6 +1640,9 @@ func (UnimplementedEveningDetectiveServerServer) GetGames(context.Context, *GetG
func (UnimplementedEveningDetectiveServerServer) GetGame(context.Context, *GetGameReq) (*GetGameRsp, error) {
return nil, status.Error(codes.Unimplemented, "method GetGame not implemented")
}
func (UnimplementedEveningDetectiveServerServer) ImportGame(context.Context, *httpbody.HttpBody) (*GameImportRsp, error) {
return nil, status.Error(codes.Unimplemented, "method ImportGame not implemented")
}
func (UnimplementedEveningDetectiveServerServer) StartGameExport(context.Context, *StartGameExportReq) (*GameExportRsp, error) {
return nil, status.Error(codes.Unimplemented, "method StartGameExport not implemented")
}
@@ -2820,6 +2838,24 @@ func _EveningDetectiveServer_GetGame_Handler(srv interface{}, ctx context.Contex
return interceptor(ctx, in, info, handler)
}
func _EveningDetectiveServer_ImportGame_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(httpbody.HttpBody)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(EveningDetectiveServerServer).ImportGame(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: EveningDetectiveServer_ImportGame_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(EveningDetectiveServerServer).ImportGame(ctx, req.(*httpbody.HttpBody))
}
return interceptor(ctx, in, info, handler)
}
func _EveningDetectiveServer_StartGameExport_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(StartGameExportReq)
if err := dec(in); err != nil {
@@ -3937,6 +3973,10 @@ var EveningDetectiveServer_ServiceDesc = grpc.ServiceDesc{
MethodName: "GetGame",
Handler: _EveningDetectiveServer_GetGame_Handler,
},
{
MethodName: "ImportGame",
Handler: _EveningDetectiveServer_ImportGame_Handler,
},
{
MethodName: "StartGameExport",
Handler: _EveningDetectiveServer_StartGameExport_Handler,