2014-11-14 22:07:41 +00:00
|
|
|
// Copyright 2014 The Gogs Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a MIT-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2015-08-26 14:34:27 +01:00
|
|
|
package gitea
|
2014-11-14 22:07:41 +00:00
|
|
|
|
2014-11-18 16:06:47 +00:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
2019-05-11 16:38:52 +01:00
|
|
|
"code.gitea.io/gitea/modules/structs"
|
|
|
|
)
|
2014-11-18 16:06:47 +00:00
|
|
|
|
2019-05-11 16:38:52 +01:00
|
|
|
// User is equal to structs.User
|
|
|
|
type User = structs.User
|
2016-12-15 16:13:48 +00:00
|
|
|
|
2016-11-10 09:44:00 +00:00
|
|
|
// GetUserInfo get user info by user's name
|
2014-11-18 16:06:47 +00:00
|
|
|
func (c *Client) GetUserInfo(user string) (*User, error) {
|
|
|
|
u := new(User)
|
|
|
|
err := c.getParsedResponse("GET", fmt.Sprintf("/users/%s", user), nil, nil, u)
|
|
|
|
return u, err
|
|
|
|
}
|
2018-06-24 12:13:26 +01:00
|
|
|
|
|
|
|
// GetMyUserInfo get user info of current user
|
|
|
|
func (c *Client) GetMyUserInfo() (*User, error) {
|
|
|
|
u := new(User)
|
|
|
|
err := c.getParsedResponse("GET", "/user", nil, nil, u)
|
|
|
|
return u, err
|
|
|
|
}
|