()
| 38 | } |
| 39 | |
| 40 | func (req UsersRequest) asRequestOption() RequestOption { |
| 41 | return func(r *http.Request) { |
| 42 | q := r.URL.Query() |
| 43 | var params []string |
| 44 | if req.Search != "" { |
| 45 | params = append(params, req.Search) |
| 46 | } |
| 47 | if req.Name != "" { |
| 48 | params = append(params, "name:"+req.Name) |
| 49 | } |
| 50 | if req.Status != "" { |
| 51 | params = append(params, "status:"+string(req.Status)) |
| 52 | } |
| 53 | if req.Role != "" { |
| 54 | params = append(params, "role:"+req.Role) |
| 55 | } |
| 56 | if req.SearchQuery != "" { |
| 57 | params = append(params, req.SearchQuery) |
| 58 | } |
| 59 | for _, lt := range req.LoginType { |
| 60 | params = append(params, "login_type:"+string(lt)) |
| 61 | } |
| 62 | q.Set("q", strings.Join(params, " ")) |
| 63 | r.URL.RawQuery = q.Encode() |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | // MinimalUser is the minimal information needed to identify a user and show |
| 68 | // them on the UI. |
no test coverage detected