add variable and method comments

This commit is contained in:
Mike Mason
2023-07-17 19:02:55 +00:00
parent 2681b3d064
commit bc87fa7726
35 changed files with 157 additions and 16 deletions

View File

@@ -14,8 +14,10 @@ const (
projectsPath = "/projects"
)
// Projects contains a list of projects.
type Projects []*Project
// ToDetails converts the objects to generic project details.
func (p Projects) ToDetails() []*models.ProjectDetails {
projects := make([]*models.ProjectDetails, len(p))
@@ -36,6 +38,7 @@ func (p Projects) ToDetails() []*models.ProjectDetails {
return projects
}
// Project contains project information.
type Project struct {
client *Client
@@ -47,6 +50,7 @@ type Project struct {
Organization *Organization `json:"organization"`
}
// ToDetails converts the project to generic project details.
func (p *Project) ToDetails() *models.ProjectDetails {
var id string
@@ -69,6 +73,7 @@ func (p *Project) ToDetails() *models.ProjectDetails {
return details
}
// getProjectWithMemberships fetches the provided project with membership information.
func (c *Client) getProjectWithMemberships(ctx context.Context, id string) (*Project, error) {
var project Project
@@ -80,6 +85,7 @@ func (c *Client) getProjectWithMemberships(ctx context.Context, id string) (*Pro
return &project, nil
}
// GetProjectDetails fetchs the provided project id with membership information.
func (c *Client) GetProjectDetails(ctx context.Context, id gidx.PrefixedID) (*models.ProjectDetails, error) {
project, err := c.getProjectWithMemberships(ctx, id.String()[gidx.PrefixPartLength+1:])
if err != nil {