Skip to content

Commit 22263b7

Browse files
nryskEnricoMi
andauthored
Add support for type parameter to get_issues (#3381)
## 1. Describe the problem the Pull Request attempts to solve This pull request adds support for the [`type` query parameter](https://docs.github.com/en/rest/issues/issues?apiVersion=2022-11-28#list-repository-issues). a feature recently added to the GitHub Issues. Currenty PyGithub's `get_issues` method does not have a way to filter issues by their type. ## 2. Explain how the you went about solving the problem I have updated the `get_issues` method in `github/Repository.py` to accept a new optional `type` parameter. When this parameter is provided, it is included in the URL parameter for API request. ## 3. Provide a test that exemplifies the expected behaviour I have added two test methods, `testGetIssuesWithTypeArgument` and `testGetIssuesWithTypeWildcard`. --- *As my native language is not English, I apologize for any errors in my writing.* --------- Co-authored-by: Enrico Minack <github@enrico.minack.dev>
1 parent 47478b0 commit 22263b7

4 files changed

Lines changed: 67 additions & 0 deletions

File tree

github/Repository.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3172,6 +3172,7 @@ def get_issues(
31723172
direction: Opt[str] = NotSet,
31733173
since: Opt[datetime] = NotSet,
31743174
creator: Opt[NamedUser] = NotSet,
3175+
type: Opt[str] = NotSet,
31753176
) -> PaginatedList[Issue]:
31763177
"""
31773178
:calls: `GET /repos/{owner}/{repo}/issues <https://docs.github.com/en/rest/reference/issues>`_
@@ -3184,11 +3185,13 @@ def get_issues(
31843185
:param direction: string
31853186
:param since: datetime
31863187
:param creator: string or :class:`github.NamedUser.NamedUser`
3188+
:param type: string
31873189
:rtype: :class:`PaginatedList` of :class:`github.Issue.Issue`
31883190
"""
31893191
assert milestone in ["*", "none", NotSet] or isinstance(milestone, github.Milestone.Milestone), milestone
31903192
assert is_optional(state, str), state
31913193
assert is_optional(assignee, (str, github.NamedUser.NamedUser)), assignee
3194+
assert is_optional(type, str), type
31923195
assert is_optional(mentioned, github.NamedUser.NamedUser), mentioned
31933196
assert is_optional_list(labels, (github.Label.Label, str)), labels
31943197
assert is_optional(sort, str), sort
@@ -3208,6 +3211,8 @@ def get_issues(
32083211
url_parameters["assignee"] = assignee._identity
32093212
else:
32103213
url_parameters["assignee"] = assignee
3214+
if is_defined(type):
3215+
url_parameters["type"] = type
32113216
if is_defined(mentioned):
32123217
url_parameters["mentioned"] = mentioned._identity
32133218
if is_defined(labels):

0 commit comments

Comments
 (0)