Skip to content

Commit

Permalink
Update parameter requirement functions per feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jwilander committed Jan 27, 2017
1 parent d24765c commit e017ccb
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions api4/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,20 +327,32 @@ func (c *Context) GetSiteURL() string {
}

func (c *Context) RequireUserId() *Context {
if c.Err != nil {
return c
}

if len(c.Params.UserId) != 26 {
c.SetInvalidUrlParam("user_id")
}
return c
}

func (c *Context) RequireTeamId() *Context {
if c.Err != nil {
return c
}

if len(c.Params.TeamId) != 26 {
c.SetInvalidUrlParam("team_id")
}
return c
}

func (c *Context) RequireChannelId() *Context {
if c.Err != nil {
return c
}

if len(c.Params.ChannelId) != 26 {
c.SetInvalidUrlParam("channel_id")
}
Expand Down

0 comments on commit e017ccb

Please sign in to comment.