Last active
August 29, 2017 16:37
-
-
Save batmany13/d1cb97175f5adf42cf3f613a6b1f4432 to your computer and use it in GitHub Desktop.
Details Implementation via Gin
This file contains 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
// This will just get the video id and call the Synq api for the details | |
func details(c *gin.Context) { | |
a := ApiCall{} | |
c.BindJSON(&a) | |
if a.VideoId == "" { | |
c.JSON(400, gin.H{ | |
"message": "missing 'video_id'", | |
}) | |
return | |
} | |
err := a.Call() | |
if err != nil { | |
c.JSON(400, gin.H{ | |
"message": "failed to make api call : " + err.Error(), | |
}) | |
return | |
} | |
c.JSON(200, gin.H{ | |
"message": a.Video, | |
"id": a.VideoId, | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment