Created
March 27, 2018 13:26
-
-
Save depado/427946305ad9825c8287d0d0a8c7c702 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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