2021-12-19 15:30:21 +07:00
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: github.com/hhhapz/codequest/api/v1/all.proto
/ *
Package codequest is a reverse proxy .
It translates gRPC into RESTful JSON APIs .
* /
package codequest
import (
"context"
"io"
"net/http"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
2021-12-21 10:18:12 +07:00
"google.golang.org/protobuf/types/known/emptypb"
2021-12-19 15:30:21 +07:00
)
// Suppress "imported and not used" errors
var _ codes . Code
var _ io . Reader
var _ status . Status
var _ = runtime . String
var _ = utilities . NewDoubleArray
var _ = metadata . Join
func request_AuthService_OAuthCode_0 ( ctx context . Context , marshaler runtime . Marshaler , client AuthServiceClient , req * http . Request , pathParams map [ string ] string ) ( proto . Message , runtime . ServerMetadata , error ) {
var protoReq OAuthCodeRequest
var metadata runtime . ServerMetadata
msg , err := client . OAuthCode ( ctx , & protoReq , grpc . Header ( & metadata . HeaderMD ) , grpc . Trailer ( & metadata . TrailerMD ) )
return msg , metadata , err
}
func local_request_AuthService_OAuthCode_0 ( ctx context . Context , marshaler runtime . Marshaler , server AuthServiceServer , req * http . Request , pathParams map [ string ] string ) ( proto . Message , runtime . ServerMetadata , error ) {
var protoReq OAuthCodeRequest
var metadata runtime . ServerMetadata
msg , err := server . OAuthCode ( ctx , & protoReq )
return msg , metadata , err
}
var (
filter_AuthService_Token_0 = & utilities . DoubleArray { Encoding : map [ string ] int { } , Base : [ ] int ( nil ) , Check : [ ] int ( nil ) }
)
func request_AuthService_Token_0 ( ctx context . Context , marshaler runtime . Marshaler , client AuthServiceClient , req * http . Request , pathParams map [ string ] string ) ( proto . Message , runtime . ServerMetadata , error ) {
var protoReq TokenRequest
var metadata runtime . ServerMetadata
if err := req . ParseForm ( ) ; err != nil {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "%v" , err )
}
if err := runtime . PopulateQueryParameters ( & protoReq , req . Form , filter_AuthService_Token_0 ) ; err != nil {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "%v" , err )
}
msg , err := client . Token ( ctx , & protoReq , grpc . Header ( & metadata . HeaderMD ) , grpc . Trailer ( & metadata . TrailerMD ) )
return msg , metadata , err
}
func local_request_AuthService_Token_0 ( ctx context . Context , marshaler runtime . Marshaler , server AuthServiceServer , req * http . Request , pathParams map [ string ] string ) ( proto . Message , runtime . ServerMetadata , error ) {
var protoReq TokenRequest
var metadata runtime . ServerMetadata
if err := req . ParseForm ( ) ; err != nil {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "%v" , err )
}
if err := runtime . PopulateQueryParameters ( & protoReq , req . Form , filter_AuthService_Token_0 ) ; err != nil {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "%v" , err )
}
msg , err := server . Token ( ctx , & protoReq )
return msg , metadata , err
}
var (
filter_AuthService_DeleteToken_0 = & utilities . DoubleArray { Encoding : map [ string ] int { } , Base : [ ] int ( nil ) , Check : [ ] int ( nil ) }
)
func request_AuthService_DeleteToken_0 ( ctx context . Context , marshaler runtime . Marshaler , client AuthServiceClient , req * http . Request , pathParams map [ string ] string ) ( proto . Message , runtime . ServerMetadata , error ) {
var protoReq DeleteTokenRequest
var metadata runtime . ServerMetadata
if err := req . ParseForm ( ) ; err != nil {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "%v" , err )
}
if err := runtime . PopulateQueryParameters ( & protoReq , req . Form , filter_AuthService_DeleteToken_0 ) ; err != nil {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "%v" , err )
}
msg , err := client . DeleteToken ( ctx , & protoReq , grpc . Header ( & metadata . HeaderMD ) , grpc . Trailer ( & metadata . TrailerMD ) )
return msg , metadata , err
}
func local_request_AuthService_DeleteToken_0 ( ctx context . Context , marshaler runtime . Marshaler , server AuthServiceServer , req * http . Request , pathParams map [ string ] string ) ( proto . Message , runtime . ServerMetadata , error ) {
var protoReq DeleteTokenRequest
var metadata runtime . ServerMetadata
if err := req . ParseForm ( ) ; err != nil {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "%v" , err )
}
if err := runtime . PopulateQueryParameters ( & protoReq , req . Form , filter_AuthService_DeleteToken_0 ) ; err != nil {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "%v" , err )
}
msg , err := server . DeleteToken ( ctx , & protoReq )
return msg , metadata , err
}
2021-12-21 10:18:12 +07:00
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
}
2021-12-19 15:30:21 +07:00
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
msg , err := client . User ( ctx , & protoReq , grpc . Header ( & metadata . HeaderMD ) , grpc . Trailer ( & metadata . TrailerMD ) )
return msg , metadata , err
}
func local_request_UserService_User_0 ( ctx context . Context , marshaler runtime . Marshaler , server UserServiceServer , req * http . Request , pathParams map [ string ] string ) ( proto . Message , runtime . ServerMetadata , error ) {
var protoReq UserRequest
var metadata runtime . ServerMetadata
msg , err := server . User ( ctx , & protoReq )
return msg , metadata , err
}
func request_UserService_UserByEmail_0 ( ctx context . Context , marshaler runtime . Marshaler , client UserServiceClient , req * http . Request , pathParams map [ string ] string ) ( proto . Message , runtime . ServerMetadata , error ) {
var protoReq UserByEmailRequest
var metadata runtime . ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val , ok = pathParams [ "Email" ]
if ! ok {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "missing parameter %s" , "Email" )
}
protoReq . Email , err = runtime . String ( val )
if err != nil {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "type mismatch, parameter: %s, error: %v" , "Email" , err )
}
msg , err := client . UserByEmail ( ctx , & protoReq , grpc . Header ( & metadata . HeaderMD ) , grpc . Trailer ( & metadata . TrailerMD ) )
return msg , metadata , err
}
func local_request_UserService_UserByEmail_0 ( ctx context . Context , marshaler runtime . Marshaler , server UserServiceServer , req * http . Request , pathParams map [ string ] string ) ( proto . Message , runtime . ServerMetadata , error ) {
var protoReq UserByEmailRequest
var metadata runtime . ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val , ok = pathParams [ "Email" ]
if ! ok {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "missing parameter %s" , "Email" )
}
protoReq . Email , err = runtime . String ( val )
if err != nil {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "type mismatch, parameter: %s, error: %v" , "Email" , err )
}
msg , err := server . UserByEmail ( ctx , & protoReq )
return msg , metadata , err
}
func request_UserService_AllUsers_0 ( ctx context . Context , marshaler runtime . Marshaler , client UserServiceClient , req * http . Request , pathParams map [ string ] string ) ( proto . Message , runtime . ServerMetadata , error ) {
var protoReq AllUsersRequest
var metadata runtime . ServerMetadata
msg , err := client . AllUsers ( ctx , & protoReq , grpc . Header ( & metadata . HeaderMD ) , grpc . Trailer ( & metadata . TrailerMD ) )
return msg , metadata , err
}
func local_request_UserService_AllUsers_0 ( ctx context . Context , marshaler runtime . Marshaler , server UserServiceServer , req * http . Request , pathParams map [ string ] string ) ( proto . Message , runtime . ServerMetadata , error ) {
var protoReq AllUsersRequest
var metadata runtime . ServerMetadata
msg , err := server . AllUsers ( ctx , & protoReq )
return msg , metadata , err
}
var (
filter_UserService_UpdateUser_0 = & utilities . DoubleArray { Encoding : map [ string ] int { "Body" : 0 } , Base : [ ] int { 1 , 1 , 0 } , Check : [ ] int { 0 , 1 , 2 } }
)
func request_UserService_UpdateUser_0 ( ctx context . Context , marshaler runtime . Marshaler , client UserServiceClient , req * http . Request , pathParams map [ string ] string ) ( proto . Message , runtime . ServerMetadata , error ) {
var protoReq UpdateUserRequest
var metadata runtime . ServerMetadata
newReader , berr := utilities . IOReaderFactory ( req . Body )
if berr != nil {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "%v" , berr )
}
if err := marshaler . NewDecoder ( newReader ( ) ) . Decode ( & protoReq . Body ) ; err != nil && err != io . EOF {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "%v" , err )
}
if err := req . ParseForm ( ) ; err != nil {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "%v" , err )
}
if err := runtime . PopulateQueryParameters ( & protoReq , req . Form , filter_UserService_UpdateUser_0 ) ; err != nil {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "%v" , err )
}
msg , err := client . UpdateUser ( ctx , & protoReq , grpc . Header ( & metadata . HeaderMD ) , grpc . Trailer ( & metadata . TrailerMD ) )
return msg , metadata , err
}
func local_request_UserService_UpdateUser_0 ( ctx context . Context , marshaler runtime . Marshaler , server UserServiceServer , req * http . Request , pathParams map [ string ] string ) ( proto . Message , runtime . ServerMetadata , error ) {
var protoReq UpdateUserRequest
var metadata runtime . ServerMetadata
newReader , berr := utilities . IOReaderFactory ( req . Body )
if berr != nil {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "%v" , berr )
}
if err := marshaler . NewDecoder ( newReader ( ) ) . Decode ( & protoReq . Body ) ; err != nil && err != io . EOF {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "%v" , err )
}
if err := req . ParseForm ( ) ; err != nil {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "%v" , err )
}
if err := runtime . PopulateQueryParameters ( & protoReq , req . Form , filter_UserService_UpdateUser_0 ) ; err != nil {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "%v" , err )
}
msg , err := server . UpdateUser ( ctx , & protoReq )
return msg , metadata , err
}
func request_UserService_AdminUpdateUser_0 ( ctx context . Context , marshaler runtime . Marshaler , client UserServiceClient , req * http . Request , pathParams map [ string ] string ) ( proto . Message , runtime . ServerMetadata , error ) {
var protoReq UpdateUserRequest
var metadata runtime . ServerMetadata
newReader , berr := utilities . IOReaderFactory ( req . Body )
if berr != nil {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "%v" , berr )
}
if err := marshaler . NewDecoder ( newReader ( ) ) . Decode ( & protoReq . Body ) ; err != nil && err != io . EOF {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "%v" , err )
}
var (
val string
ok bool
err error
_ = err
)
val , ok = pathParams [ "Email" ]
if ! ok {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "missing parameter %s" , "Email" )
}
protoReq . Email , err = runtime . String ( val )
if err != nil {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "type mismatch, parameter: %s, error: %v" , "Email" , err )
}
msg , err := client . AdminUpdateUser ( ctx , & protoReq , grpc . Header ( & metadata . HeaderMD ) , grpc . Trailer ( & metadata . TrailerMD ) )
return msg , metadata , err
}
func local_request_UserService_AdminUpdateUser_0 ( ctx context . Context , marshaler runtime . Marshaler , server UserServiceServer , req * http . Request , pathParams map [ string ] string ) ( proto . Message , runtime . ServerMetadata , error ) {
var protoReq UpdateUserRequest
var metadata runtime . ServerMetadata
newReader , berr := utilities . IOReaderFactory ( req . Body )
if berr != nil {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "%v" , berr )
}
if err := marshaler . NewDecoder ( newReader ( ) ) . Decode ( & protoReq . Body ) ; err != nil && err != io . EOF {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "%v" , err )
}
var (
val string
ok bool
err error
_ = err
)
val , ok = pathParams [ "Email" ]
if ! ok {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "missing parameter %s" , "Email" )
}
protoReq . Email , err = runtime . String ( val )
if err != nil {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "type mismatch, parameter: %s, error: %v" , "Email" , err )
}
msg , err := server . AdminUpdateUser ( ctx , & protoReq )
return msg , metadata , err
}
func request_UserService_DeleteUser_0 ( ctx context . Context , marshaler runtime . Marshaler , client UserServiceClient , req * http . Request , pathParams map [ string ] string ) ( proto . Message , runtime . ServerMetadata , error ) {
var protoReq DeleteUserRequest
var metadata runtime . ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val , ok = pathParams [ "Email" ]
if ! ok {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "missing parameter %s" , "Email" )
}
protoReq . Email , err = runtime . String ( val )
if err != nil {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "type mismatch, parameter: %s, error: %v" , "Email" , err )
}
msg , err := client . DeleteUser ( ctx , & protoReq , grpc . Header ( & metadata . HeaderMD ) , grpc . Trailer ( & metadata . TrailerMD ) )
return msg , metadata , err
}
func local_request_UserService_DeleteUser_0 ( ctx context . Context , marshaler runtime . Marshaler , server UserServiceServer , req * http . Request , pathParams map [ string ] string ) ( proto . Message , runtime . ServerMetadata , error ) {
var protoReq DeleteUserRequest
var metadata runtime . ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val , ok = pathParams [ "Email" ]
if ! ok {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "missing parameter %s" , "Email" )
}
protoReq . Email , err = runtime . String ( val )
if err != nil {
return nil , metadata , status . Errorf ( codes . InvalidArgument , "type mismatch, parameter: %s, error: %v" , "Email" , err )
}
msg , err := server . DeleteUser ( ctx , & protoReq )
return msg , metadata , err
}
// RegisterAuthServiceHandlerServer registers the http handlers for service AuthService to "mux".
// UnaryRPC :call AuthServiceServer 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 RegisterAuthServiceHandlerFromEndpoint instead.
func RegisterAuthServiceHandlerServer ( ctx context . Context , mux * runtime . ServeMux , server AuthServiceServer ) error {
mux . Handle ( "GET" , pattern_AuthService_OAuthCode_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.AuthService/OAuthCode" , runtime . WithHTTPPathPattern ( "/v1/auth/code" ) )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
resp , md , err := local_request_AuthService_OAuthCode_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_AuthService_OAuthCode_0 ( ctx , mux , outboundMarshaler , w , req , resp , mux . GetForwardResponseOptions ( ) ... )
} )
mux . Handle ( "GET" , pattern_AuthService_Token_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.AuthService/Token" , runtime . WithHTTPPathPattern ( "/v1/auth/token" ) )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
resp , md , err := local_request_AuthService_Token_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_AuthService_Token_0 ( ctx , mux , outboundMarshaler , w , req , resp , mux . GetForwardResponseOptions ( ) ... )
} )
mux . Handle ( "DELETE" , pattern_AuthService_DeleteToken_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.AuthService/DeleteToken" , runtime . WithHTTPPathPattern ( "/v1/auth/token" ) )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
resp , md , err := local_request_AuthService_DeleteToken_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_AuthService_DeleteToken_0 ( ctx , mux , outboundMarshaler , w , req , resp , mux . GetForwardResponseOptions ( ) ... )
} )
return nil
}
2021-12-21 10:18:12 +07:00
// 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
}
2021-12-19 15:30:21 +07:00
// 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.
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterUserServiceHandlerFromEndpoint instead.
func RegisterUserServiceHandlerServer ( ctx context . Context , mux * runtime . ServeMux , server UserServiceServer ) error {
mux . Handle ( "GET" , pattern_UserService_User_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.UserService/User" , runtime . WithHTTPPathPattern ( "/v1/users/me" ) )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
resp , md , err := local_request_UserService_User_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_UserService_User_0 ( ctx , mux , outboundMarshaler , w , req , resp , mux . GetForwardResponseOptions ( ) ... )
} )
mux . Handle ( "GET" , pattern_UserService_UserByEmail_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.UserService/UserByEmail" , runtime . WithHTTPPathPattern ( "/v1/admin/users/{Email}" ) )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
resp , md , err := local_request_UserService_UserByEmail_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_UserService_UserByEmail_0 ( ctx , mux , outboundMarshaler , w , req , resp , mux . GetForwardResponseOptions ( ) ... )
} )
mux . Handle ( "GET" , pattern_UserService_AllUsers_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.UserService/AllUsers" , runtime . WithHTTPPathPattern ( "/v1/admin/users" ) )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
resp , md , err := local_request_UserService_AllUsers_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_UserService_AllUsers_0 ( ctx , mux , outboundMarshaler , w , req , resp , mux . GetForwardResponseOptions ( ) ... )
} )
mux . Handle ( "PUT" , pattern_UserService_UpdateUser_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.UserService/UpdateUser" , runtime . WithHTTPPathPattern ( "/v1/users/me" ) )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
resp , md , err := local_request_UserService_UpdateUser_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_UserService_UpdateUser_0 ( ctx , mux , outboundMarshaler , w , req , resp , mux . GetForwardResponseOptions ( ) ... )
} )
mux . Handle ( "PUT" , pattern_UserService_AdminUpdateUser_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.UserService/AdminUpdateUser" , runtime . WithHTTPPathPattern ( "/v1/admin/users/{Email}" ) )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
resp , md , err := local_request_UserService_AdminUpdateUser_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_UserService_AdminUpdateUser_0 ( ctx , mux , outboundMarshaler , w , req , resp , mux . GetForwardResponseOptions ( ) ... )
} )
mux . Handle ( "DELETE" , pattern_UserService_DeleteUser_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.UserService/DeleteUser" , runtime . WithHTTPPathPattern ( "/v1/admin/users/{Email}" ) )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
resp , md , err := local_request_UserService_DeleteUser_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_UserService_DeleteUser_0 ( ctx , mux , outboundMarshaler , w , req , resp , mux . GetForwardResponseOptions ( ) ... )
} )
return nil
}
// RegisterAuthServiceHandlerFromEndpoint is same as RegisterAuthServiceHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterAuthServiceHandlerFromEndpoint ( 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 RegisterAuthServiceHandler ( ctx , mux , conn )
}
// RegisterAuthServiceHandler registers the http handlers for service AuthService to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterAuthServiceHandler ( ctx context . Context , mux * runtime . ServeMux , conn grpc . ClientConnInterface ) error {
return RegisterAuthServiceHandlerClient ( ctx , mux , NewAuthServiceClient ( conn ) )
}
// RegisterAuthServiceHandlerClient registers the http handlers for service AuthService
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AuthServiceClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AuthServiceClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "AuthServiceClient" to call the correct interceptors.
func RegisterAuthServiceHandlerClient ( ctx context . Context , mux * runtime . ServeMux , client AuthServiceClient ) error {
mux . Handle ( "GET" , pattern_AuthService_OAuthCode_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.AuthService/OAuthCode" , runtime . WithHTTPPathPattern ( "/v1/auth/code" ) )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
resp , md , err := request_AuthService_OAuthCode_0 ( rctx , inboundMarshaler , client , req , pathParams )
ctx = runtime . NewServerMetadataContext ( ctx , md )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
forward_AuthService_OAuthCode_0 ( ctx , mux , outboundMarshaler , w , req , resp , mux . GetForwardResponseOptions ( ) ... )
} )
mux . Handle ( "GET" , pattern_AuthService_Token_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.AuthService/Token" , runtime . WithHTTPPathPattern ( "/v1/auth/token" ) )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
resp , md , err := request_AuthService_Token_0 ( rctx , inboundMarshaler , client , req , pathParams )
ctx = runtime . NewServerMetadataContext ( ctx , md )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
forward_AuthService_Token_0 ( ctx , mux , outboundMarshaler , w , req , resp , mux . GetForwardResponseOptions ( ) ... )
} )
mux . Handle ( "DELETE" , pattern_AuthService_DeleteToken_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.AuthService/DeleteToken" , runtime . WithHTTPPathPattern ( "/v1/auth/token" ) )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
resp , md , err := request_AuthService_DeleteToken_0 ( rctx , inboundMarshaler , client , req , pathParams )
ctx = runtime . NewServerMetadataContext ( ctx , md )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
forward_AuthService_DeleteToken_0 ( ctx , mux , outboundMarshaler , w , req , resp , mux . GetForwardResponseOptions ( ) ... )
} )
return nil
}
var (
pattern_AuthService_OAuthCode_0 = runtime . MustPattern ( runtime . NewPattern ( 1 , [ ] int { 2 , 0 , 2 , 1 , 2 , 2 } , [ ] string { "v1" , "auth" , "code" } , "" ) )
pattern_AuthService_Token_0 = runtime . MustPattern ( runtime . NewPattern ( 1 , [ ] int { 2 , 0 , 2 , 1 , 2 , 2 } , [ ] string { "v1" , "auth" , "token" } , "" ) )
pattern_AuthService_DeleteToken_0 = runtime . MustPattern ( runtime . NewPattern ( 1 , [ ] int { 2 , 0 , 2 , 1 , 2 , 2 } , [ ] string { "v1" , "auth" , "token" } , "" ) )
)
var (
forward_AuthService_OAuthCode_0 = runtime . ForwardResponseMessage
forward_AuthService_Token_0 = runtime . ForwardResponseMessage
forward_AuthService_DeleteToken_0 = runtime . ForwardResponseMessage
)
2021-12-21 10:18:12 +07:00
// 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
)
2021-12-19 15:30:21 +07:00
// 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 ) {
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 RegisterUserServiceHandler ( ctx , mux , conn )
}
// RegisterUserServiceHandler registers the http handlers for service UserService to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterUserServiceHandler ( ctx context . Context , mux * runtime . ServeMux , conn grpc . ClientConnInterface ) error {
return RegisterUserServiceHandlerClient ( ctx , mux , NewUserServiceClient ( conn ) )
}
// RegisterUserServiceHandlerClient registers the http handlers for service UserService
// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "UserServiceClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "UserServiceClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "UserServiceClient" to call the correct interceptors.
func RegisterUserServiceHandlerClient ( ctx context . Context , mux * runtime . ServeMux , client UserServiceClient ) error {
mux . Handle ( "GET" , pattern_UserService_User_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.UserService/User" , runtime . WithHTTPPathPattern ( "/v1/users/me" ) )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
resp , md , err := request_UserService_User_0 ( rctx , inboundMarshaler , client , req , pathParams )
ctx = runtime . NewServerMetadataContext ( ctx , md )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
forward_UserService_User_0 ( ctx , mux , outboundMarshaler , w , req , resp , mux . GetForwardResponseOptions ( ) ... )
} )
mux . Handle ( "GET" , pattern_UserService_UserByEmail_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.UserService/UserByEmail" , runtime . WithHTTPPathPattern ( "/v1/admin/users/{Email}" ) )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
resp , md , err := request_UserService_UserByEmail_0 ( rctx , inboundMarshaler , client , req , pathParams )
ctx = runtime . NewServerMetadataContext ( ctx , md )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
forward_UserService_UserByEmail_0 ( ctx , mux , outboundMarshaler , w , req , resp , mux . GetForwardResponseOptions ( ) ... )
} )
mux . Handle ( "GET" , pattern_UserService_AllUsers_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.UserService/AllUsers" , runtime . WithHTTPPathPattern ( "/v1/admin/users" ) )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
resp , md , err := request_UserService_AllUsers_0 ( rctx , inboundMarshaler , client , req , pathParams )
ctx = runtime . NewServerMetadataContext ( ctx , md )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
forward_UserService_AllUsers_0 ( ctx , mux , outboundMarshaler , w , req , resp , mux . GetForwardResponseOptions ( ) ... )
} )
mux . Handle ( "PUT" , pattern_UserService_UpdateUser_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.UserService/UpdateUser" , runtime . WithHTTPPathPattern ( "/v1/users/me" ) )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
resp , md , err := request_UserService_UpdateUser_0 ( rctx , inboundMarshaler , client , req , pathParams )
ctx = runtime . NewServerMetadataContext ( ctx , md )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
forward_UserService_UpdateUser_0 ( ctx , mux , outboundMarshaler , w , req , resp , mux . GetForwardResponseOptions ( ) ... )
} )
mux . Handle ( "PUT" , pattern_UserService_AdminUpdateUser_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.UserService/AdminUpdateUser" , runtime . WithHTTPPathPattern ( "/v1/admin/users/{Email}" ) )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
resp , md , err := request_UserService_AdminUpdateUser_0 ( rctx , inboundMarshaler , client , req , pathParams )
ctx = runtime . NewServerMetadataContext ( ctx , md )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
forward_UserService_AdminUpdateUser_0 ( ctx , mux , outboundMarshaler , w , req , resp , mux . GetForwardResponseOptions ( ) ... )
} )
mux . Handle ( "DELETE" , pattern_UserService_DeleteUser_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.UserService/DeleteUser" , runtime . WithHTTPPathPattern ( "/v1/admin/users/{Email}" ) )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
resp , md , err := request_UserService_DeleteUser_0 ( rctx , inboundMarshaler , client , req , pathParams )
ctx = runtime . NewServerMetadataContext ( ctx , md )
if err != nil {
runtime . HTTPError ( ctx , mux , outboundMarshaler , w , req , err )
return
}
forward_UserService_DeleteUser_0 ( ctx , mux , outboundMarshaler , w , req , resp , mux . GetForwardResponseOptions ( ) ... )
} )
return nil
}
var (
pattern_UserService_User_0 = runtime . MustPattern ( runtime . NewPattern ( 1 , [ ] int { 2 , 0 , 2 , 1 , 2 , 2 } , [ ] string { "v1" , "users" , "me" } , "" ) )
pattern_UserService_UserByEmail_0 = runtime . MustPattern ( runtime . NewPattern ( 1 , [ ] int { 2 , 0 , 2 , 1 , 2 , 2 , 1 , 0 , 4 , 1 , 5 , 3 } , [ ] string { "v1" , "admin" , "users" , "Email" } , "" ) )
pattern_UserService_AllUsers_0 = runtime . MustPattern ( runtime . NewPattern ( 1 , [ ] int { 2 , 0 , 2 , 1 , 2 , 2 } , [ ] string { "v1" , "admin" , "users" } , "" ) )
pattern_UserService_UpdateUser_0 = runtime . MustPattern ( runtime . NewPattern ( 1 , [ ] int { 2 , 0 , 2 , 1 , 2 , 2 } , [ ] string { "v1" , "users" , "me" } , "" ) )
pattern_UserService_AdminUpdateUser_0 = runtime . MustPattern ( runtime . NewPattern ( 1 , [ ] int { 2 , 0 , 2 , 1 , 2 , 2 , 1 , 0 , 4 , 1 , 5 , 3 } , [ ] string { "v1" , "admin" , "users" , "Email" } , "" ) )
pattern_UserService_DeleteUser_0 = runtime . MustPattern ( runtime . NewPattern ( 1 , [ ] int { 2 , 0 , 2 , 1 , 2 , 2 , 1 , 0 , 4 , 1 , 5 , 3 } , [ ] string { "v1" , "admin" , "users" , "Email" } , "" ) )
)
var (
forward_UserService_User_0 = runtime . ForwardResponseMessage
forward_UserService_UserByEmail_0 = runtime . ForwardResponseMessage
forward_UserService_AllUsers_0 = runtime . ForwardResponseMessage
forward_UserService_UpdateUser_0 = runtime . ForwardResponseMessage
forward_UserService_AdminUpdateUser_0 = runtime . ForwardResponseMessage
forward_UserService_DeleteUser_0 = runtime . ForwardResponseMessage
)