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
GetEvents GetEventsParams.Type array parameter is not handled by GetQueryParams function #381
Comments
+1
of course in the int32 format. |
+2 client.GetEvents(context.Background(), jwt.AccessToken, KeycloakRealm, gocloak.GetEventsParams{
UserID: gocloak.StringP("user_id"),
Type: []string{"LOGIN"}, type GetEventsParams struct {
Client *string `json:"client,omitempty"`
DateFrom *string `json:"dateFrom,omitempty"`
DateTo *string `json:"dateTo,omitempty"`
First *int32 `json:"first,string,omitempty"`
IPAddress *string `json:"ipAddress,omitempty"`
Max *int32 `json:"max,string,omitempty"`
Type []string `json:"type,omitempty"`
UserID *string `json:"user,omitempty"`
}
func GetQueryParams(s interface{}) (map[string]string, error) {
// if obj, ok := s.(GetGroupsParams); ok {
// obj.OnMarshal()
// s = obj
// }
b, err := json.Marshal(s)
if err != nil {
return nil, err
}
var res map[string]string
err = json.Unmarshal(b, &res)
if err != nil {
return nil, err
}
return res, nil
} The GetQueryParams function returns a map[string]string, but the type field of the GetEventsParams structure is []string. |
solution solved create a new function GetEvents
|
@Nerzal any info if this will be addressed? |
Describe the bug
When the GetEventsParams.Type parameter is passed to the GetEvents function, it generate an error because the GetQueryParams function can't handle arrays. It should transform them first to a comma separated list string before the json.Mashal call.
To Reproduce
The text was updated successfully, but these errors were encountered: