#2755 Add API endpoints for listing pull requests for a user
Merged by pingou. Opened by ryanlerch.
ryanlerch/pagure userrequests-api  into  master

Download 2755.patch

There is the requests page for a user that is currently available in the web UI and it lists all the pull requests for a user (across all projects in a pagure instance) that are either filed by the user, or actionable by the user. e.g:

https://pagure.io/user/pingou/requests

This commit adds API endpoints for the information in both of the tables that are included in the requests HTML view:

api/0/user//requests/actionable
api/0/user//requests/filed

Signed-off-by: Ryan Lerch rlerch@redhat.com

Why not using the to_json() method?

For these two endpoints (esp the filled one) I was wondering if we should add an option to filter by status (ie: open PR vs closed vs merged vs all). What do you think?

rebased onto 9d466c5ec3a5ab538e08c7879893ae480502c767

For these two endpoints (esp the filled one) I was wondering if we should add an option to filter by status (ie: open PR vs closed vs merged vs all). What do you think?

Good idea! Actually, after you pointing this out, i realised that pagure.lib.get_pull_request_of_user actually returns all statuses (merged, open, and closed) -- i thought it only returned opened ones.

Long story short, i have updated the PR so it returns open requests by default, and added a param to be able to specify open, merged, closed or all.

Also updated the commit to use the to_json() method -- which i didnt use previously because i didnt know it existed :) thanks!

rebased onto 397681d2cae287c8cbd85108856ccdf9acfbf426

Quite a few empty lines there :)

I'm going to merge but we'll need to add these endpoints to the API doc.

Thanks!

Pull-Request has been merged by pingou

@pingou oh -- i did try to check if this was manually put somewhere, but i couldn't find it in the source. I assumed that it was generated from the comments in the code.

Check the api method in pagure/api/__init__.py :)

Metadata