@ -21,6 +21,7 @@ import (
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/emptypb"
)
// Suppress "imported and not used" errors
@ -121,6 +122,198 @@ func local_request_AuthService_DeleteToken_0(ctx context.Context, marshaler runt
}
func request_QuestService_Questions_0 ( ctx context . Context , marshaler runtime . Marshaler , client QuestServiceClient , req * http . Request , pathParams map [ string ] string ) ( proto . Message , runtime . ServerMetadata , error ) {
var protoReq emptypb . Empty
var metadata runtime . ServerMetadata
msg , err := client . Questions ( ctx , & protoReq , grpc . Header ( & metadata . HeaderMD ) , grpc . Trailer ( & metadata . TrailerMD ) )
return msg , metadata , err
}
func local_request_QuestService_Questions_0 ( ctx context . Context , marshaler runtime . Marshaler , server QuestServiceServer , req * http . Request , pathParams map [ string ] string ) ( proto . Message , runtime . ServerMetadata , error ) {
var protoReq emptypb . Empty
var metadata runtime . ServerMetadata
msg , err := server . Questions ( ctx , & protoReq )
return msg , metadata , err
}
func request_QuestService_QuestionByID_0 ( ctx context . Context , marshaler runtime . Marshaler , client QuestServiceClient , req * http . Request , pathParams map [ string ] string ) ( proto . Message , runtime . ServerMetadata , error ) {
var protoReq QuestionByIDRequest
var metadata runtime . ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val , ok = pathParams [ "ID" ]
if ! ok {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "missing parameter %s" , "ID" )
}
protoReq . ID , err = runtime . String ( val )
if err != nil {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "type mismatch, parameter: %s, error: %v" , "ID" , err )
}
msg , err := client . QuestionByID ( ctx , & protoReq , grpc . Header ( & metadata . HeaderMD ) , grpc . Trailer ( & metadata . TrailerMD ) )
return msg , metadata , err
}
func local_request_QuestService_QuestionByID_0 ( ctx context . Context , marshaler runtime . Marshaler , server QuestServiceServer , req * http . Request , pathParams map [ string ] string ) ( proto . Message , runtime . ServerMetadata , error ) {
var protoReq QuestionByIDRequest
var metadata runtime . ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val , ok = pathParams [ "ID" ]
if ! ok {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "missing parameter %s" , "ID" )
}
protoReq . ID , err = runtime . String ( val )
if err != nil {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "type mismatch, parameter: %s, error: %v" , "ID" , err )
}
msg , err := server . QuestionByID ( ctx , & protoReq )
return msg , metadata , err
}
func request_QuestService_QuestionInput_0 ( ctx context . Context , marshaler runtime . Marshaler , client QuestServiceClient , req * http . Request , pathParams map [ string ] string ) ( proto . Message , runtime . ServerMetadata , error ) {
var protoReq QuestionInputRequest
var metadata runtime . ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val , ok = pathParams [ "ID" ]
if ! ok {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "missing parameter %s" , "ID" )
}
protoReq . ID , err = runtime . String ( val )
if err != nil {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "type mismatch, parameter: %s, error: %v" , "ID" , err )
}
msg , err := client . QuestionInput ( ctx , & protoReq , grpc . Header ( & metadata . HeaderMD ) , grpc . Trailer ( & metadata . TrailerMD ) )
return msg , metadata , err
}
func local_request_QuestService_QuestionInput_0 ( ctx context . Context , marshaler runtime . Marshaler , server QuestServiceServer , req * http . Request , pathParams map [ string ] string ) ( proto . Message , runtime . ServerMetadata , error ) {
var protoReq QuestionInputRequest
var metadata runtime . ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val , ok = pathParams [ "ID" ]
if ! ok {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "missing parameter %s" , "ID" )
}
protoReq . ID , err = runtime . String ( val )
if err != nil {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "type mismatch, parameter: %s, error: %v" , "ID" , err )
}
msg , err := server . QuestionInput ( ctx , & protoReq )
return msg , metadata , err
}
var (
filter_QuestService_Submit_0 = & utilities . DoubleArray { Encoding : map [ string ] int { "ID" : 0 } , Base : [ ] int { 1 , 1 , 0 } , Check : [ ] int { 0 , 1 , 2 } }
)
func request_QuestService_Submit_0 ( ctx context . Context , marshaler runtime . Marshaler , client QuestServiceClient , req * http . Request , pathParams map [ string ] string ) ( proto . Message , runtime . ServerMetadata , error ) {
var protoReq SubmitRequest
var metadata runtime . ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val , ok = pathParams [ "ID" ]
if ! ok {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "missing parameter %s" , "ID" )
}
protoReq . ID , err = runtime . String ( val )
if err != nil {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "type mismatch, parameter: %s, error: %v" , "ID" , err )
}
if err := req . ParseForm ( ) ; err != nil {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "%v" , err )
}
if err := runtime . PopulateQueryParameters ( & protoReq , req . Form , filter_QuestService_Submit_0 ) ; err != nil {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "%v" , err )
}
msg , err := client . Submit ( ctx , & protoReq , grpc . Header ( & metadata . HeaderMD ) , grpc . Trailer ( & metadata . TrailerMD ) )
return msg , metadata , err
}
func local_request_QuestService_Submit_0 ( ctx context . Context , marshaler runtime . Marshaler , server QuestServiceServer , req * http . Request , pathParams map [ string ] string ) ( proto . Message , runtime . ServerMetadata , error ) {
var protoReq SubmitRequest
var metadata runtime . ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val , ok = pathParams [ "ID" ]
if ! ok {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "missing parameter %s" , "ID" )
}
protoReq . ID , err = runtime . String ( val )
if err != nil {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "type mismatch, parameter: %s, error: %v" , "ID" , err )
}
if err := req . ParseForm ( ) ; err != nil {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "%v" , err )
}
if err := runtime . PopulateQueryParameters ( & protoReq , req . Form , filter_QuestService_Submit_0 ) ; err != nil {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "%v" , err )
}
msg , err := server . Submit ( ctx , & protoReq )
return msg , metadata , err
}
func request_UserService_User_0 ( ctx context . Context , marshaler runtime . Marshaler , client UserServiceClient , req * http . Request , pathParams map [ string ] string ) ( proto . Message , runtime . ServerMetadata , error ) {
var protoReq UserRequest
var metadata runtime . ServerMetadata
@ -459,6 +652,107 @@ func RegisterAuthServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux
return nil
}
// RegisterQuestServiceHandlerServer registers the http handlers for service QuestService to "mux".
// UnaryRPC :call QuestServiceServer 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 RegisterQuestServiceHandlerFromEndpoint instead.
func RegisterQuestServiceHandlerServer ( ctx context . Context , mux * runtime . ServeMux , server QuestServiceServer ) error {
mux . Handle ( "GET" , pattern_QuestService_Questions_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 )
rctx , err := runtime . AnnotateIncomingContext ( ctx , mux , req , "/hhhapz.codequest.v1.QuestService/Questions" , runtime . WithHTTPPathPattern ( "/v1/questions" ) )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
resp , md , err := local_request_QuestService_Questions_0 ( rctx , inboundMarshaler , server , req , pathParams )
md . HeaderMD , md . TrailerMD = metadata . Join ( md . HeaderMD , stream . Header ( ) ) , metadata . Join ( md . TrailerMD , stream . Trailer ( ) )
ctx = runtime . NewServerMetadataContext ( ctx , md )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
forward_QuestService_Questions_0 ( ctx , mux , outboundMarshaler , w , req , resp , mux . GetForwardResponseOptions ( ) ... )
} )
mux . Handle ( "GET" , pattern_QuestService_QuestionByID_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 )
rctx , err := runtime . AnnotateIncomingContext ( ctx , mux , req , "/hhhapz.codequest.v1.QuestService/QuestionByID" , runtime . WithHTTPPathPattern ( "/v1/questions/{ID}" ) )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
resp , md , err := local_request_QuestService_QuestionByID_0 ( rctx , inboundMarshaler , server , req , pathParams )
md . HeaderMD , md . TrailerMD = metadata . Join ( md . HeaderMD , stream . Header ( ) ) , metadata . Join ( md . TrailerMD , stream . Trailer ( ) )
ctx = runtime . NewServerMetadataContext ( ctx , md )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
forward_QuestService_QuestionByID_0 ( ctx , mux , outboundMarshaler , w , req , resp , mux . GetForwardResponseOptions ( ) ... )
} )
mux . Handle ( "GET" , pattern_QuestService_QuestionInput_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 )
rctx , err := runtime . AnnotateIncomingContext ( ctx , mux , req , "/hhhapz.codequest.v1.QuestService/QuestionInput" , runtime . WithHTTPPathPattern ( "/v1/questions/{ID}/input" ) )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
resp , md , err := local_request_QuestService_QuestionInput_0 ( rctx , inboundMarshaler , server , req , pathParams )
md . HeaderMD , md . TrailerMD = metadata . Join ( md . HeaderMD , stream . Header ( ) ) , metadata . Join ( md . TrailerMD , stream . Trailer ( ) )
ctx = runtime . NewServerMetadataContext ( ctx , md )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
forward_QuestService_QuestionInput_0 ( ctx , mux , outboundMarshaler , w , req , resp , mux . GetForwardResponseOptions ( ) ... )
} )
mux . Handle ( "POST" , pattern_QuestService_Submit_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 )
rctx , err := runtime . AnnotateIncomingContext ( ctx , mux , req , "/hhhapz.codequest.v1.QuestService/Submit" , runtime . WithHTTPPathPattern ( "/v1/questions/{ID}" ) )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
resp , md , err := local_request_QuestService_Submit_0 ( rctx , inboundMarshaler , server , req , pathParams )
md . HeaderMD , md . TrailerMD = metadata . Join ( md . HeaderMD , stream . Header ( ) ) , metadata . Join ( md . TrailerMD , stream . Trailer ( ) )
ctx = runtime . NewServerMetadataContext ( ctx , md )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
forward_QuestService_Submit_0 ( ctx , mux , outboundMarshaler , w , req , resp , mux . GetForwardResponseOptions ( ) ... )
} )
return nil
}
// RegisterUserServiceHandlerServer registers the http handlers for service UserService to "mux".
// UnaryRPC :call UserServiceServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
@ -723,6 +1017,147 @@ var (
forward_AuthService_DeleteToken_0 = runtime . ForwardResponseMessage
)
// RegisterQuestServiceHandlerFromEndpoint is same as RegisterQuestServiceHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterQuestServiceHandlerFromEndpoint ( ctx context . Context , mux * runtime . ServeMux , endpoint string , opts [ ] grpc . DialOption ) ( err error ) {
conn , err := grpc . Dial ( endpoint , opts ... )
if err != nil {
return err
}
defer func ( ) {
if err != nil {
if cerr := conn . Close ( ) ; cerr != nil {
grpclog . Infof ( "Failed to close conn to %s: %v" , endpoint , cerr )
}
return
}
go func ( ) {
<- ctx . Done ( )
if cerr := conn . Close ( ) ; cerr != nil {
grpclog . Infof ( "Failed to close conn to %s: %v" , endpoint , cerr )
}
} ( )
} ( )
return RegisterQuestServiceHandler ( ctx , mux , conn )
}
// RegisterQuestServiceHandler registers the http handlers for service QuestService to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterQuestServiceHandler ( ctx context . Context , mux * runtime . ServeMux , conn grpc . ClientConnInterface ) error {
return RegisterQuestServiceHandlerClient ( ctx , mux , NewQuestServiceClient ( conn ) )
}
// RegisterQuestServiceHandlerClient registers the http handlers for service QuestService
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QuestServiceClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QuestServiceClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "QuestServiceClient" to call the correct interceptors.
func RegisterQuestServiceHandlerClient ( ctx context . Context , mux * runtime . ServeMux , client QuestServiceClient ) error {
mux . Handle ( "GET" , pattern_QuestService_Questions_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 )
rctx , err := runtime . AnnotateContext ( ctx , mux , req , "/hhhapz.codequest.v1.QuestService/Questions" , runtime . WithHTTPPathPattern ( "/v1/questions" ) )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
resp , md , err := request_QuestService_Questions_0 ( rctx , inboundMarshaler , client , req , pathParams )
ctx = runtime . NewServerMetadataContext ( ctx , md )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
forward_QuestService_Questions_0 ( ctx , mux , outboundMarshaler , w , req , resp , mux . GetForwardResponseOptions ( ) ... )
} )
mux . Handle ( "GET" , pattern_QuestService_QuestionByID_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 )
rctx , err := runtime . AnnotateContext ( ctx , mux , req , "/hhhapz.codequest.v1.QuestService/QuestionByID" , runtime . WithHTTPPathPattern ( "/v1/questions/{ID}" ) )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
resp , md , err := request_QuestService_QuestionByID_0 ( rctx , inboundMarshaler , client , req , pathParams )
ctx = runtime . NewServerMetadataContext ( ctx , md )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
forward_QuestService_QuestionByID_0 ( ctx , mux , outboundMarshaler , w , req , resp , mux . GetForwardResponseOptions ( ) ... )
} )
mux . Handle ( "GET" , pattern_QuestService_QuestionInput_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 )
rctx , err := runtime . AnnotateContext ( ctx , mux , req , "/hhhapz.codequest.v1.QuestService/QuestionInput" , runtime . WithHTTPPathPattern ( "/v1/questions/{ID}/input" ) )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
resp , md , err := request_QuestService_QuestionInput_0 ( rctx , inboundMarshaler , client , req , pathParams )
ctx = runtime . NewServerMetadataContext ( ctx , md )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
forward_QuestService_QuestionInput_0 ( ctx , mux , outboundMarshaler , w , req , resp , mux . GetForwardResponseOptions ( ) ... )
} )
mux . Handle ( "POST" , pattern_QuestService_Submit_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 )
rctx , err := runtime . AnnotateContext ( ctx , mux , req , "/hhhapz.codequest.v1.QuestService/Submit" , runtime . WithHTTPPathPattern ( "/v1/questions/{ID}" ) )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
resp , md , err := request_QuestService_Submit_0 ( rctx , inboundMarshaler , client , req , pathParams )
ctx = runtime . NewServerMetadataContext ( ctx , md )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
forward_QuestService_Submit_0 ( ctx , mux , outboundMarshaler , w , req , resp , mux . GetForwardResponseOptions ( ) ... )
} )
return nil
}
var (
pattern_QuestService_Questions_0 = runtime . MustPattern ( runtime . NewPattern ( 1 , [ ] int { 2 , 0 , 2 , 1 } , [ ] string { "v1" , "questions" } , "" ) )
pattern_QuestService_QuestionByID_0 = runtime . MustPattern ( runtime . NewPattern ( 1 , [ ] int { 2 , 0 , 2 , 1 , 1 , 0 , 4 , 1 , 5 , 2 } , [ ] string { "v1" , "questions" , "ID" } , "" ) )
pattern_QuestService_QuestionInput_0 = runtime . MustPattern ( runtime . NewPattern ( 1 , [ ] int { 2 , 0 , 2 , 1 , 1 , 0 , 4 , 1 , 5 , 2 , 2 , 3 } , [ ] string { "v1" , "questions" , "ID" , "input" } , "" ) )
pattern_QuestService_Submit_0 = runtime . MustPattern ( runtime . NewPattern ( 1 , [ ] int { 2 , 0 , 2 , 1 , 1 , 0 , 4 , 1 , 5 , 2 } , [ ] string { "v1" , "questions" , "ID" } , "" ) )
)
var (
forward_QuestService_Questions_0 = runtime . ForwardResponseMessage
forward_QuestService_QuestionByID_0 = runtime . ForwardResponseMessage
forward_QuestService_QuestionInput_0 = runtime . ForwardResponseMessage
forward_QuestService_Submit_0 = runtime . ForwardResponseMessage
)
// RegisterUserServiceHandlerFromEndpoint is same as RegisterUserServiceHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterUserServiceHandlerFromEndpoint ( ctx context . Context , mux * runtime . ServeMux , endpoint string , opts [ ] grpc . DialOption ) ( err error ) {