Apply Filter for GHE Problems

I want to get all the problems from GHE using the Java API client without problems with the "insfrastructure" label

I tried this:

                map.put(IssueService.FILTER_STATE, IssueService.STATE_CLOSED);
                map.put(IssueService.FIELD_DIRECTION, sort_direction);
                map.put(IssueService.FIELD_SINCE, date_from);
                map.put(IssueService.FIELD_FILTER, "-label:infrastructure");

But still I get problems with this shortcut. Do you know how I can fix this?

+4
source share
1 answer

You can see an example using IssueService.FIELD_FILTER in src/main/java/com/github/mobile/ui/issue/IssueDashboardPagerAdapter.java

@Override
public Fragment getItem(final int position) {
    String filter = null;
    switch (position) {
    case 0:
        filter = FILTER_SUBSCRIBED;
        break;
    case 1:
        filter = FILTER_ASSIGNED;
        break;
    case 2:
        filter = FILTER_CREATED;
        break;
    case 3:
        filter = FILTER_MENTIONED;
        break;
    default:
        return null;
    }
    final Map<String, String> filterData = new HashMap<String, String>();
    filterData.put(FIELD_FILTER, filter);

These filter values ​​refer to predefined values ​​in org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/IssueService.java

Include tags.

/**
 * Filter by issue labels
 */
public static final String FILTER_LABELS = "labels"; //$NON-NLS-1$

with the character 's'.

Used as:

    List<Label> labels = issue.getLabels();
    if (labels != null) {
        List<String> labelNames = new ArrayList<String>(labels.size());
        for (Label label : labels)
            labelNames.add(label.getName());
        params.put(FILTER_LABELS, labelNames);
    }
0
source

Source: https://habr.com/ru/post/1693425/


All Articles