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,257 @@
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 Yossarian King <yggy@blackbirdinteractive.com> #
15
+ # Copyright 2018 sfdye <tsfdye@gmail.com> #
16
+ # Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
17
+ # Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
18
+ # Copyright 2020 Jody McIntyre <scjody@modernduck.com> #
19
+ # Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
20
+ # Copyright 2020 chloe jungah kim <43295963+chloeeekim@users.noreply.github.com>#
21
+ # Copyright 2021 Mark Walker <mark.walker@realbuzz.com> #
22
+ # Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
23
+ # Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
24
+ # Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
25
+ # Copyright 2023 Trim21 <trim21.me@gmail.com> #
26
+ # Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
27
+ # Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
28
+ # Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
29
+ # Copyright 2026 Enrico Minack <github@enrico.minack.dev> #
30
+ # #
31
+ # This file is part of PyGithub. #
32
+ # http://pygithub.readthedocs.io/ #
33
+ # #
34
+ # PyGithub is free software: you can redistribute it and/or modify it under #
35
+ # the terms of the GNU Lesser General Public License as published by the Free #
36
+ # Software Foundation, either version 3 of the License, or (at your option) #
37
+ # any later version. #
38
+ # #
39
+ # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
40
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
41
+ # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
42
+ # details. #
43
+ # #
44
+ # You should have received a copy of the GNU Lesser General Public License #
45
+ # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
46
+ # #
47
+ ################################################################################
48
+
49
+ from __future__ import annotations
50
+
51
+ from datetime import datetime
52
+ from typing import TYPE_CHECKING, Any, Literal, overload
53
+
54
+ import githubasyncio.Issue
55
+ import githubasyncio.NamedUser
56
+ import githubasyncio.Organization
57
+ import githubasyncio.ProjectColumn
58
+ import githubasyncio.PullRequest
59
+ from githubasyncio import Consts
60
+ from githubasyncio.GithubObject import Attribute, NonCompletableGithubObject, NotSet, Opt, _NotSetType, is_undefined
61
+
62
+ if TYPE_CHECKING:
63
+ from githubasyncio.Issue import Issue
64
+ from githubasyncio.NamedUser import NamedUser
65
+ from githubasyncio.ProjectColumn import ProjectColumn
66
+ from githubasyncio.PullRequest import PullRequest
67
+
68
+ # NOTE: There is currently no way to get cards "in triage" for a project.
69
+ # https://platform.github.community/t/moving-github-project-cards-that-are-in-triage/3784
70
+ #
71
+ # See also https://developer.github.com/v4/object/projectcard for the next generation GitHub API,
72
+ # which may point the way to where the API is likely headed and what might come back to v3. E.g. ProjectCard.content member.
73
+
74
+
75
+ class ProjectCard(NonCompletableGithubObject):
76
+ """
77
+ This class represents Project Cards.
78
+
79
+ The reference can be found here
80
+ https://docs.github.com/en/rest/reference/projects#cards
81
+
82
+ The OpenAPI schema can be found at
83
+
84
+ - /components/schemas/project-card
85
+
86
+ """
87
+
88
+ def _initAttributes(self) -> None:
89
+ self._archived: Attribute[bool] = NotSet
90
+ self._column_name: Attribute[str] = NotSet
91
+ self._column_url: Attribute[str] = NotSet
92
+ self._content_url: Attribute[str] = NotSet
93
+ self._created_at: Attribute[datetime] = NotSet
94
+ self._creator: Attribute[NamedUser] = NotSet
95
+ self._id: Attribute[int] = NotSet
96
+ self._node_id: Attribute[str] = NotSet
97
+ self._note: Attribute[str] = NotSet
98
+ self._project_id: Attribute[str] = NotSet
99
+ self._project_url: Attribute[str] = NotSet
100
+ self._updated_at: Attribute[datetime] = NotSet
101
+ self._url: Attribute[str] = NotSet
102
+
103
+ def __repr__(self) -> str:
104
+ return self.get__repr__({"id": self._id.value})
105
+
106
+ @property
107
+ def archived(self) -> bool:
108
+ return self._archived.value
109
+
110
+ @property
111
+ def column_name(self) -> str:
112
+ return self._column_name.value
113
+
114
+ @property
115
+ def column_url(self) -> str:
116
+ return self._column_url.value
117
+
118
+ @property
119
+ def content_url(self) -> str:
120
+ return self._content_url.value
121
+
122
+ @property
123
+ def created_at(self) -> datetime:
124
+ return self._created_at.value
125
+
126
+ @property
127
+ def creator(self) -> NamedUser:
128
+ return self._creator.value
129
+
130
+ @property
131
+ def id(self) -> int:
132
+ return self._id.value
133
+
134
+ @property
135
+ def node_id(self) -> str:
136
+ return self._node_id.value
137
+
138
+ @property
139
+ def note(self) -> str:
140
+ return self._note.value
141
+
142
+ @property
143
+ def project_id(self) -> str:
144
+ return self._project_id.value
145
+
146
+ @property
147
+ def project_url(self) -> str:
148
+ return self._project_url.value
149
+
150
+ @property
151
+ def updated_at(self) -> datetime:
152
+ return self._updated_at.value
153
+
154
+ @property
155
+ def url(self) -> str:
156
+ return self._url.value
157
+
158
+ @overload
159
+ def get_content(self, content_type: Literal["PullRequest"]) -> PullRequest | None: ...
160
+
161
+ @overload
162
+ def get_content(self, content_type: Literal["Issue"] | _NotSetType = NotSet) -> Issue | None: ...
163
+
164
+ # Note that the content_url for any card will be an "issue" URL, from
165
+ # which you can retrieve either an Issue or a PullRequest. Unfortunately
166
+ # the API doesn't make it clear which you are dealing with.
167
+ def get_content(self, content_type: Opt[str] = NotSet) -> PullRequest | Issue | None:
168
+ """
169
+ :calls: `GET /repos/{owner}/{repo}/pulls/{pull_number} <https://docs.github.com/en/rest/reference/pulls#get-a-pull-request>`_
170
+ :calls: `GET /repos/{owner}/{repo}/issues/{pull_number} <https://docs.github.com/en/rest/reference/pulls#get-a-pull-request>`_
171
+ """
172
+ assert is_undefined(content_type) or isinstance(content_type, str), content_type
173
+ if self.content_url is None:
174
+ return None
175
+
176
+ retclass: type[PullRequest] | type[Issue]
177
+ if content_type == "PullRequest":
178
+ url = self.content_url.replace("issues", "pulls")
179
+ retclass = githubasyncio.PullRequest.PullRequest
180
+ elif is_undefined(content_type) or content_type == "Issue":
181
+ url = self.content_url
182
+ retclass = githubasyncio.Issue.Issue
183
+ else:
184
+ raise ValueError(f"Unknown content type: {content_type}")
185
+ return retclass(self._requester, url=url)
186
+
187
+ async def move(self, position: str, column: ProjectColumn | int) -> bool:
188
+ """
189
+ :calls: `POST /projects/columns/cards/{card_id}/moves <https://docs.github.com/en/rest/reference/projects#cards>`_
190
+ """
191
+ assert isinstance(position, str), position
192
+ assert isinstance(column, githubasyncio.ProjectColumn.ProjectColumn) or isinstance(column, int), column
193
+ post_parameters = {
194
+ "position": position,
195
+ "column_id": column.id if isinstance(column, githubasyncio.ProjectColumn.ProjectColumn) else column,
196
+ }
197
+ status, _, _ = await self._requester.requestJson(
198
+ "POST",
199
+ f"{self.url}/moves",
200
+ input=post_parameters,
201
+ headers={"Accept": Consts.mediaTypeProjectsPreview},
202
+ )
203
+ return status == 201
204
+
205
+ async def delete(self) -> bool:
206
+ """
207
+ :calls: `DELETE /projects/columns/cards/{card_id} <https://docs.github.com/en/rest/reference/projects#cards>`_
208
+ """
209
+ status, _, _ = await self._requester.requestJson(
210
+ "DELETE",
211
+ self.url,
212
+ headers={"Accept": Consts.mediaTypeProjectsPreview},
213
+ )
214
+ return status == 204
215
+
216
+ async def edit(self, note: Opt[str] = NotSet, archived: Opt[bool] = NotSet) -> None:
217
+ """
218
+ :calls: `PATCH /projects/columns/cards/{card_id} <https://docs.github.com/en/rest/reference/projects#cards>`_
219
+ """
220
+ assert is_undefined(note) or isinstance(note, str), note
221
+ assert is_undefined(archived) or isinstance(archived, bool), archived
222
+ patch_parameters: dict[str, Any] = NotSet.remove_unset_items({"note": note, "archived": archived})
223
+ headers, data = await self._requester.requestJsonAndCheck(
224
+ "PATCH",
225
+ self.url,
226
+ input=patch_parameters,
227
+ headers={"Accept": Consts.mediaTypeProjectsPreview},
228
+ )
229
+ self._useAttributes(data)
230
+
231
+ def _useAttributes(self, attributes: dict[str, Any]) -> None:
232
+ if "archived" in attributes: # pragma no branch
233
+ self._archived = self._makeBoolAttribute(attributes["archived"])
234
+ if "column_name" in attributes: # pragma no branch
235
+ self._column_name = self._makeStringAttribute(attributes["column_name"])
236
+ if "column_url" in attributes: # pragma no branch
237
+ self._column_url = self._makeStringAttribute(attributes["column_url"])
238
+ if "content_url" in attributes: # pragma no branch
239
+ self._content_url = self._makeStringAttribute(attributes["content_url"])
240
+ if "created_at" in attributes: # pragma no branch
241
+ self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
242
+ if "creator" in attributes: # pragma no branch
243
+ self._creator = self._makeClassAttribute(githubasyncio.NamedUser.NamedUser, attributes["creator"])
244
+ if "id" in attributes: # pragma no branch
245
+ self._id = self._makeIntAttribute(attributes["id"])
246
+ if "node_id" in attributes: # pragma no branch
247
+ self._node_id = self._makeStringAttribute(attributes["node_id"])
248
+ if "note" in attributes: # pragma no branch
249
+ self._note = self._makeStringAttribute(attributes["note"])
250
+ if "project_id" in attributes: # pragma no branch
251
+ self._project_id = self._makeStringAttribute(attributes["project_id"])
252
+ if "project_url" in attributes: # pragma no branch
253
+ self._project_url = self._makeStringAttribute(attributes["project_url"])
254
+ if "updated_at" in attributes: # pragma no branch
255
+ self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
256
+ if "url" in attributes: # pragma no branch
257
+ self._url = self._makeStringAttribute(attributes["url"])
@@ -0,0 +1,227 @@
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 Yossarian King <yggy@blackbirdinteractive.com> #
15
+ # Copyright 2018 sfdye <tsfdye@gmail.com> #
16
+ # Copyright 2019 Benoit Latinier <benoit@latinier.fr> #
17
+ # Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
18
+ # Copyright 2019 Vincent <github@fleeto.us> #
19
+ # Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
20
+ # Copyright 2020 Alice GIRARD <bouhahah@gmail.com> #
21
+ # Copyright 2020 Florent Clarret <florent.clarret@gmail.com> #
22
+ # Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
23
+ # Copyright 2021 Dhruv Bhanushali <dhruv_b@live.com> #
24
+ # Copyright 2021 Mark Walker <mark.walker@realbuzz.com> #
25
+ # Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
26
+ # Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
27
+ # Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
28
+ # Copyright 2023 Trim21 <trim21.me@gmail.com> #
29
+ # Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
30
+ # Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
31
+ # Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
32
+ # Copyright 2026 Enrico Minack <github@enrico.minack.dev> #
33
+ # #
34
+ # This file is part of PyGithub. #
35
+ # http://pygithub.readthedocs.io/ #
36
+ # #
37
+ # PyGithub is free software: you can redistribute it and/or modify it under #
38
+ # the terms of the GNU Lesser General Public License as published by the Free #
39
+ # Software Foundation, either version 3 of the License, or (at your option) #
40
+ # any later version. #
41
+ # #
42
+ # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
43
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
44
+ # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
45
+ # details. #
46
+ # #
47
+ # You should have received a copy of the GNU Lesser General Public License #
48
+ # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
49
+ # #
50
+ ################################################################################
51
+
52
+ from __future__ import annotations
53
+
54
+ from datetime import datetime
55
+ from typing import TYPE_CHECKING, Any
56
+
57
+ import githubasyncio.GithubObject
58
+ import githubasyncio.Project
59
+ import githubasyncio.ProjectCard
60
+ from githubasyncio.GithubObject import Attribute, NonCompletableGithubObject, NotSet, Opt, is_defined, is_undefined
61
+ from githubasyncio.PaginatedList import PaginatedList
62
+
63
+ from . import Consts
64
+
65
+ if TYPE_CHECKING:
66
+ from githubasyncio.ProjectCard import ProjectCard
67
+
68
+
69
+ class ProjectColumn(NonCompletableGithubObject):
70
+ """
71
+ This class represents Project Columns.
72
+
73
+ The reference can be found here
74
+ https://docs.github.com/en/rest/reference/projects#columns
75
+
76
+ The OpenAPI schema can be found at
77
+
78
+ - /components/schemas/project-column
79
+
80
+ """
81
+
82
+ def _initAttributes(self) -> None:
83
+ self._cards_url: Attribute[str] = NotSet
84
+ self._created_at: Attribute[datetime] = NotSet
85
+ self._id: Attribute[int] = NotSet
86
+ self._name: Attribute[str] = NotSet
87
+ self._node_id: Attribute[str] = NotSet
88
+ self._project_url: Attribute[str] = NotSet
89
+ self._updated_at: Attribute[datetime] = NotSet
90
+ self._url: Attribute[str] = NotSet
91
+
92
+ def __repr__(self) -> str:
93
+ return self.get__repr__({"name": self._name.value})
94
+
95
+ @property
96
+ def cards_url(self) -> str:
97
+ return self._cards_url.value
98
+
99
+ @property
100
+ def created_at(self) -> datetime:
101
+ return self._created_at.value
102
+
103
+ @property
104
+ def id(self) -> int:
105
+ return self._id.value
106
+
107
+ @property
108
+ def name(self) -> str:
109
+ return self._name.value
110
+
111
+ @property
112
+ def node_id(self) -> str:
113
+ return self._node_id.value
114
+
115
+ @property
116
+ def project_url(self) -> str:
117
+ return self._project_url.value
118
+
119
+ @property
120
+ def updated_at(self) -> datetime:
121
+ return self._updated_at.value
122
+
123
+ @property
124
+ def url(self) -> str:
125
+ return self._url.value
126
+
127
+ def get_cards(self, archived_state: Opt[str] = NotSet) -> PaginatedList[ProjectCard]:
128
+ """
129
+ :calls: `GET /projects/columns/{column_id}/cards <https://docs.github.com/en/rest/reference/projects#list-project-cards>`_
130
+ """
131
+ assert is_undefined(archived_state) or isinstance(archived_state, str), archived_state
132
+
133
+ url_parameters = dict()
134
+ if is_defined(archived_state):
135
+ url_parameters["archived_state"] = archived_state
136
+
137
+ return PaginatedList(
138
+ githubasyncio.ProjectCard.ProjectCard,
139
+ self._requester,
140
+ f"{self.url}/cards",
141
+ url_parameters,
142
+ headers={"Accept": Consts.mediaTypeProjectsPreview},
143
+ )
144
+
145
+ async def create_card(
146
+ self,
147
+ note: Opt[str] = NotSet,
148
+ content_id: Opt[int] = NotSet,
149
+ content_type: Opt[str] = NotSet,
150
+ ) -> ProjectCard:
151
+ """
152
+ :calls: `POST /projects/columns/{column_id}/cards <https://docs.github.com/en/rest/reference/projects#create-a-project-card>`_
153
+ """
154
+ if isinstance(note, str):
155
+ assert is_undefined(content_id), content_id
156
+ assert is_undefined(content_type), content_type
157
+ post_parameters: dict[str, Any] = {"note": note}
158
+ else:
159
+ assert is_undefined(note), note
160
+ assert isinstance(content_id, int), content_id
161
+ assert isinstance(content_type, str), content_type
162
+ post_parameters = {"content_id": content_id, "content_type": content_type}
163
+
164
+ import_header = {"Accept": Consts.mediaTypeProjectsPreview}
165
+ headers, data = await self._requester.requestJsonAndCheck(
166
+ "POST", f"{self.url}/cards", headers=import_header, input=post_parameters
167
+ )
168
+ return githubasyncio.ProjectCard.ProjectCard(self._requester, headers, data)
169
+
170
+ async def move(self, position: str) -> bool:
171
+ """
172
+ :calls: `POST /projects/columns/{column_id}/moves <https://docs.github.com/en/rest/reference/projects#move-a-project-column>`_
173
+ """
174
+ assert isinstance(position, str), position
175
+ post_parameters = {"position": position}
176
+ status, _, _ = await self._requester.requestJson(
177
+ "POST",
178
+ f"{self.url}/moves",
179
+ input=post_parameters,
180
+ headers={"Accept": Consts.mediaTypeProjectsPreview},
181
+ )
182
+ return status == 201
183
+
184
+ async def delete(self) -> bool:
185
+ """
186
+ :calls: `DELETE /projects/columns/{column_id} <https://docs.github.com/en/rest/reference/projects#delete-a-project-column>`_
187
+ """
188
+ status, _, _ = await self._requester.requestJson(
189
+ "DELETE",
190
+ self.url,
191
+ headers={"Accept": Consts.mediaTypeProjectsPreview},
192
+ )
193
+ return status == 204
194
+
195
+ async def edit(self, name: str) -> None:
196
+ """
197
+ :calls: `PATCH /projects/columns/{column_id} <https://docs.github.com/en/rest/reference/projects#update-an-existing-project-column>`_
198
+ """
199
+ assert isinstance(name, str), name
200
+ patch_parameters = {"name": name}
201
+
202
+ headers, data = await self._requester.requestJsonAndCheck(
203
+ "PATCH",
204
+ self.url,
205
+ input=patch_parameters,
206
+ headers={"Accept": Consts.mediaTypeProjectsPreview},
207
+ )
208
+
209
+ self._useAttributes(data)
210
+
211
+ def _useAttributes(self, attributes: dict[str, Any]) -> None:
212
+ if "cards_url" in attributes: # pragma no branch
213
+ self._cards_url = self._makeStringAttribute(attributes["cards_url"])
214
+ if "created_at" in attributes: # pragma no branch
215
+ self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
216
+ if "id" in attributes: # pragma no branch
217
+ self._id = self._makeIntAttribute(attributes["id"])
218
+ if "name" in attributes: # pragma no branch
219
+ self._name = self._makeStringAttribute(attributes["name"])
220
+ if "node_id" in attributes: # pragma no branch
221
+ self._node_id = self._makeStringAttribute(attributes["node_id"])
222
+ if "project_url" in attributes: # pragma no branch
223
+ self._project_url = self._makeStringAttribute(attributes["project_url"])
224
+ if "updated_at" in attributes: # pragma no branch
225
+ self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
226
+ if "url" in attributes: # pragma no branch
227
+ self._url = self._makeStringAttribute(attributes["url"])
@@ -0,0 +1,138 @@
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 2016 Jannis Gebauer <ja.geb@me.com> #
10
+ # Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
11
+ # Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
12
+ # Copyright 2018 sfdye <tsfdye@gmail.com> #
13
+ # Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
14
+ # Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
15
+ # Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
16
+ # Copyright 2021 Chris Keating <christopherkeating@gmail.com> #
17
+ # Copyright 2021 MeggyCal <MeggyCal@users.noreply.github.com> #
18
+ # Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
19
+ # Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
20
+ # Copyright 2023 Trim21 <trim21.me@gmail.com> #
21
+ # Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
22
+ # Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
23
+ # Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
24
+ # #
25
+ # This file is part of PyGithub. #
26
+ # http://pygithub.readthedocs.io/ #
27
+ # #
28
+ # PyGithub is free software: you can redistribute it and/or modify it under #
29
+ # the terms of the GNU Lesser General Public License as published by the Free #
30
+ # Software Foundation, either version 3 of the License, or (at your option) #
31
+ # any later version. #
32
+ # #
33
+ # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
34
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
35
+ # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
36
+ # details. #
37
+ # #
38
+ # You should have received a copy of the GNU Lesser General Public License #
39
+ # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
40
+ # #
41
+ ################################################################################
42
+
43
+ # https://docs.github.com/en/rest/reference/actions#example-encrypting-a-secret-using-python
44
+ from __future__ import annotations
45
+
46
+ from base64 import b64encode
47
+ from typing import Any
48
+
49
+ from nacl import encoding, public
50
+
51
+ from githubasyncio.GithubObject import Attribute, CompletableGithubObject, NotSet
52
+
53
+
54
+ def encrypt(public_key: str, secret_value: str) -> str:
55
+ """
56
+ Encrypt a Unicode string using the public key.
57
+ """
58
+ pk = public.PublicKey(public_key.encode("utf-8"), encoding.Base64Encoder)
59
+ sealed_box = public.SealedBox(pk)
60
+ encrypted = sealed_box.encrypt(secret_value.encode("utf-8"))
61
+ return b64encode(encrypted).decode("utf-8")
62
+
63
+
64
+ class PublicKey(CompletableGithubObject):
65
+ """
66
+ This class represents either an organization public key or a repository public key.
67
+
68
+ The reference can be found here
69
+ https://docs.github.com/en/rest/reference/actions#get-an-organization-public-key
70
+ or here
71
+ https://docs.github.com/en/rest/reference/actions#get-a-repository-public-key
72
+
73
+ The OpenAPI schema can be found at
74
+
75
+ - /components/schemas/actions-public-key
76
+
77
+ """
78
+
79
+ def _initAttributes(self) -> None:
80
+ self._created_at: Attribute[str] = NotSet
81
+ self._id: Attribute[int] = NotSet
82
+ self._key: Attribute[str] = NotSet
83
+ self._key_id: Attribute[str | int] = NotSet
84
+ self._title: Attribute[str] = NotSet
85
+ self._url: Attribute[str] = NotSet
86
+
87
+ def __repr__(self) -> str:
88
+ return self.get__repr__({"key_id": self._key_id.value, "key": self._key.value})
89
+
90
+ @property
91
+ async def created_at(self) -> str:
92
+ await self._completeIfNotSet(self._created_at)
93
+ return self._created_at.value
94
+
95
+ @property
96
+ async def id(self) -> int:
97
+ await self._completeIfNotSet(self._id)
98
+ return self._id.value
99
+
100
+ @property
101
+ async def key(self) -> str:
102
+ await self._completeIfNotSet(self._key)
103
+ return self._key.value
104
+
105
+ @property
106
+ async def key_id(self) -> str | int:
107
+ await self._completeIfNotSet(self._key_id)
108
+ return self._key_id.value
109
+
110
+ @property
111
+ async def title(self) -> str:
112
+ await self._completeIfNotSet(self._title)
113
+ return self._title.value
114
+
115
+ @property
116
+ async def url(self) -> str:
117
+ await self._completeIfNotSet(self._url)
118
+ return self._url.value
119
+
120
+ async def encrypt(self, unencrypted_value: str) -> str:
121
+ return encrypt(await self.key, unencrypted_value)
122
+
123
+ def _useAttributes(self, attributes: dict[str, Any]) -> None:
124
+ if "created_at" in attributes: # pragma no branch
125
+ self._created_at = self._makeStringAttribute(attributes["created_at"])
126
+ if "id" in attributes: # pragma no branch
127
+ self._id = self._makeIntAttribute(attributes["id"])
128
+ if "key" in attributes: # pragma no branch
129
+ self._key = self._makeStringAttribute(attributes["key"])
130
+ if "key_id" in attributes: # pragma no branch
131
+ if isinstance(attributes["key_id"], str):
132
+ self._key_id = self._makeStringAttribute(attributes["key_id"])
133
+ else:
134
+ self._key_id = self._makeIntAttribute(attributes["key_id"])
135
+ if "title" in attributes: # pragma no branch
136
+ self._title = self._makeStringAttribute(attributes["title"])
137
+ if "url" in attributes: # pragma no branch
138
+ self._url = self._makeStringAttribute(attributes["url"])