Skip to content

Commit

Permalink
feat: Add user lock & unlock operations
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Pitsilos committed Oct 11, 2023
1 parent d9e4be0 commit 679084b
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions clerk/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type User struct {
UnsafeMetadata interface{} `json:"unsafe_metadata"`
LastSignInAt *int64 `json:"last_sign_in_at"`
Banned bool `json:"banned"`
Locked bool `json:"locked"`
ExternalID *string `json:"external_id"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
Expand Down Expand Up @@ -304,6 +305,30 @@ func (s *UsersService) Unban(userID string) (*User, error) {
return &response, nil
}

func (s *UsersService) Lock(userID string) (*User, error) {
url := fmt.Sprintf("%s/%s/lock", UsersUrl, userID)
req, _ := s.client.NewRequest(http.MethodPost, url)

var response User
if _, err := s.client.Do(req, &response); err != nil {
return nil, err
}

return &response, nil
}

func (s *UsersService) Unlock(userID string) (*User, error) {
url := fmt.Sprintf("%s/%s/unlock", UsersUrl, userID)
req, _ := s.client.NewRequest(http.MethodPost, url)

var response User
if _, err := s.client.Do(req, &response); err != nil {
return nil, err
}

return &response, nil
}

type ListMembershipsParams struct {
Limit *int
Offset *int
Expand Down

0 comments on commit 679084b

Please sign in to comment.