Implement GET /users/username/{username} endpoint for APIv4 (#5310)
* added get user by username endpoint * added get user by username unit test and driver * changed username length to 22 characters max * changed Params to UserName to Username * reorganized get user by username and get user by email formatting in model/client4
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
5462f0119e
Коммит
0162d8ad08
@@ -359,6 +359,22 @@ func (c *Context) RequireChannelId() *Context {
|
||||
return c
|
||||
}
|
||||
|
||||
func (c *Context) RequireUsername() *Context {
|
||||
if c.Err != nil {
|
||||
return c
|
||||
}
|
||||
|
||||
if len(c.Params.Username) < 3 {
|
||||
c.SetInvalidUrlParam("username")
|
||||
}
|
||||
|
||||
if len(c.Params.Username) > 22 {
|
||||
c.SetInvalidUrlParam("username")
|
||||
}
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
func (c *Context) RequireEmail() *Context {
|
||||
if c.Err != nil {
|
||||
return c
|
||||
@@ -371,3 +387,4 @@ func (c *Context) RequireEmail() *Context {
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user