From 37da105d52cd732ead65494433cad3509ecafe29 Mon Sep 17 00:00:00 2001 From: Nico Pache Date: Wed, 12 Nov 2025 08:37:31 -0700 Subject: [PATCH] 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 --- patchwork/Patchwork.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/patchwork/Patchwork.py b/patchwork/Patchwork.py index 2f7a84d..ef30252 100644 --- a/patchwork/Patchwork.py +++ b/patchwork/Patchwork.py @@ -256,6 +256,8 @@ def search_patches( archived=None, hash=None, msgid=None, + before=None, + since=None, ): """ List patches @@ -277,6 +279,10 @@ def search_patches( :type hash: string :param msgid: The patch message-id as a case-sensitive string, without leading or trailing angle brackets, to filter by :type msgid: string + :param before: Show patches with date before this date/time (ISO 8601 format) + :type before: string + :param since: Show patches with date after this date/time (ISO 8601 format) + :type since: string :rtype: :class:`patchwork.Pagination.Pagination` of :class:`patchwork.Patch.Patch` """ # Check input parameters @@ -289,6 +295,8 @@ def search_patches( assert archived is None or isinstance(archived, bool) assert hash is None or isinstance(hash, str) assert msgid is None or isinstance(msgid, str) + assert before is None or isinstance(before, str) + assert since is None or isinstance(since, str) # Build the parameters params = {} @@ -308,6 +316,10 @@ def search_patches( params["msgid"] = msgid if state is not None: params["state"] = state + if before is not None: + params["before"] = before + if since is not None: + params["since"] = since # If all parameters are empty, throws an exception. # This is not what this function for...