PyGithub-asyncio 3.0.0b1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- githubasyncio/AccessToken.py +159 -0
- githubasyncio/AdvisoryBase.py +163 -0
- githubasyncio/AdvisoryCredit.py +131 -0
- githubasyncio/AdvisoryCreditDetailed.py +110 -0
- githubasyncio/AdvisoryVulnerability.py +191 -0
- githubasyncio/AdvisoryVulnerabilityPackage.py +93 -0
- githubasyncio/AppAuthentication.py +58 -0
- githubasyncio/ApplicationOAuth.py +200 -0
- githubasyncio/Artifact.py +183 -0
- githubasyncio/Auth.py +560 -0
- githubasyncio/AuthenticatedUser.py +1251 -0
- githubasyncio/Authorization.py +192 -0
- githubasyncio/AuthorizationApplication.py +73 -0
- githubasyncio/Autolink.py +104 -0
- githubasyncio/Branch.py +689 -0
- githubasyncio/BranchProtection.py +224 -0
- githubasyncio/CVSS.py +83 -0
- githubasyncio/CWE.py +75 -0
- githubasyncio/CheckRun.py +315 -0
- githubasyncio/CheckRunAnnotation.py +134 -0
- githubasyncio/CheckRunOutput.py +108 -0
- githubasyncio/CheckSuite.py +319 -0
- githubasyncio/Clones.py +97 -0
- githubasyncio/CodeScanAlert.py +215 -0
- githubasyncio/CodeScanAlertInstance.py +134 -0
- githubasyncio/CodeScanAlertInstanceLocation.py +102 -0
- githubasyncio/CodeScanRule.py +134 -0
- githubasyncio/CodeScanTool.py +94 -0
- githubasyncio/CodeSecurityConfig.py +301 -0
- githubasyncio/CodeSecurityConfigRepository.py +70 -0
- githubasyncio/Commit.py +442 -0
- githubasyncio/CommitCombinedStatus.py +126 -0
- githubasyncio/CommitComment.py +270 -0
- githubasyncio/CommitStats.py +78 -0
- githubasyncio/CommitStatus.py +169 -0
- githubasyncio/Comparison.py +219 -0
- githubasyncio/Consts.py +197 -0
- githubasyncio/ContentFile.py +304 -0
- githubasyncio/Copilot.py +97 -0
- githubasyncio/CopilotSeat.py +132 -0
- githubasyncio/DefaultCodeSecurityConfig.py +93 -0
- githubasyncio/DependabotAlert.py +184 -0
- githubasyncio/DependabotAlertAdvisory.py +82 -0
- githubasyncio/DependabotAlertDependency.py +100 -0
- githubasyncio/DependabotAlertVulnerability.py +85 -0
- githubasyncio/Deployment.py +314 -0
- githubasyncio/DeploymentBranchPolicy.py +102 -0
- githubasyncio/DeploymentStatus.py +201 -0
- githubasyncio/DiscussionBase.py +140 -0
- githubasyncio/DiscussionCommentBase.py +140 -0
- githubasyncio/Download.py +256 -0
- githubasyncio/Enterprise.py +175 -0
- githubasyncio/EnterpriseConsumedLicenses.py +138 -0
- githubasyncio/Environment.py +354 -0
- githubasyncio/EnvironmentDeploymentBranchPolicy.py +87 -0
- githubasyncio/EnvironmentProtectionRule.py +117 -0
- githubasyncio/EnvironmentProtectionRuleReviewer.py +110 -0
- githubasyncio/Event.py +134 -0
- githubasyncio/File.py +142 -0
- githubasyncio/GeneratedReleaseNotes.py +68 -0
- githubasyncio/Gist.py +373 -0
- githubasyncio/GistComment.py +162 -0
- githubasyncio/GistFile.py +106 -0
- githubasyncio/GistHistoryState.py +245 -0
- githubasyncio/GitAuthor.py +94 -0
- githubasyncio/GitBlob.py +123 -0
- githubasyncio/GitCommit.py +208 -0
- githubasyncio/GitCommitVerification.py +103 -0
- githubasyncio/GitObject.py +84 -0
- githubasyncio/GitRef.py +122 -0
- githubasyncio/GitRelease.py +476 -0
- githubasyncio/GitReleaseAsset.py +232 -0
- githubasyncio/GitTag.py +143 -0
- githubasyncio/GitTree.py +113 -0
- githubasyncio/GitTreeElement.py +104 -0
- githubasyncio/GithubApp.py +236 -0
- githubasyncio/GithubException.py +226 -0
- githubasyncio/GithubIntegration.py +365 -0
- githubasyncio/GithubObject.py +910 -0
- githubasyncio/GithubRetry.py +253 -0
- githubasyncio/GitignoreTemplate.py +88 -0
- githubasyncio/GlobalAdvisory.py +141 -0
- githubasyncio/Hook.py +238 -0
- githubasyncio/HookDelivery.py +243 -0
- githubasyncio/HookDescription.py +85 -0
- githubasyncio/HookResponse.py +83 -0
- githubasyncio/InputFileContent.py +63 -0
- githubasyncio/InputGitAuthor.py +71 -0
- githubasyncio/InputGitTreeElement.py +79 -0
- githubasyncio/Installation.py +298 -0
- githubasyncio/InstallationAuthorization.py +138 -0
- githubasyncio/Invitation.py +171 -0
- githubasyncio/Issue.py +955 -0
- githubasyncio/IssueComment.py +309 -0
- githubasyncio/IssueDependenciesSummary.py +77 -0
- githubasyncio/IssueEvent.py +296 -0
- githubasyncio/IssuePullRequest.py +97 -0
- githubasyncio/IssueType.py +123 -0
- githubasyncio/Label.py +186 -0
- githubasyncio/License.py +169 -0
- githubasyncio/MainClass.py +1142 -0
- githubasyncio/Membership.py +154 -0
- githubasyncio/MergedUpstream.py +71 -0
- githubasyncio/Migration.py +281 -0
- githubasyncio/Milestone.py +255 -0
- githubasyncio/NamedEnterpriseUser.py +207 -0
- githubasyncio/NamedUser.py +841 -0
- githubasyncio/Notification.py +182 -0
- githubasyncio/NotificationSubject.py +96 -0
- githubasyncio/Organization.py +2462 -0
- githubasyncio/OrganizationCodeScanAlert.py +65 -0
- githubasyncio/OrganizationCustomProperty.py +215 -0
- githubasyncio/OrganizationDependabotAlert.py +75 -0
- githubasyncio/OrganizationSecret.py +191 -0
- githubasyncio/OrganizationSecretScanAlert.py +112 -0
- githubasyncio/OrganizationVariable.py +141 -0
- githubasyncio/PaginatedList.py +652 -0
- githubasyncio/Path.py +102 -0
- githubasyncio/Permissions.py +113 -0
- githubasyncio/Plan.py +108 -0
- githubasyncio/Project.py +286 -0
- githubasyncio/ProjectCard.py +257 -0
- githubasyncio/ProjectColumn.py +227 -0
- githubasyncio/PublicKey.py +138 -0
- githubasyncio/PullRequest.py +1202 -0
- githubasyncio/PullRequestComment.py +401 -0
- githubasyncio/PullRequestMergeStatus.py +89 -0
- githubasyncio/PullRequestPart.py +110 -0
- githubasyncio/PullRequestReview.py +214 -0
- githubasyncio/Rate.py +123 -0
- githubasyncio/RateLimit.py +210 -0
- githubasyncio/RateLimitOverview.py +104 -0
- githubasyncio/Reaction.py +128 -0
- githubasyncio/Referrer.py +94 -0
- githubasyncio/RepoCodeSecurityConfig.py +93 -0
- githubasyncio/Repository.py +5211 -0
- githubasyncio/RepositoryAdvisory.py +431 -0
- githubasyncio/RepositoryDiscussion.py +221 -0
- githubasyncio/RepositoryDiscussionCategory.py +150 -0
- githubasyncio/RepositoryDiscussionComment.py +159 -0
- githubasyncio/RepositoryKey.py +166 -0
- githubasyncio/RepositoryPreferences.py +82 -0
- githubasyncio/RepositoryRulesetBypassActor.py +75 -0
- githubasyncio/Requester.py +1518 -0
- githubasyncio/RequiredPullRequestReviews.py +269 -0
- githubasyncio/RequiredStatusChecks.py +153 -0
- githubasyncio/Rule.py +134 -0
- githubasyncio/Ruleset.py +292 -0
- githubasyncio/Secret.py +139 -0
- githubasyncio/SecretScanAlert.py +317 -0
- githubasyncio/SecretScanAlertInstance.py +128 -0
- githubasyncio/SecurityAndAnalysis.py +188 -0
- githubasyncio/SecurityAndAnalysisFeature.py +79 -0
- githubasyncio/SelfHostedActionsRunner.py +129 -0
- githubasyncio/SelfHostedActionsRunnerApplication.py +92 -0
- githubasyncio/SelfHostedActionsRunnerJitConfig.py +74 -0
- githubasyncio/SelfHostedActionsRunnerToken.py +118 -0
- githubasyncio/SourceImport.py +260 -0
- githubasyncio/Stargazer.py +88 -0
- githubasyncio/StatsCodeFrequency.py +81 -0
- githubasyncio/StatsCommitActivity.py +86 -0
- githubasyncio/StatsContributor.py +138 -0
- githubasyncio/StatsParticipation.py +78 -0
- githubasyncio/StatsPunchCard.py +76 -0
- githubasyncio/SubIssueSummary.py +70 -0
- githubasyncio/Tag.py +108 -0
- githubasyncio/Team.py +618 -0
- githubasyncio/TeamDiscussion.py +137 -0
- githubasyncio/TimelineEvent.py +164 -0
- githubasyncio/TimelineEventSource.py +81 -0
- githubasyncio/Topic.py +177 -0
- githubasyncio/Traffic.py +95 -0
- githubasyncio/UserKey.py +141 -0
- githubasyncio/Variable.py +155 -0
- githubasyncio/View.py +97 -0
- githubasyncio/Workflow.py +335 -0
- githubasyncio/WorkflowJob.py +253 -0
- githubasyncio/WorkflowRun.py +480 -0
- githubasyncio/WorkflowStep.py +118 -0
- githubasyncio/__init__.py +38 -0
- githubasyncio/compat/__init__.py +52 -0
- githubasyncio/requestlib/__init__.py +29 -0
- pygithub_asyncio-3.0.0b1.dist-info/METADATA +102 -0
- pygithub_asyncio-3.0.0b1.dist-info/RECORD +188 -0
- pygithub_asyncio-3.0.0b1.dist-info/WHEEL +5 -0
- pygithub_asyncio-3.0.0b1.dist-info/licenses/COPYING +674 -0
- pygithub_asyncio-3.0.0b1.dist-info/licenses/COPYING.LESSER +165 -0
- pygithub_asyncio-3.0.0b1.dist-info/top_level.txt +1 -0
githubasyncio/Issue.py
ADDED
|
@@ -0,0 +1,955 @@
|
|
|
1
|
+
# FILE AUTO GENERATED DO NOT TOUCH
|
|
2
|
+
############################ Copyrights and license ############################
|
|
3
|
+
# #
|
|
4
|
+
# Copyright 2012 Andrew Bettison <andrewb@zip.com.au> #
|
|
5
|
+
# Copyright 2012 Philip Kimmey <philip@rover.com> #
|
|
6
|
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
|
7
|
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
|
8
|
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
|
9
|
+
# Copyright 2013 David Farr <david.farr@sap.com> #
|
|
10
|
+
# Copyright 2013 Stuart Glaser <stuglaser@gmail.com> #
|
|
11
|
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
|
12
|
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
|
13
|
+
# Copyright 2015 Raja Reddy Karri <klnrajareddy@gmail.com> #
|
|
14
|
+
# Copyright 2016 @tmshn <tmshn@r.recruit.co.jp> #
|
|
15
|
+
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
|
16
|
+
# Copyright 2016 Matt Babineau <babineaum@users.noreply.github.com> #
|
|
17
|
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
|
18
|
+
# Copyright 2017 Nicolas Agustín Torres <nicolastrres@gmail.com> #
|
|
19
|
+
# Copyright 2017 Simon <spam@esemi.ru> #
|
|
20
|
+
# Copyright 2018 Aaron L. Levine <allevin@sandia.gov> #
|
|
21
|
+
# Copyright 2018 Shinichi TAMURA <shnch.tmr@gmail.com> #
|
|
22
|
+
# Copyright 2018 Steve Kowalik <steven@wedontsleep.org> #
|
|
23
|
+
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
|
24
|
+
# Copyright 2018 per1234 <accounts@perglass.com> #
|
|
25
|
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
|
26
|
+
# Copyright 2019 Filipe Laíns <filipe.lains@gmail.com> #
|
|
27
|
+
# Copyright 2019 Nick Campbell <nicholas.j.campbell@gmail.com> #
|
|
28
|
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
|
29
|
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
|
30
|
+
# Copyright 2020 Huan-Cheng Chang <changhc84@gmail.com> #
|
|
31
|
+
# Copyright 2020 Huw Jones <huwcbjones@outlook.com> #
|
|
32
|
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
|
33
|
+
# Copyright 2021 Mark Walker <mark.walker@realbuzz.com> #
|
|
34
|
+
# Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
|
|
35
|
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
|
36
|
+
# Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
|
37
|
+
# Copyright 2023 Nicolas Schweitzer <nicolas.schweitzer@datadoghq.com> #
|
|
38
|
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
|
39
|
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
|
40
|
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
|
41
|
+
# Copyright 2024 Malik Shahzad Muzaffar <shahzad.malik.muzaffar@cern.ch> #
|
|
42
|
+
# Copyright 2025 Changyong Um <e7217@naver.com> #
|
|
43
|
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
|
44
|
+
# Copyright 2026 James Geiger <james-geiger@users.noreply.github.com> #
|
|
45
|
+
# #
|
|
46
|
+
# This file is part of PyGithub. #
|
|
47
|
+
# http://pygithub.readthedocs.io/ #
|
|
48
|
+
# #
|
|
49
|
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
|
50
|
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
|
51
|
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
|
52
|
+
# any later version. #
|
|
53
|
+
# #
|
|
54
|
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
|
55
|
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
|
56
|
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
|
57
|
+
# details. #
|
|
58
|
+
# #
|
|
59
|
+
# You should have received a copy of the GNU Lesser General Public License #
|
|
60
|
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
|
61
|
+
# #
|
|
62
|
+
################################################################################
|
|
63
|
+
|
|
64
|
+
from __future__ import annotations
|
|
65
|
+
|
|
66
|
+
import urllib.parse
|
|
67
|
+
import warnings
|
|
68
|
+
from datetime import datetime
|
|
69
|
+
from typing import TYPE_CHECKING, Any
|
|
70
|
+
|
|
71
|
+
import githubasyncio.GithubApp
|
|
72
|
+
import githubasyncio.GithubObject
|
|
73
|
+
import githubasyncio.IssueComment
|
|
74
|
+
import githubasyncio.IssueDependenciesSummary
|
|
75
|
+
import githubasyncio.IssueEvent
|
|
76
|
+
import githubasyncio.IssuePullRequest
|
|
77
|
+
import githubasyncio.IssueType
|
|
78
|
+
import githubasyncio.Label
|
|
79
|
+
import githubasyncio.Milestone
|
|
80
|
+
import githubasyncio.NamedUser
|
|
81
|
+
import githubasyncio.Organization
|
|
82
|
+
import githubasyncio.PullRequest
|
|
83
|
+
import githubasyncio.Reaction
|
|
84
|
+
import githubasyncio.Repository
|
|
85
|
+
import githubasyncio.SubIssueSummary
|
|
86
|
+
import githubasyncio.TimelineEvent
|
|
87
|
+
from githubasyncio import Consts
|
|
88
|
+
from githubasyncio.compat import deprecated
|
|
89
|
+
from githubasyncio.GithubObject import (
|
|
90
|
+
Attribute,
|
|
91
|
+
CompletableGithubObject,
|
|
92
|
+
NotSet,
|
|
93
|
+
Opt,
|
|
94
|
+
is_defined,
|
|
95
|
+
is_optional,
|
|
96
|
+
is_optional_list,
|
|
97
|
+
is_undefined,
|
|
98
|
+
)
|
|
99
|
+
from githubasyncio.PaginatedList import PaginatedList
|
|
100
|
+
|
|
101
|
+
if TYPE_CHECKING:
|
|
102
|
+
from githubasyncio.GithubApp import GithubApp
|
|
103
|
+
from githubasyncio.IssueComment import IssueComment
|
|
104
|
+
from githubasyncio.IssueDependenciesSummary import IssueDependenciesSummary
|
|
105
|
+
from githubasyncio.IssueEvent import IssueEvent
|
|
106
|
+
from githubasyncio.IssuePullRequest import IssuePullRequest
|
|
107
|
+
from githubasyncio.IssueType import IssueType
|
|
108
|
+
from githubasyncio.Label import Label
|
|
109
|
+
from githubasyncio.Milestone import Milestone
|
|
110
|
+
from githubasyncio.NamedUser import NamedUser
|
|
111
|
+
from githubasyncio.PullRequest import PullRequest
|
|
112
|
+
from githubasyncio.Reaction import Reaction
|
|
113
|
+
from githubasyncio.Repository import Repository
|
|
114
|
+
from githubasyncio.SubIssueSummary import SubIssueSummary
|
|
115
|
+
from githubasyncio.TimelineEvent import TimelineEvent
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
class Issue(CompletableGithubObject):
|
|
119
|
+
"""
|
|
120
|
+
This class represents Issues.
|
|
121
|
+
|
|
122
|
+
The reference can be found here
|
|
123
|
+
https://docs.github.com/en/rest/reference/issues
|
|
124
|
+
|
|
125
|
+
The OpenAPI schema can be found at
|
|
126
|
+
|
|
127
|
+
- /components/schemas/issue
|
|
128
|
+
- /components/schemas/nullable-issue
|
|
129
|
+
|
|
130
|
+
"""
|
|
131
|
+
|
|
132
|
+
def _initAttributes(self) -> None:
|
|
133
|
+
self._active_lock_reason: Attribute[str | None] = NotSet
|
|
134
|
+
self._assignee: Attribute[NamedUser | None] = NotSet
|
|
135
|
+
self._assignees: Attribute[list[NamedUser]] = NotSet
|
|
136
|
+
self._author_association: Attribute[str] = NotSet
|
|
137
|
+
self._body: Attribute[str] = NotSet
|
|
138
|
+
self._body_html: Attribute[str] = NotSet
|
|
139
|
+
self._body_text: Attribute[str] = NotSet
|
|
140
|
+
self._closed_at: Attribute[datetime] = NotSet
|
|
141
|
+
self._closed_by: Attribute[NamedUser] = NotSet
|
|
142
|
+
self._comments: Attribute[int] = NotSet
|
|
143
|
+
self._comments_url: Attribute[str] = NotSet
|
|
144
|
+
self._created_at: Attribute[datetime] = NotSet
|
|
145
|
+
self._draft: Attribute[bool] = NotSet
|
|
146
|
+
self._events_url: Attribute[str] = NotSet
|
|
147
|
+
self._html_url: Attribute[str] = NotSet
|
|
148
|
+
self._id: Attribute[int] = NotSet
|
|
149
|
+
self._issue_dependencies_summary: Attribute[IssueDependenciesSummary] = NotSet
|
|
150
|
+
self._labels: Attribute[list[Label]] = NotSet
|
|
151
|
+
self._labels_url: Attribute[str] = NotSet
|
|
152
|
+
self._locked: Attribute[bool] = NotSet
|
|
153
|
+
self._milestone: Attribute[Milestone] = NotSet
|
|
154
|
+
self._node_id: Attribute[str] = NotSet
|
|
155
|
+
self._number: Attribute[int] = NotSet
|
|
156
|
+
self._parent_issue_url: Attribute[str] = NotSet
|
|
157
|
+
self._performed_via_github_app: Attribute[GithubApp] = NotSet
|
|
158
|
+
self._pull_request: Attribute[IssuePullRequest] = NotSet
|
|
159
|
+
self._reactions: Attribute[dict] = NotSet
|
|
160
|
+
self._repository: Attribute[Repository] = NotSet
|
|
161
|
+
self._repository_url: Attribute[str] = NotSet
|
|
162
|
+
self._state: Attribute[str] = NotSet
|
|
163
|
+
self._state_reason: Attribute[str | None] = NotSet
|
|
164
|
+
self._sub_issues_summary: Attribute[SubIssueSummary] = NotSet
|
|
165
|
+
self._text_matches: Attribute[dict[str, Any]] = NotSet
|
|
166
|
+
self._timeline_url: Attribute[str] = NotSet
|
|
167
|
+
self._title: Attribute[str] = NotSet
|
|
168
|
+
self._type: Attribute[IssueType] = NotSet
|
|
169
|
+
self._updated_at: Attribute[datetime] = NotSet
|
|
170
|
+
self._url: Attribute[str] = NotSet
|
|
171
|
+
self._user: Attribute[NamedUser] = NotSet
|
|
172
|
+
|
|
173
|
+
def __repr__(self) -> str:
|
|
174
|
+
return self.get__repr__({"number": self._number.value, "title": self._title.value})
|
|
175
|
+
|
|
176
|
+
@property
|
|
177
|
+
async def _identity(self) -> int:
|
|
178
|
+
return await self.number
|
|
179
|
+
|
|
180
|
+
@property
|
|
181
|
+
async def active_lock_reason(self) -> str | None:
|
|
182
|
+
await self._completeIfNotSet(self._active_lock_reason)
|
|
183
|
+
return self._active_lock_reason.value
|
|
184
|
+
|
|
185
|
+
@property
|
|
186
|
+
@deprecated("Use assignees instead")
|
|
187
|
+
async def assignee(self) -> NamedUser | None:
|
|
188
|
+
await self._completeIfNotSet(self._assignee)
|
|
189
|
+
return self._assignee.value
|
|
190
|
+
|
|
191
|
+
@property
|
|
192
|
+
async def assignees(self) -> list[NamedUser]:
|
|
193
|
+
await self._completeIfNotSet(self._assignees)
|
|
194
|
+
return self._assignees.value
|
|
195
|
+
|
|
196
|
+
@property
|
|
197
|
+
async def author_association(self) -> str:
|
|
198
|
+
await self._completeIfNotSet(self._author_association)
|
|
199
|
+
return self._author_association.value
|
|
200
|
+
|
|
201
|
+
@property
|
|
202
|
+
async def body(self) -> str:
|
|
203
|
+
await self._completeIfNotSet(self._body)
|
|
204
|
+
return self._body.value
|
|
205
|
+
|
|
206
|
+
@property
|
|
207
|
+
async def body_html(self) -> str:
|
|
208
|
+
await self._completeIfNotSet(self._body_html)
|
|
209
|
+
return self._body_html.value
|
|
210
|
+
|
|
211
|
+
@property
|
|
212
|
+
async def body_text(self) -> str:
|
|
213
|
+
await self._completeIfNotSet(self._body_text)
|
|
214
|
+
return self._body_text.value
|
|
215
|
+
|
|
216
|
+
@property
|
|
217
|
+
async def closed_at(self) -> datetime:
|
|
218
|
+
await self._completeIfNotSet(self._closed_at)
|
|
219
|
+
return self._closed_at.value
|
|
220
|
+
|
|
221
|
+
@property
|
|
222
|
+
async def closed_by(self) -> NamedUser | None:
|
|
223
|
+
await self._completeIfNotSet(self._closed_by)
|
|
224
|
+
return self._closed_by.value
|
|
225
|
+
|
|
226
|
+
@property
|
|
227
|
+
async def comments(self) -> int:
|
|
228
|
+
await self._completeIfNotSet(self._comments)
|
|
229
|
+
return self._comments.value
|
|
230
|
+
|
|
231
|
+
@property
|
|
232
|
+
async def comments_url(self) -> str:
|
|
233
|
+
await self._completeIfNotSet(self._comments_url)
|
|
234
|
+
return self._comments_url.value
|
|
235
|
+
|
|
236
|
+
@property
|
|
237
|
+
async def created_at(self) -> datetime:
|
|
238
|
+
await self._completeIfNotSet(self._created_at)
|
|
239
|
+
return self._created_at.value
|
|
240
|
+
|
|
241
|
+
@property
|
|
242
|
+
async def draft(self) -> bool:
|
|
243
|
+
await self._completeIfNotSet(self._draft)
|
|
244
|
+
return self._draft.value
|
|
245
|
+
|
|
246
|
+
@property
|
|
247
|
+
async def events_url(self) -> str:
|
|
248
|
+
await self._completeIfNotSet(self._events_url)
|
|
249
|
+
return self._events_url.value
|
|
250
|
+
|
|
251
|
+
@property
|
|
252
|
+
async def html_url(self) -> str:
|
|
253
|
+
await self._completeIfNotSet(self._html_url)
|
|
254
|
+
return self._html_url.value
|
|
255
|
+
|
|
256
|
+
@property
|
|
257
|
+
async def id(self) -> int:
|
|
258
|
+
await self._completeIfNotSet(self._id)
|
|
259
|
+
return self._id.value
|
|
260
|
+
|
|
261
|
+
@property
|
|
262
|
+
async def issue_dependencies_summary(self) -> IssueDependenciesSummary:
|
|
263
|
+
await self._completeIfNotSet(self._issue_dependencies_summary)
|
|
264
|
+
return self._issue_dependencies_summary.value
|
|
265
|
+
|
|
266
|
+
@property
|
|
267
|
+
async def labels(self) -> list[Label]:
|
|
268
|
+
await self._completeIfNotSet(self._labels)
|
|
269
|
+
return self._labels.value
|
|
270
|
+
|
|
271
|
+
@property
|
|
272
|
+
async def labels_url(self) -> str:
|
|
273
|
+
await self._completeIfNotSet(self._labels_url)
|
|
274
|
+
return self._labels_url.value
|
|
275
|
+
|
|
276
|
+
@property
|
|
277
|
+
async def locked(self) -> bool:
|
|
278
|
+
await self._completeIfNotSet(self._locked)
|
|
279
|
+
return self._locked.value
|
|
280
|
+
|
|
281
|
+
@property
|
|
282
|
+
async def milestone(self) -> Milestone:
|
|
283
|
+
await self._completeIfNotSet(self._milestone)
|
|
284
|
+
return self._milestone.value
|
|
285
|
+
|
|
286
|
+
@property
|
|
287
|
+
async def node_id(self) -> str:
|
|
288
|
+
await self._completeIfNotSet(self._node_id)
|
|
289
|
+
return self._node_id.value
|
|
290
|
+
|
|
291
|
+
@property
|
|
292
|
+
async def number(self) -> int:
|
|
293
|
+
await self._completeIfNotSet(self._number)
|
|
294
|
+
return self._number.value
|
|
295
|
+
|
|
296
|
+
@property
|
|
297
|
+
async def parent_issue_url(self) -> str:
|
|
298
|
+
await self._completeIfNotSet(self._parent_issue_url)
|
|
299
|
+
return self._parent_issue_url.value
|
|
300
|
+
|
|
301
|
+
@property
|
|
302
|
+
async def performed_via_github_app(self) -> GithubApp:
|
|
303
|
+
await self._completeIfNotSet(self._performed_via_github_app)
|
|
304
|
+
return self._performed_via_github_app.value
|
|
305
|
+
|
|
306
|
+
@property
|
|
307
|
+
async def pull_request(self) -> IssuePullRequest | None:
|
|
308
|
+
await self._completeIfNotSet(self._pull_request)
|
|
309
|
+
return self._pull_request.value
|
|
310
|
+
|
|
311
|
+
@property
|
|
312
|
+
async def reactions(self) -> dict:
|
|
313
|
+
await self._completeIfNotSet(self._reactions)
|
|
314
|
+
return self._reactions.value
|
|
315
|
+
|
|
316
|
+
@property
|
|
317
|
+
async def repository(self) -> Repository:
|
|
318
|
+
await self._completeIfNotSet(self._repository)
|
|
319
|
+
if is_undefined(self._repository):
|
|
320
|
+
# The repository was not set automatically, so it must be looked up by url.
|
|
321
|
+
repo_url = "/".join((await self.url).split("/")[:-2])
|
|
322
|
+
self._repository = githubasyncio.GithubObject._ValuedAttribute(
|
|
323
|
+
githubasyncio.Repository.Repository(self._requester, self._headers, {"url": repo_url}, completed=False)
|
|
324
|
+
)
|
|
325
|
+
return self._repository.value
|
|
326
|
+
|
|
327
|
+
@property
|
|
328
|
+
async def repository_url(self) -> str:
|
|
329
|
+
await self._completeIfNotSet(self._repository_url)
|
|
330
|
+
return self._repository_url.value
|
|
331
|
+
|
|
332
|
+
@property
|
|
333
|
+
async def state(self) -> str:
|
|
334
|
+
await self._completeIfNotSet(self._state)
|
|
335
|
+
return self._state.value
|
|
336
|
+
|
|
337
|
+
@property
|
|
338
|
+
async def state_reason(self) -> str | None:
|
|
339
|
+
await self._completeIfNotSet(self._state_reason)
|
|
340
|
+
return self._state_reason.value
|
|
341
|
+
|
|
342
|
+
@property
|
|
343
|
+
async def sub_issues_summary(self) -> SubIssueSummary:
|
|
344
|
+
await self._completeIfNotSet(self._sub_issues_summary)
|
|
345
|
+
return self._sub_issues_summary.value
|
|
346
|
+
|
|
347
|
+
@property
|
|
348
|
+
async def text_matches(self) -> dict[str, Any]:
|
|
349
|
+
await self._completeIfNotSet(self._text_matches)
|
|
350
|
+
return self._text_matches.value
|
|
351
|
+
|
|
352
|
+
@property
|
|
353
|
+
async def timeline_url(self) -> str:
|
|
354
|
+
await self._completeIfNotSet(self._timeline_url)
|
|
355
|
+
return self._timeline_url.value
|
|
356
|
+
|
|
357
|
+
@property
|
|
358
|
+
async def title(self) -> str:
|
|
359
|
+
await self._completeIfNotSet(self._title)
|
|
360
|
+
return self._title.value
|
|
361
|
+
|
|
362
|
+
@property
|
|
363
|
+
async def type(self) -> IssueType:
|
|
364
|
+
await self._completeIfNotSet(self._type)
|
|
365
|
+
return self._type.value
|
|
366
|
+
|
|
367
|
+
@property
|
|
368
|
+
async def updated_at(self) -> datetime:
|
|
369
|
+
await self._completeIfNotSet(self._updated_at)
|
|
370
|
+
return self._updated_at.value
|
|
371
|
+
|
|
372
|
+
@property
|
|
373
|
+
async def url(self) -> str:
|
|
374
|
+
await self._completeIfNotSet(self._url)
|
|
375
|
+
return self._url.value
|
|
376
|
+
|
|
377
|
+
@property
|
|
378
|
+
async def user(self) -> NamedUser:
|
|
379
|
+
await self._completeIfNotSet(self._user)
|
|
380
|
+
return self._user.value
|
|
381
|
+
|
|
382
|
+
async def as_pull_request(self) -> PullRequest:
|
|
383
|
+
"""
|
|
384
|
+
:calls: `GET /repos/{owner}/{repo}/pulls/{pull_number} <https://docs.github.com/en/rest/reference/pulls>`_
|
|
385
|
+
"""
|
|
386
|
+
url = "/pulls/".join((await self.url).rsplit("/issues/", 1))
|
|
387
|
+
return githubasyncio.PullRequest.PullRequest(self._requester, url=url)
|
|
388
|
+
|
|
389
|
+
async def add_to_assignees(self, *assignees: NamedUser | str) -> None:
|
|
390
|
+
"""
|
|
391
|
+
:calls: `POST /repos/{owner}/{repo}/issues/{issue_number}/assignees <https://docs.github.com/en/rest/reference/issues#assignees>`_
|
|
392
|
+
"""
|
|
393
|
+
assert all(isinstance(element, (githubasyncio.NamedUser.NamedUser, str)) for element in assignees), assignees
|
|
394
|
+
post_parameters = {
|
|
395
|
+
"assignees": [
|
|
396
|
+
(await assignee.login) if isinstance(assignee, githubasyncio.NamedUser.NamedUser) else assignee
|
|
397
|
+
for assignee in assignees
|
|
398
|
+
]
|
|
399
|
+
}
|
|
400
|
+
headers, data = await self._requester.requestJsonAndCheck(
|
|
401
|
+
"POST", f"{await self.url}/assignees", input=post_parameters
|
|
402
|
+
)
|
|
403
|
+
self._useAttributes(data)
|
|
404
|
+
self._set_complete()
|
|
405
|
+
|
|
406
|
+
async def add_to_labels(self, *labels: Label | str) -> None:
|
|
407
|
+
"""
|
|
408
|
+
:calls: `POST /repos/{owner}/{repo}/issues/{issue_number}/labels <https://docs.github.com/en/rest/reference/issues#labels>`_
|
|
409
|
+
"""
|
|
410
|
+
assert all(isinstance(element, (githubasyncio.Label.Label, str)) for element in labels), labels
|
|
411
|
+
post_parameters = [
|
|
412
|
+
(await label.name) if isinstance(label, githubasyncio.Label.Label) else label for label in labels
|
|
413
|
+
]
|
|
414
|
+
headers, data = await self._requester.requestJsonAndCheck(
|
|
415
|
+
"POST", f"{await self.url}/labels", input=post_parameters
|
|
416
|
+
)
|
|
417
|
+
|
|
418
|
+
async def create_comment(self, body: str) -> IssueComment:
|
|
419
|
+
"""
|
|
420
|
+
:calls: `POST /repos/{owner}/{repo}/issues/{issue_number}/comments <https://docs.github.com/en/rest/reference/issues#comments>`_
|
|
421
|
+
"""
|
|
422
|
+
assert isinstance(body, str), body
|
|
423
|
+
post_parameters = {
|
|
424
|
+
"body": body,
|
|
425
|
+
}
|
|
426
|
+
headers, data = await self._requester.requestJsonAndCheck(
|
|
427
|
+
"POST", f"{await self.url}/comments", input=post_parameters
|
|
428
|
+
)
|
|
429
|
+
return githubasyncio.IssueComment.IssueComment(self._requester, headers, data, completed=True)
|
|
430
|
+
|
|
431
|
+
async def delete_labels(self) -> None:
|
|
432
|
+
"""
|
|
433
|
+
:calls: `DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels <https://docs.github.com/en/rest/reference/issues#labels>`_
|
|
434
|
+
"""
|
|
435
|
+
headers, data = await self._requester.requestJsonAndCheck("DELETE", f"{await self.url}/labels")
|
|
436
|
+
|
|
437
|
+
# breaking change: remove deprecated assignee
|
|
438
|
+
async def edit(
|
|
439
|
+
self,
|
|
440
|
+
title: Opt[str] = NotSet,
|
|
441
|
+
body: Opt[str] = NotSet,
|
|
442
|
+
assignee: Opt[str | NamedUser | None] = NotSet,
|
|
443
|
+
state: Opt[str] = NotSet,
|
|
444
|
+
milestone: Opt[Milestone | None] = NotSet,
|
|
445
|
+
labels: Opt[list[str]] = NotSet,
|
|
446
|
+
assignees: Opt[list[NamedUser | str]] = NotSet,
|
|
447
|
+
state_reason: Opt[str] = NotSet,
|
|
448
|
+
) -> None:
|
|
449
|
+
"""
|
|
450
|
+
:calls: `PATCH /repos/{owner}/{repo}/issues/{issue_number} <https://docs.github.com/en/rest/reference/issues>`_
|
|
451
|
+
:param assignee: deprecated, use `assignees` instead. `assignee=None` means to remove current assignee.
|
|
452
|
+
:param milestone: `milestone=None` means to remove current milestone.
|
|
453
|
+
"""
|
|
454
|
+
assert is_optional(title, str), title
|
|
455
|
+
assert is_optional(body, str), body
|
|
456
|
+
assert assignee is None or is_optional(assignee, (githubasyncio.NamedUser.NamedUser, str)), assignee
|
|
457
|
+
assert is_optional_list(assignees, (githubasyncio.NamedUser.NamedUser, str)), assignees
|
|
458
|
+
assert is_optional(state, str), state
|
|
459
|
+
assert milestone is None or is_optional(milestone, githubasyncio.Milestone.Milestone), milestone
|
|
460
|
+
assert is_optional_list(labels, str), labels
|
|
461
|
+
|
|
462
|
+
if assignee is None or is_defined(assignee):
|
|
463
|
+
warnings.warn(
|
|
464
|
+
"Argument assignee is deprecated, please use assignees=[assignee] instead",
|
|
465
|
+
category=DeprecationWarning,
|
|
466
|
+
)
|
|
467
|
+
if is_undefined(assignees):
|
|
468
|
+
assignees = [assignee] if assignee is not None else [] # type: ignore
|
|
469
|
+
if is_defined(assignees):
|
|
470
|
+
assignees = [
|
|
471
|
+
(await element._identity) if isinstance(element, githubasyncio.NamedUser.NamedUser) else element
|
|
472
|
+
for element in assignees
|
|
473
|
+
]
|
|
474
|
+
|
|
475
|
+
post_parameters = NotSet.remove_unset_items(
|
|
476
|
+
{
|
|
477
|
+
"title": title,
|
|
478
|
+
"body": body,
|
|
479
|
+
"state": state,
|
|
480
|
+
"state_reason": state_reason,
|
|
481
|
+
"labels": labels,
|
|
482
|
+
"assignees": assignees,
|
|
483
|
+
"milestone": milestone._identity
|
|
484
|
+
if isinstance(milestone, githubasyncio.Milestone.Milestone)
|
|
485
|
+
else (milestone or ""),
|
|
486
|
+
}
|
|
487
|
+
)
|
|
488
|
+
|
|
489
|
+
headers, data = await self._requester.requestJsonAndCheck("PATCH", await self.url, input=post_parameters)
|
|
490
|
+
self._useAttributes(data)
|
|
491
|
+
self._set_complete()
|
|
492
|
+
|
|
493
|
+
async def lock(self, lock_reason: str) -> None:
|
|
494
|
+
"""
|
|
495
|
+
:calls: `PUT /repos/{owner}/{repo}/issues/{issue_number}/lock <https://docs.github.com/en/rest/reference/issues>`_
|
|
496
|
+
"""
|
|
497
|
+
assert isinstance(lock_reason, str), lock_reason
|
|
498
|
+
put_parameters = {"lock_reason": lock_reason}
|
|
499
|
+
headers, data = await self._requester.requestJsonAndCheck(
|
|
500
|
+
"PUT",
|
|
501
|
+
f"{await self.url}/lock",
|
|
502
|
+
input=put_parameters,
|
|
503
|
+
headers={"Accept": Consts.mediaTypeLockReasonPreview},
|
|
504
|
+
)
|
|
505
|
+
|
|
506
|
+
async def unlock(self) -> None:
|
|
507
|
+
"""
|
|
508
|
+
:calls: `DELETE /repos/{owner}/{repo}/issues/{issue_number}/lock <https://docs.github.com/en/rest/reference/issues>`_
|
|
509
|
+
"""
|
|
510
|
+
headers, data = await self._requester.requestJsonAndCheck("DELETE", f"{await self.url}/lock")
|
|
511
|
+
|
|
512
|
+
async def get_comment(self, id: int) -> IssueComment:
|
|
513
|
+
"""
|
|
514
|
+
:calls: `GET /repos/{owner}/{repo}/issues/comments/{comment_id} <https://docs.github.com/en/rest/reference/issues#comments>`_
|
|
515
|
+
"""
|
|
516
|
+
assert isinstance(id, int), id
|
|
517
|
+
url = f"{self._parentUrl(await self.url)}/comments/{id}"
|
|
518
|
+
return githubasyncio.IssueComment.IssueComment(self._requester, url=url)
|
|
519
|
+
|
|
520
|
+
async def get_comments(self, since: Opt[datetime] = NotSet) -> PaginatedList[IssueComment]:
|
|
521
|
+
"""
|
|
522
|
+
:calls: `GET /repos/{owner}/{repo}/issues/{issue_number}/comments <https://docs.github.com/en/rest/reference/issues#comments>`_
|
|
523
|
+
"""
|
|
524
|
+
url_parameters = {}
|
|
525
|
+
if is_defined(since):
|
|
526
|
+
assert isinstance(since, datetime), since
|
|
527
|
+
url_parameters["since"] = since.strftime("%Y-%m-%dT%H:%M:%SZ")
|
|
528
|
+
|
|
529
|
+
return PaginatedList(
|
|
530
|
+
githubasyncio.IssueComment.IssueComment,
|
|
531
|
+
self._requester,
|
|
532
|
+
f"{await self.url}/comments",
|
|
533
|
+
url_parameters,
|
|
534
|
+
)
|
|
535
|
+
|
|
536
|
+
async def get_events(self) -> PaginatedList[IssueEvent]:
|
|
537
|
+
"""
|
|
538
|
+
:calls: `GET /repos/{owner}/{repo}/issues/{issue_number}/events <https://docs.github.com/en/rest/reference/issues#events>`_
|
|
539
|
+
"""
|
|
540
|
+
return PaginatedList(
|
|
541
|
+
githubasyncio.IssueEvent.IssueEvent,
|
|
542
|
+
self._requester,
|
|
543
|
+
f"{await self.url}/events",
|
|
544
|
+
None,
|
|
545
|
+
headers={"Accept": Consts.mediaTypeLockReasonPreview},
|
|
546
|
+
)
|
|
547
|
+
|
|
548
|
+
async def get_labels(self) -> PaginatedList[Label]:
|
|
549
|
+
"""
|
|
550
|
+
:calls: `GET /repos/{owner}/{repo}/issues/{issue_number}/labels <https://docs.github.com/en/rest/reference/issues#labels>`_
|
|
551
|
+
"""
|
|
552
|
+
return PaginatedList(githubasyncio.Label.Label, self._requester, f"{await self.url}/labels", None)
|
|
553
|
+
|
|
554
|
+
async def remove_from_assignees(self, *assignees: NamedUser | str) -> None:
|
|
555
|
+
"""
|
|
556
|
+
:calls: `DELETE /repos/{owner}/{repo}/issues/{issue_number}/assignees <https://docs.github.com/en/rest/reference/issues#assignees>`_
|
|
557
|
+
"""
|
|
558
|
+
assert all(isinstance(element, (githubasyncio.NamedUser.NamedUser, str)) for element in assignees), assignees
|
|
559
|
+
post_parameters = {
|
|
560
|
+
"assignees": [
|
|
561
|
+
(await assignee.login) if isinstance(assignee, githubasyncio.NamedUser.NamedUser) else assignee
|
|
562
|
+
for assignee in assignees
|
|
563
|
+
]
|
|
564
|
+
}
|
|
565
|
+
headers, data = await self._requester.requestJsonAndCheck(
|
|
566
|
+
"DELETE", f"{await self.url}/assignees", input=post_parameters
|
|
567
|
+
)
|
|
568
|
+
self._useAttributes(data)
|
|
569
|
+
self._set_complete()
|
|
570
|
+
|
|
571
|
+
async def remove_from_labels(self, label: Label | str) -> None:
|
|
572
|
+
"""
|
|
573
|
+
:calls: `DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels/{name} <https://docs.github.com/en/rest/reference/issues#labels>`_
|
|
574
|
+
"""
|
|
575
|
+
assert isinstance(label, (githubasyncio.Label.Label, str)), label
|
|
576
|
+
if isinstance(label, githubasyncio.Label.Label):
|
|
577
|
+
label = await label._identity
|
|
578
|
+
else:
|
|
579
|
+
label = urllib.parse.quote(label)
|
|
580
|
+
headers, data = await self._requester.requestJsonAndCheck("DELETE", f"{await self.url}/labels/{label}")
|
|
581
|
+
|
|
582
|
+
async def set_labels(self, *labels: Label | str) -> None:
|
|
583
|
+
"""
|
|
584
|
+
:calls: `PUT /repos/{owner}/{repo}/issues/{issue_number}/labels <https://docs.github.com/en/rest/reference/issues#labels>`_
|
|
585
|
+
"""
|
|
586
|
+
assert all(isinstance(element, (githubasyncio.Label.Label, str)) for element in labels), labels
|
|
587
|
+
post_parameters = [
|
|
588
|
+
(await label.name) if isinstance(label, githubasyncio.Label.Label) else label for label in labels
|
|
589
|
+
]
|
|
590
|
+
headers, data = await self._requester.requestJsonAndCheck(
|
|
591
|
+
"PUT", f"{await self.url}/labels", input=post_parameters
|
|
592
|
+
)
|
|
593
|
+
|
|
594
|
+
async def get_reactions(self) -> PaginatedList[Reaction]:
|
|
595
|
+
"""
|
|
596
|
+
:calls: `GET /repos/{owner}/{repo}/issues/{issue_number}/reactions <https://docs.github.com/en/rest/reference/reactions#list-reactions-for-an-issue>`_
|
|
597
|
+
"""
|
|
598
|
+
return PaginatedList(
|
|
599
|
+
githubasyncio.Reaction.Reaction,
|
|
600
|
+
self._requester,
|
|
601
|
+
f"{await self.url}/reactions",
|
|
602
|
+
None,
|
|
603
|
+
headers={"Accept": Consts.mediaTypeReactionsPreview},
|
|
604
|
+
)
|
|
605
|
+
|
|
606
|
+
async def get_sub_issues(self) -> PaginatedList[SubIssue]:
|
|
607
|
+
"""
|
|
608
|
+
:calls: `GET /repos/{owner}/{repo}/issues/{issue_number}/sub_issues <https://docs.github.com/en/rest/issues/sub-issues?apiVersion=2022-11-28>`_
|
|
609
|
+
:rtype: :class:`githubasyncio.PaginatedList.PaginatedList` of :class:`Issue`
|
|
610
|
+
"""
|
|
611
|
+
return PaginatedList(
|
|
612
|
+
SubIssue,
|
|
613
|
+
self._requester,
|
|
614
|
+
f"{await self.url}/sub_issues",
|
|
615
|
+
None,
|
|
616
|
+
headers={"Accept": Consts.mediaType},
|
|
617
|
+
)
|
|
618
|
+
|
|
619
|
+
async def add_sub_issue(self, sub_issue: int | Issue) -> SubIssue:
|
|
620
|
+
"""
|
|
621
|
+
:calls: `POST /repos/{owner}/{repo}/issues/{issue_number}/sub_issues <https://docs.github.com/en/rest/issues/sub-issues>`_
|
|
622
|
+
:param sub_issue: int (sub-issue ID) or Issue object. Note: Use sub_issue.id, not sub_issue.number
|
|
623
|
+
:rtype: :class:`Issue.SubIssue`
|
|
624
|
+
"""
|
|
625
|
+
assert isinstance(sub_issue, (int, Issue)), sub_issue
|
|
626
|
+
|
|
627
|
+
sub_issue_id = sub_issue
|
|
628
|
+
if isinstance(sub_issue, Issue):
|
|
629
|
+
sub_issue_id = await sub_issue.id
|
|
630
|
+
|
|
631
|
+
post_parameters: dict[str, Any] = {
|
|
632
|
+
"sub_issue_id": sub_issue_id,
|
|
633
|
+
}
|
|
634
|
+
headers, data = await self._requester.requestJsonAndCheck(
|
|
635
|
+
"POST",
|
|
636
|
+
f"{await self.url}/sub_issues",
|
|
637
|
+
input=post_parameters,
|
|
638
|
+
headers={"Accept": Consts.mediaType},
|
|
639
|
+
)
|
|
640
|
+
return SubIssue(self._requester, headers, data, completed=True)
|
|
641
|
+
|
|
642
|
+
async def remove_sub_issue(self, sub_issue: int | Issue) -> SubIssue:
|
|
643
|
+
"""
|
|
644
|
+
:calls: `DELETE /repos/{owner}/{repo}/issues/{issue_number}/sub_issue <https://docs.github.com/en/rest/issues/sub-issues>`_
|
|
645
|
+
:param sub_issue: int (sub-issue ID) or Issue object. Note: Use sub_issue.id, not sub_issue.number
|
|
646
|
+
:rtype: :class:`Issue.SubIssue`
|
|
647
|
+
"""
|
|
648
|
+
assert isinstance(sub_issue, (int, Issue)), sub_issue
|
|
649
|
+
|
|
650
|
+
sub_issue_id = sub_issue
|
|
651
|
+
if isinstance(sub_issue, Issue):
|
|
652
|
+
sub_issue_id = await sub_issue.id
|
|
653
|
+
|
|
654
|
+
post_parameters: dict[str, Any] = {
|
|
655
|
+
"sub_issue_id": sub_issue_id,
|
|
656
|
+
}
|
|
657
|
+
headers, data = await self._requester.requestJsonAndCheck(
|
|
658
|
+
"DELETE",
|
|
659
|
+
f"{await self.url}/sub_issue",
|
|
660
|
+
input=post_parameters,
|
|
661
|
+
headers={"Accept": Consts.mediaType},
|
|
662
|
+
)
|
|
663
|
+
return SubIssue(self._requester, headers, data, completed=True)
|
|
664
|
+
|
|
665
|
+
async def prioritize_sub_issue(self, sub_issue: int | Issue, after_sub_issue: int | Issue | None) -> SubIssue:
|
|
666
|
+
"""
|
|
667
|
+
:calls: `PATCH /repos/{owner}/{repo}/issues/{issue_number}/sub_issues/priority <https://docs.github.com/en/rest/issues/sub-issues>`_
|
|
668
|
+
:param sub_issue: int (sub-issue ID) or Issue object. Note: Use sub_issue.id, not sub_issue.number
|
|
669
|
+
:param after_sub_issue: int (sub-issue ID) or Issue object. Note: Use sub_issue.id, not sub_issue.number
|
|
670
|
+
:rtype: :class:`Issue.SubIssue`
|
|
671
|
+
"""
|
|
672
|
+
assert isinstance(sub_issue, (int, Issue)), sub_issue
|
|
673
|
+
assert after_sub_issue is None or isinstance(after_sub_issue, (int, Issue)), after_sub_issue
|
|
674
|
+
|
|
675
|
+
sub_issue_id = sub_issue
|
|
676
|
+
if isinstance(sub_issue, Issue):
|
|
677
|
+
sub_issue_id = await sub_issue.id
|
|
678
|
+
after_sub_issue_id = after_sub_issue
|
|
679
|
+
if isinstance(after_sub_issue, Issue):
|
|
680
|
+
after_sub_issue_id = await after_sub_issue.id
|
|
681
|
+
|
|
682
|
+
patch_parameters = {"sub_issue_id": sub_issue_id, "after_id": after_sub_issue_id}
|
|
683
|
+
headers, data = await self._requester.requestJsonAndCheck(
|
|
684
|
+
"PATCH",
|
|
685
|
+
f"{await self.url}/sub_issues/priority",
|
|
686
|
+
input=patch_parameters,
|
|
687
|
+
headers={"Accept": Consts.mediaType},
|
|
688
|
+
)
|
|
689
|
+
return SubIssue(self._requester, headers, data, completed=True)
|
|
690
|
+
|
|
691
|
+
async def create_reaction(self, reaction_type: str) -> Reaction:
|
|
692
|
+
"""
|
|
693
|
+
:calls: `POST /repos/{owner}/{repo}/issues/{issue_number}/reactions <https://docs.github.com/en/rest/reference/reactions>`_
|
|
694
|
+
"""
|
|
695
|
+
assert isinstance(reaction_type, str), reaction_type
|
|
696
|
+
post_parameters = {
|
|
697
|
+
"content": reaction_type,
|
|
698
|
+
}
|
|
699
|
+
headers, data = await self._requester.requestJsonAndCheck(
|
|
700
|
+
"POST",
|
|
701
|
+
f"{await self.url}/reactions",
|
|
702
|
+
input=post_parameters,
|
|
703
|
+
headers={"Accept": Consts.mediaTypeReactionsPreview},
|
|
704
|
+
)
|
|
705
|
+
return githubasyncio.Reaction.Reaction(self._requester, headers, data)
|
|
706
|
+
|
|
707
|
+
async def delete_reaction(self, reaction_id: int) -> bool:
|
|
708
|
+
"""
|
|
709
|
+
:calls: `DELETE /repos/{owner}/{repo}/issues/{issue_number}/reactions/{reaction_id} <https://docs.github.com/en/rest/reference/reactions#delete-an-issue-reaction>`_
|
|
710
|
+
"""
|
|
711
|
+
assert isinstance(reaction_id, int), reaction_id
|
|
712
|
+
status, _, _ = await self._requester.requestJson(
|
|
713
|
+
"DELETE",
|
|
714
|
+
f"{await self.url}/reactions/{reaction_id}",
|
|
715
|
+
headers={"Accept": Consts.mediaTypeReactionsPreview},
|
|
716
|
+
)
|
|
717
|
+
return status == 204
|
|
718
|
+
|
|
719
|
+
async def get_timeline(self) -> PaginatedList[TimelineEvent]:
|
|
720
|
+
"""
|
|
721
|
+
:calls: `GET /repos/{owner}/{repo}/issues/{issue_number}/timeline <https://docs.github.com/en/rest/reference/issues#list-timeline-events-for-an-issue>`_
|
|
722
|
+
"""
|
|
723
|
+
return PaginatedList(
|
|
724
|
+
githubasyncio.TimelineEvent.TimelineEvent,
|
|
725
|
+
self._requester,
|
|
726
|
+
f"{await self.url}/timeline",
|
|
727
|
+
None,
|
|
728
|
+
headers={"Accept": Consts.issueTimelineEventsPreview},
|
|
729
|
+
)
|
|
730
|
+
|
|
731
|
+
async def get_blocked_by(self) -> PaginatedList[Issue]:
|
|
732
|
+
"""
|
|
733
|
+
:calls: `GET /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocked_by <https://docs.github.com/en/rest/issues/issue-dependencies#list-dependencies-an-issue-is-blocked-by>`_
|
|
734
|
+
:rtype: :class:`githubasyncio.PaginatedList.PaginatedList` of :class:`Issue`
|
|
735
|
+
"""
|
|
736
|
+
return PaginatedList(
|
|
737
|
+
Issue,
|
|
738
|
+
self._requester,
|
|
739
|
+
f"{await self.url}/dependencies/blocked_by",
|
|
740
|
+
None,
|
|
741
|
+
headers={"Accept": Consts.mediaType},
|
|
742
|
+
)
|
|
743
|
+
|
|
744
|
+
async def get_blocking(self) -> PaginatedList[Issue]:
|
|
745
|
+
"""
|
|
746
|
+
:calls: `GET /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocking <https://docs.github.com/en/rest/issues/issue-dependencies#list-dependencies-an-issue-is-blocking>`_
|
|
747
|
+
:rtype: :class:`githubasyncio.PaginatedList.PaginatedList` of :class:`Issue`
|
|
748
|
+
"""
|
|
749
|
+
return PaginatedList(
|
|
750
|
+
Issue,
|
|
751
|
+
self._requester,
|
|
752
|
+
f"{await self.url}/dependencies/blocking",
|
|
753
|
+
None,
|
|
754
|
+
headers={"Accept": Consts.mediaType},
|
|
755
|
+
)
|
|
756
|
+
|
|
757
|
+
async def add_blocked_by(self, issue: Issue) -> None:
|
|
758
|
+
"""
|
|
759
|
+
:calls: `POST /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocked_by <https://docs.github.com/en/rest/issues/issue-dependencies#list-dependencies-an-issue-is-blocked-by>`_
|
|
760
|
+
"""
|
|
761
|
+
assert isinstance(issue, Issue)
|
|
762
|
+
post_parameters: dict[str, int] = {"issue_id": (await issue.id)}
|
|
763
|
+
headers, data = await self._requester.requestJsonAndCheck(
|
|
764
|
+
"POST", f"{await self.url}/dependencies/blocked_by", input=post_parameters
|
|
765
|
+
)
|
|
766
|
+
self._useAttributes(data)
|
|
767
|
+
self._set_complete()
|
|
768
|
+
|
|
769
|
+
async def remove_blocked_by(self, issue: Issue) -> None:
|
|
770
|
+
"""
|
|
771
|
+
:calls: `DELETE /repos/{owner}/{repo}/issues/{issue_number}/dependencies/blocked_by/{issue_id} <https://docs.github.com/en/rest/issues/issue-dependencies#remove-dependency-an-issue-is-blocked-by>`_
|
|
772
|
+
"""
|
|
773
|
+
assert isinstance(issue, Issue)
|
|
774
|
+
headers, data = await self._requester.requestJsonAndCheck(
|
|
775
|
+
"DELETE", f"{await self.url}/dependencies/blocked_by/{(await issue.id)}"
|
|
776
|
+
)
|
|
777
|
+
self._useAttributes(data)
|
|
778
|
+
self._set_complete()
|
|
779
|
+
|
|
780
|
+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
|
|
781
|
+
if "active_lock_reason" in attributes: # pragma no branch
|
|
782
|
+
self._active_lock_reason = self._makeStringAttribute(attributes["active_lock_reason"])
|
|
783
|
+
if "assignee" in attributes: # pragma no branch
|
|
784
|
+
self._assignee = self._makeClassAttribute(githubasyncio.NamedUser.NamedUser, attributes["assignee"])
|
|
785
|
+
if "assignees" in attributes: # pragma no branch
|
|
786
|
+
self._assignees = self._makeListOfClassesAttribute(
|
|
787
|
+
githubasyncio.NamedUser.NamedUser, attributes["assignees"]
|
|
788
|
+
)
|
|
789
|
+
elif "assignee" in attributes:
|
|
790
|
+
if attributes["assignee"] is not None:
|
|
791
|
+
self._assignees = self._makeListOfClassesAttribute(
|
|
792
|
+
githubasyncio.NamedUser.NamedUser, [attributes["assignee"]]
|
|
793
|
+
)
|
|
794
|
+
else:
|
|
795
|
+
self._assignees = self._makeListOfClassesAttribute(githubasyncio.NamedUser.NamedUser, [])
|
|
796
|
+
if "author_association" in attributes: # pragma no branch
|
|
797
|
+
self._author_association = self._makeStringAttribute(attributes["author_association"])
|
|
798
|
+
if "body" in attributes: # pragma no branch
|
|
799
|
+
self._body = self._makeStringAttribute(attributes["body"])
|
|
800
|
+
if "body_html" in attributes: # pragma no branch
|
|
801
|
+
self._body_html = self._makeStringAttribute(attributes["body_html"])
|
|
802
|
+
if "body_text" in attributes: # pragma no branch
|
|
803
|
+
self._body_text = self._makeStringAttribute(attributes["body_text"])
|
|
804
|
+
if "closed_at" in attributes: # pragma no branch
|
|
805
|
+
self._closed_at = self._makeDatetimeAttribute(attributes["closed_at"])
|
|
806
|
+
if "closed_by" in attributes: # pragma no branch
|
|
807
|
+
self._closed_by = self._makeClassAttribute(githubasyncio.NamedUser.NamedUser, attributes["closed_by"])
|
|
808
|
+
if "comments" in attributes: # pragma no branch
|
|
809
|
+
self._comments = self._makeIntAttribute(attributes["comments"])
|
|
810
|
+
if "comments_url" in attributes: # pragma no branch
|
|
811
|
+
self._comments_url = self._makeStringAttribute(attributes["comments_url"])
|
|
812
|
+
if "created_at" in attributes: # pragma no branch
|
|
813
|
+
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
|
814
|
+
if "draft" in attributes: # pragma no branch
|
|
815
|
+
self._draft = self._makeBoolAttribute(attributes["draft"])
|
|
816
|
+
if "events_url" in attributes: # pragma no branch
|
|
817
|
+
self._events_url = self._makeStringAttribute(attributes["events_url"])
|
|
818
|
+
if "html_url" in attributes: # pragma no branch
|
|
819
|
+
self._html_url = self._makeStringAttribute(attributes["html_url"])
|
|
820
|
+
if "id" in attributes: # pragma no branch
|
|
821
|
+
self._id = self._makeIntAttribute(attributes["id"])
|
|
822
|
+
if "issue_dependencies_summary" in attributes: # pragma no branch
|
|
823
|
+
self._issue_dependencies_summary = self._makeClassAttribute(
|
|
824
|
+
githubasyncio.IssueDependenciesSummary.IssueDependenciesSummary,
|
|
825
|
+
attributes["issue_dependencies_summary"],
|
|
826
|
+
)
|
|
827
|
+
if "labels" in attributes: # pragma no branch
|
|
828
|
+
self._labels = self._makeListOfClassesAttribute(githubasyncio.Label.Label, attributes["labels"])
|
|
829
|
+
if "labels_url" in attributes: # pragma no branch
|
|
830
|
+
self._labels_url = self._makeStringAttribute(attributes["labels_url"])
|
|
831
|
+
if "locked" in attributes: # pragma no branch
|
|
832
|
+
self._locked = self._makeBoolAttribute(attributes["locked"])
|
|
833
|
+
if "milestone" in attributes: # pragma no branch
|
|
834
|
+
self._milestone = self._makeClassAttribute(githubasyncio.Milestone.Milestone, attributes["milestone"])
|
|
835
|
+
if "node_id" in attributes: # pragma no branch
|
|
836
|
+
self._node_id = self._makeStringAttribute(attributes["node_id"])
|
|
837
|
+
if "number" in attributes: # pragma no branch
|
|
838
|
+
self._number = self._makeIntAttribute(attributes["number"])
|
|
839
|
+
elif "url" in attributes:
|
|
840
|
+
number = attributes["url"].split("/")[-1]
|
|
841
|
+
if number.isnumeric():
|
|
842
|
+
self._number = self._makeIntAttribute(int(number))
|
|
843
|
+
if "parent_issue_url" in attributes: # pragma no branch
|
|
844
|
+
self._parent_issue_url = self._makeStringAttribute(attributes["parent_issue_url"])
|
|
845
|
+
if "performed_via_github_app" in attributes: # pragma no branch
|
|
846
|
+
self._performed_via_github_app = self._makeClassAttribute(
|
|
847
|
+
githubasyncio.GithubApp.GithubApp, attributes["performed_via_github_app"]
|
|
848
|
+
)
|
|
849
|
+
if "pull_request" in attributes: # pragma no branch
|
|
850
|
+
self._pull_request = self._makeClassAttribute(
|
|
851
|
+
githubasyncio.IssuePullRequest.IssuePullRequest, attributes["pull_request"]
|
|
852
|
+
)
|
|
853
|
+
if "reactions" in attributes:
|
|
854
|
+
self._reactions = self._makeDictAttribute(attributes["reactions"])
|
|
855
|
+
if "repository" in attributes: # pragma no branch
|
|
856
|
+
self._repository = self._makeClassAttribute(githubasyncio.Repository.Repository, attributes["repository"])
|
|
857
|
+
if "repository_url" in attributes: # pragma no branch
|
|
858
|
+
self._repository_url = self._makeStringAttribute(attributes["repository_url"])
|
|
859
|
+
if "state" in attributes: # pragma no branch
|
|
860
|
+
self._state = self._makeStringAttribute(attributes["state"])
|
|
861
|
+
if "state_reason" in attributes: # pragma no branch
|
|
862
|
+
self._state_reason = self._makeStringAttribute(attributes["state_reason"])
|
|
863
|
+
if "sub_issues_summary" in attributes: # pragma no branch
|
|
864
|
+
self._sub_issues_summary = self._makeClassAttribute(
|
|
865
|
+
githubasyncio.SubIssueSummary.SubIssueSummary, attributes["sub_issues_summary"]
|
|
866
|
+
)
|
|
867
|
+
if "text_matches" in attributes: # pragma no branch
|
|
868
|
+
self._text_matches = self._makeDictAttribute(attributes["text_matches"])
|
|
869
|
+
if "timeline_url" in attributes: # pragma no branch
|
|
870
|
+
self._timeline_url = self._makeStringAttribute(attributes["timeline_url"])
|
|
871
|
+
if "title" in attributes: # pragma no branch
|
|
872
|
+
self._title = self._makeStringAttribute(attributes["title"])
|
|
873
|
+
if "type" in attributes: # pragma no branch
|
|
874
|
+
self._type = self._makeClassAttribute(githubasyncio.IssueType.IssueType, attributes["type"])
|
|
875
|
+
if "updated_at" in attributes: # pragma no branch
|
|
876
|
+
self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
|
|
877
|
+
if "url" in attributes: # pragma no branch
|
|
878
|
+
self._url = self._makeStringAttribute(attributes["url"])
|
|
879
|
+
if "user" in attributes: # pragma no branch
|
|
880
|
+
self._user = self._makeClassAttribute(githubasyncio.NamedUser.NamedUser, attributes["user"])
|
|
881
|
+
|
|
882
|
+
|
|
883
|
+
class IssueSearchResult(Issue):
|
|
884
|
+
"""
|
|
885
|
+
This class represents IssueSearchResult.
|
|
886
|
+
|
|
887
|
+
The reference can be found here
|
|
888
|
+
https://docs.github.com/en/rest/reference/search#search-issues-and-pull-requests
|
|
889
|
+
|
|
890
|
+
The OpenAPI schema can be found at
|
|
891
|
+
|
|
892
|
+
- /components/schemas/issue-search-result-item
|
|
893
|
+
|
|
894
|
+
"""
|
|
895
|
+
|
|
896
|
+
def _initAttributes(self) -> None:
|
|
897
|
+
# TODO: remove if parent does not implement this
|
|
898
|
+
super()._initAttributes()
|
|
899
|
+
self._score: Attribute[float] = NotSet
|
|
900
|
+
|
|
901
|
+
def __repr__(self) -> str:
|
|
902
|
+
return self.get__repr__({"number": self._number.value, "title": self._title.value, "score": self._score.value})
|
|
903
|
+
|
|
904
|
+
@property
|
|
905
|
+
async def score(self) -> float:
|
|
906
|
+
await self._completeIfNotSet(self._score)
|
|
907
|
+
return self._score.value
|
|
908
|
+
|
|
909
|
+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
|
|
910
|
+
# TODO: remove if parent does not implement this
|
|
911
|
+
super()._useAttributes(attributes)
|
|
912
|
+
if "score" in attributes: # pragma no branch
|
|
913
|
+
self._score = self._makeFloatAttribute(attributes["score"])
|
|
914
|
+
|
|
915
|
+
|
|
916
|
+
class SubIssue(Issue):
|
|
917
|
+
"""
|
|
918
|
+
This class represents a Sub-issue in GitHub's REST API. Sub-issues are issues that are linked to a parent issue.
|
|
919
|
+
|
|
920
|
+
See https://docs.github.com/en/rest/issues/sub-issues for more details.
|
|
921
|
+
|
|
922
|
+
"""
|
|
923
|
+
|
|
924
|
+
def _initAttributes(self) -> None:
|
|
925
|
+
super()._initAttributes()
|
|
926
|
+
# Sub-issue specific attributes
|
|
927
|
+
self._parent_issue: Attribute[Issue] = NotSet
|
|
928
|
+
self._priority_position: Attribute[int] = NotSet
|
|
929
|
+
|
|
930
|
+
def __repr__(self) -> str:
|
|
931
|
+
return self.get__repr__({"number": self._number.value, "title": self._title.value})
|
|
932
|
+
|
|
933
|
+
@property
|
|
934
|
+
async def parent_issue(self) -> Issue:
|
|
935
|
+
"""
|
|
936
|
+
:type: :class:`Issue`
|
|
937
|
+
"""
|
|
938
|
+
await self._completeIfNotSet(self._parent_issue)
|
|
939
|
+
return self._parent_issue.value
|
|
940
|
+
|
|
941
|
+
@property
|
|
942
|
+
async def priority_position(self) -> int:
|
|
943
|
+
"""
|
|
944
|
+
:type: int
|
|
945
|
+
"""
|
|
946
|
+
await self._completeIfNotSet(self._priority_position)
|
|
947
|
+
return self._priority_position.value
|
|
948
|
+
|
|
949
|
+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
|
|
950
|
+
super()._useAttributes(attributes)
|
|
951
|
+
# Process sub-issue specific attributes
|
|
952
|
+
if "parent_issue" in attributes:
|
|
953
|
+
self._parent_issue = self._makeClassAttribute(Issue, attributes["parent_issue"])
|
|
954
|
+
if "priority_position" in attributes:
|
|
955
|
+
self._priority_position = self._makeIntAttribute(attributes["priority_position"])
|