Implement GET /users/email/{email} endpoint for APIv4 (#5309)
* added get user by email endpoint for APIv4 * added get user by email endpoint unit test and driver * removed the appended return of user ids on logout * Added RequireEmail to validate user email. Also updated the get user by email endpoint and unit test
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
5cc30fa061
Коммит
d91fea6518
@@ -56,6 +56,10 @@ func (c *Client4) GetUserRoute(userId string) string {
|
||||
return fmt.Sprintf(c.GetUsersRoute()+"/%v", userId)
|
||||
}
|
||||
|
||||
func (c *Client4) GetUserByEmailRoute(email string) string {
|
||||
return fmt.Sprintf(c.GetUsersRoute()+"/email/%v", email)
|
||||
}
|
||||
|
||||
func (c *Client4) GetTeamsRoute() string {
|
||||
return fmt.Sprintf("/teams")
|
||||
}
|
||||
@@ -210,6 +214,16 @@ func (c *Client4) GetUser(userId, etag string) (*User, *Response) {
|
||||
}
|
||||
}
|
||||
|
||||
// GetUserByEmail returns a user based on the provided user email string.
|
||||
func (c *Client4) GetUserByEmail(email, etag string) (*User, *Response) {
|
||||
if r, err := c.DoApiGet(c.GetUserByEmailRoute(email), etag); err != nil {
|
||||
return nil, &Response{StatusCode: r.StatusCode, Error: err}
|
||||
} else {
|
||||
defer closeBody(r)
|
||||
return UserFromJson(r.Body), BuildResponse(r)
|
||||
}
|
||||
}
|
||||
|
||||
// GetUsers returns a page of users on the system. Page counting starts at 0.
|
||||
func (c *Client4) GetUsers(page int, perPage int, etag string) ([]*User, *Response) {
|
||||
query := fmt.Sprintf("?page=%v&per_page=%v", page, perPage)
|
||||
|
||||
Ссылка в новой задаче
Block a user