Changes
- Deprecated the
b2c.Users.GetPending
method. Useb2c.Users.SearchAll
orb2c.Users.Search
instead. See the upgrade guide below for an example change.
Fixes
- Add the B2B
Passwords.Delete
method - Add the B2B
Sessions.GetJWKS
method - Add the B2B
PasswordsAuthenticateParams.OrganizationID
field
Upgrade Guide
Existing calls to b2c.Users.GetPending
will continue to work until the next major version of stytch-go
. To prepare for its removal, change all uses of b2c.Users.GetPending
to b2c.Users.SearchAll
. Here's an example migration:
Before
ctx := context.TODO()
params := &b2c.UsersGetPendingParams{
Limit: 200,
}
res, err := client.Users.GetPending(ctx, params)
if err != nil {
panic(err)
}
// TODO: Do something with res.Users
for res.HasMore {
params.StartingAfterID = res.StartingAfterID
res, err = client.Users.GetPending(ctx, params)
if err != nil {
panic(err)
}
// TODO: Do something with res.Users
}
After
ctx := context.TODO()
params := &b2c.UsersSearchParams{
Limit: 200,
Query: &b2c.UsersSearchQuery{
Operator: b2c.UserSearchOperatorOR,
Operands: []json.Marshaler{
b2c.UsersSearchQueryStatusFilter{Status: "pending"},
},
},
}
pendingUsers := client.Users.SearchAll(params)
for pendingUsers.HasNext() {
users, err := pendingUsers.Next(ctx)
if err != nil {
panic(err)
}
// TODO: Do something with users
}
If you prefer to keep the same iteration pattern that GetPending has, use Search directly instead:
ctx := context.TODO()
params := &b2c.UsersSearchParams{
Limit: 200,
Query: &b2c.UsersSearchQuery{
Operator: b2c.UserSearchOperatorOR,
Operands: []json.Marshaler{
b2c.UsersSearchQueryStatusFilter{Status: "pending"},
},
},
}
res, err := client.Users.Search(ctx, params)
if err != nil {
panic(err)
}
// TODO: Do something with res.Results
for res.ResultsMetadata.NextCursor != "" {
params.Cursor = res.ResultsMetadata.NextCursor
res, err = client.Users.Search(ctx, params)
if err != nil {
panic(err)
}
// TODO: Do something with res.Results
}