Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Users API #234

Merged
merged 1 commit into from
Feb 9, 2024
Merged

feat: Users API #234

merged 1 commit into from
Feb 9, 2024

Conversation

gkats
Copy link
Member

@gkats gkats commented Feb 9, 2024

Added support for the Users API. Available operations are Create, Get, List, Count, Update, UpdateMetadata, Delete, DeleteMFA, Ban, Unban, Lock, Unlock and ListOrganizationMemberships.

@gkats gkats requested a review from a team as a code owner February 9, 2024 08:28
clerk.go Outdated Show resolved Hide resolved
user/client.go Outdated

type CreateParams struct {
clerk.APIParams
EmailAddresses []string `json:"email_address,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ Would you mind reminding me why we don't need to use pointer to slices? Is it because here we don't need to differentiate between existing parameter and empty?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do have to use pointer for slices as well! It's my mistake. Updated.

user/client.go Outdated
PrivateMetadata *json.RawMessage `json:"private_metadata,omitempty"`
UnsafeMetadata *json.RawMessage `json:"unsafe_metadata,omitempty"`
TOTPSecret *string `json:"totp_secret,omitempty"`
BackupCodes []string `json:"backup_codes,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ Same question as above with regard to pointer to slice.

user/client.go Show resolved Hide resolved
user/client.go Outdated
q.Add("user_id", v)
}
if params.LastActiveAtSince != nil {
q.Add("limit", strconv.FormatInt(*params.LastActiveAtSince, 10))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔧 Not sure if I'm missing something:

Suggested change
q.Add("limit", strconv.FormatInt(*params.LastActiveAtSince, 10))
q.Add("last_active_at_since", strconv.FormatInt(*params.LastActiveAtSince, 10))

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch, thanks! Updated.

user/client_test.go Show resolved Hide resolved
Added support for the Users API. Available operations are Create, Get,
List, Count, Update, UpdateMetadata, Delete, DeleteMFA, Ban, Unban,
Lock, Unlock and ListOrganizationMemberships.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants