(filters map[string]any)
| 173 | } |
| 174 | |
| 175 | func buildQueryParams(filters map[string]any) url.Values { |
| 176 | params := url.Values{} |
| 177 | params.Set("per_page", strconv.Itoa(perPage)) |
| 178 | |
| 179 | hasState := false |
| 180 | for key, val := range filters { |
| 181 | switch key { |
| 182 | case "labels": |
| 183 | params.Set("labels", toCommaSeparated(val)) |
| 184 | case "milestone": |
| 185 | params.Set("milestone", fmt.Sprint(val)) |
| 186 | case "assignee": |
| 187 | params.Set("assignee", fmt.Sprint(val)) |
| 188 | case "state": |
| 189 | params.Set("state", fmt.Sprint(val)) |
| 190 | hasState = true |
| 191 | default: |
| 192 | params.Set(key, fmt.Sprint(val)) |
| 193 | } |
| 194 | } |
| 195 | |
| 196 | if !hasState { |
| 197 | params.Set("state", "all") |
| 198 | } |
| 199 | |
| 200 | return params |
| 201 | } |
| 202 | |
| 203 | func toCommaSeparated(val any) string { |
| 204 | switch v := val.(type) { |
no test coverage detected