Checklist
Description
management.UserIdentitySchema now has a UserID field of type *management.UserID, but management.Identity's UserID is of type string.
That makes it awkward to get a user identity's ID from one API call and pass it into another.
Also, the Provider fields have different types, even though they appear to be equivalent enums.
Expectation
User identities have consistently-typed fields so that you can round-trip them easily.
Reproduction
package users
import (
"context"
"fmt"
"github.com/auth0/go-auth0/v2/management"
"github.com/auth0/go-auth0/v2/management/client"
)
func resendVerificationEmail(ctx context.Context, id string) error {
auth0, err := client.New("...")
if err != nil {
return err
}
user, err := auth0.Users.Get(ctx, id, &management.GetUserRequestParameters{
Fields: new("identities"),
IncludeFields: new(true),
})
if err != nil {
return err
}
if len(user.Identities) != 1 {
return fmt.Errorf("user %w has %d identities", len(user.Identities))
}
identity := user.Identities[0]
_, err = auth0.Jobs.VerificationEmail.Create(ctx, &management.CreateVerificationEmailRequestContent{
ClientID: new("..."),
UserID: id,
Identity: &management.Identity{
// cannot use identity.GetProvider() (value of string type management.UserIdentityProviderEnum) as management.IdentityProviderEnum value in struct literal
Provider: identity.GetProvider(),
// cannot use identity.GetUserID() (value of struct type management.UserID) as string value in struct literal
UserID: identity.GetUserID(),
},
})
return err
}
Auth0 Go SDK version
v2.14.0
Checklist
Description
management.UserIdentitySchemanow has aUserIDfield of type*management.UserID, butmanagement.Identity'sUserIDis of typestring.That makes it awkward to get a user identity's ID from one API call and pass it into another.
Also, the
Providerfields have different types, even though they appear to be equivalent enums.Expectation
User identities have consistently-typed fields so that you can round-trip them easily.
Reproduction
Auth0 Go SDK version
v2.14.0