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,65 @@
1
+ # FILE AUTO GENERATED DO NOT TOUCH
2
+ ############################ Copyrights and license ############################
3
+ # #
4
+ # Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
5
+ # Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
6
+ # Copyright 2024 Thomas Cooper <coopernetes@proton.me> #
7
+ # Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
8
+ # Copyright 2026 Enrico Minack <github@enrico.minack.dev> #
9
+ # Copyright 2026 Matt Davis <35502728+matt-davis27@users.noreply.github.com> #
10
+ # #
11
+ # This file is part of PyGithub. #
12
+ # http://pygithub.readthedocs.io/ #
13
+ # #
14
+ # PyGithub is free software: you can redistribute it and/or modify it under #
15
+ # the terms of the GNU Lesser General Public License as published by the Free #
16
+ # Software Foundation, either version 3 of the License, or (at your option) #
17
+ # any later version. #
18
+ # #
19
+ # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
20
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
21
+ # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
22
+ # details. #
23
+ # #
24
+ # You should have received a copy of the GNU Lesser General Public License #
25
+ # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
26
+ # #
27
+ ################################################################################
28
+
29
+ from __future__ import annotations
30
+
31
+ from typing import TYPE_CHECKING, Any
32
+
33
+ import githubasyncio.Repository
34
+ from githubasyncio.CodeScanAlert import CodeScanAlert
35
+ from githubasyncio.GithubObject import Attribute, NotSet
36
+
37
+ if TYPE_CHECKING:
38
+ from githubasyncio.Repository import Repository
39
+
40
+
41
+ class OrganizationCodeScanAlert(CodeScanAlert):
42
+ """
43
+ This class represents a Code Scan Alerts for an organization.
44
+
45
+ The reference can be found here
46
+ https://docs.github.com/en/rest/code-scanning/code-scanning#list-code-scanning-alerts-for-an-organization
47
+
48
+ The OpenAPI schema can be found at
49
+
50
+ - /components/schemas/code-scanning-organization-alert-items
51
+
52
+ """
53
+
54
+ def _initAttributes(self) -> None:
55
+ super()._initAttributes()
56
+ self._repository: Attribute[Repository] = NotSet
57
+
58
+ @property
59
+ def repository(self) -> Repository:
60
+ return self._repository.value
61
+
62
+ def _useAttributes(self, attributes: dict[str, Any]) -> None:
63
+ super()._useAttributes(attributes)
64
+ if "repository" in attributes:
65
+ self._repository = self._makeClassAttribute(githubasyncio.Repository.Repository, attributes["repository"])
@@ -0,0 +1,215 @@
1
+ # FILE AUTO GENERATED DO NOT TOUCH
2
+ ############################ Copyrights and license ############################
3
+ # #
4
+ # Copyright 2024 Jacky Lam <jacky.lam@r2studiohk.com> #
5
+ # Copyright 2024 Kian-Meng Ang <kianmeng.ang@gmail.com> #
6
+ # Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
7
+ # Copyright 2025 Greg Fogelberg <52933995+gfog-floqast@users.noreply.github.com>#
8
+ # #
9
+ # This file is part of PyGithub. #
10
+ # http://pygithub.readthedocs.io/ #
11
+ # #
12
+ # PyGithub is free software: you can redistribute it and/or modify it under #
13
+ # the terms of the GNU Lesser General Public License as published by the Free #
14
+ # Software Foundation, either version 3 of the License, or (at your option) #
15
+ # any later version. #
16
+ # #
17
+ # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
18
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
19
+ # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
20
+ # details. #
21
+ # #
22
+ # You should have received a copy of the GNU Lesser General Public License #
23
+ # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
24
+ # #
25
+ ################################################################################
26
+
27
+ from __future__ import annotations
28
+
29
+ from typing import Any
30
+
31
+ from githubasyncio.GithubObject import Attribute, NonCompletableGithubObject, NotSet, Opt, is_defined, is_optional
32
+
33
+
34
+ class CustomProperty:
35
+ """
36
+ This class represents a CustomProperty for an Organization. Use this class to create a new post parameter object.
37
+
38
+ The reference can be found here
39
+ https://docs.github.com/en/rest/orgs/custom-properties#create-or-update-custom-properties-for-an-organization
40
+
41
+ """
42
+
43
+ def __init__(
44
+ self,
45
+ property_name: str,
46
+ value_type: str,
47
+ required: Opt[bool] = NotSet,
48
+ default_value: Opt[None | str | list[str]] = NotSet,
49
+ description: Opt[str | None] = NotSet,
50
+ allowed_values: Opt[list[str] | None] = NotSet,
51
+ values_editable_by: Opt[str | None] = NotSet,
52
+ ):
53
+ assert isinstance(property_name, str), property_name
54
+ assert isinstance(value_type, str), value_type
55
+ assert value_type in ["string", "single_select", "multi_select", "true_false"], value_type
56
+ assert is_optional(required, bool), required
57
+ assert is_optional(default_value, (type(None), str, list)), default_value
58
+ assert is_optional(description, (str, type(None))), description
59
+ assert is_optional(allowed_values, (list, type(None))), allowed_values
60
+ assert is_optional(values_editable_by, (str, type(None))), values_editable_by
61
+ if is_defined(values_editable_by):
62
+ assert values_editable_by in ["org_actors", "org_and_repo_actors"], values_editable_by
63
+
64
+ self.property_name = property_name
65
+ self.value_type = value_type
66
+ self.required = required
67
+ self.default_value = default_value
68
+ self.description = description
69
+ self.allowed_values = allowed_values
70
+ self.values_editable_by = values_editable_by
71
+
72
+ def to_dict(self) -> dict[str, Any]:
73
+ return NotSet.remove_unset_items(self.__dict__)
74
+
75
+
76
+ class OrganizationCustomProperty(NonCompletableGithubObject):
77
+ """
78
+ This class represents a CustomProperty for an Organization.
79
+
80
+ The reference can be found here
81
+ https://docs.github.com/en/rest/orgs/custom-properties
82
+
83
+ The OpenAPI schema can be found at
84
+
85
+ - /components/schemas/custom-property
86
+
87
+ """
88
+
89
+ def _initAttributes(self) -> None:
90
+ self._allowed_values: Attribute[list[str]] = NotSet
91
+ self._default_value: Attribute[str | list[str]] = NotSet
92
+ self._description: Attribute[str] = NotSet
93
+ self._property_name: Attribute[str] = NotSet
94
+ self._regex: Attribute[str] = NotSet
95
+ self._require_explicit_values: Attribute[bool] = NotSet
96
+ self._required: Attribute[bool] = NotSet
97
+ self._source_type: Attribute[str] = NotSet
98
+ self._url: Attribute[str] = NotSet
99
+ self._value_type: Attribute[str] = NotSet
100
+ self._values_editable_by: Attribute[str] = NotSet
101
+
102
+ @property
103
+ def allowed_values(self) -> Opt[list[str] | None]:
104
+ return self._allowed_values.value
105
+
106
+ @property
107
+ def default_value(self) -> Opt[str | list[str] | None]:
108
+ return self._default_value.value
109
+
110
+ @property
111
+ def description(self) -> Opt[str | None]:
112
+ return self._description.value
113
+
114
+ @property
115
+ def property_name(self) -> str:
116
+ return self._property_name.value
117
+
118
+ @property
119
+ def regex(self) -> str:
120
+ return self._regex.value
121
+
122
+ @property
123
+ def require_explicit_values(self) -> bool:
124
+ return self._require_explicit_values.value
125
+
126
+ @property
127
+ def required(self) -> Opt[bool | None]:
128
+ return self._required.value
129
+
130
+ @property
131
+ def source_type(self) -> str:
132
+ return self._source_type.value
133
+
134
+ @property
135
+ def url(self) -> str:
136
+ return self._url.value
137
+
138
+ @property
139
+ def value_type(self) -> str:
140
+ return self._value_type.value
141
+
142
+ @property
143
+ def values_editable_by(self) -> Opt[str | None]:
144
+ return self._values_editable_by.value
145
+
146
+ def _useAttributes(self, attributes: dict[str, Any]) -> None:
147
+ if "allowed_values" in attributes:
148
+ self._allowed_values = self._makeListOfStringsAttribute(attributes["allowed_values"])
149
+ if "default_value" in attributes:
150
+ self._default_value = self._makeStringAttribute(attributes["default_value"])
151
+ if "description" in attributes:
152
+ self._description = self._makeStringAttribute(attributes["description"])
153
+ if "property_name" in attributes: # pragma no branch
154
+ self._property_name = self._makeStringAttribute(attributes["property_name"])
155
+ if "regex" in attributes: # pragma no branch
156
+ self._regex = self._makeStringAttribute(attributes["regex"])
157
+ if "require_explicit_values" in attributes: # pragma no branch
158
+ self._require_explicit_values = self._makeBoolAttribute(attributes["require_explicit_values"])
159
+ if "required" in attributes:
160
+ self._required = self._makeBoolAttribute(attributes["required"])
161
+ if "source_type" in attributes: # pragma no branch
162
+ self._source_type = self._makeStringAttribute(attributes["source_type"])
163
+ if "url" in attributes: # pragma no branch
164
+ self._url = self._makeStringAttribute(attributes["url"])
165
+ if "value_type" in attributes: # pragma no branch
166
+ self._value_type = self._makeStringAttribute(attributes["value_type"])
167
+ if "values_editable_by" in attributes:
168
+ self._values_editable_by = self._makeStringAttribute(attributes["values_editable_by"])
169
+
170
+
171
+ class RepositoryCustomPropertyValues(NonCompletableGithubObject):
172
+ """
173
+ This class represents CustomPropertyValues for a Repository.
174
+
175
+ The reference can be found here
176
+ https://docs.github.com/en/rest/orgs/custom-properties#list-custom-property-values-for-organization-repositories
177
+
178
+ The OpenAPI schema can be found at
179
+
180
+ - /components/schemas/org-repo-custom-property-values
181
+
182
+ """
183
+
184
+ def _initAttributes(self) -> None:
185
+ self._properties: Attribute[dict[str, str]] = NotSet
186
+ self._repository_full_name: Attribute[str] = NotSet
187
+ self._repository_id: Attribute[int] = NotSet
188
+ self._repository_name: Attribute[str] = NotSet
189
+
190
+ @property
191
+ def properties(self) -> dict[str, str]:
192
+ return self._properties.value
193
+
194
+ @property
195
+ def repository_full_name(self) -> str:
196
+ return self._repository_full_name.value
197
+
198
+ @property
199
+ def repository_id(self) -> int:
200
+ return self._repository_id.value
201
+
202
+ @property
203
+ def repository_name(self) -> str:
204
+ return self._repository_name.value
205
+
206
+ def _useAttributes(self, attributes: dict[str, Any]) -> None:
207
+ if "properties" in attributes: # pragma no branch
208
+ properties = {p["property_name"]: p["value"] for p in attributes["properties"]}
209
+ self._properties = self._makeDictAttribute(properties)
210
+ if "repository_full_name" in attributes: # pragma no branch
211
+ self._repository_full_name = self._makeStringAttribute(attributes["repository_full_name"])
212
+ if "repository_id" in attributes: # pragma no branch
213
+ self._repository_id = self._makeIntAttribute(attributes["repository_id"])
214
+ if "repository_name" in attributes: # pragma no branch
215
+ self._repository_name = self._makeStringAttribute(attributes["repository_name"])
@@ -0,0 +1,75 @@
1
+ # FILE AUTO GENERATED DO NOT TOUCH
2
+ ############################ Copyrights and license ############################
3
+ # #
4
+ # Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
5
+ # Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
6
+ # Copyright 2024 Thomas Cooper <coopernetes@proton.me> #
7
+ # Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
8
+ # Copyright 2026 Enrico Minack <github@enrico.minack.dev> #
9
+ # #
10
+ # This file is part of PyGithub. #
11
+ # http://pygithub.readthedocs.io/ #
12
+ # #
13
+ # PyGithub is free software: you can redistribute it and/or modify it under #
14
+ # the terms of the GNU Lesser General Public License as published by the Free #
15
+ # Software Foundation, either version 3 of the License, or (at your option) #
16
+ # any later version. #
17
+ # #
18
+ # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
19
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
20
+ # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
21
+ # details. #
22
+ # #
23
+ # You should have received a copy of the GNU Lesser General Public License #
24
+ # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
25
+ # #
26
+ ################################################################################
27
+
28
+ from __future__ import annotations
29
+
30
+ from typing import TYPE_CHECKING, Any
31
+
32
+ import githubasyncio.NamedUser
33
+ import githubasyncio.Repository
34
+ from githubasyncio.DependabotAlert import DependabotAlert
35
+ from githubasyncio.GithubObject import Attribute, NotSet
36
+
37
+ if TYPE_CHECKING:
38
+ from githubasyncio.NamedUser import NamedUser
39
+ from githubasyncio.Repository import Repository
40
+
41
+
42
+ class OrganizationDependabotAlert(DependabotAlert):
43
+ """
44
+ This class represents a Dependabot alert on an organization.
45
+
46
+ The reference can be found here
47
+ https://docs.github.com/en/rest/dependabot/alerts#list-dependabot-alerts-for-an-organization
48
+
49
+ The OpenAPI schema can be found at
50
+
51
+ - /components/schemas/dependabot-alert-with-repository
52
+
53
+ """
54
+
55
+ def _initAttributes(self) -> None:
56
+ super()._initAttributes()
57
+ self._assignees: Attribute[list[NamedUser]] = NotSet
58
+ self._repository: Attribute[Repository] = NotSet
59
+
60
+ @property
61
+ def assignees(self) -> list[NamedUser]:
62
+ return self._assignees.value
63
+
64
+ @property
65
+ def repository(self) -> Repository:
66
+ return self._repository.value
67
+
68
+ def _useAttributes(self, attributes: dict[str, Any]) -> None:
69
+ super()._useAttributes(attributes)
70
+ if "assignees" in attributes: # pragma no branch
71
+ self._assignees = self._makeListOfClassesAttribute(
72
+ githubasyncio.NamedUser.NamedUser, attributes["assignees"]
73
+ )
74
+ if "repository" in attributes:
75
+ self._repository = self._makeClassAttribute(githubasyncio.Repository.Repository, attributes["repository"])
@@ -0,0 +1,191 @@
1
+ # FILE AUTO GENERATED DO NOT TOUCH
2
+ ############################ Copyrights and license ############################
3
+ # #
4
+ # Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
5
+ # Copyright 2023 Mauricio Alejandro Martínez Pacheco <mauricio.martinez@premise.com>#
6
+ # Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
7
+ # Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
8
+ # Copyright 2024 Thomas Crowley <15927917+thomascrowley@users.noreply.github.com>#
9
+ # Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
10
+ # Copyright 2026 Enrico Minack <github@enrico.minack.dev> #
11
+ # Copyright 2026 Krishna Chaitanya <krishnabkc15@gmail.com> #
12
+ # Copyright 2026 Noethix <ryuga.rago1111@gmail.com> #
13
+ # #
14
+ # This file is part of PyGithub. #
15
+ # http://pygithub.readthedocs.io/ #
16
+ # #
17
+ # PyGithub is free software: you can redistribute it and/or modify it under #
18
+ # the terms of the GNU Lesser General Public License as published by the Free #
19
+ # Software Foundation, either version 3 of the License, or (at your option) #
20
+ # any later version. #
21
+ # #
22
+ # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
23
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
24
+ # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
25
+ # details. #
26
+ # #
27
+ # You should have received a copy of the GNU Lesser General Public License #
28
+ # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
29
+ # #
30
+ ################################################################################
31
+
32
+ from __future__ import annotations
33
+
34
+ import urllib.parse
35
+ from datetime import datetime
36
+ from typing import TYPE_CHECKING, Any
37
+
38
+ import githubasyncio.PublicKey
39
+ import githubasyncio.Repository
40
+ from githubasyncio.GithubObject import Attribute, NotSet, Opt, is_defined, is_optional_list
41
+ from githubasyncio.PaginatedList import PaginatedList
42
+ from githubasyncio.Secret import Secret
43
+
44
+ if TYPE_CHECKING:
45
+ from githubasyncio.PublicKey import PublicKey
46
+ from githubasyncio.Repository import Repository
47
+
48
+
49
+ class OrganizationSecret(Secret):
50
+ """
51
+ This class represents a org level GitHub secret.
52
+
53
+ The reference can be found here
54
+ https://docs.github.com/en/rest/actions/secrets
55
+
56
+ The OpenAPI schema can be found at
57
+
58
+ - /components/schemas/organization-actions-secret
59
+
60
+ """
61
+
62
+ def _initAttributes(self) -> None:
63
+ self._created_at: Attribute[datetime] = NotSet
64
+ self._name: Attribute[str] = NotSet
65
+ self._selected_repositories: Attribute[PaginatedList[Repository]] = NotSet
66
+ self._selected_repositories_url: Attribute[str] = NotSet
67
+ self._updated_at: Attribute[datetime] = NotSet
68
+ self._url: Attribute[str] = NotSet
69
+ self._visibility: Attribute[str] = NotSet
70
+
71
+ @property
72
+ async def selected_repositories_url(self) -> str:
73
+ await self._completeIfNotSet(self._selected_repositories_url)
74
+ return self._selected_repositories_url.value
75
+
76
+ @property
77
+ async def visibility(self) -> str:
78
+ """
79
+ :type: string
80
+ """
81
+ await self._completeIfNotSet(self._visibility)
82
+ return self._visibility.value
83
+
84
+ @property
85
+ async def selected_repositories(self) -> PaginatedList[Repository]:
86
+ return PaginatedList(
87
+ githubasyncio.Repository.Repository,
88
+ self._requester,
89
+ await self.selected_repositories_url,
90
+ None,
91
+ list_item="repositories",
92
+ )
93
+
94
+ async def edit(
95
+ self,
96
+ value: str,
97
+ visibility: str = "all",
98
+ secret_type: str = "actions",
99
+ selected_repositories: Opt[list[Repository]] = NotSet,
100
+ ) -> bool:
101
+ """
102
+ :calls: `PUT /orgs/{org}/actions/secrets/{secret_name} <https://docs.github.com/en/rest/actions/secrets#create-or-update-an-organization-secret>`_
103
+ :calls: `PUT /orgs/{org}/dependabot/secrets/{secret_name} <https://docs.github.com/en/rest/dependabot/secrets#create-or-update-an-organization-secret>`_
104
+ :param value: string plain text value of the secret
105
+ :param visibility: string options all, private or selected
106
+ :param secret_type: string options actions or dependabot
107
+ :param selected_repositories: list of :class:`githubasyncio.Repository.Repository`
108
+ :rtype: bool
109
+ """
110
+ assert isinstance(value, str), value
111
+ assert isinstance(visibility, str), visibility
112
+ assert is_optional_list(selected_repositories, githubasyncio.Repository.Repository), selected_repositories
113
+ assert secret_type in ["actions", "dependabot"], "secret_type should be actions or dependabot"
114
+
115
+ public_key = await self.get_public_key(secret_type=secret_type)
116
+ encrypted_value = await public_key.encrypt(value)
117
+ put_parameters: dict[str, Any] = {
118
+ "key_id": (await public_key.key_id),
119
+ "encrypted_value": encrypted_value,
120
+ "visibility": visibility,
121
+ }
122
+ if visibility == "selected" and is_defined(selected_repositories):
123
+ # Dependabot and Actions endpoints expect different types
124
+ # https://docs.github.com/en/rest/dependabot/secrets#create-or-update-an-organization-secret
125
+ # https://docs.github.com/en/rest/actions/secrets#create-or-update-an-organization-secret
126
+ if secret_type == "actions":
127
+ put_parameters["selected_repository_ids"] = [(await element.id) for element in selected_repositories]
128
+ else:
129
+ put_parameters["selected_repository_ids"] = [str(await element.id) for element in selected_repositories]
130
+
131
+ status, _, _ = await self._requester.requestJson(
132
+ "PUT",
133
+ await self.url,
134
+ input=put_parameters,
135
+ )
136
+ return status in (201, 204)
137
+
138
+ async def get_public_key(self, secret_type: str = "actions") -> PublicKey:
139
+ """
140
+ :calls: `GET /orgs/{org}/actions/secrets/public-key <https://docs.github.com/en/rest/actions/secrets#get-an-organization-public-key>`_
141
+ :calls: `GET /orgs/{org}/dependabot/secrets/public-key <https://docs.github.com/en/rest/dependabot/secrets#get-an-organization-public-key>`_
142
+ :param secret_type: string options actions or dependabot
143
+ :rtype: :class:`githubasyncio.PublicKey.PublicKey`
144
+ """
145
+ assert secret_type in ["actions", "dependabot"], "secret_type should be actions or dependabot"
146
+ # self.url is .../orgs/{org}/{secret_type}/secrets/{secret_name}
147
+ base_url = (await self.url).rsplit("/secrets/", 1)[0]
148
+ headers, data = await self._requester.requestJsonAndCheck("GET", f"{base_url}/secrets/public-key")
149
+ return githubasyncio.PublicKey.PublicKey(self._requester, headers, data, completed=True)
150
+
151
+ async def add_repo(self, repo: Repository) -> bool:
152
+ """
153
+ :calls: `PUT /orgs/{org}/actions/secrets/{secret_name} <https://docs.github.com/en/rest/actions/secrets#add-selected-repository-to-an-organization-secret>`_
154
+ :param repo: githubasyncio.Repository.Repository
155
+ :rtype: bool
156
+ """
157
+ if (await self.visibility) != "selected":
158
+ return False
159
+ await self._requester.requestJsonAndCheck("PUT", f"{self._selected_repositories_url.value}/{(await repo.id)}")
160
+ return True
161
+
162
+ async def remove_repo(self, repo: Repository) -> bool:
163
+ """
164
+ :calls: `DELETE /orgs/{org}/actions/secrets/{secret_name} <https://docs.github.com/en/rest/actions/secrets#add-selected-repository-to-an-organization-secret>`_
165
+ :param repo: githubasyncio.Repository.Repository
166
+ :rtype: bool
167
+ """
168
+ if (await self.visibility) != "selected":
169
+ return False
170
+ await self._requester.requestJsonAndCheck(
171
+ "DELETE", f"{self._selected_repositories_url.value}/{(await repo.id)}"
172
+ )
173
+ return True
174
+
175
+ def _useAttributes(self, attributes: dict[str, Any]) -> None:
176
+ if "created_at" in attributes:
177
+ self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
178
+ if "name" in attributes:
179
+ self._name = self._makeStringAttribute(attributes["name"])
180
+ elif "url" in attributes and attributes["url"]:
181
+ quoted_name = attributes["url"].split("/")[-1]
182
+ name = urllib.parse.unquote(quoted_name)
183
+ self._name = self._makeStringAttribute(name)
184
+ if "selected_repositories_url" in attributes:
185
+ self._selected_repositories_url = self._makeStringAttribute(attributes["selected_repositories_url"])
186
+ if "updated_at" in attributes:
187
+ self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
188
+ if "url" in attributes:
189
+ self._url = self._makeStringAttribute(attributes["url"])
190
+ if "visibility" in attributes:
191
+ self._visibility = self._makeStringAttribute(attributes["visibility"])
@@ -0,0 +1,112 @@
1
+ # FILE AUTO GENERATED DO NOT TOUCH
2
+ ############################ Copyrights and license ############################
3
+ # #
4
+ # Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
5
+ # Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
6
+ # Copyright 2024 Thomas Cooper <coopernetes@proton.me> #
7
+ # Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
8
+ # Copyright 2026 Enrico Minack <github@enrico.minack.dev> #
9
+ # Copyright 2026 Matt Davis <35502728+matt-davis27@users.noreply.github.com> #
10
+ # #
11
+ # This file is part of PyGithub. #
12
+ # http://pygithub.readthedocs.io/ #
13
+ # #
14
+ # PyGithub is free software: you can redistribute it and/or modify it under #
15
+ # the terms of the GNU Lesser General Public License as published by the Free #
16
+ # Software Foundation, either version 3 of the License, or (at your option) #
17
+ # any later version. #
18
+ # #
19
+ # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
20
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
21
+ # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
22
+ # details. #
23
+ # #
24
+ # You should have received a copy of the GNU Lesser General Public License #
25
+ # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
26
+ # #
27
+ ################################################################################
28
+
29
+ from __future__ import annotations
30
+
31
+ from typing import TYPE_CHECKING, Any
32
+
33
+ import githubasyncio.NamedUser
34
+ import githubasyncio.Organization
35
+ import githubasyncio.Repository
36
+ from githubasyncio.GithubObject import Attribute, NotSet
37
+ from githubasyncio.SecretScanAlert import SecretScanAlert
38
+
39
+ if TYPE_CHECKING:
40
+ from githubasyncio.NamedUser import NamedUser
41
+ from githubasyncio.Organization import Organization
42
+ from githubasyncio.Repository import Repository
43
+
44
+
45
+ class OrganizationSecretScanAlert(SecretScanAlert):
46
+ """
47
+ This class represents a Secret Scanning Alert on an organization.
48
+
49
+ The reference can be found here
50
+ https://docs.github.com/en/rest/secret-scanning/secret-scanning#list-secret-scanning-alerts-for-an-organization
51
+
52
+ The OpenAPI schema can be found at
53
+
54
+ - /components/schemas/organization-secret-scanning-alert
55
+
56
+ """
57
+
58
+ def _initAttributes(self) -> None:
59
+ super()._initAttributes()
60
+ self._closure_request_comment: Attribute[str] = NotSet
61
+ self._closure_request_reviewer: Attribute[NamedUser | Organization] = NotSet
62
+ self._closure_request_reviewer_comment: Attribute[str] = NotSet
63
+ self._provider: Attribute[str] = NotSet
64
+ self._provider_slug: Attribute[str] = NotSet
65
+ self._repository: Attribute[Repository] = NotSet
66
+
67
+ @property
68
+ def closure_request_comment(self) -> str:
69
+ return self._closure_request_comment.value
70
+
71
+ @property
72
+ def closure_request_reviewer(self) -> NamedUser | Organization:
73
+ return self._closure_request_reviewer.value
74
+
75
+ @property
76
+ def closure_request_reviewer_comment(self) -> str:
77
+ return self._closure_request_reviewer_comment.value
78
+
79
+ @property
80
+ def provider(self) -> str:
81
+ return self._provider.value
82
+
83
+ @property
84
+ def provider_slug(self) -> str:
85
+ return self._provider_slug.value
86
+
87
+ @property
88
+ def repository(self) -> Repository:
89
+ return self._repository.value
90
+
91
+ def _useAttributes(self, attributes: dict[str, Any]) -> None:
92
+ super()._useAttributes(attributes)
93
+ if "closure_request_comment" in attributes: # pragma no branch
94
+ self._closure_request_comment = self._makeStringAttribute(attributes["closure_request_comment"])
95
+ if "closure_request_reviewer" in attributes: # pragma no branch
96
+ self._closure_request_reviewer = self._makeUnionClassAttributeFromTypeKey(
97
+ "type",
98
+ "User",
99
+ attributes["closure_request_reviewer"],
100
+ (githubasyncio.NamedUser.NamedUser, "User"),
101
+ (githubasyncio.Organization.Organization, "Organization"),
102
+ )
103
+ if "closure_request_reviewer_comment" in attributes: # pragma no branch
104
+ self._closure_request_reviewer_comment = self._makeStringAttribute(
105
+ attributes["closure_request_reviewer_comment"]
106
+ )
107
+ if "provider" in attributes: # pragma no branch
108
+ self._provider = self._makeStringAttribute(attributes["provider"])
109
+ if "provider_slug" in attributes: # pragma no branch
110
+ self._provider_slug = self._makeStringAttribute(attributes["provider_slug"])
111
+ if "repository" in attributes:
112
+ self._repository = self._makeClassAttribute(githubasyncio.Repository.Repository, attributes["repository"])