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.
Files changed (188) hide show
  1. githubasyncio/AccessToken.py +159 -0
  2. githubasyncio/AdvisoryBase.py +163 -0
  3. githubasyncio/AdvisoryCredit.py +131 -0
  4. githubasyncio/AdvisoryCreditDetailed.py +110 -0
  5. githubasyncio/AdvisoryVulnerability.py +191 -0
  6. githubasyncio/AdvisoryVulnerabilityPackage.py +93 -0
  7. githubasyncio/AppAuthentication.py +58 -0
  8. githubasyncio/ApplicationOAuth.py +200 -0
  9. githubasyncio/Artifact.py +183 -0
  10. githubasyncio/Auth.py +560 -0
  11. githubasyncio/AuthenticatedUser.py +1251 -0
  12. githubasyncio/Authorization.py +192 -0
  13. githubasyncio/AuthorizationApplication.py +73 -0
  14. githubasyncio/Autolink.py +104 -0
  15. githubasyncio/Branch.py +689 -0
  16. githubasyncio/BranchProtection.py +224 -0
  17. githubasyncio/CVSS.py +83 -0
  18. githubasyncio/CWE.py +75 -0
  19. githubasyncio/CheckRun.py +315 -0
  20. githubasyncio/CheckRunAnnotation.py +134 -0
  21. githubasyncio/CheckRunOutput.py +108 -0
  22. githubasyncio/CheckSuite.py +319 -0
  23. githubasyncio/Clones.py +97 -0
  24. githubasyncio/CodeScanAlert.py +215 -0
  25. githubasyncio/CodeScanAlertInstance.py +134 -0
  26. githubasyncio/CodeScanAlertInstanceLocation.py +102 -0
  27. githubasyncio/CodeScanRule.py +134 -0
  28. githubasyncio/CodeScanTool.py +94 -0
  29. githubasyncio/CodeSecurityConfig.py +301 -0
  30. githubasyncio/CodeSecurityConfigRepository.py +70 -0
  31. githubasyncio/Commit.py +442 -0
  32. githubasyncio/CommitCombinedStatus.py +126 -0
  33. githubasyncio/CommitComment.py +270 -0
  34. githubasyncio/CommitStats.py +78 -0
  35. githubasyncio/CommitStatus.py +169 -0
  36. githubasyncio/Comparison.py +219 -0
  37. githubasyncio/Consts.py +197 -0
  38. githubasyncio/ContentFile.py +304 -0
  39. githubasyncio/Copilot.py +97 -0
  40. githubasyncio/CopilotSeat.py +132 -0
  41. githubasyncio/DefaultCodeSecurityConfig.py +93 -0
  42. githubasyncio/DependabotAlert.py +184 -0
  43. githubasyncio/DependabotAlertAdvisory.py +82 -0
  44. githubasyncio/DependabotAlertDependency.py +100 -0
  45. githubasyncio/DependabotAlertVulnerability.py +85 -0
  46. githubasyncio/Deployment.py +314 -0
  47. githubasyncio/DeploymentBranchPolicy.py +102 -0
  48. githubasyncio/DeploymentStatus.py +201 -0
  49. githubasyncio/DiscussionBase.py +140 -0
  50. githubasyncio/DiscussionCommentBase.py +140 -0
  51. githubasyncio/Download.py +256 -0
  52. githubasyncio/Enterprise.py +175 -0
  53. githubasyncio/EnterpriseConsumedLicenses.py +138 -0
  54. githubasyncio/Environment.py +354 -0
  55. githubasyncio/EnvironmentDeploymentBranchPolicy.py +87 -0
  56. githubasyncio/EnvironmentProtectionRule.py +117 -0
  57. githubasyncio/EnvironmentProtectionRuleReviewer.py +110 -0
  58. githubasyncio/Event.py +134 -0
  59. githubasyncio/File.py +142 -0
  60. githubasyncio/GeneratedReleaseNotes.py +68 -0
  61. githubasyncio/Gist.py +373 -0
  62. githubasyncio/GistComment.py +162 -0
  63. githubasyncio/GistFile.py +106 -0
  64. githubasyncio/GistHistoryState.py +245 -0
  65. githubasyncio/GitAuthor.py +94 -0
  66. githubasyncio/GitBlob.py +123 -0
  67. githubasyncio/GitCommit.py +208 -0
  68. githubasyncio/GitCommitVerification.py +103 -0
  69. githubasyncio/GitObject.py +84 -0
  70. githubasyncio/GitRef.py +122 -0
  71. githubasyncio/GitRelease.py +476 -0
  72. githubasyncio/GitReleaseAsset.py +232 -0
  73. githubasyncio/GitTag.py +143 -0
  74. githubasyncio/GitTree.py +113 -0
  75. githubasyncio/GitTreeElement.py +104 -0
  76. githubasyncio/GithubApp.py +236 -0
  77. githubasyncio/GithubException.py +226 -0
  78. githubasyncio/GithubIntegration.py +365 -0
  79. githubasyncio/GithubObject.py +910 -0
  80. githubasyncio/GithubRetry.py +253 -0
  81. githubasyncio/GitignoreTemplate.py +88 -0
  82. githubasyncio/GlobalAdvisory.py +141 -0
  83. githubasyncio/Hook.py +238 -0
  84. githubasyncio/HookDelivery.py +243 -0
  85. githubasyncio/HookDescription.py +85 -0
  86. githubasyncio/HookResponse.py +83 -0
  87. githubasyncio/InputFileContent.py +63 -0
  88. githubasyncio/InputGitAuthor.py +71 -0
  89. githubasyncio/InputGitTreeElement.py +79 -0
  90. githubasyncio/Installation.py +298 -0
  91. githubasyncio/InstallationAuthorization.py +138 -0
  92. githubasyncio/Invitation.py +171 -0
  93. githubasyncio/Issue.py +955 -0
  94. githubasyncio/IssueComment.py +309 -0
  95. githubasyncio/IssueDependenciesSummary.py +77 -0
  96. githubasyncio/IssueEvent.py +296 -0
  97. githubasyncio/IssuePullRequest.py +97 -0
  98. githubasyncio/IssueType.py +123 -0
  99. githubasyncio/Label.py +186 -0
  100. githubasyncio/License.py +169 -0
  101. githubasyncio/MainClass.py +1142 -0
  102. githubasyncio/Membership.py +154 -0
  103. githubasyncio/MergedUpstream.py +71 -0
  104. githubasyncio/Migration.py +281 -0
  105. githubasyncio/Milestone.py +255 -0
  106. githubasyncio/NamedEnterpriseUser.py +207 -0
  107. githubasyncio/NamedUser.py +841 -0
  108. githubasyncio/Notification.py +182 -0
  109. githubasyncio/NotificationSubject.py +96 -0
  110. githubasyncio/Organization.py +2462 -0
  111. githubasyncio/OrganizationCodeScanAlert.py +65 -0
  112. githubasyncio/OrganizationCustomProperty.py +215 -0
  113. githubasyncio/OrganizationDependabotAlert.py +75 -0
  114. githubasyncio/OrganizationSecret.py +191 -0
  115. githubasyncio/OrganizationSecretScanAlert.py +112 -0
  116. githubasyncio/OrganizationVariable.py +141 -0
  117. githubasyncio/PaginatedList.py +652 -0
  118. githubasyncio/Path.py +102 -0
  119. githubasyncio/Permissions.py +113 -0
  120. githubasyncio/Plan.py +108 -0
  121. githubasyncio/Project.py +286 -0
  122. githubasyncio/ProjectCard.py +257 -0
  123. githubasyncio/ProjectColumn.py +227 -0
  124. githubasyncio/PublicKey.py +138 -0
  125. githubasyncio/PullRequest.py +1202 -0
  126. githubasyncio/PullRequestComment.py +401 -0
  127. githubasyncio/PullRequestMergeStatus.py +89 -0
  128. githubasyncio/PullRequestPart.py +110 -0
  129. githubasyncio/PullRequestReview.py +214 -0
  130. githubasyncio/Rate.py +123 -0
  131. githubasyncio/RateLimit.py +210 -0
  132. githubasyncio/RateLimitOverview.py +104 -0
  133. githubasyncio/Reaction.py +128 -0
  134. githubasyncio/Referrer.py +94 -0
  135. githubasyncio/RepoCodeSecurityConfig.py +93 -0
  136. githubasyncio/Repository.py +5211 -0
  137. githubasyncio/RepositoryAdvisory.py +431 -0
  138. githubasyncio/RepositoryDiscussion.py +221 -0
  139. githubasyncio/RepositoryDiscussionCategory.py +150 -0
  140. githubasyncio/RepositoryDiscussionComment.py +159 -0
  141. githubasyncio/RepositoryKey.py +166 -0
  142. githubasyncio/RepositoryPreferences.py +82 -0
  143. githubasyncio/RepositoryRulesetBypassActor.py +75 -0
  144. githubasyncio/Requester.py +1518 -0
  145. githubasyncio/RequiredPullRequestReviews.py +269 -0
  146. githubasyncio/RequiredStatusChecks.py +153 -0
  147. githubasyncio/Rule.py +134 -0
  148. githubasyncio/Ruleset.py +292 -0
  149. githubasyncio/Secret.py +139 -0
  150. githubasyncio/SecretScanAlert.py +317 -0
  151. githubasyncio/SecretScanAlertInstance.py +128 -0
  152. githubasyncio/SecurityAndAnalysis.py +188 -0
  153. githubasyncio/SecurityAndAnalysisFeature.py +79 -0
  154. githubasyncio/SelfHostedActionsRunner.py +129 -0
  155. githubasyncio/SelfHostedActionsRunnerApplication.py +92 -0
  156. githubasyncio/SelfHostedActionsRunnerJitConfig.py +74 -0
  157. githubasyncio/SelfHostedActionsRunnerToken.py +118 -0
  158. githubasyncio/SourceImport.py +260 -0
  159. githubasyncio/Stargazer.py +88 -0
  160. githubasyncio/StatsCodeFrequency.py +81 -0
  161. githubasyncio/StatsCommitActivity.py +86 -0
  162. githubasyncio/StatsContributor.py +138 -0
  163. githubasyncio/StatsParticipation.py +78 -0
  164. githubasyncio/StatsPunchCard.py +76 -0
  165. githubasyncio/SubIssueSummary.py +70 -0
  166. githubasyncio/Tag.py +108 -0
  167. githubasyncio/Team.py +618 -0
  168. githubasyncio/TeamDiscussion.py +137 -0
  169. githubasyncio/TimelineEvent.py +164 -0
  170. githubasyncio/TimelineEventSource.py +81 -0
  171. githubasyncio/Topic.py +177 -0
  172. githubasyncio/Traffic.py +95 -0
  173. githubasyncio/UserKey.py +141 -0
  174. githubasyncio/Variable.py +155 -0
  175. githubasyncio/View.py +97 -0
  176. githubasyncio/Workflow.py +335 -0
  177. githubasyncio/WorkflowJob.py +253 -0
  178. githubasyncio/WorkflowRun.py +480 -0
  179. githubasyncio/WorkflowStep.py +118 -0
  180. githubasyncio/__init__.py +38 -0
  181. githubasyncio/compat/__init__.py +52 -0
  182. githubasyncio/requestlib/__init__.py +29 -0
  183. pygithub_asyncio-3.0.0b1.dist-info/METADATA +102 -0
  184. pygithub_asyncio-3.0.0b1.dist-info/RECORD +188 -0
  185. pygithub_asyncio-3.0.0b1.dist-info/WHEEL +5 -0
  186. pygithub_asyncio-3.0.0b1.dist-info/licenses/COPYING +674 -0
  187. pygithub_asyncio-3.0.0b1.dist-info/licenses/COPYING.LESSER +165 -0
  188. pygithub_asyncio-3.0.0b1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,314 @@
1
+ # FILE AUTO GENERATED DO NOT TOUCH
2
+ ############################ Copyrights and license ############################
3
+ # #
4
+ # Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
5
+ # Copyright 2012 Zearin <zearin@gonk.net> #
6
+ # Copyright 2013 AKFish <akfish@gmail.com> #
7
+ # Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
8
+ # Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
9
+ # Copyright 2015 Matt Babineau <mbabineau@dataxu.com> #
10
+ # Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
11
+ # Copyright 2016 Martijn Koster <mak-github@greenhills.co.uk> #
12
+ # Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
13
+ # Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
14
+ # Copyright 2018 sfdye <tsfdye@gmail.com> #
15
+ # Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
16
+ # Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
17
+ # Copyright 2020 Colby Gallup <colbygallup@gmail.com> #
18
+ # Copyright 2020 Pascal Hofmann <mail@pascalhofmann.de> #
19
+ # Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
20
+ # Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
21
+ # Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
22
+ # Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
23
+ # Copyright 2023 Nevins <nevins-b@users.noreply.github.com> #
24
+ # Copyright 2023 Trim21 <trim21.me@gmail.com> #
25
+ # Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
26
+ # Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
27
+ # Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
28
+ # Copyright 2026 Enrico Minack <github@enrico.minack.dev> #
29
+ # #
30
+ # This file is part of PyGithub. #
31
+ # http://pygithub.readthedocs.io/ #
32
+ # #
33
+ # PyGithub is free software: you can redistribute it and/or modify it under #
34
+ # the terms of the GNU Lesser General Public License as published by the Free #
35
+ # Software Foundation, either version 3 of the License, or (at your option) #
36
+ # any later version. #
37
+ # #
38
+ # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
39
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
40
+ # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
41
+ # details. #
42
+ # #
43
+ # You should have received a copy of the GNU Lesser General Public License #
44
+ # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
45
+ # #
46
+ ################################################################################
47
+
48
+ from __future__ import annotations
49
+
50
+ from datetime import datetime
51
+ from typing import TYPE_CHECKING, Any
52
+
53
+ import githubasyncio.Consts
54
+ import githubasyncio.DeploymentStatus
55
+ import githubasyncio.GithubApp
56
+ import githubasyncio.NamedUser
57
+ import githubasyncio.Organization
58
+ from githubasyncio.GithubObject import Attribute, CompletableGithubObject, NotSet, Opt, is_undefined
59
+ from githubasyncio.PaginatedList import PaginatedList
60
+
61
+ if TYPE_CHECKING:
62
+ from githubasyncio.DeploymentStatus import DeploymentStatus
63
+ from githubasyncio.GithubApp import GithubApp
64
+ from githubasyncio.NamedUser import NamedUser
65
+ from githubasyncio.Organization import Organization
66
+
67
+
68
+ class Deployment(CompletableGithubObject):
69
+ """
70
+ This class represents Deployments.
71
+
72
+ The reference can be found here
73
+ https://docs.github.com/en/rest/reference/repos#deployments
74
+
75
+ The OpenAPI schema can be found at
76
+
77
+ - /components/schemas/deployment
78
+ - /components/schemas/deployment-simple
79
+
80
+ """
81
+
82
+ def _initAttributes(self) -> None:
83
+ self._created_at: Attribute[datetime] = NotSet
84
+ self._creator: Attribute[NamedUser | Organization] = NotSet
85
+ self._description: Attribute[str] = NotSet
86
+ self._environment: Attribute[str] = NotSet
87
+ self._id: Attribute[int] = NotSet
88
+ self._node_id: Attribute[str] = NotSet
89
+ self._original_environment: Attribute[str] = NotSet
90
+ self._payload: Attribute[dict[str, Any]] = NotSet
91
+ self._performed_via_github_app: Attribute[GithubApp] = NotSet
92
+ self._production_environment: Attribute[bool] = NotSet
93
+ self._ref: Attribute[str] = NotSet
94
+ self._repository_url: Attribute[str] = NotSet
95
+ self._sha: Attribute[str] = NotSet
96
+ self._statuses_url: Attribute[str] = NotSet
97
+ self._task: Attribute[str] = NotSet
98
+ self._transient_environment: Attribute[bool] = NotSet
99
+ self._updated_at: Attribute[datetime | None] = NotSet
100
+ self._url: Attribute[str] = NotSet
101
+
102
+ def __repr__(self) -> str:
103
+ return self.get__repr__({"id": self._id.value, "url": self._url.value})
104
+
105
+ @property
106
+ async def created_at(self) -> datetime:
107
+ await self._completeIfNotSet(self._created_at)
108
+ return self._created_at.value
109
+
110
+ @property
111
+ async def creator(self) -> NamedUser | Organization:
112
+ await self._completeIfNotSet(self._creator)
113
+ return self._creator.value
114
+
115
+ @property
116
+ async def description(self) -> str:
117
+ await self._completeIfNotSet(self._description)
118
+ return self._description.value
119
+
120
+ @property
121
+ async def environment(self) -> str:
122
+ await self._completeIfNotSet(self._environment)
123
+ return self._environment.value
124
+
125
+ @property
126
+ async def id(self) -> int:
127
+ await self._completeIfNotSet(self._id)
128
+ return self._id.value
129
+
130
+ @property
131
+ async def node_id(self) -> str:
132
+ await self._completeIfNotSet(self._node_id)
133
+ return self._node_id.value
134
+
135
+ @property
136
+ async def original_environment(self) -> str:
137
+ await self._completeIfNotSet(self._original_environment)
138
+ return self._original_environment.value
139
+
140
+ @property
141
+ async def payload(self) -> dict[str, Any]:
142
+ await self._completeIfNotSet(self._payload)
143
+ return self._payload.value
144
+
145
+ @property
146
+ async def performed_via_github_app(self) -> GithubApp:
147
+ await self._completeIfNotSet(self._performed_via_github_app)
148
+ return self._performed_via_github_app.value
149
+
150
+ @property
151
+ async def production_environment(self) -> bool:
152
+ await self._completeIfNotSet(self._production_environment)
153
+ return self._production_environment.value
154
+
155
+ @property
156
+ async def ref(self) -> str:
157
+ await self._completeIfNotSet(self._ref)
158
+ return self._ref.value
159
+
160
+ @property
161
+ async def repository_url(self) -> str:
162
+ await self._completeIfNotSet(self._repository_url)
163
+ return self._repository_url.value
164
+
165
+ @property
166
+ async def sha(self) -> str:
167
+ await self._completeIfNotSet(self._sha)
168
+ return self._sha.value
169
+
170
+ @property
171
+ async def statuses_url(self) -> str:
172
+ await self._completeIfNotSet(self._statuses_url)
173
+ return self._statuses_url.value
174
+
175
+ @property
176
+ async def task(self) -> str:
177
+ await self._completeIfNotSet(self._task)
178
+ return self._task.value
179
+
180
+ @property
181
+ async def transient_environment(self) -> bool:
182
+ await self._completeIfNotSet(self._transient_environment)
183
+ return self._transient_environment.value
184
+
185
+ @property
186
+ async def updated_at(self) -> datetime | None:
187
+ await self._completeIfNotSet(self._updated_at)
188
+ return self._updated_at.value
189
+
190
+ @property
191
+ async def url(self) -> str:
192
+ await self._completeIfNotSet(self._url)
193
+ return self._url.value
194
+
195
+ async def get_statuses(self) -> PaginatedList[DeploymentStatus]:
196
+ """
197
+ :calls: `GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses <https://docs.github.com/en/rest/reference/repos#list-deployments>`_
198
+ """
199
+ return PaginatedList(
200
+ githubasyncio.DeploymentStatus.DeploymentStatus,
201
+ self._requester,
202
+ f"{await self.url}/statuses",
203
+ None,
204
+ headers={"Accept": self._get_accept_header()},
205
+ )
206
+
207
+ async def get_status(self, id_: int) -> DeploymentStatus:
208
+ """
209
+ :calls: `GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses/{status_id} <https://docs.github.com/en/rest/reference/repos#get-a-deployment>`_
210
+ """
211
+ assert isinstance(id_, int), id_
212
+ headers, data = await self._requester.requestJsonAndCheck(
213
+ "GET",
214
+ f"{await self.url}/statuses/{id_}",
215
+ headers={"Accept": self._get_accept_header()},
216
+ )
217
+ return githubasyncio.DeploymentStatus.DeploymentStatus(self._requester, headers, data, completed=True)
218
+
219
+ async def create_status(
220
+ self,
221
+ state: str,
222
+ target_url: Opt[str] = NotSet,
223
+ description: Opt[str] = NotSet,
224
+ environment: Opt[str] = NotSet,
225
+ environment_url: Opt[str] = NotSet,
226
+ auto_inactive: Opt[bool] = NotSet,
227
+ ) -> DeploymentStatus:
228
+ """
229
+ :calls: `POST /repos/{owner}/{repo}/deployments/{deployment_id}/statuses <https://docs.github.com/en/rest/reference/repos#create-a-deployment-status>`_
230
+ """
231
+ assert isinstance(state, str), state
232
+ assert is_undefined(target_url) or isinstance(target_url, str), target_url
233
+ assert is_undefined(description) or isinstance(description, str), description
234
+ assert is_undefined(environment) or isinstance(environment, str), environment
235
+ assert is_undefined(environment_url) or isinstance(environment_url, str), environment_url
236
+ assert is_undefined(auto_inactive) or isinstance(auto_inactive, bool), auto_inactive
237
+
238
+ post_parameters = NotSet.remove_unset_items(
239
+ {
240
+ "state": state,
241
+ "target_url": target_url,
242
+ "description": description,
243
+ "environment": environment,
244
+ "environment_url": environment_url,
245
+ "auto_inactive": auto_inactive,
246
+ }
247
+ )
248
+
249
+ headers, data = await self._requester.requestJsonAndCheck(
250
+ "POST",
251
+ f"{await self.url}/statuses",
252
+ input=post_parameters,
253
+ headers={"Accept": self._get_accept_header()},
254
+ )
255
+ return githubasyncio.DeploymentStatus.DeploymentStatus(self._requester, headers, data, completed=True)
256
+
257
+ @staticmethod
258
+ def _get_accept_header() -> str:
259
+ return ", ".join(
260
+ [
261
+ githubasyncio.Consts.deploymentEnhancementsPreview,
262
+ githubasyncio.Consts.deploymentStatusEnhancementsPreview,
263
+ ]
264
+ )
265
+
266
+ def _useAttributes(self, attributes: dict[str, Any]) -> None:
267
+ if "created_at" in attributes: # pragma no branch
268
+ self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
269
+ if "creator" in attributes: # pragma no branch
270
+ self._creator = self._makeUnionClassAttributeFromTypeKey(
271
+ "type",
272
+ "User",
273
+ attributes["creator"],
274
+ (githubasyncio.NamedUser.NamedUser, "User"),
275
+ (githubasyncio.Organization.Organization, "Organization"),
276
+ )
277
+ if "description" in attributes: # pragma no branch
278
+ self._description = self._makeStringAttribute(attributes["description"])
279
+ if "environment" in attributes: # pragma no branch
280
+ self._environment = self._makeStringAttribute(attributes["environment"])
281
+ if "id" in attributes: # pragma no branch
282
+ self._id = self._makeIntAttribute(attributes["id"])
283
+ elif "url" in attributes and attributes["url"]:
284
+ id = attributes["url"].split("/")[-1]
285
+ if id.isnumeric():
286
+ self._id = self._makeIntAttribute(int(id))
287
+ if "node_id" in attributes: # pragma no branch
288
+ self._node_id = self._makeStringAttribute(attributes["node_id"])
289
+ if "original_environment" in attributes: # pragma no branch
290
+ self._original_environment = self._makeStringAttribute(attributes["original_environment"])
291
+ if "payload" in attributes: # pragma no branch
292
+ self._payload = self._makeDictAttribute(attributes["payload"])
293
+ if "performed_via_github_app" in attributes: # pragma no branch
294
+ self._performed_via_github_app = self._makeClassAttribute(
295
+ githubasyncio.GithubApp.GithubApp, attributes["performed_via_github_app"]
296
+ )
297
+ if "production_environment" in attributes: # pragma no branch
298
+ self._production_environment = self._makeBoolAttribute(attributes["production_environment"])
299
+ if "ref" in attributes: # pragma no branch
300
+ self._ref = self._makeStringAttribute(attributes["ref"])
301
+ if "repository_url" in attributes: # pragma no branch
302
+ self._repository_url = self._makeStringAttribute(attributes["repository_url"])
303
+ if "sha" in attributes: # pragma no branch
304
+ self._sha = self._makeStringAttribute(attributes["sha"])
305
+ if "statuses_url" in attributes: # pragma no branch
306
+ self._statuses_url = self._makeStringAttribute(attributes["statuses_url"])
307
+ if "task" in attributes: # pragma no branch
308
+ self._task = self._makeStringAttribute(attributes["task"])
309
+ if "transient_environment" in attributes: # pragma no branch
310
+ self._transient_environment = self._makeBoolAttribute(attributes["transient_environment"])
311
+ if "updated_at" in attributes: # pragma no branch
312
+ self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
313
+ if "url" in attributes: # pragma no branch
314
+ self._url = self._makeStringAttribute(attributes["url"])
@@ -0,0 +1,102 @@
1
+ # FILE AUTO GENERATED DO NOT TOUCH
2
+ ############################ Copyrights and license ############################
3
+ # #
4
+ # #
5
+ # This file is part of PyGithub. #
6
+ # http://pygithub.readthedocs.io/ #
7
+ # #
8
+ # PyGithub is free software: you can redistribute it and/or modify it under #
9
+ # the terms of the GNU Lesser General Public License as published by the Free #
10
+ # Software Foundation, either version 3 of the License, or (at your option) #
11
+ # any later version. #
12
+ # #
13
+ # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
14
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
15
+ # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
16
+ # details. #
17
+ # #
18
+ # You should have received a copy of the GNU Lesser General Public License #
19
+ # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
20
+ # #
21
+ ################################################################################
22
+
23
+ from __future__ import annotations
24
+
25
+ from typing import Any
26
+
27
+ from githubasyncio.GithubObject import Attribute, NonCompletableGithubObject, NotSet
28
+
29
+
30
+ class DeploymentBranchPolicy(NonCompletableGithubObject):
31
+ """
32
+ This class represents a deployment branch or tag policy of an environment.
33
+
34
+ The reference can be found here
35
+ https://docs.github.com/en/rest/deployments/branch-policies
36
+
37
+ The OpenAPI schema can be found at
38
+
39
+ - /components/schemas/deployment-branch-policy
40
+
41
+ """
42
+
43
+ def _initAttributes(self) -> None:
44
+ self._branch_policies_url: Attribute[str] = NotSet
45
+ self._id: Attribute[int] = NotSet
46
+ self._name: Attribute[str] = NotSet
47
+ self._node_id: Attribute[str] = NotSet
48
+ self._type: Attribute[str] = NotSet
49
+
50
+ def __repr__(self) -> str:
51
+ return self.get__repr__({"id": self._id.value, "name": self._name.value})
52
+
53
+ @property
54
+ def branch_policies_url(self) -> str:
55
+ return self._branch_policies_url.value
56
+
57
+ @property
58
+ def id(self) -> int:
59
+ return self._id.value
60
+
61
+ @property
62
+ def name(self) -> str:
63
+ return self._name.value
64
+
65
+ @property
66
+ def node_id(self) -> str:
67
+ return self._node_id.value
68
+
69
+ @property
70
+ def type(self) -> str:
71
+ return self._type.value
72
+
73
+ @property
74
+ def url(self) -> str:
75
+ return f"{self.branch_policies_url}/{self.id}"
76
+
77
+ async def edit(self, name: str) -> None:
78
+ """
79
+ :calls: `PUT /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id} <https://docs.github.com/en/rest/deployments/branch-policies#update-a-deployment-branch-policy>`_
80
+ :param name: new name pattern that branches or tags must match to be deployed to the environment
81
+ """
82
+ assert isinstance(name, str), name
83
+ headers, data = await self._requester.requestJsonAndCheck("PUT", self.url, input={"name": name})
84
+ self._useAttributes(data)
85
+
86
+ async def delete(self) -> None:
87
+ """
88
+ :calls: `DELETE /repos/{owner}/{repo}/environments/{environment_name}/deployment-branch-policies/{branch_policy_id} <https://docs.github.com/en/rest/deployments/branch-policies#delete-a-deployment-branch-policy>`_
89
+ """
90
+ await self._requester.requestJsonAndCheck("DELETE", self.url)
91
+
92
+ def _useAttributes(self, attributes: dict[str, Any]) -> None:
93
+ if "branch_policies_url" in attributes: # pragma no branch
94
+ self._branch_policies_url = self._makeStringAttribute(attributes["branch_policies_url"])
95
+ if "id" in attributes: # pragma no branch
96
+ self._id = self._makeIntAttribute(attributes["id"])
97
+ if "name" in attributes: # pragma no branch
98
+ self._name = self._makeStringAttribute(attributes["name"])
99
+ if "node_id" in attributes: # pragma no branch
100
+ self._node_id = self._makeStringAttribute(attributes["node_id"])
101
+ if "type" in attributes: # pragma no branch
102
+ self._type = self._makeStringAttribute(attributes["type"])
@@ -0,0 +1,201 @@
1
+ # FILE AUTO GENERATED DO NOT TOUCH
2
+ ############################ Copyrights and license ############################
3
+ # #
4
+ # Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
5
+ # Copyright 2012 Zearin <zearin@gonk.net> #
6
+ # Copyright 2013 AKFish <akfish@gmail.com> #
7
+ # Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
8
+ # Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
9
+ # Copyright 2015 Matt Babineau <mbabineau@dataxu.com> #
10
+ # Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
11
+ # Copyright 2016 Martijn Koster <mak-github@greenhills.co.uk> #
12
+ # Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
13
+ # Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
14
+ # Copyright 2018 sfdye <tsfdye@gmail.com> #
15
+ # Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
16
+ # Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
17
+ # Copyright 2020 Colby Gallup <colbygallup@gmail.com> #
18
+ # Copyright 2020 Pascal Hofmann <mail@pascalhofmann.de> #
19
+ # Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
20
+ # Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
21
+ # Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
22
+ # Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
23
+ # Copyright 2023 Trim21 <trim21.me@gmail.com> #
24
+ # Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
25
+ # Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
26
+ # Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
27
+ # #
28
+ # This file is part of PyGithub. #
29
+ # http://pygithub.readthedocs.io/ #
30
+ # #
31
+ # PyGithub is free software: you can redistribute it and/or modify it under #
32
+ # the terms of the GNU Lesser General Public License as published by the Free #
33
+ # Software Foundation, either version 3 of the License, or (at your option) #
34
+ # any later version. #
35
+ # #
36
+ # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
37
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
38
+ # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
39
+ # details. #
40
+ # #
41
+ # You should have received a copy of the GNU Lesser General Public License #
42
+ # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
43
+ # #
44
+ ################################################################################
45
+
46
+ from __future__ import annotations
47
+
48
+ from datetime import datetime
49
+ from typing import TYPE_CHECKING, Any
50
+
51
+ import githubasyncio.GithubApp
52
+ import githubasyncio.NamedUser
53
+ import githubasyncio.Organization
54
+ from githubasyncio.GithubObject import Attribute, CompletableGithubObject, NotSet
55
+
56
+ if TYPE_CHECKING:
57
+ from githubasyncio.GithubApp import GithubApp
58
+ from githubasyncio.NamedUser import NamedUser
59
+
60
+
61
+ class DeploymentStatus(CompletableGithubObject):
62
+ """
63
+ This class represents Deployment Statuses.
64
+
65
+ The reference can be found here
66
+ https://docs.github.com/en/rest/reference/repos#deployments
67
+
68
+ The OpenAPI schema can be found at
69
+
70
+ - /components/schemas/deployment-status
71
+
72
+ """
73
+
74
+ def _initAttributes(self) -> None:
75
+ self._created_at: Attribute[datetime] = NotSet
76
+ self._creator: Attribute[NamedUser] = NotSet
77
+ self._deployment_url: Attribute[str] = NotSet
78
+ self._description: Attribute[str] = NotSet
79
+ self._environment: Attribute[str] = NotSet
80
+ self._environment_url: Attribute[str] = NotSet
81
+ self._id: Attribute[int] = NotSet
82
+ self._log_url: Attribute[str] = NotSet
83
+ self._node_id: Attribute[str] = NotSet
84
+ self._performed_via_github_app: Attribute[GithubApp] = NotSet
85
+ self._repository_url: Attribute[str] = NotSet
86
+ self._state: Attribute[str] = NotSet
87
+ self._target_url: Attribute[str] = NotSet
88
+ self._updated_at: Attribute[datetime] = NotSet
89
+ self._url: Attribute[str] = NotSet
90
+
91
+ def __repr__(self) -> str:
92
+ return self.get__repr__({"id": self._id.value, "url": self._url.value})
93
+
94
+ @property
95
+ async def created_at(self) -> datetime:
96
+ await self._completeIfNotSet(self._created_at)
97
+ return self._created_at.value
98
+
99
+ @property
100
+ async def creator(self) -> NamedUser:
101
+ await self._completeIfNotSet(self._creator)
102
+ return self._creator.value
103
+
104
+ @property
105
+ async def deployment_url(self) -> str:
106
+ await self._completeIfNotSet(self._deployment_url)
107
+ return self._deployment_url.value
108
+
109
+ @property
110
+ async def description(self) -> str:
111
+ await self._completeIfNotSet(self._description)
112
+ return self._description.value
113
+
114
+ @property
115
+ async def environment(self) -> str:
116
+ await self._completeIfNotSet(self._environment)
117
+ return self._environment.value
118
+
119
+ @property
120
+ async def environment_url(self) -> str:
121
+ await self._completeIfNotSet(self._environment_url)
122
+ return self._environment_url.value
123
+
124
+ @property
125
+ async def id(self) -> int:
126
+ await self._completeIfNotSet(self._id)
127
+ return self._id.value
128
+
129
+ @property
130
+ async def log_url(self) -> str:
131
+ await self._completeIfNotSet(self._log_url)
132
+ return self._log_url.value
133
+
134
+ @property
135
+ async def node_id(self) -> str:
136
+ await self._completeIfNotSet(self._node_id)
137
+ return self._node_id.value
138
+
139
+ @property
140
+ async def performed_via_github_app(self) -> GithubApp:
141
+ await self._completeIfNotSet(self._performed_via_github_app)
142
+ return self._performed_via_github_app.value
143
+
144
+ @property
145
+ async def repository_url(self) -> str:
146
+ await self._completeIfNotSet(self._repository_url)
147
+ return self._repository_url.value
148
+
149
+ @property
150
+ async def state(self) -> str:
151
+ await self._completeIfNotSet(self._state)
152
+ return self._state.value
153
+
154
+ @property
155
+ async def target_url(self) -> str:
156
+ await self._completeIfNotSet(self._target_url)
157
+ return self._target_url.value
158
+
159
+ @property
160
+ async def updated_at(self) -> datetime:
161
+ await self._completeIfNotSet(self._updated_at)
162
+ return self._updated_at.value
163
+
164
+ @property
165
+ async def url(self) -> str:
166
+ await self._completeIfNotSet(self._url)
167
+ return self._url.value
168
+
169
+ def _useAttributes(self, attributes: dict[str, Any]) -> None:
170
+ if "created_at" in attributes: # pragma no branch
171
+ self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
172
+ if "creator" in attributes: # pragma no branch
173
+ self._creator = self._makeClassAttribute(githubasyncio.NamedUser.NamedUser, attributes["creator"])
174
+ if "deployment_url" in attributes: # pragma no branch
175
+ self._deployment_url = self._makeStringAttribute(attributes["deployment_url"])
176
+ if "description" in attributes: # pragma no branch
177
+ self._description = self._makeStringAttribute(attributes["description"])
178
+ if "environment" in attributes: # pragma no branch
179
+ self._environment = self._makeStringAttribute(attributes["environment"])
180
+ if "environment_url" in attributes: # pragma no branch
181
+ self._environment_url = self._makeStringAttribute(attributes["environment_url"])
182
+ if "id" in attributes: # pragma no branch
183
+ self._id = self._makeIntAttribute(attributes["id"])
184
+ if "log_url" in attributes: # pragma no branch
185
+ self._log_url = self._makeStringAttribute(attributes["log_url"])
186
+ if "node_id" in attributes: # pragma no branch
187
+ self._node_id = self._makeStringAttribute(attributes["node_id"])
188
+ if "performed_via_github_app" in attributes: # pragma no branch
189
+ self._performed_via_github_app = self._makeClassAttribute(
190
+ githubasyncio.GithubApp.GithubApp, attributes["performed_via_github_app"]
191
+ )
192
+ if "repository_url" in attributes: # pragma no branch
193
+ self._repository_url = self._makeStringAttribute(attributes["repository_url"])
194
+ if "state" in attributes: # pragma no branch
195
+ self._state = self._makeStringAttribute(attributes["state"])
196
+ if "target_url" in attributes: # pragma no branch
197
+ self._target_url = self._makeStringAttribute(attributes["target_url"])
198
+ if "updated_at" in attributes: # pragma no branch
199
+ self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
200
+ if "url" in attributes: # pragma no branch
201
+ self._url = self._makeStringAttribute(attributes["url"])