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
|
@@ -0,0 +1,1202 @@
|
|
|
1
|
+
# FILE AUTO GENERATED DO NOT TOUCH
|
|
2
|
+
############################ Copyrights and license ############################
|
|
3
|
+
# #
|
|
4
|
+
# Copyright 2012 Michael Stead <michael.stead@gmail.com> #
|
|
5
|
+
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
|
|
6
|
+
# Copyright 2012 Zearin <zearin@gonk.net> #
|
|
7
|
+
# Copyright 2013 AKFish <akfish@gmail.com> #
|
|
8
|
+
# Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
|
|
9
|
+
# Copyright 2013 martinqt <m.ki2@laposte.net> #
|
|
10
|
+
# Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
|
|
11
|
+
# Copyright 2016 @tmshn <tmshn@r.recruit.co.jp> #
|
|
12
|
+
# Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
|
|
13
|
+
# Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
|
|
14
|
+
# Copyright 2017 Aaron Levine <allevin@sandia.gov> #
|
|
15
|
+
# Copyright 2017 Simon <spam@esemi.ru> #
|
|
16
|
+
# Copyright 2018 Ben Yohay <ben@lightricks.com> #
|
|
17
|
+
# Copyright 2018 Brian J. Murrell <brian@interlinx.bc.ca> #
|
|
18
|
+
# Copyright 2018 Gilad Shefer <gshefer@redhat.com> #
|
|
19
|
+
# Copyright 2018 Martin Monperrus <monperrus@users.noreply.github.com> #
|
|
20
|
+
# Copyright 2018 Matt Babineau <9685860+babineaum@users.noreply.github.com> #
|
|
21
|
+
# Copyright 2018 Shinichi TAMURA <shnch.tmr@gmail.com> #
|
|
22
|
+
# Copyright 2018 Steve Kowalik <steven@wedontsleep.org> #
|
|
23
|
+
# Copyright 2018 Thibault Jamet <tjamet@users.noreply.github.com> #
|
|
24
|
+
# Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
|
|
25
|
+
# Copyright 2018 per1234 <accounts@perglass.com> #
|
|
26
|
+
# Copyright 2018 sfdye <tsfdye@gmail.com> #
|
|
27
|
+
# Copyright 2019 MarcoFalke <falke.marco@gmail.com> #
|
|
28
|
+
# Copyright 2019 Mark Browning <mark@cerebras.net> #
|
|
29
|
+
# Copyright 2019 MurphyZhao <d2014zjt@163.com> #
|
|
30
|
+
# Copyright 2019 Olof-Joachim Frahm (欧雅福) <olof@macrolet.net> #
|
|
31
|
+
# Copyright 2019 Pavan Kunisetty <nagapavan@users.noreply.github.com> #
|
|
32
|
+
# Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
|
|
33
|
+
# Copyright 2019 Tim Gates <tim.gates@iress.com> #
|
|
34
|
+
# Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
|
|
35
|
+
# Copyright 2020 Alice GIRARD <bouhahah@gmail.com> #
|
|
36
|
+
# Copyright 2020 Florent Clarret <florent.clarret@gmail.com> #
|
|
37
|
+
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
|
|
38
|
+
# Copyright 2021 Mark Walker <mark.walker@realbuzz.com> #
|
|
39
|
+
# Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
|
|
40
|
+
# Copyright 2022 tison <wander4096@gmail.com> #
|
|
41
|
+
# Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
|
|
42
|
+
# Copyright 2023 Heitor Polidoro <14806300+heitorpolidoro@users.noreply.github.com>#
|
|
43
|
+
# Copyright 2023 Heitor Polidoro <heitor.polidoro@gmail.com> #
|
|
44
|
+
# Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
|
45
|
+
# Copyright 2023 Trim21 <trim21.me@gmail.com> #
|
|
46
|
+
# Copyright 2023 sd-kialo <138505487+sd-kialo@users.noreply.github.com> #
|
|
47
|
+
# Copyright 2023 vanya20074 <vanya20074@gmail.com> #
|
|
48
|
+
# Copyright 2024 Austin Sasko <austintyler0239@yahoo.com> #
|
|
49
|
+
# Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
|
|
50
|
+
# Copyright 2024 Evan Fetsko <emfetsko@gmail.com> #
|
|
51
|
+
# Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
|
|
52
|
+
# Copyright 2024 Kobbi Gal <85439776+kgal-pan@users.noreply.github.com> #
|
|
53
|
+
# Copyright 2025 Aidan McNay <acm289@cornell.edu> #
|
|
54
|
+
# Copyright 2025 Bruno Didot <bdidot@gmail.com> #
|
|
55
|
+
# Copyright 2025 Eddie Santos <9561596+eddie-santos@users.noreply.github.com> #
|
|
56
|
+
# Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
|
|
57
|
+
# Copyright 2025 Matt Tuchfarber <matt@tuchfarber.com> #
|
|
58
|
+
# Copyright 2025 Michael Kukarkin <kukarkinmm@gmail.com> #
|
|
59
|
+
# Copyright 2025 Ryan Peach <github.essential257@passmail.net> #
|
|
60
|
+
# Copyright 2025 a-sido <andrei.sidorenko.1993@gmail.com> #
|
|
61
|
+
# Copyright 2026 Enrico Minack <github@enrico.minack.dev> #
|
|
62
|
+
# #
|
|
63
|
+
# This file is part of PyGithub. #
|
|
64
|
+
# http://pygithub.readthedocs.io/ #
|
|
65
|
+
# #
|
|
66
|
+
# PyGithub is free software: you can redistribute it and/or modify it under #
|
|
67
|
+
# the terms of the GNU Lesser General Public License as published by the Free #
|
|
68
|
+
# Software Foundation, either version 3 of the License, or (at your option) #
|
|
69
|
+
# any later version. #
|
|
70
|
+
# #
|
|
71
|
+
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
|
|
72
|
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
|
|
73
|
+
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
|
|
74
|
+
# details. #
|
|
75
|
+
# #
|
|
76
|
+
# You should have received a copy of the GNU Lesser General Public License #
|
|
77
|
+
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
|
78
|
+
# #
|
|
79
|
+
################################################################################
|
|
80
|
+
|
|
81
|
+
from __future__ import annotations
|
|
82
|
+
|
|
83
|
+
import urllib.parse
|
|
84
|
+
from datetime import datetime
|
|
85
|
+
from typing import TYPE_CHECKING, Any
|
|
86
|
+
|
|
87
|
+
import githubasyncio.Commit
|
|
88
|
+
import githubasyncio.File
|
|
89
|
+
import githubasyncio.Issue
|
|
90
|
+
import githubasyncio.IssueComment
|
|
91
|
+
import githubasyncio.IssueEvent
|
|
92
|
+
import githubasyncio.Label
|
|
93
|
+
import githubasyncio.Milestone
|
|
94
|
+
import githubasyncio.NamedUser
|
|
95
|
+
import githubasyncio.Organization
|
|
96
|
+
import githubasyncio.PaginatedList
|
|
97
|
+
import githubasyncio.PullRequestComment
|
|
98
|
+
import githubasyncio.PullRequestMergeStatus
|
|
99
|
+
import githubasyncio.PullRequestPart
|
|
100
|
+
import githubasyncio.PullRequestReview
|
|
101
|
+
import githubasyncio.Team
|
|
102
|
+
import githubasyncio.TimelineEvent
|
|
103
|
+
from githubasyncio import Consts
|
|
104
|
+
from githubasyncio.compat import NotRequired, TypedDict
|
|
105
|
+
from githubasyncio.GithubObject import (
|
|
106
|
+
Attribute,
|
|
107
|
+
CompletableGithubObject,
|
|
108
|
+
NotSet,
|
|
109
|
+
Opt,
|
|
110
|
+
is_defined,
|
|
111
|
+
is_optional,
|
|
112
|
+
is_optional_list,
|
|
113
|
+
is_undefined,
|
|
114
|
+
)
|
|
115
|
+
from githubasyncio.PaginatedList import PaginatedList
|
|
116
|
+
|
|
117
|
+
if TYPE_CHECKING:
|
|
118
|
+
from githubasyncio.Commit import Commit
|
|
119
|
+
from githubasyncio.File import File
|
|
120
|
+
from githubasyncio.GitRef import GitRef
|
|
121
|
+
from githubasyncio.Issue import Issue
|
|
122
|
+
from githubasyncio.IssueComment import IssueComment
|
|
123
|
+
from githubasyncio.IssueEvent import IssueEvent
|
|
124
|
+
from githubasyncio.Label import Label
|
|
125
|
+
from githubasyncio.Milestone import Milestone
|
|
126
|
+
from githubasyncio.NamedUser import NamedUser
|
|
127
|
+
from githubasyncio.PullRequestComment import PullRequestComment
|
|
128
|
+
from githubasyncio.PullRequestMergeStatus import PullRequestMergeStatus
|
|
129
|
+
from githubasyncio.PullRequestPart import PullRequestPart
|
|
130
|
+
from githubasyncio.PullRequestReview import PullRequestReview
|
|
131
|
+
from githubasyncio.Team import Team
|
|
132
|
+
from githubasyncio.TimelineEvent import TimelineEvent
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
class ReviewComment(TypedDict):
|
|
136
|
+
path: str
|
|
137
|
+
position: NotRequired[int]
|
|
138
|
+
body: str
|
|
139
|
+
line: NotRequired[int]
|
|
140
|
+
side: NotRequired[str]
|
|
141
|
+
start_line: NotRequired[int]
|
|
142
|
+
start_side: NotRequired[str]
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
class PullRequest(CompletableGithubObject):
|
|
146
|
+
"""
|
|
147
|
+
This class represents PullRequests.
|
|
148
|
+
|
|
149
|
+
The reference can be found here
|
|
150
|
+
https://docs.github.com/en/rest/reference/pulls
|
|
151
|
+
|
|
152
|
+
The OpenAPI schema can be found at
|
|
153
|
+
|
|
154
|
+
- /components/schemas/pull-request
|
|
155
|
+
- /components/schemas/pull-request-minimal
|
|
156
|
+
- /components/schemas/pull-request-simple
|
|
157
|
+
|
|
158
|
+
"""
|
|
159
|
+
|
|
160
|
+
def _initAttributes(self) -> None:
|
|
161
|
+
self.__links: Attribute[dict[str, Any]] = NotSet
|
|
162
|
+
self._active_lock_reason: Attribute[str] = NotSet
|
|
163
|
+
self._additions: Attribute[int] = NotSet
|
|
164
|
+
self._assignee: Attribute[NamedUser] = NotSet
|
|
165
|
+
self._assignees: Attribute[list[NamedUser]] = NotSet
|
|
166
|
+
self._author_association: Attribute[str] = NotSet
|
|
167
|
+
self._auto_merge: Attribute[dict[str, Any]] = NotSet
|
|
168
|
+
self._base: Attribute[PullRequestPart] = NotSet
|
|
169
|
+
self._body: Attribute[str] = NotSet
|
|
170
|
+
self._changed_files: Attribute[int] = NotSet
|
|
171
|
+
self._closed_at: Attribute[datetime | None] = NotSet
|
|
172
|
+
self._comments: Attribute[int] = NotSet
|
|
173
|
+
self._comments_url: Attribute[str] = NotSet
|
|
174
|
+
self._commits: Attribute[int] = NotSet
|
|
175
|
+
self._commits_url: Attribute[str] = NotSet
|
|
176
|
+
self._created_at: Attribute[datetime] = NotSet
|
|
177
|
+
self._deletions: Attribute[int] = NotSet
|
|
178
|
+
self._diff_url: Attribute[str] = NotSet
|
|
179
|
+
self._draft: Attribute[bool] = NotSet
|
|
180
|
+
self._head: Attribute[PullRequestPart] = NotSet
|
|
181
|
+
self._html_url: Attribute[str] = NotSet
|
|
182
|
+
self._id: Attribute[int] = NotSet
|
|
183
|
+
self._issue_url: Attribute[str] = NotSet
|
|
184
|
+
self._labels: Attribute[list[Label]] = NotSet
|
|
185
|
+
self._locked: Attribute[bool] = NotSet
|
|
186
|
+
self._maintainer_can_modify: Attribute[bool] = NotSet
|
|
187
|
+
self._merge_commit_sha: Attribute[str] = NotSet
|
|
188
|
+
self._mergeable: Attribute[bool] = NotSet
|
|
189
|
+
self._mergeable_state: Attribute[str] = NotSet
|
|
190
|
+
self._merged: Attribute[bool] = NotSet
|
|
191
|
+
self._merged_at: Attribute[datetime | None] = NotSet
|
|
192
|
+
self._merged_by: Attribute[NamedUser] = NotSet
|
|
193
|
+
self._milestone: Attribute[Milestone] = NotSet
|
|
194
|
+
self._node_id: Attribute[str] = NotSet
|
|
195
|
+
self._number: Attribute[int] = NotSet
|
|
196
|
+
self._patch_url: Attribute[str] = NotSet
|
|
197
|
+
self._rebaseable: Attribute[bool] = NotSet
|
|
198
|
+
self._requested_reviewers: Attribute[list[NamedUser]] = NotSet
|
|
199
|
+
self._requested_teams: Attribute[list[Team]] = NotSet
|
|
200
|
+
self._review_comment_url: Attribute[str] = NotSet
|
|
201
|
+
self._review_comments: Attribute[int] = NotSet
|
|
202
|
+
self._review_comments_url: Attribute[str] = NotSet
|
|
203
|
+
self._state: Attribute[str] = NotSet
|
|
204
|
+
self._statuses_url: Attribute[str] = NotSet
|
|
205
|
+
self._title: Attribute[str] = NotSet
|
|
206
|
+
self._updated_at: Attribute[datetime | None] = NotSet
|
|
207
|
+
self._url: Attribute[str] = NotSet
|
|
208
|
+
self._user: Attribute[NamedUser] = NotSet
|
|
209
|
+
|
|
210
|
+
def __repr__(self) -> str:
|
|
211
|
+
return self.get__repr__({"number": self._number.value, "title": self._title.value})
|
|
212
|
+
|
|
213
|
+
@property
|
|
214
|
+
async def _links(self) -> dict[str, Any]:
|
|
215
|
+
await self._completeIfNotSet(self.__links)
|
|
216
|
+
return self.__links.value
|
|
217
|
+
|
|
218
|
+
@property
|
|
219
|
+
async def active_lock_reason(self) -> str:
|
|
220
|
+
await self._completeIfNotSet(self._active_lock_reason)
|
|
221
|
+
return self._active_lock_reason.value
|
|
222
|
+
|
|
223
|
+
@property
|
|
224
|
+
async def additions(self) -> int:
|
|
225
|
+
await self._completeIfNotSet(self._additions)
|
|
226
|
+
return self._additions.value
|
|
227
|
+
|
|
228
|
+
@property
|
|
229
|
+
async def assignee(self) -> NamedUser:
|
|
230
|
+
await self._completeIfNotSet(self._assignee)
|
|
231
|
+
return self._assignee.value
|
|
232
|
+
|
|
233
|
+
@property
|
|
234
|
+
async def assignees(self) -> list[NamedUser]:
|
|
235
|
+
await self._completeIfNotSet(self._assignees)
|
|
236
|
+
return self._assignees.value
|
|
237
|
+
|
|
238
|
+
@property
|
|
239
|
+
async def author_association(self) -> str:
|
|
240
|
+
await self._completeIfNotSet(self._author_association)
|
|
241
|
+
return self._author_association.value
|
|
242
|
+
|
|
243
|
+
@property
|
|
244
|
+
async def auto_merge(self) -> dict[str, Any]:
|
|
245
|
+
await self._completeIfNotSet(self._auto_merge)
|
|
246
|
+
return self._auto_merge.value
|
|
247
|
+
|
|
248
|
+
@property
|
|
249
|
+
async def base(self) -> PullRequestPart:
|
|
250
|
+
await self._completeIfNotSet(self._base)
|
|
251
|
+
return self._base.value
|
|
252
|
+
|
|
253
|
+
@property
|
|
254
|
+
async def body(self) -> str:
|
|
255
|
+
await self._completeIfNotSet(self._body)
|
|
256
|
+
return self._body.value
|
|
257
|
+
|
|
258
|
+
@property
|
|
259
|
+
async def changed_files(self) -> int:
|
|
260
|
+
await self._completeIfNotSet(self._changed_files)
|
|
261
|
+
return self._changed_files.value
|
|
262
|
+
|
|
263
|
+
@property
|
|
264
|
+
async def closed_at(self) -> datetime | None:
|
|
265
|
+
await self._completeIfNotSet(self._closed_at)
|
|
266
|
+
return self._closed_at.value
|
|
267
|
+
|
|
268
|
+
@property
|
|
269
|
+
async def comments(self) -> int:
|
|
270
|
+
await self._completeIfNotSet(self._comments)
|
|
271
|
+
return self._comments.value
|
|
272
|
+
|
|
273
|
+
@property
|
|
274
|
+
async def comments_url(self) -> str:
|
|
275
|
+
await self._completeIfNotSet(self._comments_url)
|
|
276
|
+
return self._comments_url.value
|
|
277
|
+
|
|
278
|
+
@property
|
|
279
|
+
async def commits(self) -> int:
|
|
280
|
+
await self._completeIfNotSet(self._commits)
|
|
281
|
+
return self._commits.value
|
|
282
|
+
|
|
283
|
+
@property
|
|
284
|
+
async def commits_url(self) -> str:
|
|
285
|
+
await self._completeIfNotSet(self._commits_url)
|
|
286
|
+
return self._commits_url.value
|
|
287
|
+
|
|
288
|
+
@property
|
|
289
|
+
async def created_at(self) -> datetime:
|
|
290
|
+
await self._completeIfNotSet(self._created_at)
|
|
291
|
+
return self._created_at.value
|
|
292
|
+
|
|
293
|
+
@property
|
|
294
|
+
async def deletions(self) -> int:
|
|
295
|
+
await self._completeIfNotSet(self._deletions)
|
|
296
|
+
return self._deletions.value
|
|
297
|
+
|
|
298
|
+
@property
|
|
299
|
+
async def diff_url(self) -> str:
|
|
300
|
+
await self._completeIfNotSet(self._diff_url)
|
|
301
|
+
return self._diff_url.value
|
|
302
|
+
|
|
303
|
+
@property
|
|
304
|
+
async def draft(self) -> bool:
|
|
305
|
+
await self._completeIfNotSet(self._draft)
|
|
306
|
+
return self._draft.value
|
|
307
|
+
|
|
308
|
+
@property
|
|
309
|
+
async def head(self) -> PullRequestPart:
|
|
310
|
+
await self._completeIfNotSet(self._head)
|
|
311
|
+
return self._head.value
|
|
312
|
+
|
|
313
|
+
@property
|
|
314
|
+
async def html_url(self) -> str:
|
|
315
|
+
await self._completeIfNotSet(self._html_url)
|
|
316
|
+
return self._html_url.value
|
|
317
|
+
|
|
318
|
+
@property
|
|
319
|
+
async def id(self) -> int:
|
|
320
|
+
await self._completeIfNotSet(self._id)
|
|
321
|
+
return self._id.value
|
|
322
|
+
|
|
323
|
+
@property
|
|
324
|
+
async def issue_url(self) -> str:
|
|
325
|
+
await self._completeIfNotSet(self._issue_url)
|
|
326
|
+
return self._issue_url.value
|
|
327
|
+
|
|
328
|
+
@property
|
|
329
|
+
async def labels(self) -> list[Label]:
|
|
330
|
+
await self._completeIfNotSet(self._labels)
|
|
331
|
+
return self._labels.value
|
|
332
|
+
|
|
333
|
+
@property
|
|
334
|
+
async def locked(self) -> bool:
|
|
335
|
+
await self._completeIfNotSet(self._locked)
|
|
336
|
+
return self._locked.value
|
|
337
|
+
|
|
338
|
+
@property
|
|
339
|
+
async def maintainer_can_modify(self) -> bool:
|
|
340
|
+
await self._completeIfNotSet(self._maintainer_can_modify)
|
|
341
|
+
return self._maintainer_can_modify.value
|
|
342
|
+
|
|
343
|
+
@property
|
|
344
|
+
async def merge_commit_sha(self) -> str:
|
|
345
|
+
await self._completeIfNotSet(self._merge_commit_sha)
|
|
346
|
+
return self._merge_commit_sha.value
|
|
347
|
+
|
|
348
|
+
@property
|
|
349
|
+
async def mergeable(self) -> bool:
|
|
350
|
+
await self._completeIfNotSet(self._mergeable)
|
|
351
|
+
return self._mergeable.value
|
|
352
|
+
|
|
353
|
+
@property
|
|
354
|
+
async def mergeable_state(self) -> str:
|
|
355
|
+
await self._completeIfNotSet(self._mergeable_state)
|
|
356
|
+
return self._mergeable_state.value
|
|
357
|
+
|
|
358
|
+
@property
|
|
359
|
+
async def merged(self) -> bool:
|
|
360
|
+
await self._completeIfNotSet(self._merged)
|
|
361
|
+
return self._merged.value
|
|
362
|
+
|
|
363
|
+
@property
|
|
364
|
+
async def merged_at(self) -> datetime | None:
|
|
365
|
+
await self._completeIfNotSet(self._merged_at)
|
|
366
|
+
return self._merged_at.value
|
|
367
|
+
|
|
368
|
+
@property
|
|
369
|
+
async def merged_by(self) -> NamedUser:
|
|
370
|
+
await self._completeIfNotSet(self._merged_by)
|
|
371
|
+
return self._merged_by.value
|
|
372
|
+
|
|
373
|
+
@property
|
|
374
|
+
async def milestone(self) -> Milestone:
|
|
375
|
+
await self._completeIfNotSet(self._milestone)
|
|
376
|
+
return self._milestone.value
|
|
377
|
+
|
|
378
|
+
@property
|
|
379
|
+
async def node_id(self) -> str:
|
|
380
|
+
await self._completeIfNotSet(self._node_id)
|
|
381
|
+
return self._node_id.value
|
|
382
|
+
|
|
383
|
+
@property
|
|
384
|
+
async def number(self) -> int:
|
|
385
|
+
await self._completeIfNotSet(self._number)
|
|
386
|
+
return self._number.value
|
|
387
|
+
|
|
388
|
+
@property
|
|
389
|
+
async def patch_url(self) -> str:
|
|
390
|
+
await self._completeIfNotSet(self._patch_url)
|
|
391
|
+
return self._patch_url.value
|
|
392
|
+
|
|
393
|
+
@property
|
|
394
|
+
async def rebaseable(self) -> bool:
|
|
395
|
+
await self._completeIfNotSet(self._rebaseable)
|
|
396
|
+
return self._rebaseable.value
|
|
397
|
+
|
|
398
|
+
@property
|
|
399
|
+
async def requested_reviewers(self) -> list[NamedUser]:
|
|
400
|
+
await self._completeIfNotSet(self._requested_reviewers)
|
|
401
|
+
return self._requested_reviewers.value
|
|
402
|
+
|
|
403
|
+
@property
|
|
404
|
+
async def requested_teams(self) -> list[Team]:
|
|
405
|
+
await self._completeIfNotSet(self._requested_teams)
|
|
406
|
+
return self._requested_teams.value
|
|
407
|
+
|
|
408
|
+
@property
|
|
409
|
+
async def review_comment_url(self) -> str:
|
|
410
|
+
await self._completeIfNotSet(self._review_comment_url)
|
|
411
|
+
return self._review_comment_url.value
|
|
412
|
+
|
|
413
|
+
@property
|
|
414
|
+
async def review_comments(self) -> int:
|
|
415
|
+
await self._completeIfNotSet(self._review_comments)
|
|
416
|
+
return self._review_comments.value
|
|
417
|
+
|
|
418
|
+
@property
|
|
419
|
+
async def review_comments_url(self) -> str:
|
|
420
|
+
await self._completeIfNotSet(self._review_comments_url)
|
|
421
|
+
return self._review_comments_url.value
|
|
422
|
+
|
|
423
|
+
@property
|
|
424
|
+
async def state(self) -> str:
|
|
425
|
+
await self._completeIfNotSet(self._state)
|
|
426
|
+
return self._state.value
|
|
427
|
+
|
|
428
|
+
@property
|
|
429
|
+
async def statuses_url(self) -> str:
|
|
430
|
+
await self._completeIfNotSet(self._statuses_url)
|
|
431
|
+
return self._statuses_url.value
|
|
432
|
+
|
|
433
|
+
@property
|
|
434
|
+
async def title(self) -> str:
|
|
435
|
+
await self._completeIfNotSet(self._title)
|
|
436
|
+
return self._title.value
|
|
437
|
+
|
|
438
|
+
@property
|
|
439
|
+
async def updated_at(self) -> datetime | None:
|
|
440
|
+
await self._completeIfNotSet(self._updated_at)
|
|
441
|
+
return self._updated_at.value
|
|
442
|
+
|
|
443
|
+
@property
|
|
444
|
+
async def url(self) -> str:
|
|
445
|
+
await self._completeIfNotSet(self._url)
|
|
446
|
+
return self._url.value
|
|
447
|
+
|
|
448
|
+
@property
|
|
449
|
+
async def user(self) -> NamedUser:
|
|
450
|
+
await self._completeIfNotSet(self._user)
|
|
451
|
+
return self._user.value
|
|
452
|
+
|
|
453
|
+
async def as_issue(self) -> Issue:
|
|
454
|
+
"""
|
|
455
|
+
:calls: `GET /repos/{owner}/{repo}/issues/{issue_number} <https://docs.github.com/en/rest/reference/issues>`_
|
|
456
|
+
"""
|
|
457
|
+
return githubasyncio.Issue.Issue(self._requester, url=await self.issue_url)
|
|
458
|
+
|
|
459
|
+
async def create_comment(self, body: str, commit: Commit, path: str, position: int) -> PullRequestComment:
|
|
460
|
+
"""
|
|
461
|
+
:calls: `POST /repos/{owner}/{repo}/pulls/{pull_number}/comments <https://docs.github.com/en/rest/reference/pulls#review-comments>`_
|
|
462
|
+
"""
|
|
463
|
+
return await self.create_review_comment(body, commit, path, position)
|
|
464
|
+
|
|
465
|
+
async def create_review_comment(
|
|
466
|
+
self,
|
|
467
|
+
body: str,
|
|
468
|
+
commit: Commit | str,
|
|
469
|
+
path: str,
|
|
470
|
+
# line replaces deprecated position argument, so we put it between path and side
|
|
471
|
+
line: Opt[int] = NotSet,
|
|
472
|
+
side: Opt[str] = NotSet,
|
|
473
|
+
start_line: Opt[int] = NotSet,
|
|
474
|
+
start_side: Opt[str] = NotSet,
|
|
475
|
+
in_reply_to: Opt[int] = NotSet,
|
|
476
|
+
subject_type: Opt[str] = NotSet,
|
|
477
|
+
as_suggestion: bool = False,
|
|
478
|
+
) -> PullRequestComment:
|
|
479
|
+
"""
|
|
480
|
+
:calls: `POST /repos/{owner}/{repo}/pulls/{pull_number}/comments <https://docs.github.com/en/rest/reference/pulls#review-comments>`_
|
|
481
|
+
"""
|
|
482
|
+
assert isinstance(body, str), body
|
|
483
|
+
assert isinstance(commit, (githubasyncio.Commit.Commit, str)), commit
|
|
484
|
+
assert isinstance(path, str), path
|
|
485
|
+
assert is_optional(line, int), line
|
|
486
|
+
assert is_undefined(side) or side in ["LEFT", "RIGHT"], side
|
|
487
|
+
assert is_optional(start_line, int), start_line
|
|
488
|
+
assert is_undefined(start_side) or start_side in [
|
|
489
|
+
"LEFT",
|
|
490
|
+
"RIGHT",
|
|
491
|
+
"side",
|
|
492
|
+
], start_side
|
|
493
|
+
assert is_optional(in_reply_to, int), in_reply_to
|
|
494
|
+
assert is_undefined(subject_type) or subject_type in [
|
|
495
|
+
"line",
|
|
496
|
+
"file",
|
|
497
|
+
], subject_type
|
|
498
|
+
assert isinstance(as_suggestion, bool), as_suggestion
|
|
499
|
+
|
|
500
|
+
commit_id = (await commit._identity) if isinstance(commit, githubasyncio.Commit.Commit) else commit
|
|
501
|
+
|
|
502
|
+
if as_suggestion:
|
|
503
|
+
body = f"```suggestion\n{body}\n```"
|
|
504
|
+
post_parameters = NotSet.remove_unset_items(
|
|
505
|
+
{
|
|
506
|
+
"body": body,
|
|
507
|
+
"commit_id": commit_id,
|
|
508
|
+
"path": path,
|
|
509
|
+
"line": line,
|
|
510
|
+
"side": side,
|
|
511
|
+
"start_line": start_line,
|
|
512
|
+
"start_side": start_side,
|
|
513
|
+
"in_reply_to": in_reply_to,
|
|
514
|
+
"subject_type": subject_type,
|
|
515
|
+
}
|
|
516
|
+
)
|
|
517
|
+
|
|
518
|
+
headers, data = await self._requester.requestJsonAndCheck(
|
|
519
|
+
"POST", f"{await self.url}/comments", input=post_parameters
|
|
520
|
+
)
|
|
521
|
+
return githubasyncio.PullRequestComment.PullRequestComment(self._requester, headers, data, completed=True)
|
|
522
|
+
|
|
523
|
+
async def create_review_comment_reply(self, comment_id: int, body: str) -> PullRequestComment:
|
|
524
|
+
"""
|
|
525
|
+
:calls: `POST /repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies <https://docs.github.com/en/rest/reference/pulls#review-comments>`_
|
|
526
|
+
"""
|
|
527
|
+
assert isinstance(comment_id, int), comment_id
|
|
528
|
+
assert isinstance(body, str), body
|
|
529
|
+
post_parameters = {"body": body}
|
|
530
|
+
headers, data = await self._requester.requestJsonAndCheck(
|
|
531
|
+
"POST",
|
|
532
|
+
f"{await self.url}/comments/{comment_id}/replies",
|
|
533
|
+
input=post_parameters,
|
|
534
|
+
)
|
|
535
|
+
return githubasyncio.PullRequestComment.PullRequestComment(self._requester, headers, data, completed=True)
|
|
536
|
+
|
|
537
|
+
async def create_issue_comment(self, body: str) -> IssueComment:
|
|
538
|
+
"""
|
|
539
|
+
:calls: `POST /repos/{owner}/{repo}/issues/{issue_number}/comments <https://docs.github.com/en/rest/reference/issues#comments>`_
|
|
540
|
+
"""
|
|
541
|
+
assert isinstance(body, str), body
|
|
542
|
+
post_parameters = {
|
|
543
|
+
"body": body,
|
|
544
|
+
}
|
|
545
|
+
headers, data = await self._requester.requestJsonAndCheck(
|
|
546
|
+
"POST", f"{await self.issue_url}/comments", input=post_parameters
|
|
547
|
+
)
|
|
548
|
+
return githubasyncio.IssueComment.IssueComment(self._requester, headers, data, completed=True)
|
|
549
|
+
|
|
550
|
+
async def create_review(
|
|
551
|
+
self,
|
|
552
|
+
commit: Opt[Commit] = NotSet,
|
|
553
|
+
body: Opt[str] = NotSet,
|
|
554
|
+
event: Opt[str] = NotSet,
|
|
555
|
+
comments: Opt[list[ReviewComment]] = NotSet,
|
|
556
|
+
) -> PullRequestReview:
|
|
557
|
+
"""
|
|
558
|
+
:calls: `POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews <https://docs.github.com/en/free-pro-team@latest/rest/pulls/reviews?apiVersion=2022-11-28#create-a-review-for-a-pull-request>`_
|
|
559
|
+
"""
|
|
560
|
+
assert is_optional(commit, githubasyncio.Commit.Commit), commit
|
|
561
|
+
assert is_optional(body, str), body
|
|
562
|
+
assert is_optional(event, str), event
|
|
563
|
+
assert is_optional_list(comments, dict), comments
|
|
564
|
+
post_parameters: dict[str, Any] = NotSet.remove_unset_items(
|
|
565
|
+
{
|
|
566
|
+
"body": body,
|
|
567
|
+
"event": event,
|
|
568
|
+
"commit_id": (await commit.sha) if is_defined(commit) else NotSet,
|
|
569
|
+
"comments": comments if is_defined(comments) else [],
|
|
570
|
+
}
|
|
571
|
+
)
|
|
572
|
+
headers, data = await self._requester.requestJsonAndCheck(
|
|
573
|
+
"POST", f"{await self.url}/reviews", input=post_parameters
|
|
574
|
+
)
|
|
575
|
+
return githubasyncio.PullRequestReview.PullRequestReview(self._requester, headers, data)
|
|
576
|
+
|
|
577
|
+
async def create_review_request(
|
|
578
|
+
self,
|
|
579
|
+
reviewers: Opt[list[str] | str] = NotSet,
|
|
580
|
+
team_reviewers: Opt[list[str] | str] = NotSet,
|
|
581
|
+
) -> None:
|
|
582
|
+
"""
|
|
583
|
+
:calls: `POST /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers <https://docs.github.com/en/rest/reference/pulls#review-requests>`_
|
|
584
|
+
"""
|
|
585
|
+
assert is_optional(reviewers, str) or is_optional_list(reviewers, str), reviewers
|
|
586
|
+
assert is_optional(team_reviewers, str) or is_optional_list(team_reviewers, str), team_reviewers
|
|
587
|
+
|
|
588
|
+
if isinstance(reviewers, str):
|
|
589
|
+
reviewers = [reviewers]
|
|
590
|
+
if isinstance(team_reviewers, str):
|
|
591
|
+
team_reviewers = [team_reviewers]
|
|
592
|
+
|
|
593
|
+
post_parameters = NotSet.remove_unset_items({"reviewers": reviewers, "team_reviewers": team_reviewers})
|
|
594
|
+
|
|
595
|
+
headers, data = await self._requester.requestJsonAndCheck(
|
|
596
|
+
"POST", f"{await self.url}/requested_reviewers", input=post_parameters
|
|
597
|
+
)
|
|
598
|
+
|
|
599
|
+
async def delete_review_request(
|
|
600
|
+
self,
|
|
601
|
+
reviewers: Opt[list[str] | str] = NotSet,
|
|
602
|
+
team_reviewers: Opt[list[str] | str] = NotSet,
|
|
603
|
+
) -> None:
|
|
604
|
+
"""
|
|
605
|
+
:calls: `DELETE /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers <https://docs.github.com/en/rest/reference/pulls#review-requests>`_
|
|
606
|
+
"""
|
|
607
|
+
assert is_optional(reviewers, str) or is_optional_list(reviewers, str), reviewers
|
|
608
|
+
assert is_optional(team_reviewers, str) or is_optional_list(team_reviewers, str), team_reviewers
|
|
609
|
+
|
|
610
|
+
if isinstance(reviewers, str):
|
|
611
|
+
reviewers = [reviewers]
|
|
612
|
+
if isinstance(team_reviewers, str):
|
|
613
|
+
team_reviewers = [team_reviewers]
|
|
614
|
+
|
|
615
|
+
post_parameters = NotSet.remove_unset_items({"reviewers": reviewers, "team_reviewers": team_reviewers})
|
|
616
|
+
|
|
617
|
+
headers, data = await self._requester.requestJsonAndCheck(
|
|
618
|
+
"DELETE", f"{await self.url}/requested_reviewers", input=post_parameters
|
|
619
|
+
)
|
|
620
|
+
|
|
621
|
+
async def edit(
|
|
622
|
+
self,
|
|
623
|
+
title: Opt[str] = NotSet,
|
|
624
|
+
body: Opt[str] = NotSet,
|
|
625
|
+
state: Opt[str] = NotSet,
|
|
626
|
+
base: Opt[str] = NotSet,
|
|
627
|
+
maintainer_can_modify: Opt[bool] = NotSet,
|
|
628
|
+
) -> None:
|
|
629
|
+
"""
|
|
630
|
+
:calls: `PATCH /repos/{owner}/{repo}/pulls/{pull_number} <https://docs.github.com/en/rest/reference/pulls>`_
|
|
631
|
+
"""
|
|
632
|
+
assert is_optional(title, str), title
|
|
633
|
+
assert is_optional(body, str), body
|
|
634
|
+
assert is_optional(state, str), state
|
|
635
|
+
assert is_optional(base, str), base
|
|
636
|
+
assert is_optional(maintainer_can_modify, bool), maintainer_can_modify
|
|
637
|
+
post_parameters = NotSet.remove_unset_items(
|
|
638
|
+
{"title": title, "body": body, "state": state, "base": base, "maintainer_can_modify": maintainer_can_modify}
|
|
639
|
+
)
|
|
640
|
+
|
|
641
|
+
headers, data = await self._requester.requestJsonAndCheck("PATCH", await self.url, input=post_parameters)
|
|
642
|
+
self._useAttributes(data)
|
|
643
|
+
self._set_complete()
|
|
644
|
+
|
|
645
|
+
async def get_comment(self, id: int) -> PullRequestComment:
|
|
646
|
+
"""
|
|
647
|
+
:calls: `GET /repos/{owner}/{repo}/pulls/comments/{comment_id} <https://docs.github.com/en/rest/reference/pulls#review-comments>`_
|
|
648
|
+
"""
|
|
649
|
+
return await self.get_review_comment(id)
|
|
650
|
+
|
|
651
|
+
async def get_review_comment(self, id: int) -> PullRequestComment:
|
|
652
|
+
"""
|
|
653
|
+
:calls: `GET /repos/{owner}/{repo}/pulls/comments/{comment_id} <https://docs.github.com/en/rest/reference/pulls#review-comments>`_
|
|
654
|
+
"""
|
|
655
|
+
assert isinstance(id, int), id
|
|
656
|
+
url = f"{self._parentUrl(await self.url)}/comments/{id}"
|
|
657
|
+
return githubasyncio.PullRequestComment.PullRequestComment(self._requester, url=url)
|
|
658
|
+
|
|
659
|
+
async def get_comments(
|
|
660
|
+
self,
|
|
661
|
+
sort: Opt[str] = NotSet,
|
|
662
|
+
direction: Opt[str] = NotSet,
|
|
663
|
+
since: Opt[datetime] = NotSet,
|
|
664
|
+
) -> PaginatedList[PullRequestComment]:
|
|
665
|
+
"""
|
|
666
|
+
Warning: this only returns review comments. For normal conversation comments, use get_issue_comments.
|
|
667
|
+
|
|
668
|
+
:calls: `GET /repos/{owner}/{repo}/pulls/{pull_number}/comments <https://docs.github.com/en/rest/reference/pulls#review-comments>`_
|
|
669
|
+
:param sort: string 'created' or 'updated'
|
|
670
|
+
:param direction: string 'asc' or 'desc'
|
|
671
|
+
:param since: datetime
|
|
672
|
+
"""
|
|
673
|
+
return await self.get_review_comments(sort=sort, direction=direction, since=since)
|
|
674
|
+
|
|
675
|
+
# v3: remove *, added here to force named parameters because order has changed
|
|
676
|
+
async def get_review_comments(
|
|
677
|
+
self,
|
|
678
|
+
*,
|
|
679
|
+
sort: Opt[str] = NotSet,
|
|
680
|
+
direction: Opt[str] = NotSet,
|
|
681
|
+
since: Opt[datetime] = NotSet,
|
|
682
|
+
) -> PaginatedList[PullRequestComment]:
|
|
683
|
+
"""
|
|
684
|
+
:calls: `GET /repos/{owner}/{repo}/pulls/{pull_number}/comments <https://docs.github.com/en/rest/reference/pulls#review-comments>`_
|
|
685
|
+
:param sort: string 'created' or 'updated'
|
|
686
|
+
:param direction: string 'asc' or 'desc'
|
|
687
|
+
:param since: datetime
|
|
688
|
+
"""
|
|
689
|
+
assert is_optional(sort, str), sort
|
|
690
|
+
assert is_optional(direction, str), direction
|
|
691
|
+
assert is_optional(since, datetime), since
|
|
692
|
+
|
|
693
|
+
url_parameters = NotSet.remove_unset_items({"sort": sort, "direction": direction})
|
|
694
|
+
if is_defined(since):
|
|
695
|
+
url_parameters["since"] = since.strftime("%Y-%m-%dT%H:%M:%SZ")
|
|
696
|
+
|
|
697
|
+
return PaginatedList(
|
|
698
|
+
githubasyncio.PullRequestComment.PullRequestComment,
|
|
699
|
+
self._requester,
|
|
700
|
+
f"{await self.url}/comments",
|
|
701
|
+
url_parameters,
|
|
702
|
+
)
|
|
703
|
+
|
|
704
|
+
async def get_single_review_comments(self, id: int) -> PaginatedList[PullRequestComment]:
|
|
705
|
+
"""
|
|
706
|
+
:calls: `GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments <https://docs.github.com/en/rest/reference/pulls#reviews>`_
|
|
707
|
+
"""
|
|
708
|
+
assert isinstance(id, int), id
|
|
709
|
+
return PaginatedList(
|
|
710
|
+
githubasyncio.PullRequestComment.PullRequestComment,
|
|
711
|
+
self._requester,
|
|
712
|
+
f"{await self.url}/reviews/{id}/comments",
|
|
713
|
+
None,
|
|
714
|
+
)
|
|
715
|
+
|
|
716
|
+
async def get_commits(self) -> PaginatedList[Commit]:
|
|
717
|
+
"""
|
|
718
|
+
:calls: `GET /repos/{owner}/{repo}/pulls/{pull_number}/commits <https://docs.github.com/en/rest/reference/pulls>`_
|
|
719
|
+
"""
|
|
720
|
+
return PaginatedList(githubasyncio.Commit.Commit, self._requester, f"{await self.url}/commits", None)
|
|
721
|
+
|
|
722
|
+
async def get_files(self) -> PaginatedList[File]:
|
|
723
|
+
"""
|
|
724
|
+
:calls: `GET /repos/{owner}/{repo}/pulls/{pull_number}/files <https://docs.github.com/en/rest/reference/pulls>`_
|
|
725
|
+
"""
|
|
726
|
+
return PaginatedList(githubasyncio.File.File, self._requester, f"{await self.url}/files", None)
|
|
727
|
+
|
|
728
|
+
async def get_issue_comment(self, id: int) -> IssueComment:
|
|
729
|
+
"""
|
|
730
|
+
:calls: `GET /repos/{owner}/{repo}/issues/comments/{comment_id} <https://docs.github.com/en/rest/reference/issues#comments>`_
|
|
731
|
+
"""
|
|
732
|
+
assert isinstance(id, int), id
|
|
733
|
+
url = f"{self._parentUrl(await self.issue_url)}/comments/{id}"
|
|
734
|
+
return githubasyncio.IssueComment.IssueComment(self._requester, url=url)
|
|
735
|
+
|
|
736
|
+
async def get_issue_comments(self) -> PaginatedList[IssueComment]:
|
|
737
|
+
"""
|
|
738
|
+
:calls: `GET /repos/{owner}/{repo}/issues/{issue_number}/comments <https://docs.github.com/en/rest/reference/issues#comments>`_
|
|
739
|
+
"""
|
|
740
|
+
return PaginatedList(
|
|
741
|
+
githubasyncio.IssueComment.IssueComment,
|
|
742
|
+
self._requester,
|
|
743
|
+
f"{await self.issue_url}/comments",
|
|
744
|
+
None,
|
|
745
|
+
)
|
|
746
|
+
|
|
747
|
+
async def get_issue_events(self) -> PaginatedList[IssueEvent]:
|
|
748
|
+
"""
|
|
749
|
+
:calls: `GET /repos/{owner}/{repo}/issues/{issue_number}/events <https://docs.github.com/en/rest/reference/issues#events>`_
|
|
750
|
+
:rtype: :class:`githubasyncio.PaginatedList.PaginatedList` of :class:`githubasyncio.IssueEvent.IssueEvent`
|
|
751
|
+
"""
|
|
752
|
+
return PaginatedList(
|
|
753
|
+
githubasyncio.IssueEvent.IssueEvent,
|
|
754
|
+
self._requester,
|
|
755
|
+
f"{await self.issue_url}/events",
|
|
756
|
+
None,
|
|
757
|
+
headers={"Accept": Consts.mediaTypeLockReasonPreview},
|
|
758
|
+
)
|
|
759
|
+
|
|
760
|
+
async def get_issue_timeline(self) -> PaginatedList[TimelineEvent]:
|
|
761
|
+
"""
|
|
762
|
+
:calls `GET /repos/{owner}/{repo}/issues/{issue_number}/timeline <https://docs.github.com/en/rest/reference/issues#timeline>`_
|
|
763
|
+
:rtype: :class:`githubasyncio.PaginatedList.PaginatedList` of :class:`github.TimelineEvent`
|
|
764
|
+
"""
|
|
765
|
+
return PaginatedList(
|
|
766
|
+
githubasyncio.TimelineEvent.TimelineEvent,
|
|
767
|
+
self._requester,
|
|
768
|
+
f"{await self.issue_url}/timeline",
|
|
769
|
+
None,
|
|
770
|
+
headers={"Accept": Consts.mediaTypeLockReasonPreview},
|
|
771
|
+
)
|
|
772
|
+
|
|
773
|
+
async def get_review(self, id: int) -> PullRequestReview:
|
|
774
|
+
"""
|
|
775
|
+
:calls: `GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id} <https://docs.github.com/en/rest/reference/pulls#reviews>`_
|
|
776
|
+
:param id: integer
|
|
777
|
+
:rtype: :class:`githubasyncio.PullRequestReview.PullRequestReview`
|
|
778
|
+
"""
|
|
779
|
+
assert isinstance(id, int), id
|
|
780
|
+
headers, data = await self._requester.requestJsonAndCheck(
|
|
781
|
+
"GET",
|
|
782
|
+
f"{await self.url}/reviews/{id}",
|
|
783
|
+
)
|
|
784
|
+
return githubasyncio.PullRequestReview.PullRequestReview(self._requester, headers, data)
|
|
785
|
+
|
|
786
|
+
async def get_reviews(self) -> PaginatedList[PullRequestReview]:
|
|
787
|
+
"""
|
|
788
|
+
:calls: `GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews <https://docs.github.com/en/rest/reference/pulls#reviews>`_
|
|
789
|
+
:rtype: :class:`githubasyncio.PaginatedList.PaginatedList` of :class:`githubasyncio.PullRequestReview.PullRequestReview`
|
|
790
|
+
"""
|
|
791
|
+
return PaginatedList(
|
|
792
|
+
githubasyncio.PullRequestReview.PullRequestReview,
|
|
793
|
+
self._requester,
|
|
794
|
+
f"{await self.url}/reviews",
|
|
795
|
+
None,
|
|
796
|
+
)
|
|
797
|
+
|
|
798
|
+
async def get_review_requests(self) -> tuple[PaginatedList[NamedUser], PaginatedList[Team]]:
|
|
799
|
+
"""
|
|
800
|
+
:calls: `GET /repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers <https://docs.github.com/en/rest/reference/pulls#review-requests>`_
|
|
801
|
+
:rtype: tuple of :class:`githubasyncio.PaginatedList.PaginatedList` of :class:`githubasyncio.NamedUser.NamedUser` and of :class:`githubasyncio.PaginatedList.PaginatedList` of :class:`githubasyncio.Team.Team`
|
|
802
|
+
"""
|
|
803
|
+
return (
|
|
804
|
+
PaginatedList(
|
|
805
|
+
githubasyncio.NamedUser.NamedUser,
|
|
806
|
+
self._requester,
|
|
807
|
+
f"{await self.url}/requested_reviewers",
|
|
808
|
+
None,
|
|
809
|
+
list_item="users",
|
|
810
|
+
),
|
|
811
|
+
PaginatedList(
|
|
812
|
+
githubasyncio.Team.Team,
|
|
813
|
+
self._requester,
|
|
814
|
+
f"{await self.url}/requested_reviewers",
|
|
815
|
+
None,
|
|
816
|
+
list_item="teams",
|
|
817
|
+
),
|
|
818
|
+
)
|
|
819
|
+
|
|
820
|
+
async def get_labels(self) -> PaginatedList[Label]:
|
|
821
|
+
"""
|
|
822
|
+
:calls: `GET /repos/{owner}/{repo}/issues/{issue_number}/labels <https://docs.github.com/en/rest/reference/issues#labels>`_
|
|
823
|
+
"""
|
|
824
|
+
return PaginatedList(githubasyncio.Label.Label, self._requester, f"{await self.issue_url}/labels", None)
|
|
825
|
+
|
|
826
|
+
async def add_to_labels(self, *labels: Label | str) -> None:
|
|
827
|
+
"""
|
|
828
|
+
:calls: `POST /repos/{owner}/{repo}/issues/{issue_number}/labels <https://docs.github.com/en/rest/reference/issues#labels>`_
|
|
829
|
+
"""
|
|
830
|
+
assert all(isinstance(element, (githubasyncio.Label.Label, str)) for element in labels), labels
|
|
831
|
+
post_parameters = [
|
|
832
|
+
(await label.name) if isinstance(label, githubasyncio.Label.Label) else label for label in labels
|
|
833
|
+
]
|
|
834
|
+
headers, data = await self._requester.requestJsonAndCheck(
|
|
835
|
+
"POST", f"{await self.issue_url}/labels", input=post_parameters
|
|
836
|
+
)
|
|
837
|
+
|
|
838
|
+
async def delete_labels(self) -> None:
|
|
839
|
+
"""
|
|
840
|
+
:calls: `DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels <https://docs.github.com/en/rest/reference/issues#labels>`_
|
|
841
|
+
"""
|
|
842
|
+
headers, data = await self._requester.requestJsonAndCheck("DELETE", f"{await self.issue_url}/labels")
|
|
843
|
+
|
|
844
|
+
async def remove_from_labels(self, label: Label | str) -> None:
|
|
845
|
+
"""
|
|
846
|
+
:calls: `DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels/{name} <https://docs.github.com/en/rest/reference/issues#labels>`_
|
|
847
|
+
"""
|
|
848
|
+
assert isinstance(label, (githubasyncio.Label.Label, str)), label
|
|
849
|
+
if isinstance(label, githubasyncio.Label.Label):
|
|
850
|
+
label = await label._identity
|
|
851
|
+
else:
|
|
852
|
+
label = urllib.parse.quote(label)
|
|
853
|
+
headers, data = await self._requester.requestJsonAndCheck("DELETE", f"{await self.issue_url}/labels/{label}")
|
|
854
|
+
|
|
855
|
+
async def set_labels(self, *labels: Label | str) -> None:
|
|
856
|
+
"""
|
|
857
|
+
:calls: `PUT /repos/{owner}/{repo}/issues/{issue_number}/labels <https://docs.github.com/en/rest/reference/issues#labels>`_
|
|
858
|
+
"""
|
|
859
|
+
assert all(isinstance(element, (githubasyncio.Label.Label, str)) for element in labels), labels
|
|
860
|
+
post_parameters = [
|
|
861
|
+
(await label.name) if isinstance(label, githubasyncio.Label.Label) else label for label in labels
|
|
862
|
+
]
|
|
863
|
+
headers, data = await self._requester.requestJsonAndCheck(
|
|
864
|
+
"PUT", f"{await self.issue_url}/labels", input=post_parameters
|
|
865
|
+
)
|
|
866
|
+
|
|
867
|
+
async def is_merged(self) -> bool:
|
|
868
|
+
"""
|
|
869
|
+
:calls: `GET /repos/{owner}/{repo}/pulls/{pull_number}/merge <https://docs.github.com/en/rest/reference/pulls>`_
|
|
870
|
+
"""
|
|
871
|
+
status, headers, data = await self._requester.requestJson("GET", f"{await self.url}/merge")
|
|
872
|
+
return status == 204
|
|
873
|
+
|
|
874
|
+
async def restore_branch(self) -> GitRef:
|
|
875
|
+
"""
|
|
876
|
+
Convenience function that calls :meth:`Repository.create_git_ref` :rtype: :class:`githubasyncio.GitRef.GitRef`
|
|
877
|
+
"""
|
|
878
|
+
return await (await self.head).repo.create_git_ref(
|
|
879
|
+
f"refs/heads/{(await self.head).ref}", sha=(await self.head).sha
|
|
880
|
+
)
|
|
881
|
+
|
|
882
|
+
async def delete_branch(self, force: bool = False) -> None:
|
|
883
|
+
"""
|
|
884
|
+
Convenience function that calls :meth:`GitRef.delete` :rtype: bool.
|
|
885
|
+
"""
|
|
886
|
+
if not force:
|
|
887
|
+
remaining_pulls = await (await self.head).repo.get_pulls(
|
|
888
|
+
head=f"{await (await (await self.head).repo.owner).login}:{(await self.head).ref}"
|
|
889
|
+
)
|
|
890
|
+
if (await remaining_pulls.totalCount) > 0:
|
|
891
|
+
raise RuntimeError(
|
|
892
|
+
"This branch is referenced by open pull requests, set force=True to delete this branch."
|
|
893
|
+
)
|
|
894
|
+
_chain_get_git_ref = await (await self.head).repo.get_git_ref(f"heads/{(await self.head).ref}")
|
|
895
|
+
await _chain_get_git_ref.complete()
|
|
896
|
+
return await _chain_get_git_ref.delete()
|
|
897
|
+
|
|
898
|
+
async def enable_automerge(
|
|
899
|
+
self,
|
|
900
|
+
merge_method: Opt[str] = "MERGE",
|
|
901
|
+
author_email: Opt[str] = NotSet,
|
|
902
|
+
client_mutation_id: Opt[str] = NotSet,
|
|
903
|
+
commit_body: Opt[str] = NotSet,
|
|
904
|
+
commit_headline: Opt[str] = NotSet,
|
|
905
|
+
expected_head_oid: Opt[str] = NotSet,
|
|
906
|
+
) -> dict[str, Any]:
|
|
907
|
+
"""
|
|
908
|
+
:calls: `POST /graphql <https://docs.github.com/en/graphql>`_ with a mutation to enable pull request auto merge
|
|
909
|
+
<https://docs.github.com/en/graphql/reference/mutations#enablepullrequestautomerge>
|
|
910
|
+
:graphql: `mutation enablePullRequestAutoMerge <https://docs.github.com/en/graphql/reference/pulls#mutation-enablepullrequestautomerge>`_
|
|
911
|
+
"""
|
|
912
|
+
assert is_optional(author_email, str), author_email
|
|
913
|
+
assert is_optional(client_mutation_id, str), client_mutation_id
|
|
914
|
+
assert is_optional(commit_body, str), commit_body
|
|
915
|
+
assert is_optional(commit_headline, str), commit_headline
|
|
916
|
+
assert is_optional(expected_head_oid, str), expected_head_oid
|
|
917
|
+
assert isinstance(merge_method, str) and merge_method in ["MERGE", "REBASE", "SQUASH"], merge_method
|
|
918
|
+
|
|
919
|
+
# Define the variables
|
|
920
|
+
variables = {
|
|
921
|
+
"pullRequestId": await self.node_id,
|
|
922
|
+
"authorEmail": author_email,
|
|
923
|
+
"clientMutationId": client_mutation_id,
|
|
924
|
+
"commitBody": commit_body,
|
|
925
|
+
"commitHeadline": commit_headline,
|
|
926
|
+
"expectedHeadOid": expected_head_oid,
|
|
927
|
+
"mergeMethod": merge_method,
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
# Make the request
|
|
931
|
+
_, data = await self._requester.graphql_named_mutation(
|
|
932
|
+
mutation_name="enablePullRequestAutoMerge",
|
|
933
|
+
mutation_input=NotSet.remove_unset_items(variables),
|
|
934
|
+
output_schema="actor { avatarUrl login resourcePath url } clientMutationId",
|
|
935
|
+
)
|
|
936
|
+
return data
|
|
937
|
+
|
|
938
|
+
async def disable_automerge(
|
|
939
|
+
self,
|
|
940
|
+
client_mutation_id: Opt[str] = NotSet,
|
|
941
|
+
) -> dict[str, Any]:
|
|
942
|
+
"""
|
|
943
|
+
:calls: `POST /graphql <https://docs.github.com/en/graphql>`_ with a mutation to disable pull request auto merge
|
|
944
|
+
<https://docs.github.com/en/graphql/reference/mutations#disablepullrequestautomerge>
|
|
945
|
+
:graphql: `mutation disablePullRequestAutoMerge <https://docs.github.com/en/graphql/reference/pulls#mutation-disablepullrequestautomerge>`_
|
|
946
|
+
"""
|
|
947
|
+
assert is_optional(client_mutation_id, str), client_mutation_id
|
|
948
|
+
|
|
949
|
+
# Define the variables
|
|
950
|
+
variables = {
|
|
951
|
+
"pullRequestId": await self.node_id,
|
|
952
|
+
"clientMutationId": client_mutation_id,
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
# Make the request
|
|
956
|
+
_, data = await self._requester.graphql_named_mutation(
|
|
957
|
+
mutation_name="disablePullRequestAutoMerge",
|
|
958
|
+
mutation_input=NotSet.remove_unset_items(variables),
|
|
959
|
+
output_schema="actor { avatarUrl login resourcePath url } clientMutationId",
|
|
960
|
+
)
|
|
961
|
+
return data
|
|
962
|
+
|
|
963
|
+
async def merge(
|
|
964
|
+
self,
|
|
965
|
+
commit_message: Opt[str] = NotSet,
|
|
966
|
+
commit_title: Opt[str] = NotSet,
|
|
967
|
+
merge_method: Opt[str] = NotSet,
|
|
968
|
+
sha: Opt[str] = NotSet,
|
|
969
|
+
delete_branch: bool = False,
|
|
970
|
+
) -> PullRequestMergeStatus:
|
|
971
|
+
"""
|
|
972
|
+
:calls: `PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge <https://docs.github.com/en/rest/reference/pulls>`_
|
|
973
|
+
"""
|
|
974
|
+
assert is_optional(commit_message, str), commit_message
|
|
975
|
+
assert is_optional(commit_title, str), commit_title
|
|
976
|
+
assert is_optional(merge_method, str), merge_method
|
|
977
|
+
assert is_optional(sha, str), sha
|
|
978
|
+
post_parameters = NotSet.remove_unset_items(
|
|
979
|
+
{"commit_message": commit_message, "commit_title": commit_title, "merge_method": merge_method, "sha": sha}
|
|
980
|
+
)
|
|
981
|
+
headers, data = await self._requester.requestJsonAndCheck(
|
|
982
|
+
"PUT", f"{await self.url}/merge", input=post_parameters
|
|
983
|
+
)
|
|
984
|
+
if delete_branch:
|
|
985
|
+
await self.delete_branch()
|
|
986
|
+
|
|
987
|
+
return githubasyncio.PullRequestMergeStatus.PullRequestMergeStatus(self._requester, headers, data)
|
|
988
|
+
|
|
989
|
+
async def add_to_assignees(self, *assignees: NamedUser | str) -> None:
|
|
990
|
+
"""
|
|
991
|
+
:calls: `POST /repos/{owner}/{repo}/issues/{issue_number}/assignees <https://docs.github.com/en/rest/issues/assignees?apiVersion=2022-11-28#add-assignees-to-an-issue>`_
|
|
992
|
+
"""
|
|
993
|
+
assert all(isinstance(element, (githubasyncio.NamedUser.NamedUser, str)) for element in assignees), assignees
|
|
994
|
+
post_parameters = {
|
|
995
|
+
"assignees": [
|
|
996
|
+
(await assignee.login) if isinstance(assignee, githubasyncio.NamedUser.NamedUser) else assignee
|
|
997
|
+
for assignee in assignees
|
|
998
|
+
]
|
|
999
|
+
}
|
|
1000
|
+
headers, data = await self._requester.requestJsonAndCheck(
|
|
1001
|
+
"POST", f"{await self.issue_url}/assignees", input=post_parameters
|
|
1002
|
+
)
|
|
1003
|
+
# Only use the assignees attribute, since we call this PR as an issue
|
|
1004
|
+
self._useAttributes({"assignees": data["assignees"]})
|
|
1005
|
+
|
|
1006
|
+
async def remove_from_assignees(self, *assignees: NamedUser | str) -> None:
|
|
1007
|
+
"""
|
|
1008
|
+
:calls: `DELETE /repos/{owner}/{repo}/issues/{issue_number}/assignees <https://docs.github.com/en/rest/reference/issues#assignees>`_
|
|
1009
|
+
"""
|
|
1010
|
+
assert all(isinstance(element, (githubasyncio.NamedUser.NamedUser, str)) for element in assignees), assignees
|
|
1011
|
+
post_parameters = {
|
|
1012
|
+
"assignees": [
|
|
1013
|
+
(await assignee.login) if isinstance(assignee, githubasyncio.NamedUser.NamedUser) else assignee
|
|
1014
|
+
for assignee in assignees
|
|
1015
|
+
]
|
|
1016
|
+
}
|
|
1017
|
+
headers, data = await self._requester.requestJsonAndCheck(
|
|
1018
|
+
"DELETE", f"{await self.issue_url}/assignees", input=post_parameters
|
|
1019
|
+
)
|
|
1020
|
+
# Only use the assignees attribute, since we call this PR as an issue
|
|
1021
|
+
self._useAttributes({"assignees": data["assignees"]})
|
|
1022
|
+
|
|
1023
|
+
async def update_branch(self, expected_head_sha: Opt[str] = NotSet) -> bool:
|
|
1024
|
+
"""
|
|
1025
|
+
:calls `PUT /repos/{owner}/{repo}/pulls/{pull_number}/update-branch <https://docs.github.com/en/rest/reference/pulls>`_
|
|
1026
|
+
"""
|
|
1027
|
+
assert is_optional(expected_head_sha, str), expected_head_sha
|
|
1028
|
+
post_parameters = NotSet.remove_unset_items({"expected_head_sha": expected_head_sha})
|
|
1029
|
+
status, headers, data = await self._requester.requestJson(
|
|
1030
|
+
"PUT",
|
|
1031
|
+
f"{await self.url}/update-branch",
|
|
1032
|
+
input=post_parameters,
|
|
1033
|
+
headers={"Accept": Consts.updateBranchPreview},
|
|
1034
|
+
)
|
|
1035
|
+
return status == 202
|
|
1036
|
+
|
|
1037
|
+
async def convert_to_draft(
|
|
1038
|
+
self,
|
|
1039
|
+
client_mutation_id: Opt[str] = NotSet,
|
|
1040
|
+
) -> dict[str, Any]:
|
|
1041
|
+
"""
|
|
1042
|
+
:calls: `POST /graphql <https://docs.github.com/en/graphql>`_ to convert pull request to draft
|
|
1043
|
+
<https://docs.github.com/en/graphql/reference/mutations#convertpullrequesttodraft>
|
|
1044
|
+
:graphql: `mutation convertPullRequestToDraft <https://docs.github.com/en/graphql/reference/pulls#mutation-convertpullrequesttodraft>`_
|
|
1045
|
+
"""
|
|
1046
|
+
assert is_optional(client_mutation_id, str), client_mutation_id
|
|
1047
|
+
|
|
1048
|
+
# Define the variables
|
|
1049
|
+
variables = {
|
|
1050
|
+
"pullRequestId": await self.node_id,
|
|
1051
|
+
"clientMutationId": client_mutation_id,
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
# Make the request
|
|
1055
|
+
_, data = await self._requester.graphql_named_mutation(
|
|
1056
|
+
mutation_name="convertPullRequestToDraft",
|
|
1057
|
+
mutation_input=NotSet.remove_unset_items(variables),
|
|
1058
|
+
output_schema="clientMutationId pullRequest { isDraft }",
|
|
1059
|
+
)
|
|
1060
|
+
self._useAttributes({"draft": data["pullRequest"]["isDraft"]})
|
|
1061
|
+
return data
|
|
1062
|
+
|
|
1063
|
+
async def mark_ready_for_review(
|
|
1064
|
+
self,
|
|
1065
|
+
client_mutation_id: Opt[str] = NotSet,
|
|
1066
|
+
) -> dict[str, Any]:
|
|
1067
|
+
"""
|
|
1068
|
+
:calls: `POST /graphql <https://docs.github.com/en/graphql>`_ to mark pull request ready for review
|
|
1069
|
+
<https://docs.github.com/en/graphql/reference/mutations#markpullrequestreadyforreview>
|
|
1070
|
+
:graphql: `mutation markPullRequestReadyForReview <https://docs.github.com/en/graphql/reference/pulls#mutation-markpullrequestreadyforreview>`_
|
|
1071
|
+
"""
|
|
1072
|
+
assert is_optional(client_mutation_id, str), client_mutation_id
|
|
1073
|
+
|
|
1074
|
+
# Define the variables
|
|
1075
|
+
variables = {
|
|
1076
|
+
"pullRequestId": await self.node_id,
|
|
1077
|
+
"clientMutationId": client_mutation_id,
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
# Make the request
|
|
1081
|
+
_, data = await self._requester.graphql_named_mutation(
|
|
1082
|
+
mutation_name="markPullRequestReadyForReview",
|
|
1083
|
+
mutation_input=NotSet.remove_unset_items(variables),
|
|
1084
|
+
output_schema="clientMutationId pullRequest { isDraft }",
|
|
1085
|
+
)
|
|
1086
|
+
self._useAttributes({"draft": data["pullRequest"]["isDraft"]})
|
|
1087
|
+
return data
|
|
1088
|
+
|
|
1089
|
+
def _useAttributes(self, attributes: dict[str, Any]) -> None:
|
|
1090
|
+
if "_links" in attributes: # pragma no branch
|
|
1091
|
+
self.__links = self._makeDictAttribute(attributes["_links"])
|
|
1092
|
+
if "active_lock_reason" in attributes: # pragma no branch
|
|
1093
|
+
self._active_lock_reason = self._makeStringAttribute(attributes["active_lock_reason"])
|
|
1094
|
+
if "additions" in attributes: # pragma no branch
|
|
1095
|
+
self._additions = self._makeIntAttribute(attributes["additions"])
|
|
1096
|
+
if "assignee" in attributes: # pragma no branch
|
|
1097
|
+
self._assignee = self._makeClassAttribute(githubasyncio.NamedUser.NamedUser, attributes["assignee"])
|
|
1098
|
+
if "assignees" in attributes: # pragma no branch
|
|
1099
|
+
self._assignees = self._makeListOfClassesAttribute(
|
|
1100
|
+
githubasyncio.NamedUser.NamedUser, attributes["assignees"]
|
|
1101
|
+
)
|
|
1102
|
+
elif "assignee" in attributes:
|
|
1103
|
+
if attributes["assignee"] is not None:
|
|
1104
|
+
self._assignees = self._makeListOfClassesAttribute(
|
|
1105
|
+
githubasyncio.NamedUser.NamedUser, [attributes["assignee"]]
|
|
1106
|
+
)
|
|
1107
|
+
else:
|
|
1108
|
+
self._assignees = self._makeListOfClassesAttribute(githubasyncio.NamedUser.NamedUser, [])
|
|
1109
|
+
if "author_association" in attributes: # pragma no branch
|
|
1110
|
+
self._author_association = self._makeStringAttribute(attributes["author_association"])
|
|
1111
|
+
if "auto_merge" in attributes: # pragma no branch
|
|
1112
|
+
self._auto_merge = self._makeDictAttribute(attributes["auto_merge"])
|
|
1113
|
+
if "base" in attributes: # pragma no branch
|
|
1114
|
+
self._base = self._makeClassAttribute(githubasyncio.PullRequestPart.PullRequestPart, attributes["base"])
|
|
1115
|
+
if "body" in attributes: # pragma no branch
|
|
1116
|
+
self._body = self._makeStringAttribute(attributes["body"])
|
|
1117
|
+
if "changed_files" in attributes: # pragma no branch
|
|
1118
|
+
self._changed_files = self._makeIntAttribute(attributes["changed_files"])
|
|
1119
|
+
if "closed_at" in attributes: # pragma no branch
|
|
1120
|
+
self._closed_at = self._makeDatetimeAttribute(attributes["closed_at"])
|
|
1121
|
+
if "comments" in attributes: # pragma no branch
|
|
1122
|
+
self._comments = self._makeIntAttribute(attributes["comments"])
|
|
1123
|
+
if "comments_url" in attributes: # pragma no branch
|
|
1124
|
+
self._comments_url = self._makeStringAttribute(attributes["comments_url"])
|
|
1125
|
+
if "commits" in attributes: # pragma no branch
|
|
1126
|
+
self._commits = self._makeIntAttribute(attributes["commits"])
|
|
1127
|
+
if "commits_url" in attributes: # pragma no branch
|
|
1128
|
+
self._commits_url = self._makeStringAttribute(attributes["commits_url"])
|
|
1129
|
+
if "created_at" in attributes: # pragma no branch
|
|
1130
|
+
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
|
|
1131
|
+
if "deletions" in attributes: # pragma no branch
|
|
1132
|
+
self._deletions = self._makeIntAttribute(attributes["deletions"])
|
|
1133
|
+
if "diff_url" in attributes: # pragma no branch
|
|
1134
|
+
self._diff_url = self._makeStringAttribute(attributes["diff_url"])
|
|
1135
|
+
if "draft" in attributes: # pragma no branch
|
|
1136
|
+
self._draft = self._makeBoolAttribute(attributes["draft"])
|
|
1137
|
+
if "head" in attributes: # pragma no branch
|
|
1138
|
+
self._head = self._makeClassAttribute(githubasyncio.PullRequestPart.PullRequestPart, attributes["head"])
|
|
1139
|
+
if "html_url" in attributes: # pragma no branch
|
|
1140
|
+
self._html_url = self._makeStringAttribute(attributes["html_url"])
|
|
1141
|
+
if "id" in attributes: # pragma no branch
|
|
1142
|
+
self._id = self._makeIntAttribute(attributes["id"])
|
|
1143
|
+
if "issue_url" in attributes: # pragma no branch
|
|
1144
|
+
self._issue_url = self._makeStringAttribute(attributes["issue_url"])
|
|
1145
|
+
if "labels" in attributes: # pragma no branch
|
|
1146
|
+
self._labels = self._makeListOfClassesAttribute(githubasyncio.Label.Label, attributes["labels"])
|
|
1147
|
+
if "locked" in attributes: # pragma no branch
|
|
1148
|
+
self._locked = self._makeBoolAttribute(attributes["locked"])
|
|
1149
|
+
if "maintainer_can_modify" in attributes: # pragma no branch
|
|
1150
|
+
self._maintainer_can_modify = self._makeBoolAttribute(attributes["maintainer_can_modify"])
|
|
1151
|
+
if "merge_commit_sha" in attributes: # pragma no branch
|
|
1152
|
+
self._merge_commit_sha = self._makeStringAttribute(attributes["merge_commit_sha"])
|
|
1153
|
+
if "mergeable" in attributes: # pragma no branch
|
|
1154
|
+
self._mergeable = self._makeBoolAttribute(attributes["mergeable"])
|
|
1155
|
+
if "mergeable_state" in attributes: # pragma no branch
|
|
1156
|
+
self._mergeable_state = self._makeStringAttribute(attributes["mergeable_state"])
|
|
1157
|
+
if "merged" in attributes: # pragma no branch
|
|
1158
|
+
self._merged = self._makeBoolAttribute(attributes["merged"])
|
|
1159
|
+
if "merged_at" in attributes: # pragma no branch
|
|
1160
|
+
self._merged_at = self._makeDatetimeAttribute(attributes["merged_at"])
|
|
1161
|
+
if "merged_by" in attributes: # pragma no branch
|
|
1162
|
+
self._merged_by = self._makeClassAttribute(githubasyncio.NamedUser.NamedUser, attributes["merged_by"])
|
|
1163
|
+
if "milestone" in attributes: # pragma no branch
|
|
1164
|
+
self._milestone = self._makeClassAttribute(githubasyncio.Milestone.Milestone, attributes["milestone"])
|
|
1165
|
+
if "node_id" in attributes: # pragma no branch
|
|
1166
|
+
self._node_id = self._makeStringAttribute(attributes["node_id"])
|
|
1167
|
+
if "number" in attributes: # pragma no branch
|
|
1168
|
+
self._number = self._makeIntAttribute(attributes["number"])
|
|
1169
|
+
elif "url" in attributes:
|
|
1170
|
+
number = attributes["url"].split("/")[-1]
|
|
1171
|
+
if number.isnumeric():
|
|
1172
|
+
self._number = self._makeIntAttribute(int(number))
|
|
1173
|
+
if "patch_url" in attributes: # pragma no branch
|
|
1174
|
+
self._patch_url = self._makeStringAttribute(attributes["patch_url"])
|
|
1175
|
+
if "rebaseable" in attributes: # pragma no branch
|
|
1176
|
+
self._rebaseable = self._makeBoolAttribute(attributes["rebaseable"])
|
|
1177
|
+
if "requested_reviewers" in attributes:
|
|
1178
|
+
self._requested_reviewers = self._makeListOfClassesAttribute(
|
|
1179
|
+
githubasyncio.NamedUser.NamedUser, attributes["requested_reviewers"]
|
|
1180
|
+
)
|
|
1181
|
+
if "requested_teams" in attributes:
|
|
1182
|
+
self._requested_teams = self._makeListOfClassesAttribute(
|
|
1183
|
+
githubasyncio.Team.Team, attributes["requested_teams"]
|
|
1184
|
+
)
|
|
1185
|
+
if "review_comment_url" in attributes: # pragma no branch
|
|
1186
|
+
self._review_comment_url = self._makeStringAttribute(attributes["review_comment_url"])
|
|
1187
|
+
if "review_comments" in attributes: # pragma no branch
|
|
1188
|
+
self._review_comments = self._makeIntAttribute(attributes["review_comments"])
|
|
1189
|
+
if "review_comments_url" in attributes: # pragma no branch
|
|
1190
|
+
self._review_comments_url = self._makeStringAttribute(attributes["review_comments_url"])
|
|
1191
|
+
if "state" in attributes: # pragma no branch
|
|
1192
|
+
self._state = self._makeStringAttribute(attributes["state"])
|
|
1193
|
+
if "statuses_url" in attributes: # pragma no branch
|
|
1194
|
+
self._statuses_url = self._makeStringAttribute(attributes["statuses_url"])
|
|
1195
|
+
if "title" in attributes: # pragma no branch
|
|
1196
|
+
self._title = self._makeStringAttribute(attributes["title"])
|
|
1197
|
+
if "updated_at" in attributes: # pragma no branch
|
|
1198
|
+
self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
|
|
1199
|
+
if "url" in attributes: # pragma no branch
|
|
1200
|
+
self._url = self._makeStringAttribute(attributes["url"])
|
|
1201
|
+
if "user" in attributes: # pragma no branch
|
|
1202
|
+
self._user = self._makeClassAttribute(githubasyncio.NamedUser.NamedUser, attributes["user"])
|