Skip to content

Commit 2b27f37

Browse files
PacheNicotedd-an
authored andcommitted
search_patches: add since and before to the search_patches endpoint
The API has the ability to filter patches by dates. This makes the API much more powerful, and avoids unnecessary calls when looking for patches. Signed-off-by: Nico Pache <npache@redhat.com>
1 parent 480bb6f commit 2b27f37

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

patchwork/Patchwork.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,8 @@ def search_patches(
256256
archived=None,
257257
hash=None,
258258
msgid=None,
259+
before=None,
260+
since=None,
259261
):
260262
"""
261263
List patches
@@ -277,6 +279,10 @@ def search_patches(
277279
:type hash: string
278280
:param msgid: The patch message-id as a case-sensitive string, without leading or trailing angle brackets, to filter by
279281
:type msgid: string
282+
:param before: Show patches with date before this date/time (ISO 8601 format)
283+
:type before: string
284+
:param since: Show patches with date after this date/time (ISO 8601 format)
285+
:type since: string
280286
:rtype: :class:`patchwork.Pagination.Pagination` of :class:`patchwork.Patch.Patch`
281287
"""
282288
# Check input parameters
@@ -289,6 +295,8 @@ def search_patches(
289295
assert archived is None or isinstance(archived, bool)
290296
assert hash is None or isinstance(hash, str)
291297
assert msgid is None or isinstance(msgid, str)
298+
assert before is None or isinstance(before, str)
299+
assert since is None or isinstance(since, str)
292300

293301
# Build the parameters
294302
params = {}
@@ -308,6 +316,10 @@ def search_patches(
308316
params["msgid"] = msgid
309317
if state is not None:
310318
params["state"] = state
319+
if before is not None:
320+
params["before"] = before
321+
if since is not None:
322+
params["since"] = since
311323

312324
# If all parameters are empty, throws an exception.
313325
# This is not what this function for...

0 commit comments

Comments
 (0)