add variable and method comments
This commit is contained in:
@@ -14,8 +14,10 @@ const (
|
||||
organizationsPath = "/organizations"
|
||||
)
|
||||
|
||||
// Organizations contains a list of organizations.
|
||||
type Organizations []*Organization
|
||||
|
||||
// ToDetails converts to a generic model organization details.
|
||||
func (o Organizations) ToDetails() []*models.OrganizationDetails {
|
||||
orgs := make([]*models.OrganizationDetails, len(o))
|
||||
|
||||
@@ -36,6 +38,7 @@ func (o Organizations) ToDetails() []*models.OrganizationDetails {
|
||||
return orgs
|
||||
}
|
||||
|
||||
// Organization contains organization information.
|
||||
type Organization struct {
|
||||
client *Client
|
||||
|
||||
@@ -47,6 +50,7 @@ type Organization struct {
|
||||
Projects Projects `json:"projects"`
|
||||
}
|
||||
|
||||
// ToDetails converts the object to a generic orgnization details.
|
||||
func (o *Organization) ToDetails() *models.OrganizationDetails {
|
||||
var id string
|
||||
|
||||
@@ -69,6 +73,7 @@ func (o *Organization) ToDetails() *models.OrganizationDetails {
|
||||
return details
|
||||
}
|
||||
|
||||
// getOrganizationWithMemberships fetches an organization from the equinix metal api with membership user information.
|
||||
func (c *Client) getOrganizationWithMemberships(ctx context.Context, id string) (*Organization, error) {
|
||||
var org Organization
|
||||
|
||||
@@ -80,6 +85,7 @@ func (c *Client) getOrganizationWithMemberships(ctx context.Context, id string)
|
||||
return &org, nil
|
||||
}
|
||||
|
||||
// GetOrganizationDetails fetches the organization id provided with its memberships.
|
||||
func (c *Client) GetOrganizationDetails(ctx context.Context, id gidx.PrefixedID) (*models.OrganizationDetails, error) {
|
||||
org, err := c.getOrganizationWithMemberships(ctx, id.String()[gidx.PrefixPartLength+1:])
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user