Skip to content

Commit

Permalink
refactor: go var names (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
tenstad authored Jan 15, 2025
1 parent 445e881 commit 53f7815
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions internal/sdk/cloudian/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,15 @@ func NewClient(baseURL string, authHeader string, opts ...func(*Client)) *Client
}

// List all users of a group.
func (client Client) ListUsers(ctx context.Context, groupId string, offsetUserId *string) ([]User, error) {
func (client Client) ListUsers(ctx context.Context, groupID string, userID *string) ([]User, error) {
params := map[string]string{
"groupId": groupId,
"groupId": groupID,
"userType": "all",
"userStatus": "all",
"limit": strconv.Itoa(ListLimit),
}
if offsetUserId != nil {
params["offset"] = *offsetUserId
if userID != nil {
params["offset"] = *userID
}

var users []User
Expand All @@ -157,7 +157,7 @@ func (client Client) ListUsers(ctx context.Context, groupId string, offsetUserId
// Paginated API endpoint where limit+1 elements indicates more pages
if len(users) > ListLimit {
// Fetch remaining users starting from the user after the limit
moreUsers, err := client.ListUsers(ctx, groupId, &users[ListLimit].UserID)
moreUsers, err := client.ListUsers(ctx, groupID, &users[ListLimit].UserID)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -290,8 +290,8 @@ func (client Client) DeleteUserCredentials(ctx context.Context, accessKey string
}

// Delete a group and all its members.
func (client Client) DeleteGroupRecursive(ctx context.Context, groupId string) error {
users, err := client.ListUsers(ctx, groupId, nil)
func (client Client) DeleteGroupRecursive(ctx context.Context, groupID string) error {
users, err := client.ListUsers(ctx, groupID, nil)
if err != nil {
return fmt.Errorf("error listing users: %w", err)
}
Expand All @@ -302,13 +302,13 @@ func (client Client) DeleteGroupRecursive(ctx context.Context, groupId string) e
}
}

return client.DeleteGroup(ctx, groupId)
return client.DeleteGroup(ctx, groupID)
}

// Deletes a group if it is without members.
func (client Client) DeleteGroup(ctx context.Context, groupId string) error {
func (client Client) DeleteGroup(ctx context.Context, groupID string) error {
resp, err := client.newRequest(ctx).
SetQueryParams(map[string]string{"groupId": groupId}).
SetQueryParams(map[string]string{"groupId": groupID}).
Delete("/group")
if err != nil {
return err
Expand Down Expand Up @@ -358,10 +358,10 @@ func (client Client) UpdateGroup(ctx context.Context, group Group) error {

// Get a group. Returns an error even in the case of a group not found.
// This error can then be checked against ErrNotFound: errors.Is(err, ErrNotFound)
func (client Client) GetGroup(ctx context.Context, groupId string) (*Group, error) {
func (client Client) GetGroup(ctx context.Context, groupID string) (*Group, error) {
var group groupInternal
resp, err := client.newRequest(ctx).
SetQueryParams(map[string]string{"groupId": groupId}).
SetQueryParams(map[string]string{"groupId": groupID}).
SetResult(&group).
Get("/group")
if err != nil {
Expand Down

0 comments on commit 53f7815

Please sign in to comment.