Skip to content

Instantly share code, notes, and snippets.

@depado
Created March 27, 2018 13:26
Show Gist options
  • Select an option

  • Save depado/427946305ad9825c8287d0d0a8c7c702 to your computer and use it in GitHub Desktop.

Select an option

Save depado/427946305ad9825c8287d0d0a8c7c702 to your computer and use it in GitHub Desktop.
func webhook(c *gin.Context) {
var err error
var dfr *df.Request
if err = c.BindJSON(&dfr); err != nil {
c.AbortWithStatus(http.StatusBadRequest)
return
}
switch dfr.QueryResult.Action {
case "search":
log.Println("Search action detected")
c.JSON(http.StatusOK, gin.H{})
case "random":
log.Println("Search action detected")
c.JSON(http.StatusOK, gin.H{})
default:
log.Println("Unknown action")
c.AbortWithStatus(http.StatusNotFound)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment