Skip to content

Commit

Permalink
support the delegate filter for REST API
Browse files Browse the repository at this point in the history
The REST API does not add the delegate filter to the REST API query, which
makes using -d give unexpected results:

If you add -d <something> then you will still obtain all patches, and then
print them out sorted by delegate.

Fix this by passing the delegate as a filter to the query command.

I suspect this was not implemented before because the REST API may not
actually allow partial names for the delegate. I believe this is still
valuable to support even if it requires strict matching against the
delegate names or IDs.

If a match is desirable, this could be refactored to query the set of
delegates from the API, find all the IDs which match, and then make
multiple calls to _list for each matching delegate ID. I did not attempt to
implement that.

Signed-off-by: Jacob Keller <[email protected]>
  • Loading branch information
jacob-keller authored and stephenfin committed Jan 8, 2025
1 parent 4d2f914 commit 70f96f9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pwclient/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,9 @@ def patch_list(
if archived is not None:
filters['archived'] = archived

if delegate is not None:
filters['delegate'] = delegate

patches = self._list('patches', params=filters)
return [self._patch_to_dict(patch) for patch in patches]

Expand Down

0 comments on commit 70f96f9

Please sign in to comment.