add variable and method comments
This commit is contained in:
@@ -14,8 +14,10 @@ const (
|
||||
usersPath = "/users"
|
||||
)
|
||||
|
||||
// Users contains a list of users.
|
||||
type Users []*User
|
||||
|
||||
// ToDetails converts the objects to generic user details.
|
||||
func (u Users) ToDetails() []*models.UserDetails {
|
||||
users := make([]*models.UserDetails, len(u))
|
||||
|
||||
@@ -36,6 +38,7 @@ func (u Users) ToDetails() []*models.UserDetails {
|
||||
return users
|
||||
}
|
||||
|
||||
// User contains user information.
|
||||
type User struct {
|
||||
client *Client
|
||||
|
||||
@@ -46,6 +49,7 @@ type User struct {
|
||||
Projects Projects `json:"projects"`
|
||||
}
|
||||
|
||||
// ToDetails converts the user to generic user details.
|
||||
func (u *User) ToDetails() *models.UserDetails {
|
||||
var id string
|
||||
|
||||
@@ -65,6 +69,7 @@ func (u *User) ToDetails() *models.UserDetails {
|
||||
}
|
||||
}
|
||||
|
||||
// getUser fetches the provided user.
|
||||
func (c *Client) getUser(ctx context.Context, id string) (*User, error) {
|
||||
var user User
|
||||
|
||||
@@ -76,6 +81,7 @@ func (c *Client) getUser(ctx context.Context, id string) (*User, error) {
|
||||
return &user, nil
|
||||
}
|
||||
|
||||
// GetUserDetails fetches the provided user id.
|
||||
func (c *Client) GetUserDetails(ctx context.Context, id gidx.PrefixedID) (*models.UserDetails, error) {
|
||||
user, err := c.getUser(ctx, id.String()[gidx.PrefixPartLength+1:])
|
||||
if err != nil {
|
||||
@@ -85,10 +91,12 @@ func (c *Client) GetUserDetails(ctx context.Context, id gidx.PrefixedID) (*model
|
||||
return user.ToDetails(), nil
|
||||
}
|
||||
|
||||
// GetUserOrganizationRole returns collaborator for all organizations.
|
||||
func (c *Client) GetUserOrganizationRole(ctx context.Context, userID, orgID gidx.PrefixedID) (string, error) {
|
||||
return "collaborator", nil
|
||||
}
|
||||
|
||||
// GetUserProjectRole returns collaborator for all projects.
|
||||
func (c *Client) GetUserProjectRole(ctx context.Context, userID, projectID gidx.PrefixedID) (string, error) {
|
||||
return "collaborator", nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user