Skip to content
This repository was archived by the owner on Nov 4, 2020. It is now read-only.

Allow Project Issues to be filtered by passing kwargs #112

Merged
merged 4 commits into from
Mar 13, 2015
Merged

Allow Project Issues to be filtered by passing kwargs #112

merged 4 commits into from
Mar 13, 2015

Conversation

nickw444
Copy link
Contributor

This can be extended to many other areas of the API which support filtering by query string arguments.

This significantly improves performance when querying projects which have > 100 issues since you can filter them on the API rather than with python code, which needs to request more than one API call.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.07%) when pulling 84072b5 on nickw444:develop into faa852f on Itxaka:develop.

@Itxaka
Copy link
Member

Itxaka commented Dec 28, 2014

I was wondering of doing away with any named parameters and just use **kwargs everywhere including per_page and page. IIRC they will default to sane parameters if not included so it would be easiar to use them as input for the data instead of managing all kwargs manually.

@nickw444
Copy link
Contributor Author

In my opinion, to use **kwargs for things like per_page and page, where they do have default values on the API end, is kind of misleading (and makes things harder to document). Keeping them as named args with default values not only makes docs easier but also makes usage more clarified.

The use of kwargs should be limited only to parameters where they are optional, such as where I used them in this patch.

@python33r
Copy link

Extending with keyword args would be really useful - e.g. to specify the search parameter to the 'List projects' API call:

foo_projects = getprojects(search="foo")

(Note: this behaviour can't be achieved using the searchproject method because the corresponding API calls don't search in the same way. 'List projects' allows you to search by the name of the group to which projects belong, whereas 'Search projects by name' seems to consider project name only.)

@nickw444
Copy link
Contributor Author

nickw444 commented Mar 6, 2015

Any progress towards this pull request? Is there any reason this should not be pulled to the master branch?

@Itxaka
Copy link
Member

Itxaka commented Mar 6, 2015

Hey nick,
Sorry for the delay, I been quite busy lately. I'll have a look at this during this weekend, and probably merge it + upload the new version.

Thanks for reminding me :)

@nickw444
Copy link
Contributor Author

nickw444 commented Mar 6, 2015

No problem, just becoming more and more daunting for me every time pip clones via a git repo rather than the real package :P never know when a new version will drop, and my fork will be left behind.

Cheers,

@Itxaka
Copy link
Member

Itxaka commented Mar 8, 2015

@nickw444 Looks great, can you update your branch with the latest changes from develop so I can merge it?

Thanks!

@nickw444
Copy link
Contributor Author

nickw444 commented Mar 8, 2015

Just pulled latest upstream changes from develop and pushed,

Thanks :)

@Itxaka
Copy link
Member

Itxaka commented Mar 13, 2015

Perfect, thanks for the patch!

Itxaka added a commit that referenced this pull request Mar 13, 2015
Allow Project Issues to be filtered by passing kwargs
@Itxaka Itxaka merged commit dfdb8e5 into pyapi-gitlab:develop Mar 13, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants