// GetMultipleUserHandler - handles requests for a multiple user.
handles requests for a multiple user.
// GetMultipleUserHandler - handles requests for a multiple user .
func GetMultipleUserHandler(ctx *gin.Context) {
	conn := connector.Connect()
	client := proto.NewUserManagementServiceClient(conn)
	var userData proto.RequestUsers
	requestBody, err := ioutil.ReadAll(ctx.Request.Body)
	if err != nil {
		ctx.JSON(http.StatusBadRequest, gin.H{
			"error": "Invalid Request Body",
		})
		return
	}
	if err := json.Unmarshal(requestBody, &userData); err != nil {
		ctx.JSON(http.StatusBadRequest, gin.H{
			"error": "Invalid Request Body",
		})
	}
	if response, err := client.GetMultipleUsers(ctx, &userData); err == nil {
		ctx.JSON(http.StatusOK, gin.H{
			"result": response,
		})
	} else {
		ctx.JSON(http.StatusInternalServerError, gin.H{
			"Error": err.Error(),
		})
	}
}
func GetMultipleUserHandler ( ctx * gin . Context ) { conn := connector . Connect ( ) client := proto . NewUserManagementServiceClient ( conn ) var userData proto . RequestUsers requestBody , err := ioutil . ReadAll ( ctx . Request . Body ) if err != nil { ctx . JSON ( http . StatusBadRequest , gin . H { " " : " " , } ) return } if err := json . Unmarshal ( requestBody , & userData ) ; err != nil { ctx . JSON ( http . StatusBadRequest , gin . H { " " : " " , } ) } if response , err := client . GetMultipleUsers ( ctx , & userData ) ; err == nil { ctx . JSON ( http . StatusOK , gin . H { " " : response , } ) } else { ctx . JSON ( http . StatusInternalServerError , gin . H { " " : err . Error ( ) , } ) } }
handles requests for a multiple user.
handles requests for a multiple user .
// connection with server // client is created // proto.RequestUsers type variable is created // request body is read as bytes // if request maped to proto struct // the corresponding server is called to get the desired response