Introduced helper methods for parsing/biding request parameters

This commit is contained in:
Deluan
2016-03-07 14:13:01 -05:00
parent 91c660c746
commit 28bef732cf
8 changed files with 28 additions and 20 deletions
+2 -3
View File
@@ -4,13 +4,12 @@ import "github.com/deluan/gosonic/api/responses"
type UsersController struct{ BaseAPIController }
// TODO This is a placeholder. The real one has to read this info from a config file
// TODO This is a placeholder. The real one has to read this info from a config file or the database
func (c *UsersController) GetUser() {
r := c.NewEmpty()
r.User = &responses.User{}
r.User.Username = c.GetParameter("username", "Required string parameter 'username' is not present")
r.User.Username = c.RequiredParamString("username", "Required string parameter 'username' is not present")
r.User.StreamRole = true
r.User.DownloadRole = true
c.SendResponse(r)
}