forgejo-sdk/gitea/user.go
Lunny Xiao 38803cbe75 Refactor codes to remove structs and depend them on code.gitea.io/gitea/modules/structs (#171)
* refactor codes to remove structs and depend them on code.gitea.io/gitea/modules/structs

* fix testing
2019-05-11 18:38:52 +03:00

28 lines
699 B
Go

// 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.
package gitea
import (
"fmt"
"code.gitea.io/gitea/modules/structs"
)
// User is equal to structs.User
type User = structs.User
// GetUserInfo get user info by user's name
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
}
// 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
}