Skip to content

Commit

Permalink
Adds support for banned query param for users list & count (#377)
Browse files Browse the repository at this point in the history
  • Loading branch information
BrandonRomano authored Jan 29, 2025
1 parent 93130d5 commit 9c79ac7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions user/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ type ListParams struct {
PhoneNumberQuery *string `json:"phone_number_query,omitempty"`
UsernameQuery *string `json:"username_query,omitempty"`
NameQuery *string `json:"name_query,omitempty"`
Banned *bool `json:"banned,omitempty"`
EmailAddresses []string `json:"email_address,omitempty"`
ExternalIDs []string `json:"external_id,omitempty"`
PhoneNumbers []string `json:"phone_number,omitempty"`
Expand Down Expand Up @@ -258,6 +259,10 @@ func (params *ListParams) ToQuery() url.Values {
if params.NameQuery != nil {
q.Add("name_query", *params.NameQuery)
}
if params.Banned != nil {
q.Add("banned", strconv.FormatBool(*params.Banned))
}

for _, v := range params.EmailAddresses {
q.Add("email_address", v)
}
Expand Down
2 changes: 2 additions & 0 deletions user/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func TestUserClientList_Request(t *testing.T) {
"created_at_after": []string{"1730333164378"},
"last_active_at_before": []string{"1730333164378"},
"last_active_at_after": []string{"1730333164378"},
"banned": []string{"false"},
},
},
}
Expand All @@ -75,6 +76,7 @@ func TestUserClientList_Request(t *testing.T) {
params.CreatedAtAfter = clerk.Int64(1730333164378)
params.LastActiveAtBefore = clerk.Int64(1730333164378)
params.LastActiveAtAfter = clerk.Int64(1730333164378)
params.Banned = clerk.Bool(false)
_, err := client.List(context.Background(), params)
require.NoError(t, err)
}
Expand Down

0 comments on commit 9c79ac7

Please sign in to comment.