user.go 692 B

12345678910111213141516171819202122232425
  1. // Copyright 2014 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package gogs
  5. import (
  6. "fmt"
  7. )
  8. // User represents a API user.
  9. type User struct {
  10. ID int64 `json:"id"`
  11. UserName string `json:"username"` // LEGACY [Gogs 1.0]: remove field(s) for backward compatibility
  12. Login string `json:"login"`
  13. FullName string `json:"full_name"`
  14. Email string `json:"email"`
  15. AvatarUrl string `json:"avatar_url"`
  16. }
  17. func (c *Client) GetUserInfo(user string) (*User, error) {
  18. u := new(User)
  19. err := c.getParsedResponse("GET", fmt.Sprintf("/users/%s", user), nil, nil, u)
  20. return u, err
  21. }