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,2462 @@
1
+ # FILE AUTO GENERATED DO NOT TOUCH
2
+ ############################ Copyrights and license ############################
3
+ # #
4
+ # Copyright 2012 Steve English <steve.english@navetas.com> #
5
+ # Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
6
+ # Copyright 2012 Zearin <zearin@gonk.net> #
7
+ # Copyright 2013 AKFish <akfish@gmail.com> #
8
+ # Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
9
+ # Copyright 2013 martinqt <m.ki2@laposte.net> #
10
+ # Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
11
+ # Copyright 2015 Sebastien Besson <seb.besson@gmail.com> #
12
+ # Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
13
+ # Copyright 2016 Matthew Neal <meneal@matthews-mbp.raleigh.ibm.com> #
14
+ # Copyright 2016 Michael Pereira <pereira.m@gmail.com> #
15
+ # Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
16
+ # Copyright 2017 Balázs Rostás <rostas.balazs@gmail.com> #
17
+ # Copyright 2018 Anton Nguyen <afnguyen85@gmail.com> #
18
+ # Copyright 2018 Jacopo Notarstefano <jacopo.notarstefano@gmail.com> #
19
+ # Copyright 2018 Jasper van Wanrooy <jasper@vanwanrooy.net> #
20
+ # Copyright 2018 Raihaan <31362124+res0nance@users.noreply.github.com> #
21
+ # Copyright 2018 Shubham Singh <41840111+singh811@users.noreply.github.com> #
22
+ # Copyright 2018 Steve Kowalik <steven@wedontsleep.org> #
23
+ # Copyright 2018 Tim Boring <tboring@hearst.com> #
24
+ # Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
25
+ # Copyright 2018 Yossarian King <yggy@blackbirdinteractive.com> #
26
+ # Copyright 2018 sfdye <tsfdye@gmail.com> #
27
+ # Copyright 2019 Brian Choy <byceee@gmail.com> #
28
+ # Copyright 2019 Geoffroy Jabouley <gjabouley@invensense.com> #
29
+ # Copyright 2019 Pascal Bach <pasci.bach@gmail.com> #
30
+ # Copyright 2019 Raihaan <31362124+res0nance@users.noreply.github.com> #
31
+ # Copyright 2019 Shibasis Patel <smartshibasish@gmail.com> #
32
+ # Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
33
+ # Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
34
+ # Copyright 2019 ebrown <brownierin@users.noreply.github.com> #
35
+ # Copyright 2020 Anuj Bansal <bansalanuj1996@gmail.com> #
36
+ # Copyright 2020 Glenn McDonald <testworksau@users.noreply.github.com> #
37
+ # Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
38
+ # Copyright 2020 latacora-daniel <71085674+latacora-daniel@users.noreply.github.com>#
39
+ # Copyright 2020 ton-katsu <sakamoto.yoshihisa@gmail.com> #
40
+ # Copyright 2021 James Simpson <jsimpso@users.noreply.github.com> #
41
+ # Copyright 2021 Marina Peresypkina <mi9onev@gmail.com> #
42
+ # Copyright 2021 Mark Walker <mark.walker@realbuzz.com> #
43
+ # Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
44
+ # Copyright 2021 Tanner <51724788+lightningboltemoji@users.noreply.github.com> #
45
+ # Copyright 2022 KimSia Sim <245021+simkimsia@users.noreply.github.com> #
46
+ # Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
47
+ # Copyright 2023 Felipe Peter <mr-peipei@web.de> #
48
+ # Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
49
+ # Copyright 2023 Jonathan Greg <31892308+jmgreg31@users.noreply.github.com> #
50
+ # Copyright 2023 Jonathan Leitschuh <jonathan.leitschuh@gmail.com> #
51
+ # Copyright 2023 Mark Amery <markamery@btinternet.com> #
52
+ # Copyright 2023 Mauricio Alejandro Martínez Pacheco <mauricio.martinez@premise.com>#
53
+ # Copyright 2023 Mauricio Alejandro Martínez Pacheco <n_othing@hotmail.com> #
54
+ # Copyright 2023 Oliver Mannion <125105+tekumara@users.noreply.github.com> #
55
+ # Copyright 2023 Trim21 <trim21.me@gmail.com> #
56
+ # Copyright 2024 Andrii Kezikov <cheshirez@gmail.com> #
57
+ # Copyright 2024 Bill Napier <napier@pobox.com> #
58
+ # Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
59
+ # Copyright 2024 Jacky Lam <jacky.lam@r2studiohk.com> #
60
+ # Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
61
+ # Copyright 2024 Mohamed Mostafa <112487260+mohy01@users.noreply.github.com> #
62
+ # Copyright 2024 Oskar Jansson <56458534+janssonoskar@users.noreply.github.com>#
63
+ # Copyright 2024 Pasha Fateev <pasha@autokitteh.com> #
64
+ # Copyright 2024 Thomas Cooper <coopernetes@proton.me> #
65
+ # Copyright 2024 Thomas Crowley <15927917+thomascrowley@users.noreply.github.com>#
66
+ # Copyright 2025 Bill Napier <napier@pobox.com> #
67
+ # Copyright 2025 Dom Heinzeller <dom.heinzeller@icloud.com> #
68
+ # Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
69
+ # Copyright 2025 Pavel Abramov <31950564+uncleDecart@users.noreply.github.com> #
70
+ # Copyright 2025 Zachary <6599715+interifter@users.noreply.github.com> #
71
+ # Copyright 2026 Enrico Minack <github@enrico.minack.dev> #
72
+ # Copyright 2026 Jay Chawla <92621202+chawlajay9@users.noreply.github.com> #
73
+ # Copyright 2026 Krishna Chaitanya <krishnabkc15@gmail.com> #
74
+ # Copyright 2026 Matt Davis <35502728+matt-davis27@users.noreply.github.com> #
75
+ # #
76
+ # This file is part of PyGithub. #
77
+ # http://pygithub.readthedocs.io/ #
78
+ # #
79
+ # PyGithub is free software: you can redistribute it and/or modify it under #
80
+ # the terms of the GNU Lesser General Public License as published by the Free #
81
+ # Software Foundation, either version 3 of the License, or (at your option) #
82
+ # any later version. #
83
+ # #
84
+ # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
85
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
86
+ # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
87
+ # details. #
88
+ # #
89
+ # You should have received a copy of the GNU Lesser General Public License #
90
+ # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
91
+ # #
92
+ ################################################################################
93
+
94
+ from __future__ import annotations
95
+
96
+ import urllib.parse
97
+ from datetime import datetime
98
+ from typing import TYPE_CHECKING, Any
99
+
100
+ import githubasyncio.CodeSecurityConfig
101
+ import githubasyncio.CodeSecurityConfigRepository
102
+ import githubasyncio.Copilot
103
+ import githubasyncio.DefaultCodeSecurityConfig
104
+ import githubasyncio.Event
105
+ import githubasyncio.GithubObject
106
+ import githubasyncio.Hook
107
+ import githubasyncio.HookDelivery
108
+ import githubasyncio.Installation
109
+ import githubasyncio.Issue
110
+ import githubasyncio.Label
111
+ import githubasyncio.Migration
112
+ import githubasyncio.NamedUser
113
+ import githubasyncio.OrganizationCodeScanAlert
114
+ import githubasyncio.OrganizationCustomProperty
115
+ import githubasyncio.OrganizationDependabotAlert
116
+ import githubasyncio.OrganizationSecret
117
+ import githubasyncio.OrganizationSecretScanAlert
118
+ import githubasyncio.OrganizationVariable
119
+ import githubasyncio.Plan
120
+ import githubasyncio.Project
121
+ import githubasyncio.PublicKey
122
+ import githubasyncio.Repository
123
+ import githubasyncio.SelfHostedActionsRunner
124
+ import githubasyncio.SelfHostedActionsRunnerApplication
125
+ import githubasyncio.SelfHostedActionsRunnerJitConfig
126
+ import githubasyncio.SelfHostedActionsRunnerToken
127
+ import githubasyncio.Team
128
+ from githubasyncio import Consts
129
+ from githubasyncio.compat import deprecated
130
+ from githubasyncio.GithubObject import (
131
+ Attribute,
132
+ CompletableGithubObject,
133
+ NotSet,
134
+ Opt,
135
+ is_defined,
136
+ is_optional,
137
+ is_optional_list,
138
+ is_undefined,
139
+ )
140
+ from githubasyncio.PaginatedList import PaginatedList
141
+
142
+ if TYPE_CHECKING:
143
+ from githubasyncio.CodeSecurityConfig import CodeSecurityConfig
144
+ from githubasyncio.CodeSecurityConfigRepository import CodeSecurityConfigRepository
145
+ from githubasyncio.Copilot import Copilot
146
+ from githubasyncio.DefaultCodeSecurityConfig import DefaultCodeSecurityConfig
147
+ from githubasyncio.Event import Event
148
+ from githubasyncio.Hook import Hook
149
+ from githubasyncio.HookDelivery import HookDelivery, HookDeliverySummary
150
+ from githubasyncio.Installation import Installation
151
+ from githubasyncio.Issue import Issue
152
+ from githubasyncio.Label import Label
153
+ from githubasyncio.Migration import Migration
154
+ from githubasyncio.NamedUser import NamedUser, OrganizationInvitation
155
+ from githubasyncio.OrganizationCodeScanAlert import OrganizationCodeScanAlert
156
+ from githubasyncio.OrganizationCustomProperty import (
157
+ CustomProperty,
158
+ OrganizationCustomProperty,
159
+ RepositoryCustomPropertyValues,
160
+ )
161
+ from githubasyncio.OrganizationDependabotAlert import OrganizationDependabotAlert
162
+ from githubasyncio.OrganizationSecret import OrganizationSecret
163
+ from githubasyncio.OrganizationSecretScanAlert import OrganizationSecretScanAlert
164
+ from githubasyncio.OrganizationVariable import OrganizationVariable
165
+ from githubasyncio.Plan import Plan
166
+ from githubasyncio.Project import Project
167
+ from githubasyncio.PublicKey import PublicKey
168
+ from githubasyncio.Repository import Repository
169
+ from githubasyncio.SelfHostedActionsRunner import SelfHostedActionsRunner
170
+ from githubasyncio.SelfHostedActionsRunnerApplication import SelfHostedActionsRunnerApplication
171
+ from githubasyncio.SelfHostedActionsRunnerJitConfig import SelfHostedActionsRunnerJitConfig
172
+ from githubasyncio.SelfHostedActionsRunnerToken import SelfHostedActionsRunnerToken
173
+ from githubasyncio.Team import Team
174
+
175
+
176
+ class Organization(CompletableGithubObject):
177
+ """
178
+ This class represents Organizations.
179
+
180
+ The reference can be found here
181
+ https://docs.github.com/en/rest/reference/orgs
182
+
183
+ The OpenAPI schema can be found at
184
+
185
+ - /components/schemas/actor
186
+ - /components/schemas/nullable-organization-simple
187
+ - /components/schemas/nullable-simple-user
188
+ - /components/schemas/organization-full
189
+ - /components/schemas/organization-simple
190
+ - /components/schemas/team-organization
191
+
192
+ """
193
+
194
+ def _initAttributes(self) -> None:
195
+ self._advanced_security_enabled_for_new_repositories: Attribute[bool] = NotSet
196
+ self._archived_at: Attribute[datetime] = NotSet
197
+ self._avatar_url: Attribute[str] = NotSet
198
+ self._billing_email: Attribute[str] = NotSet
199
+ self._blog: Attribute[str | None] = NotSet
200
+ self._collaborators: Attribute[int] = NotSet
201
+ self._company: Attribute[str] = NotSet
202
+ self._created_at: Attribute[datetime] = NotSet
203
+ self._default_repository_branch: Attribute[str] = NotSet
204
+ self._default_repository_permission: Attribute[str] = NotSet
205
+ self._dependabot_alerts_enabled_for_new_repositories: Attribute[bool] = NotSet
206
+ self._dependabot_security_updates_enabled_for_new_repositories: Attribute[bool] = NotSet
207
+ self._dependency_graph_enabled_for_new_repositories: Attribute[bool] = NotSet
208
+ self._deploy_keys_enabled_for_repositories: Attribute[bool] = NotSet
209
+ self._description: Attribute[str] = NotSet
210
+ self._disk_usage: Attribute[int] = NotSet
211
+ self._display_commenter_full_name_setting_enabled: Attribute[bool] = NotSet
212
+ self._display_login: Attribute[str] = NotSet
213
+ self._email: Attribute[str] = NotSet
214
+ self._events_url: Attribute[str] = NotSet
215
+ self._followers: Attribute[int] = NotSet
216
+ self._followers_url: Attribute[str] = NotSet
217
+ self._following: Attribute[int] = NotSet
218
+ self._following_url: Attribute[str] = NotSet
219
+ self._gists_url: Attribute[str] = NotSet
220
+ self._gravatar_id: Attribute[str] = NotSet
221
+ self._has_organization_projects: Attribute[bool] = NotSet
222
+ self._has_repository_projects: Attribute[bool] = NotSet
223
+ self._hooks_url: Attribute[str] = NotSet
224
+ self._html_url: Attribute[str] = NotSet
225
+ self._id: Attribute[int] = NotSet
226
+ self._is_verified: Attribute[bool] = NotSet
227
+ self._issues_url: Attribute[str] = NotSet
228
+ self._location: Attribute[str] = NotSet
229
+ self._login: Attribute[str] = NotSet
230
+ self._members_allowed_repository_creation_type: Attribute[str] = NotSet
231
+ self._members_can_change_repo_visibility: Attribute[bool] = NotSet
232
+ self._members_can_create_internal_repositories: Attribute[bool] = NotSet
233
+ self._members_can_create_pages: Attribute[bool] = NotSet
234
+ self._members_can_create_private_pages: Attribute[bool] = NotSet
235
+ self._members_can_create_private_repositories: Attribute[bool] = NotSet
236
+ self._members_can_create_public_pages: Attribute[bool] = NotSet
237
+ self._members_can_create_public_repositories: Attribute[bool] = NotSet
238
+ self._members_can_create_repositories: Attribute[bool] = NotSet
239
+ self._members_can_create_teams: Attribute[bool] = NotSet
240
+ self._members_can_delete_issues: Attribute[bool] = NotSet
241
+ self._members_can_delete_repositories: Attribute[bool] = NotSet
242
+ self._members_can_fork_private_repositories: Attribute[bool] = NotSet
243
+ self._members_can_invite_outside_collaborators: Attribute[bool] = NotSet
244
+ self._members_can_view_dependency_insights: Attribute[bool] = NotSet
245
+ self._members_url: Attribute[str] = NotSet
246
+ self._name: Attribute[str] = NotSet
247
+ self._node_id: Attribute[str] = NotSet
248
+ self._organizations_url: Attribute[str] = NotSet
249
+ self._owned_private_repos: Attribute[int] = NotSet
250
+ self._plan: Attribute[Plan] = NotSet
251
+ self._private_gists: Attribute[int] = NotSet
252
+ self._public_gists: Attribute[int] = NotSet
253
+ self._public_members_url: Attribute[str] = NotSet
254
+ self._public_repos: Attribute[int] = NotSet
255
+ self._readers_can_create_discussions: Attribute[bool] = NotSet
256
+ self._received_events_url: Attribute[str] = NotSet
257
+ self._repos_url: Attribute[str] = NotSet
258
+ self._secret_scanning_enabled_for_new_repositories: Attribute[bool] = NotSet
259
+ self._secret_scanning_push_protection_custom_link: Attribute[str] = NotSet
260
+ self._secret_scanning_push_protection_custom_link_enabled: Attribute[bool] = NotSet
261
+ self._secret_scanning_push_protection_enabled_for_new_repositories: Attribute[bool] = NotSet
262
+ self._site_admin: Attribute[bool] = NotSet
263
+ self._starred_at: Attribute[str] = NotSet
264
+ self._starred_url: Attribute[str] = NotSet
265
+ self._subscriptions_url: Attribute[str] = NotSet
266
+ self._total_private_repos: Attribute[int] = NotSet
267
+ self._twitter_username: Attribute[str] = NotSet
268
+ self._two_factor_requirement_enabled: Attribute[bool] = NotSet
269
+ self._type: Attribute[str] = NotSet
270
+ self._updated_at: Attribute[datetime] = NotSet
271
+ self._url: Attribute[str] = NotSet
272
+ self._user_view_type: Attribute[str] = NotSet
273
+ self._web_commit_signoff_required: Attribute[bool] = NotSet
274
+
275
+ def __repr__(self) -> str:
276
+ return self.get__repr__({"login": self._login.value})
277
+
278
+ @property
279
+ async def advanced_security_enabled_for_new_repositories(self) -> bool:
280
+ await self._completeIfNotSet(self._advanced_security_enabled_for_new_repositories)
281
+ return self._advanced_security_enabled_for_new_repositories.value
282
+
283
+ @property
284
+ async def archived_at(self) -> datetime:
285
+ await self._completeIfNotSet(self._archived_at)
286
+ return self._archived_at.value
287
+
288
+ @property
289
+ async def avatar_url(self) -> str:
290
+ await self._completeIfNotSet(self._avatar_url)
291
+ return self._avatar_url.value
292
+
293
+ @property
294
+ async def billing_email(self) -> str:
295
+ await self._completeIfNotSet(self._billing_email)
296
+ return self._billing_email.value
297
+
298
+ @property
299
+ async def blog(self) -> str | None:
300
+ await self._completeIfNotSet(self._blog)
301
+ return self._blog.value
302
+
303
+ @property
304
+ async def collaborators(self) -> int:
305
+ await self._completeIfNotSet(self._collaborators)
306
+ return self._collaborators.value
307
+
308
+ @property
309
+ async def company(self) -> str | None:
310
+ await self._completeIfNotSet(self._company)
311
+ return self._company.value
312
+
313
+ @property
314
+ async def created_at(self) -> datetime:
315
+ await self._completeIfNotSet(self._created_at)
316
+ return self._created_at.value
317
+
318
+ @property
319
+ async def default_repository_branch(self) -> str:
320
+ await self._completeIfNotSet(self._default_repository_branch)
321
+ return self._default_repository_branch.value
322
+
323
+ @property
324
+ async def default_repository_permission(self) -> str:
325
+ await self._completeIfNotSet(self._default_repository_permission)
326
+ return self._default_repository_permission.value
327
+
328
+ @property
329
+ async def dependabot_alerts_enabled_for_new_repositories(self) -> bool:
330
+ await self._completeIfNotSet(self._dependabot_alerts_enabled_for_new_repositories)
331
+ return self._dependabot_alerts_enabled_for_new_repositories.value
332
+
333
+ @property
334
+ async def dependabot_security_updates_enabled_for_new_repositories(self) -> bool:
335
+ await self._completeIfNotSet(self._dependabot_security_updates_enabled_for_new_repositories)
336
+ return self._dependabot_security_updates_enabled_for_new_repositories.value
337
+
338
+ @property
339
+ async def dependency_graph_enabled_for_new_repositories(self) -> bool:
340
+ await self._completeIfNotSet(self._dependency_graph_enabled_for_new_repositories)
341
+ return self._dependency_graph_enabled_for_new_repositories.value
342
+
343
+ @property
344
+ async def deploy_keys_enabled_for_repositories(self) -> bool:
345
+ await self._completeIfNotSet(self._deploy_keys_enabled_for_repositories)
346
+ return self._deploy_keys_enabled_for_repositories.value
347
+
348
+ @property
349
+ async def description(self) -> str:
350
+ await self._completeIfNotSet(self._description)
351
+ return self._description.value
352
+
353
+ @property
354
+ async def disk_usage(self) -> int:
355
+ await self._completeIfNotSet(self._disk_usage)
356
+ return self._disk_usage.value
357
+
358
+ @property
359
+ async def display_commenter_full_name_setting_enabled(self) -> bool:
360
+ await self._completeIfNotSet(self._display_commenter_full_name_setting_enabled)
361
+ return self._display_commenter_full_name_setting_enabled.value
362
+
363
+ @property
364
+ async def display_login(self) -> str:
365
+ await self._completeIfNotSet(self._display_login)
366
+ return self._display_login.value
367
+
368
+ @property
369
+ async def email(self) -> str | None:
370
+ await self._completeIfNotSet(self._email)
371
+ return self._email.value
372
+
373
+ @property
374
+ async def events_url(self) -> str:
375
+ await self._completeIfNotSet(self._events_url)
376
+ return self._events_url.value
377
+
378
+ @property
379
+ async def followers(self) -> int:
380
+ await self._completeIfNotSet(self._followers)
381
+ return self._followers.value
382
+
383
+ @property
384
+ async def followers_url(self) -> str:
385
+ await self._completeIfNotSet(self._followers_url)
386
+ return self._followers_url.value
387
+
388
+ @property
389
+ async def following(self) -> int:
390
+ await self._completeIfNotSet(self._following)
391
+ return self._following.value
392
+
393
+ @property
394
+ async def following_url(self) -> str:
395
+ await self._completeIfNotSet(self._following_url)
396
+ return self._following_url.value
397
+
398
+ @property
399
+ async def gists_url(self) -> str:
400
+ await self._completeIfNotSet(self._gists_url)
401
+ return self._gists_url.value
402
+
403
+ @property
404
+ async def gravatar_id(self) -> str:
405
+ await self._completeIfNotSet(self._gravatar_id)
406
+ return self._gravatar_id.value
407
+
408
+ @property
409
+ async def has_organization_projects(self) -> bool:
410
+ await self._completeIfNotSet(self._has_organization_projects)
411
+ return self._has_organization_projects.value
412
+
413
+ @property
414
+ async def has_repository_projects(self) -> bool:
415
+ await self._completeIfNotSet(self._has_repository_projects)
416
+ return self._has_repository_projects.value
417
+
418
+ @property
419
+ async def hooks_url(self) -> str:
420
+ await self._completeIfNotSet(self._hooks_url)
421
+ return self._hooks_url.value
422
+
423
+ @property
424
+ async def html_url(self) -> str:
425
+ await self._completeIfNotSet(self._html_url)
426
+ return self._html_url.value
427
+
428
+ @property
429
+ async def id(self) -> int:
430
+ await self._completeIfNotSet(self._id)
431
+ return self._id.value
432
+
433
+ @property
434
+ async def is_verified(self) -> bool:
435
+ await self._completeIfNotSet(self._is_verified)
436
+ return self._is_verified.value
437
+
438
+ @property
439
+ async def issues_url(self) -> str:
440
+ await self._completeIfNotSet(self._issues_url)
441
+ return self._issues_url.value
442
+
443
+ @property
444
+ async def location(self) -> str:
445
+ await self._completeIfNotSet(self._location)
446
+ return self._location.value
447
+
448
+ @property
449
+ async def login(self) -> str:
450
+ await self._completeIfNotSet(self._login)
451
+ return self._login.value
452
+
453
+ @property
454
+ async def members_allowed_repository_creation_type(self) -> str:
455
+ await self._completeIfNotSet(self._members_allowed_repository_creation_type)
456
+ return self._members_allowed_repository_creation_type.value
457
+
458
+ @property
459
+ async def members_can_change_repo_visibility(self) -> bool:
460
+ await self._completeIfNotSet(self._members_can_change_repo_visibility)
461
+ return self._members_can_change_repo_visibility.value
462
+
463
+ @property
464
+ async def members_can_create_internal_repositories(self) -> bool:
465
+ await self._completeIfNotSet(self._members_can_create_internal_repositories)
466
+ return self._members_can_create_internal_repositories.value
467
+
468
+ @property
469
+ async def members_can_create_pages(self) -> bool:
470
+ await self._completeIfNotSet(self._members_can_create_pages)
471
+ return self._members_can_create_pages.value
472
+
473
+ @property
474
+ async def members_can_create_private_pages(self) -> bool:
475
+ await self._completeIfNotSet(self._members_can_create_private_pages)
476
+ return self._members_can_create_private_pages.value
477
+
478
+ @property
479
+ async def members_can_create_private_repositories(self) -> bool:
480
+ await self._completeIfNotSet(self._members_can_create_private_repositories)
481
+ return self._members_can_create_private_repositories.value
482
+
483
+ @property
484
+ async def members_can_create_public_pages(self) -> bool:
485
+ await self._completeIfNotSet(self._members_can_create_public_pages)
486
+ return self._members_can_create_public_pages.value
487
+
488
+ @property
489
+ async def members_can_create_public_repositories(self) -> bool:
490
+ await self._completeIfNotSet(self._members_can_create_public_repositories)
491
+ return self._members_can_create_public_repositories.value
492
+
493
+ @property
494
+ async def members_can_create_repositories(self) -> bool:
495
+ await self._completeIfNotSet(self._members_can_create_repositories)
496
+ return self._members_can_create_repositories.value
497
+
498
+ @property
499
+ async def members_can_create_teams(self) -> bool:
500
+ await self._completeIfNotSet(self._members_can_create_teams)
501
+ return self._members_can_create_teams.value
502
+
503
+ @property
504
+ async def members_can_delete_issues(self) -> bool:
505
+ await self._completeIfNotSet(self._members_can_delete_issues)
506
+ return self._members_can_delete_issues.value
507
+
508
+ @property
509
+ async def members_can_delete_repositories(self) -> bool:
510
+ await self._completeIfNotSet(self._members_can_delete_repositories)
511
+ return self._members_can_delete_repositories.value
512
+
513
+ @property
514
+ async def members_can_fork_private_repositories(self) -> bool:
515
+ await self._completeIfNotSet(self._members_can_fork_private_repositories)
516
+ return self._members_can_fork_private_repositories.value
517
+
518
+ @property
519
+ async def members_can_invite_outside_collaborators(self) -> bool:
520
+ await self._completeIfNotSet(self._members_can_invite_outside_collaborators)
521
+ return self._members_can_invite_outside_collaborators.value
522
+
523
+ @property
524
+ async def members_can_view_dependency_insights(self) -> bool:
525
+ await self._completeIfNotSet(self._members_can_view_dependency_insights)
526
+ return self._members_can_view_dependency_insights.value
527
+
528
+ @property
529
+ async def members_url(self) -> str:
530
+ await self._completeIfNotSet(self._members_url)
531
+ return self._members_url.value
532
+
533
+ @property
534
+ async def name(self) -> str | None:
535
+ await self._completeIfNotSet(self._name)
536
+ return self._name.value
537
+
538
+ @property
539
+ async def node_id(self) -> str:
540
+ await self._completeIfNotSet(self._node_id)
541
+ return self._node_id.value
542
+
543
+ @property
544
+ async def organizations_url(self) -> str:
545
+ await self._completeIfNotSet(self._organizations_url)
546
+ return self._organizations_url.value
547
+
548
+ @property
549
+ async def owned_private_repos(self) -> int:
550
+ await self._completeIfNotSet(self._owned_private_repos)
551
+ return self._owned_private_repos.value
552
+
553
+ @property
554
+ async def plan(self) -> Plan:
555
+ await self._completeIfNotSet(self._plan)
556
+ return self._plan.value
557
+
558
+ @property
559
+ async def private_gists(self) -> int:
560
+ await self._completeIfNotSet(self._private_gists)
561
+ return self._private_gists.value
562
+
563
+ @property
564
+ async def public_gists(self) -> int:
565
+ await self._completeIfNotSet(self._public_gists)
566
+ return self._public_gists.value
567
+
568
+ @property
569
+ async def public_members_url(self) -> str:
570
+ await self._completeIfNotSet(self._public_members_url)
571
+ return self._public_members_url.value
572
+
573
+ @property
574
+ async def public_repos(self) -> int:
575
+ await self._completeIfNotSet(self._public_repos)
576
+ return self._public_repos.value
577
+
578
+ @property
579
+ async def readers_can_create_discussions(self) -> bool:
580
+ await self._completeIfNotSet(self._readers_can_create_discussions)
581
+ return self._readers_can_create_discussions.value
582
+
583
+ @property
584
+ async def received_events_url(self) -> str:
585
+ await self._completeIfNotSet(self._received_events_url)
586
+ return self._received_events_url.value
587
+
588
+ @property
589
+ async def repos_url(self) -> str:
590
+ await self._completeIfNotSet(self._repos_url)
591
+ return self._repos_url.value
592
+
593
+ @property
594
+ async def secret_scanning_enabled_for_new_repositories(self) -> bool:
595
+ await self._completeIfNotSet(self._secret_scanning_enabled_for_new_repositories)
596
+ return self._secret_scanning_enabled_for_new_repositories.value
597
+
598
+ @property
599
+ async def secret_scanning_push_protection_custom_link(self) -> str:
600
+ await self._completeIfNotSet(self._secret_scanning_push_protection_custom_link)
601
+ return self._secret_scanning_push_protection_custom_link.value
602
+
603
+ @property
604
+ async def secret_scanning_push_protection_custom_link_enabled(self) -> bool:
605
+ await self._completeIfNotSet(self._secret_scanning_push_protection_custom_link_enabled)
606
+ return self._secret_scanning_push_protection_custom_link_enabled.value
607
+
608
+ @property
609
+ async def secret_scanning_push_protection_enabled_for_new_repositories(self) -> bool:
610
+ await self._completeIfNotSet(self._secret_scanning_push_protection_enabled_for_new_repositories)
611
+ return self._secret_scanning_push_protection_enabled_for_new_repositories.value
612
+
613
+ @property
614
+ async def site_admin(self) -> bool:
615
+ await self._completeIfNotSet(self._site_admin)
616
+ return self._site_admin.value
617
+
618
+ @property
619
+ async def starred_at(self) -> str:
620
+ await self._completeIfNotSet(self._starred_at)
621
+ return self._starred_at.value
622
+
623
+ @property
624
+ async def starred_url(self) -> str:
625
+ await self._completeIfNotSet(self._starred_url)
626
+ return self._starred_url.value
627
+
628
+ @property
629
+ async def subscriptions_url(self) -> str:
630
+ await self._completeIfNotSet(self._subscriptions_url)
631
+ return self._subscriptions_url.value
632
+
633
+ @property
634
+ async def total_private_repos(self) -> int:
635
+ await self._completeIfNotSet(self._total_private_repos)
636
+ return self._total_private_repos.value
637
+
638
+ @property
639
+ async def twitter_username(self) -> str:
640
+ await self._completeIfNotSet(self._twitter_username)
641
+ return self._twitter_username.value
642
+
643
+ @property
644
+ async def two_factor_requirement_enabled(self) -> bool:
645
+ await self._completeIfNotSet(self._two_factor_requirement_enabled)
646
+ return self._two_factor_requirement_enabled.value
647
+
648
+ @property
649
+ async def type(self) -> str:
650
+ await self._completeIfNotSet(self._type)
651
+ return self._type.value
652
+
653
+ @property
654
+ async def updated_at(self) -> datetime:
655
+ await self._completeIfNotSet(self._updated_at)
656
+ return self._updated_at.value
657
+
658
+ @property
659
+ async def url(self) -> str:
660
+ await self._completeIfNotSet(self._url)
661
+ return self._url.value
662
+
663
+ @property
664
+ async def user_view_type(self) -> str:
665
+ await self._completeIfNotSet(self._user_view_type)
666
+ return self._user_view_type.value
667
+
668
+ @property
669
+ async def web_commit_signoff_required(self) -> bool:
670
+ await self._completeIfNotSet(self._web_commit_signoff_required)
671
+ return self._web_commit_signoff_required.value
672
+
673
+ async def add_to_members(self, member: NamedUser, role: Opt[str] = NotSet) -> None:
674
+ """
675
+ :calls: `PUT /orgs/{org}/memberships/{username} <https://docs.github.com/en/rest/reference/orgs#update-an-organization-membership-for-the-authenticated-user>`_
676
+ """
677
+ assert is_optional(role, str), role
678
+ assert isinstance(member, githubasyncio.NamedUser.NamedUser), member
679
+ put_parameters = NotSet.remove_unset_items({"role": role})
680
+ headers, data = await self._requester.requestJsonAndCheck(
681
+ "PUT", f"{await self.url}/memberships/{(await member._identity)}", input=put_parameters
682
+ )
683
+
684
+ async def add_to_public_members(self, public_member: NamedUser) -> None:
685
+ """
686
+ :calls: `PUT /orgs/{org}/public_members/{username} <https://docs.github.com/en/rest/reference/orgs#members>`_
687
+ """
688
+ assert isinstance(public_member, githubasyncio.NamedUser.NamedUser), public_member
689
+ headers, data = await self._requester.requestJsonAndCheck(
690
+ "PUT", f"{await self.url}/public_members/{(await public_member._identity)}"
691
+ )
692
+
693
+ async def create_fork(
694
+ self,
695
+ repo: Repository,
696
+ name: Opt[str] = NotSet,
697
+ default_branch_only: Opt[bool] = NotSet,
698
+ ) -> Repository:
699
+ """
700
+ :calls: `POST /repos/{owner}/{repo}/forks <https://docs.github.com/en/rest/reference/repos#forks>`_
701
+ """
702
+ assert isinstance(repo, githubasyncio.Repository.Repository), repo
703
+ return await repo.create_fork(
704
+ self,
705
+ name=name,
706
+ default_branch_only=default_branch_only,
707
+ )
708
+
709
+ async def create_repo_from_template(
710
+ self,
711
+ name: str,
712
+ repo: Repository,
713
+ description: Opt[str] = NotSet,
714
+ include_all_branches: Opt[bool] = NotSet,
715
+ private: Opt[bool] = NotSet,
716
+ ) -> Repository:
717
+ """
718
+ Await self.name
719
+ :calls: `POST /repos/{template_owner}/{template_repo}/generate <https://docs.github.com/en/rest/reference/repos#create-a-repository-using-a-template>`_
720
+ """
721
+ assert isinstance(name, str), name
722
+ assert isinstance(repo, githubasyncio.Repository.Repository), repo
723
+ assert is_optional(description, str), description
724
+ assert is_optional(include_all_branches, bool), include_all_branches
725
+ assert is_optional(private, bool), private
726
+ post_parameters: dict[str, Any] = NotSet.remove_unset_items(
727
+ {
728
+ "name": name,
729
+ "owner": await self.login,
730
+ "description": description,
731
+ "include_all_branches": include_all_branches,
732
+ "private": private,
733
+ }
734
+ )
735
+
736
+ headers, data = await self._requester.requestJsonAndCheck(
737
+ "POST",
738
+ f"/repos/{await (await repo.owner).login}/{(await repo.name)}/generate",
739
+ input=post_parameters,
740
+ headers={"Accept": "application/vnd.github.v3+json"},
741
+ )
742
+ return githubasyncio.Repository.Repository(self._requester, headers, data, completed=True)
743
+
744
+ async def create_hook(
745
+ self,
746
+ name: str,
747
+ config: dict[str, str],
748
+ events: Opt[list[str]] = NotSet,
749
+ active: Opt[bool] = NotSet,
750
+ ) -> Hook:
751
+ """
752
+ :calls: `POST /orgs/{org}/hooks <https://docs.github.com/en/rest/reference/orgs#webhooks>`_
753
+ :param name: string
754
+ :param config: dict
755
+ :param events: list of string
756
+ :param active: bool
757
+ :rtype: :class:`githubasyncio.Hook.Hook`
758
+ """
759
+ assert isinstance(name, str), name
760
+ assert isinstance(config, dict), config
761
+ assert is_optional_list(events, str), events
762
+ assert is_optional(active, bool), active
763
+ post_parameters: dict[str, Any] = NotSet.remove_unset_items(
764
+ {
765
+ "name": name,
766
+ "config": config,
767
+ "events": events,
768
+ "active": active,
769
+ }
770
+ )
771
+ headers, data = await self._requester.requestJsonAndCheck(
772
+ "POST", f"{await self.url}/hooks", input=post_parameters
773
+ )
774
+ return githubasyncio.Hook.Hook(self._requester, headers, data, completed=True)
775
+
776
+ async def create_project(self, name: str, body: Opt[str] = NotSet) -> Project:
777
+ """
778
+ :calls: `POST /orgs/{org}/projects <https://docs.github.com/en/rest/reference/projects#create-an-organization-project>`_
779
+ """
780
+ assert isinstance(name, str), name
781
+ assert is_optional(body, str), body
782
+ post_parameters: dict[str, Any] = NotSet.remove_unset_items({"name": name, "body": body})
783
+
784
+ headers, data = await self._requester.requestJsonAndCheck(
785
+ "POST",
786
+ f"{await self.url}/projects",
787
+ input=post_parameters,
788
+ headers={"Accept": Consts.mediaTypeProjectsPreview},
789
+ )
790
+ return githubasyncio.Project.Project(self._requester, headers, data, completed=True)
791
+
792
+ async def create_repo(
793
+ self,
794
+ name: str,
795
+ description: Opt[str] = NotSet,
796
+ homepage: Opt[str] = NotSet,
797
+ private: Opt[bool] = NotSet,
798
+ visibility: Opt[str] = NotSet,
799
+ has_issues: Opt[bool] = NotSet,
800
+ has_wiki: Opt[bool] = NotSet,
801
+ has_downloads: Opt[bool] = NotSet,
802
+ has_projects: Opt[bool] = NotSet,
803
+ team_id: Opt[int] = NotSet,
804
+ auto_init: Opt[bool] = NotSet,
805
+ license_template: Opt[str] = NotSet,
806
+ gitignore_template: Opt[str] = NotSet,
807
+ allow_squash_merge: Opt[bool] = NotSet,
808
+ allow_merge_commit: Opt[bool] = NotSet,
809
+ allow_rebase_merge: Opt[bool] = NotSet,
810
+ delete_branch_on_merge: Opt[bool] = NotSet,
811
+ allow_update_branch: Opt[bool] = NotSet,
812
+ is_template: Opt[bool] = NotSet,
813
+ allow_auto_merge: Opt[bool] = NotSet,
814
+ use_squash_pr_title_as_default: Opt[bool] = NotSet,
815
+ squash_merge_commit_title: Opt[str] = NotSet,
816
+ squash_merge_commit_message: Opt[str] = NotSet,
817
+ merge_commit_title: Opt[str] = NotSet,
818
+ merge_commit_message: Opt[str] = NotSet,
819
+ custom_properties: Opt[dict[str, Any]] = NotSet,
820
+ ) -> Repository:
821
+ """
822
+ :calls: `POST /orgs/{org}/repos <https://docs.github.com/en/rest/reference/repos>`_
823
+ """
824
+ assert isinstance(name, str), name
825
+ assert is_optional(description, str), description
826
+ assert is_optional(homepage, str), homepage
827
+ assert is_optional(private, bool), private
828
+ assert is_optional(visibility, str), visibility
829
+ assert is_optional(has_issues, bool), has_issues
830
+ assert is_optional(has_wiki, bool), has_wiki
831
+ assert is_optional(has_downloads, bool), has_downloads
832
+ assert is_optional(has_projects, bool), has_projects
833
+ assert is_optional(team_id, int), team_id
834
+ assert is_optional(auto_init, bool), auto_init
835
+ assert is_optional(license_template, str), license_template
836
+ assert is_optional(gitignore_template, str), gitignore_template
837
+ assert is_optional(allow_squash_merge, bool), allow_squash_merge
838
+ assert is_optional(allow_merge_commit, bool), allow_merge_commit
839
+ assert is_optional(allow_rebase_merge, bool), allow_rebase_merge
840
+ assert is_optional(delete_branch_on_merge, bool), delete_branch_on_merge
841
+ assert is_optional(allow_update_branch, bool), allow_update_branch
842
+ assert is_optional(is_template, bool), is_template
843
+ assert is_optional(allow_auto_merge, bool), allow_auto_merge
844
+ assert is_optional(use_squash_pr_title_as_default, bool), use_squash_pr_title_as_default
845
+ assert squash_merge_commit_title in ["PR_TITLE", "COMMIT_OR_PR_TITLE", NotSet], squash_merge_commit_title
846
+ assert squash_merge_commit_message in [
847
+ "PR_BODY",
848
+ "COMMIT_MESSAGES",
849
+ "BLANK",
850
+ NotSet,
851
+ ], squash_merge_commit_message
852
+ assert merge_commit_title in ["PR_TITLE", "MERGE_MESSAGE", NotSet], merge_commit_title
853
+ assert merge_commit_message in ["PR_TITLE", "PR_BODY", "BLANK", NotSet], merge_commit_message
854
+ assert is_optional(custom_properties, dict), custom_properties
855
+ post_parameters = NotSet.remove_unset_items(
856
+ {
857
+ "name": name,
858
+ "description": description,
859
+ "homepage": homepage,
860
+ "private": private,
861
+ "visibility": visibility,
862
+ "has_issues": has_issues,
863
+ "has_wiki": has_wiki,
864
+ "has_downloads": has_downloads,
865
+ "has_projects": has_projects,
866
+ "team_id": team_id,
867
+ "auto_init": auto_init,
868
+ "license_template": license_template,
869
+ "gitignore_template": gitignore_template,
870
+ "allow_squash_merge": allow_squash_merge,
871
+ "allow_merge_commit": allow_merge_commit,
872
+ "allow_rebase_merge": allow_rebase_merge,
873
+ "delete_branch_on_merge": delete_branch_on_merge,
874
+ "allow_update_branch": allow_update_branch,
875
+ "is_template": is_template,
876
+ "allow_auto_merge": allow_auto_merge,
877
+ "use_squash_pr_title_as_default": use_squash_pr_title_as_default,
878
+ "squash_merge_commit_title": squash_merge_commit_title,
879
+ "squash_merge_commit_message": squash_merge_commit_message,
880
+ "merge_commit_title": merge_commit_title,
881
+ "merge_commit_message": merge_commit_message,
882
+ "custom_properties": custom_properties,
883
+ }
884
+ )
885
+
886
+ headers, data = await self._requester.requestJsonAndCheck(
887
+ "POST",
888
+ f"{await self.url}/repos",
889
+ input=post_parameters,
890
+ headers={"Accept": Consts.repoVisibilityPreview},
891
+ )
892
+ return githubasyncio.Repository.Repository(self._requester, headers, data, completed=True)
893
+
894
+ async def create_secret(
895
+ self,
896
+ secret_name: str,
897
+ unencrypted_value: str,
898
+ visibility: str = "all",
899
+ selected_repositories: Opt[list[Repository]] = NotSet,
900
+ secret_type: str = "actions",
901
+ ) -> OrganizationSecret:
902
+ """
903
+ :param secret_name: string name of the secret
904
+ :param unencrypted_value: string plain text value of the secret
905
+ :param visibility: string options all or selected
906
+ :param selected_repositories: list of repositrories that the secret will be available in
907
+ :param secret_type: string options actions or dependabot
908
+
909
+ :calls: `PUT /orgs/{org}/actions/secrets/{secret_name} <https://docs.github.com/rest/actions/secrets#get-an-organization-secret>`_
910
+ :calls: `PUT /orgs/{org}/dependabot/secrets/{secret_name} <https://docs.github.com/rest/dependabot/secrets#get-an-organization-secret>`_
911
+ """
912
+ assert isinstance(secret_name, str), secret_name
913
+ assert isinstance(unencrypted_value, str), unencrypted_value
914
+ assert isinstance(visibility, str), visibility
915
+ assert is_optional_list(selected_repositories, githubasyncio.Repository.Repository), selected_repositories
916
+ assert secret_type in ["actions", "dependabot"], "secret_type should be actions or dependabot"
917
+
918
+ if visibility == "selected":
919
+ assert isinstance(selected_repositories, list) and all(
920
+ isinstance(element, githubasyncio.Repository.Repository) for element in selected_repositories
921
+ ), selected_repositories
922
+ else:
923
+ assert is_undefined(selected_repositories)
924
+
925
+ public_key = await self.get_public_key(secret_type=secret_type)
926
+ payload = await public_key.encrypt(unencrypted_value)
927
+ put_parameters: dict[str, Any] = {
928
+ "key_id": (await public_key.key_id),
929
+ "encrypted_value": payload,
930
+ "visibility": visibility,
931
+ }
932
+ if is_defined(selected_repositories):
933
+ # Dependbot and Actions endpoint expects different types
934
+ # https://docs.github.com/en/rest/dependabot/secrets?apiVersion=2022-11-28#create-or-update-an-organization-secret
935
+ # https://docs.github.com/en/rest/actions/secrets?apiVersion=2022-11-28#create-or-update-an-organization-secret
936
+ if secret_type == "actions":
937
+ put_parameters["selected_repository_ids"] = [(await element.id) for element in selected_repositories]
938
+ if secret_type == "dependabot":
939
+ put_parameters["selected_repository_ids"] = [str(await element.id) for element in selected_repositories]
940
+
941
+ quoted_secret_name = urllib.parse.quote(secret_name, safe="")
942
+ url = f"{await self.url}/{secret_type}/secrets/{quoted_secret_name}"
943
+ await self._requester.requestJsonAndCheck("PUT", url, input=put_parameters)
944
+
945
+ return githubasyncio.OrganizationSecret.OrganizationSecret(
946
+ self._requester,
947
+ url=url,
948
+ attributes={
949
+ "name": secret_name,
950
+ "visibility": visibility,
951
+ "selected_repositories_url": f"{url}/repositories",
952
+ },
953
+ completed=False,
954
+ )
955
+
956
+ async def get_secrets(self, secret_type: str = "actions") -> PaginatedList[OrganizationSecret]:
957
+ """
958
+ Gets all organization secrets :param secret_type: string options actions or dependabot :rtype:
959
+
960
+ :calls: `GET /orgs/{org}/actions/secrets <https://docs.github.com/rest/actions/secrets#list-organization-
961
+ secrets>`_ :calls: `GET /orgs/{org}/dependabot/secrets
962
+ <https://docs.github.com/rest/dependabot/secrets#list-organization-secrets>`_
963
+
964
+ """
965
+ assert secret_type in ["actions", "dependabot"], "secret_type should be actions or dependabot"
966
+ return PaginatedList(
967
+ githubasyncio.OrganizationSecret.OrganizationSecret,
968
+ self._requester,
969
+ f"{await self.url}/{secret_type}/secrets",
970
+ None,
971
+ list_item="secrets",
972
+ )
973
+
974
+ async def get_secret(self, secret_name: str, secret_type: str = "actions") -> OrganizationSecret:
975
+ """
976
+ :calls: `GET /orgs/{org}/actions/secrets/{secret_name} <https://docs.github.com/rest/actions/secrets#get-an-organization-secret>`_
977
+ :calls: `GET /orgs/{org}/dependabot/secrets/{secret_name} <https://docs.github.com/rest/actions/secrets#get-an-organization-secret>`_
978
+ :param secret_name: string
979
+ :param secret_type: string options actions or dependabot
980
+ :rtype: githubasyncio.OrganizationSecret.OrganizationSecret
981
+ """
982
+ assert isinstance(secret_name, str), secret_name
983
+ assert secret_type in ["actions", "dependabot"], "secret_type should be actions or dependabot"
984
+ secret_name = urllib.parse.quote(secret_name, safe="")
985
+ url = f"{await self.url}/{secret_type}/secrets/{secret_name}"
986
+ return githubasyncio.OrganizationSecret.OrganizationSecret(self._requester, url=url)
987
+
988
+ async def create_team(
989
+ self,
990
+ name: str,
991
+ repo_names: Opt[list[Repository]] = NotSet,
992
+ permission: Opt[str] = NotSet,
993
+ privacy: Opt[str] = NotSet,
994
+ description: Opt[str] = NotSet,
995
+ parent_team_id: Opt[int] = NotSet,
996
+ maintainers: Opt[list[str]] = NotSet,
997
+ notification_setting: Opt[str] = NotSet,
998
+ ) -> Team:
999
+ """
1000
+ :calls: `POST /orgs/{org}/teams <https://docs.github.com/en/rest/reference/teams#list-teams>`_
1001
+ :param name: string
1002
+ :param repo_names: list of :class:`githubasyncio.Repository.Repository`
1003
+ :param permission: string
1004
+ :param privacy: string
1005
+ :param description: string
1006
+ :param parent_team_id: integer
1007
+ :param maintainers: list of: integer
1008
+ :param notification_setting: string
1009
+ :rtype: :class:`githubasyncio.Team.Team`
1010
+ """
1011
+ assert isinstance(name, str), name
1012
+ assert is_optional_list(repo_names, githubasyncio.Repository.Repository), repo_names
1013
+ assert is_optional_list(maintainers, str), maintainers
1014
+ assert is_optional(parent_team_id, int), parent_team_id
1015
+ assert is_optional(permission, str), permission
1016
+ assert is_optional(privacy, str), privacy
1017
+ assert is_optional(description, str), description
1018
+ assert notification_setting in ["notifications_enabled", "notifications_disabled", NotSet], notification_setting
1019
+ post_parameters: dict[str, Any] = NotSet.remove_unset_items(
1020
+ {
1021
+ "name": name,
1022
+ "permission": permission,
1023
+ "privacy": privacy,
1024
+ "description": description,
1025
+ "parent_team_id": parent_team_id,
1026
+ "maintainers": maintainers,
1027
+ "notification_setting": notification_setting,
1028
+ }
1029
+ )
1030
+ if is_defined(repo_names):
1031
+ post_parameters["repo_names"] = [(await element._identity) for element in repo_names]
1032
+ headers, data = await self._requester.requestJsonAndCheck(
1033
+ "POST", f"{await self.url}/teams", input=post_parameters
1034
+ )
1035
+ return githubasyncio.Team.Team(self._requester, headers, data, completed=True)
1036
+
1037
+ async def create_variable(
1038
+ self,
1039
+ variable_name: str,
1040
+ value: str,
1041
+ visibility: str = "all",
1042
+ selected_repositories: Opt[list[Repository]] = NotSet,
1043
+ ) -> OrganizationVariable:
1044
+ """
1045
+ :calls: `POST /orgs/{org}/actions/variables <https://docs.github.com/en/rest/actions/variables#create-an-organization-variable>`_
1046
+ :param variable_name: string
1047
+ :param value: string
1048
+ :param visibility: string
1049
+ :param selected_repositories: list of :class:`githubasyncio.Repository.Repository`
1050
+ :rtype: githubasyncio.OrganizationVariable.OrganizationVariable
1051
+ """
1052
+ assert isinstance(variable_name, str), variable_name
1053
+ assert isinstance(value, str), value
1054
+ assert isinstance(visibility, str), visibility
1055
+ if visibility == "selected":
1056
+ assert isinstance(selected_repositories, list) and all(
1057
+ isinstance(element, githubasyncio.Repository.Repository) for element in selected_repositories
1058
+ ), selected_repositories
1059
+ else:
1060
+ assert is_undefined(selected_repositories)
1061
+
1062
+ post_parameters: dict[str, Any] = {
1063
+ "name": variable_name,
1064
+ "value": value,
1065
+ "visibility": visibility,
1066
+ }
1067
+ if is_defined(selected_repositories):
1068
+ post_parameters["selected_repository_ids"] = [(await element.id) for element in selected_repositories]
1069
+
1070
+ await self._requester.requestJsonAndCheck("POST", f"{await self.url}/actions/variables", input=post_parameters)
1071
+
1072
+ quoted_variable_name = urllib.parse.quote(variable_name, safe="")
1073
+ url = f"{await self.url}/actions/variables/{quoted_variable_name}"
1074
+ return githubasyncio.OrganizationVariable.OrganizationVariable(
1075
+ requester=self._requester,
1076
+ headers={},
1077
+ attributes={
1078
+ "name": variable_name,
1079
+ "visibility": visibility,
1080
+ "value": value,
1081
+ "selected_repositories_url": f"{url}/repositories",
1082
+ "url": url,
1083
+ },
1084
+ completed=False,
1085
+ )
1086
+
1087
+ async def get_variables(self) -> PaginatedList[OrganizationVariable]:
1088
+ """
1089
+ Gets all organization variables :rtype: :class:`PaginatedList` of
1090
+ :class:`githubasyncio.OrganizationVariable.OrganizationVariable`
1091
+ """
1092
+ return PaginatedList(
1093
+ githubasyncio.OrganizationVariable.OrganizationVariable,
1094
+ self._requester,
1095
+ f"{await self.url}/actions/variables",
1096
+ None,
1097
+ list_item="variables",
1098
+ )
1099
+
1100
+ async def get_variable(self, variable_name: str) -> OrganizationVariable:
1101
+ """
1102
+ :calls: `GET /orgs/{org}/actions/variables/{name} <https://docs.github.com/en/rest/actions/variables#get-an-organization-variable>`_
1103
+ :param variable_name: string
1104
+ :rtype: githubasyncio.OrganizationVariable.OrganizationVariable
1105
+ """
1106
+ assert isinstance(variable_name, str), variable_name
1107
+ variable_name = urllib.parse.quote(variable_name, safe="")
1108
+ url = f"{await self.url}/actions/variables/{variable_name}"
1109
+ return githubasyncio.OrganizationVariable.OrganizationVariable(self._requester, url=url)
1110
+
1111
+ async def delete_hook(self, id: int) -> None:
1112
+ """
1113
+ :calls: `DELETE /orgs/{org}/hooks/{hook_id} <https://docs.github.com/en/rest/reference/orgs#webhooks>`_
1114
+ :param id: integer
1115
+ :rtype: None`
1116
+ """
1117
+ assert isinstance(id, int), id
1118
+ headers, data = await self._requester.requestJsonAndCheck("DELETE", f"{await self.url}/hooks/{id}")
1119
+
1120
+ async def edit(
1121
+ self,
1122
+ billing_email: Opt[str] = NotSet,
1123
+ blog: Opt[str] = NotSet,
1124
+ company: Opt[str] = NotSet,
1125
+ description: Opt[str] = NotSet,
1126
+ email: Opt[str] = NotSet,
1127
+ location: Opt[str] = NotSet,
1128
+ name: Opt[str] = NotSet,
1129
+ ) -> None:
1130
+ """
1131
+ :calls: `PATCH /orgs/{org} <https://docs.github.com/en/rest/reference/orgs>`_
1132
+ """
1133
+ assert is_optional(billing_email, str), billing_email
1134
+ assert is_optional(blog, str), blog
1135
+ assert is_optional(company, str), company
1136
+ assert is_optional(description, str), description
1137
+ assert is_optional(email, str), email
1138
+ assert is_optional(location, str), location
1139
+ assert is_optional(name, str), name
1140
+ post_parameters = NotSet.remove_unset_items(
1141
+ {
1142
+ "billing_email": billing_email,
1143
+ "blog": blog,
1144
+ "company": company,
1145
+ "description": description,
1146
+ "email": email,
1147
+ "location": location,
1148
+ "name": name,
1149
+ }
1150
+ )
1151
+
1152
+ headers, data = await self._requester.requestJsonAndCheck("PATCH", await self.url, input=post_parameters)
1153
+ self._useAttributes(data)
1154
+ self._set_complete()
1155
+
1156
+ @deprecated("Use Organization.get_hook(id).edit(…) instead")
1157
+ async def edit_hook(
1158
+ self,
1159
+ id: int,
1160
+ name: str,
1161
+ config: dict[str, str],
1162
+ events: Opt[list[str]] = NotSet,
1163
+ active: Opt[bool] = NotSet,
1164
+ ) -> Hook:
1165
+ """
1166
+ :calls: `PATCH /orgs/{org}/hooks/{hook_id} <https://docs.github.com/en/rest/reference/orgs#webhooks>`_
1167
+ """
1168
+ assert isinstance(id, int), id
1169
+ assert isinstance(name, str), name
1170
+ assert isinstance(config, dict), config
1171
+ assert is_optional_list(events, str), events
1172
+ assert is_optional(active, bool), active
1173
+ post_parameters: dict[str, Any] = NotSet.remove_unset_items(
1174
+ {"name": name, "config": config, "events": events, "active": active}
1175
+ )
1176
+
1177
+ headers, data = await self._requester.requestJsonAndCheck(
1178
+ "PATCH", f"{await self.url}/hooks/{id}", input=post_parameters
1179
+ )
1180
+ return githubasyncio.Hook.Hook(self._requester, headers, data, completed=True)
1181
+
1182
+ async def get_events(self) -> PaginatedList[Event]:
1183
+ """
1184
+ :calls: `GET /orgs/{org}/events <https://docs.github.com/en/rest/reference/activity#events>`_
1185
+ :rtype: :class:`PaginatedList` of :class:`githubasyncio.Event.Event`
1186
+ """
1187
+ return PaginatedList(githubasyncio.Event.Event, self._requester, f"{await self.url}/events", None)
1188
+
1189
+ async def get_hook(self, id: int) -> Hook:
1190
+ """
1191
+ :calls: `GET /orgs/{org}/hooks/{hook_id} <https://docs.github.com/en/rest/reference/orgs#webhooks>`_
1192
+ """
1193
+ assert isinstance(id, int), id
1194
+ url = f"{await self.url}/hooks/{id}"
1195
+ return githubasyncio.Hook.Hook(self._requester, url=url)
1196
+
1197
+ async def get_hooks(self) -> PaginatedList[Hook]:
1198
+ """
1199
+ :calls: `GET /orgs/{org}/hooks <https://docs.github.com/en/rest/reference/orgs#webhooks>`_
1200
+ """
1201
+ return PaginatedList(githubasyncio.Hook.Hook, self._requester, f"{await self.url}/hooks", None)
1202
+
1203
+ async def get_hook_delivery(self, hook_id: int, delivery_id: int) -> HookDelivery:
1204
+ """
1205
+ :calls: `GET /orgs/{org}/hooks/{hook_id}/deliveries/{delivery_id} <https://docs.github.com/en/rest/reference/orgs#get-a-webhook-delivery-for-an-organization-webhook>`_
1206
+ :param hook_id: integer
1207
+ :param delivery_id: integer
1208
+ :rtype: :class:`githubasyncio.HookDelivery.HookDelivery`
1209
+ """
1210
+ assert isinstance(hook_id, int), hook_id
1211
+ assert isinstance(delivery_id, int), delivery_id
1212
+ headers, data = await self._requester.requestJsonAndCheck(
1213
+ "GET", f"{await self.url}/hooks/{hook_id}/deliveries/{delivery_id}"
1214
+ )
1215
+ return githubasyncio.HookDelivery.HookDelivery(self._requester, headers, data)
1216
+
1217
+ async def get_hook_deliveries(self, hook_id: int) -> PaginatedList[HookDeliverySummary]:
1218
+ """
1219
+ :calls: `GET /orgs/{org}/hooks/{hook_id}/deliveries <https://docs.github.com/en/rest/reference/orgs#list-deliveries-for-an-organization-webhook>`_
1220
+ :param hook_id: integer
1221
+ :rtype: :class:`PaginatedList` of :class:`githubasyncio.HookDelivery.HookDeliverySummary`
1222
+ """
1223
+ assert isinstance(hook_id, int), hook_id
1224
+ return PaginatedList(
1225
+ githubasyncio.HookDelivery.HookDeliverySummary,
1226
+ self._requester,
1227
+ f"{await self.url}/hooks/{hook_id}/deliveries",
1228
+ None,
1229
+ )
1230
+
1231
+ async def get_issues(
1232
+ self,
1233
+ filter: Opt[str] = NotSet,
1234
+ state: Opt[str] = NotSet,
1235
+ labels: Opt[list[Label]] = NotSet,
1236
+ sort: Opt[str] = NotSet,
1237
+ direction: Opt[str] = NotSet,
1238
+ since: Opt[datetime] = NotSet,
1239
+ ) -> PaginatedList[Issue]:
1240
+ """
1241
+ :calls: `GET /orgs/{org}/issues <https://docs.github.com/en/rest/reference/issues>`_
1242
+ :rtype: :class:`PaginatedList` of :class:`githubasyncio.Issue.Issue`
1243
+ :param filter: string
1244
+ :param state: string
1245
+ :param labels: list of :class:`githubasyncio.Label.Label`
1246
+ :param sort: string
1247
+ :param direction: string
1248
+ :param since: datetime
1249
+ :rtype: :class:`PaginatedList` of :class:`githubasyncio.Issue.Issue`
1250
+ """
1251
+ assert is_optional(filter, str), filter
1252
+ assert is_optional(state, str), state
1253
+ assert is_optional_list(labels, githubasyncio.Label.Label), labels
1254
+ assert is_optional(sort, str), sort
1255
+ assert is_optional(direction, str), direction
1256
+ assert is_optional(since, datetime), since
1257
+ url_parameters: dict[str, Any] = NotSet.remove_unset_items(
1258
+ {"filter": filter, "state": state, "sort": sort, "direction": direction}
1259
+ )
1260
+ if is_defined(labels):
1261
+ url_parameters["labels"] = ",".join([(await label.name) for label in labels])
1262
+ if is_defined(since):
1263
+ url_parameters["since"] = since.strftime("%Y-%m-%dT%H:%M:%SZ")
1264
+ return PaginatedList(githubasyncio.Issue.Issue, self._requester, f"{await self.url}/issues", url_parameters)
1265
+
1266
+ async def get_members(
1267
+ self,
1268
+ filter_: Opt[str] = NotSet,
1269
+ role: Opt[str] = NotSet,
1270
+ ) -> PaginatedList[NamedUser]:
1271
+ """
1272
+ :calls: `GET /orgs/{org}/members <https://docs.github.com/en/rest/reference/orgs#members>`_
1273
+ """
1274
+ assert is_optional(filter_, str), filter_
1275
+ assert is_optional(role, str), role
1276
+
1277
+ url_parameters = NotSet.remove_unset_items({"filter": filter_, "role": role})
1278
+
1279
+ return PaginatedList(
1280
+ githubasyncio.NamedUser.NamedUser,
1281
+ self._requester,
1282
+ f"{await self.url}/members",
1283
+ url_parameters,
1284
+ )
1285
+
1286
+ async def get_projects(self, state: Opt[str] = NotSet) -> PaginatedList[Project]:
1287
+ """
1288
+ :calls: `GET /orgs/{org}/projects <https://docs.github.com/en/rest/reference/projects#list-organization-projects>`_
1289
+ """
1290
+ url_parameters = NotSet.remove_unset_items({"state": state})
1291
+
1292
+ return PaginatedList(
1293
+ githubasyncio.Project.Project,
1294
+ self._requester,
1295
+ f"{await self.url}/projects",
1296
+ url_parameters,
1297
+ headers={"Accept": Consts.mediaTypeProjectsPreview},
1298
+ )
1299
+
1300
+ async def get_public_members(self) -> PaginatedList[NamedUser]:
1301
+ """
1302
+ :calls: `GET /orgs/{org}/public_members <https://docs.github.com/en/rest/reference/orgs#members>`_
1303
+ :rtype: :class:`PaginatedList` of :class:`githubasyncio.NamedUser.NamedUser`
1304
+ """
1305
+ return PaginatedList(
1306
+ githubasyncio.NamedUser.NamedUser,
1307
+ self._requester,
1308
+ f"{await self.url}/public_members",
1309
+ None,
1310
+ )
1311
+
1312
+ async def get_outside_collaborators(self, filter_: Opt[str] = NotSet) -> PaginatedList[NamedUser]:
1313
+ """
1314
+ :calls: `GET /orgs/{org}/outside_collaborators <https://docs.github.com/en/rest/reference/orgs#outside-collaborators>`_
1315
+ """
1316
+ assert is_optional(filter_, str), filter_
1317
+
1318
+ url_parameters = NotSet.remove_unset_items({"filter": filter_})
1319
+ return PaginatedList(
1320
+ githubasyncio.NamedUser.NamedUser,
1321
+ self._requester,
1322
+ f"{await self.url}/outside_collaborators",
1323
+ url_parameters,
1324
+ )
1325
+
1326
+ async def remove_outside_collaborator(self, collaborator: NamedUser) -> None:
1327
+ """
1328
+ :calls: `DELETE /orgs/{org}/outside_collaborators/{username} <https://docs.github.com/en/rest/reference/orgs#outside-collaborators>`_
1329
+ :param collaborator: :class:`githubasyncio.NamedUser.NamedUser`
1330
+ :rtype: None
1331
+ """
1332
+ assert isinstance(collaborator, githubasyncio.NamedUser.NamedUser), collaborator
1333
+ headers, data = await self._requester.requestJsonAndCheck(
1334
+ "DELETE", f"{await self.url}/outside_collaborators/{(await collaborator._identity)}"
1335
+ )
1336
+
1337
+ async def convert_to_outside_collaborator(self, member: NamedUser) -> None:
1338
+ """
1339
+ :calls: `PUT /orgs/{org}/outside_collaborators/{username} <https://docs.github.com/en/rest/reference/orgs#outside-collaborators>`_
1340
+ :param member: :class:`githubasyncio.NamedUser.NamedUser`
1341
+ :rtype: None
1342
+ """
1343
+ assert isinstance(member, githubasyncio.NamedUser.NamedUser), member
1344
+ headers, data = await self._requester.requestJsonAndCheck(
1345
+ "PUT", f"{await self.url}/outside_collaborators/{(await member._identity)}"
1346
+ )
1347
+
1348
+ async def get_public_key(self, secret_type: str = "actions") -> PublicKey:
1349
+ """
1350
+ :calls: `GET /orgs/{org}/actions/secrets/public-key <http://docs.github.com/rest/actions/secrets#get-an-organization-public-key>`_
1351
+ :calls: `GET /orgs/{org}/dependabot/secrets/public-key <http://docs.github.com/rest/dependabot/secrets#get-an-organization-public-key>`_
1352
+ :param secret_type: string options actions or dependabot
1353
+ :rtype: :class:`githubasyncio.PublicKey.PublicKey`
1354
+ """
1355
+ headers, data = await self._requester.requestJsonAndCheck(
1356
+ "GET", f"{await self.url}/{secret_type}/secrets/public-key"
1357
+ )
1358
+ return githubasyncio.PublicKey.PublicKey(self._requester, headers, data, completed=True)
1359
+
1360
+ async def get_copilot(self) -> Copilot:
1361
+ """
1362
+ Provides various Copilot-related endpoints for this organization.
1363
+
1364
+ :rtype: :class:`githubasyncio.Copilot.Copilot`
1365
+
1366
+ """
1367
+ return githubasyncio.Copilot.Copilot(self._requester, await self.login)
1368
+
1369
+ async def get_repo(self, name: str) -> Repository:
1370
+ """
1371
+ :calls: `GET /repos/{owner}/{repo} <https://docs.github.com/en/rest/reference/repos>`_
1372
+ :param name: string
1373
+ :rtype: :class:`githubasyncio.Repository.Repository`
1374
+ """
1375
+ assert isinstance(name, str), name
1376
+ name = urllib.parse.quote(name, safe="")
1377
+ url = f"/repos/{await self.login}/{name}"
1378
+ return githubasyncio.Repository.Repository(self._requester, url=url, accept=Consts.repoVisibilityPreview)
1379
+
1380
+ async def get_repos(
1381
+ self,
1382
+ type: Opt[str] = NotSet,
1383
+ sort: Opt[str] = NotSet,
1384
+ direction: Opt[str] = NotSet,
1385
+ ) -> PaginatedList[Repository]:
1386
+ """
1387
+ :calls: `GET /orgs/{org}/repos <https://docs.github.com/en/rest/reference/repos>`_
1388
+ :param type: string ('all', 'public', 'private', 'forks', 'sources', 'member')
1389
+ :param sort: string ('created', 'updated', 'pushed', 'full_name')
1390
+ :param direction: string ('asc', desc')
1391
+ """
1392
+ assert is_optional(type, str), type
1393
+ assert is_optional(sort, str), sort
1394
+ assert is_optional(direction, str), direction
1395
+
1396
+ url_parameters = NotSet.remove_unset_items({"type": type, "sort": sort, "direction": direction})
1397
+
1398
+ return PaginatedList(
1399
+ githubasyncio.Repository.Repository,
1400
+ self._requester,
1401
+ f"{await self.url}/repos",
1402
+ url_parameters,
1403
+ headers={"Accept": Consts.repoVisibilityPreview},
1404
+ )
1405
+
1406
+ def get_team(self, id: int) -> Team:
1407
+ """
1408
+ :calls: `GET /teams/{team_id} <https://docs.github.com/en/rest/reference/teams>`_
1409
+ """
1410
+ assert isinstance(id, int), id
1411
+ url = f"/teams/{id}"
1412
+ return githubasyncio.Team.Team(self._requester, url=url)
1413
+
1414
+ async def get_team_by_slug(self, slug: str) -> Team:
1415
+ """
1416
+ :calls: `GET /orgs/{org}/teams/{team_slug} <https://docs.github.com/en/rest/reference/teams#get-a-team-by-name>`_
1417
+ """
1418
+ assert isinstance(slug, str), slug
1419
+ slug = urllib.parse.quote(slug, safe="")
1420
+ url = f"{await self.url}/teams/{slug}"
1421
+ return githubasyncio.Team.Team(self._requester, url=url)
1422
+
1423
+ async def get_teams(self) -> PaginatedList[Team]:
1424
+ """
1425
+ :calls: `GET /orgs/{org}/teams <https://docs.github.com/en/rest/reference/teams#list-teams>`_
1426
+ """
1427
+ return PaginatedList(githubasyncio.Team.Team, self._requester, f"{await self.url}/teams", None)
1428
+
1429
+ @deprecated("Use get_invitations instead")
1430
+ async def invitations(self) -> PaginatedList[OrganizationInvitation]:
1431
+ """
1432
+ :calls: `GET /orgs/{org}/invitations <https://docs.github.com/en/rest/reference/orgs#members>`_
1433
+ """
1434
+ return await self.get_invitations()
1435
+
1436
+ async def get_invitations(self) -> PaginatedList[OrganizationInvitation]:
1437
+ """
1438
+ :calls: `GET /orgs/{org}/invitations <https://docs.github.com/en/rest/reference/orgs#members>`_
1439
+ """
1440
+ return PaginatedList(
1441
+ githubasyncio.NamedUser.OrganizationInvitation,
1442
+ self._requester,
1443
+ f"{await self.url}/invitations",
1444
+ None,
1445
+ headers={"Accept": Consts.mediaTypeOrganizationInvitationPreview},
1446
+ )
1447
+
1448
+ async def get_failed_invitations(self) -> PaginatedList[OrganizationInvitation]:
1449
+ """
1450
+ :calls: `GET /orgs/{org}/failed_invitations <https://docs.github.com/en/rest/orgs/members#list-failed-organization-invitations>`_
1451
+ """
1452
+ return PaginatedList(
1453
+ githubasyncio.NamedUser.OrganizationInvitation,
1454
+ self._requester,
1455
+ f"{await self.url}/failed_invitations",
1456
+ None,
1457
+ )
1458
+
1459
+ async def invite_user(
1460
+ self,
1461
+ user: Opt[NamedUser] = NotSet,
1462
+ email: Opt[str] = NotSet,
1463
+ role: Opt[str] = NotSet,
1464
+ teams: Opt[list[Team]] = NotSet,
1465
+ ) -> None:
1466
+ """
1467
+ :calls: `POST /orgs/{org}/invitations <https://docs.github.com/en/rest/reference/orgs#members>`_
1468
+ :param user: :class:`githubasyncio.NamedUser.NamedUser`
1469
+ :param email: string
1470
+ :param role: string
1471
+ :param teams: array of :class:`githubasyncio.Team.Team`
1472
+ :rtype: None
1473
+ """
1474
+ assert is_optional(user, githubasyncio.NamedUser.NamedUser), user
1475
+ assert is_optional(email, str), email
1476
+ assert is_defined(email) != is_defined(user), "specify only one of email or user"
1477
+
1478
+ assert is_undefined(role) or role in ["admin", "direct_member", "billing_manager"], role
1479
+ assert is_optional_list(teams, githubasyncio.Team.Team), teams
1480
+
1481
+ parameters: dict[str, Any] = NotSet.remove_unset_items({"email": email, "role": role})
1482
+
1483
+ if is_defined(user):
1484
+ parameters["invitee_id"] = await user.id
1485
+ if is_defined(teams):
1486
+ parameters["team_ids"] = [(await t.id) for t in teams]
1487
+
1488
+ headers, data = await self._requester.requestJsonAndCheck(
1489
+ "POST",
1490
+ f"{await self.url}/invitations",
1491
+ headers={"Accept": Consts.mediaTypeOrganizationInvitationPreview},
1492
+ input=parameters,
1493
+ )
1494
+
1495
+ async def cancel_invitation(self, invitee: NamedUser) -> bool:
1496
+ """
1497
+ :calls: `DELETE /orgs/{org}/invitations/{invitation_id} <https://docs.github.com/en/rest/reference/orgs#cancel-an-organization-invitation>`_
1498
+ :param invitee: :class:`githubasyncio.NamedUser.NamedUser`
1499
+ :rtype: bool
1500
+ """
1501
+ assert isinstance(invitee, githubasyncio.NamedUser.NamedUser), invitee
1502
+ status, headers, data = await self._requester.requestJson(
1503
+ "DELETE", f"{await self.url}/invitations/{(await invitee.id)}"
1504
+ )
1505
+ return status == 204
1506
+
1507
+ async def has_in_members(self, member: NamedUser) -> bool:
1508
+ """
1509
+ :calls: `GET /orgs/{org}/members/{username} <https://docs.github.com/en/rest/reference/orgs#members>`_
1510
+ :param member: :class:`githubasyncio.NamedUser.NamedUser`
1511
+ :rtype: bool
1512
+ """
1513
+ assert isinstance(member, githubasyncio.NamedUser.NamedUser), member
1514
+ status, headers, data = await self._requester.requestJson(
1515
+ "GET", f"{await self.url}/members/{(await member._identity)}"
1516
+ )
1517
+ if status == 302:
1518
+ status, headers, data = await self._requester.requestJson("GET", headers["location"])
1519
+ return status == 204
1520
+
1521
+ async def has_in_public_members(self, public_member: NamedUser) -> bool:
1522
+ """
1523
+ :calls: `GET /orgs/{org}/public_members/{username} <https://docs.github.com/en/rest/reference/orgs#members>`_
1524
+ :param public_member: :class:`githubasyncio.NamedUser.NamedUser`
1525
+ :rtype: bool
1526
+ """
1527
+ assert isinstance(public_member, githubasyncio.NamedUser.NamedUser), public_member
1528
+ status, headers, data = await self._requester.requestJson(
1529
+ "GET", f"{await self.url}/public_members/{(await public_member._identity)}"
1530
+ )
1531
+ return status == 204
1532
+
1533
+ async def remove_from_membership(self, member: NamedUser) -> None:
1534
+ """
1535
+ :calls: `DELETE /orgs/{org}/memberships/{username} <https://docs.github.com/en/rest/reference/orgs#remove-an-organization-member>`_
1536
+ :param member: :class:`githubasyncio.NamedUser.NamedUser`
1537
+ :rtype: None
1538
+ """
1539
+ assert isinstance(member, githubasyncio.NamedUser.NamedUser), member
1540
+ headers, data = await self._requester.requestJsonAndCheck(
1541
+ "DELETE", f"{await self.url}/memberships/{(await member._identity)}"
1542
+ )
1543
+
1544
+ async def remove_from_members(self, member: NamedUser) -> None:
1545
+ """
1546
+ :calls: `DELETE /orgs/{org}/members/{username} <https://docs.github.com/en/rest/reference/orgs#members>`_
1547
+ :param member: :class:`githubasyncio.NamedUser.NamedUser`
1548
+ :rtype: None
1549
+ """
1550
+ assert isinstance(member, githubasyncio.NamedUser.NamedUser), member
1551
+ headers, data = await self._requester.requestJsonAndCheck(
1552
+ "DELETE", f"{await self.url}/members/{(await member._identity)}"
1553
+ )
1554
+
1555
+ async def remove_from_public_members(self, public_member: NamedUser) -> None:
1556
+ """
1557
+ :calls: `DELETE /orgs/{org}/public_members/{username} <https://docs.github.com/en/rest/reference/orgs#members>`_
1558
+ :param public_member: :class:`githubasyncio.NamedUser.NamedUser`
1559
+ :rtype: None
1560
+ """
1561
+ assert isinstance(public_member, githubasyncio.NamedUser.NamedUser), public_member
1562
+ headers, data = await self._requester.requestJsonAndCheck(
1563
+ "DELETE", f"{await self.url}/public_members/{(await public_member._identity)}"
1564
+ )
1565
+
1566
+ async def create_migration(
1567
+ self,
1568
+ repos: list[str],
1569
+ lock_repositories: Opt[bool] = NotSet,
1570
+ exclude_attachments: Opt[bool] = NotSet,
1571
+ ) -> Migration:
1572
+ """
1573
+ :calls: `POST /orgs/{org}/migrations <https://docs.github.com/en/rest/reference/migrations#list-organization-migrations>`_
1574
+ :param repos: list or tuple of str
1575
+ :param lock_repositories: bool
1576
+ :param exclude_attachments: bool
1577
+ :rtype: :class:`githubasyncio.Migration.Migration`
1578
+ """
1579
+ assert isinstance(repos, (list, tuple)), repos
1580
+ assert all(isinstance(repo, str) for repo in repos), repos
1581
+ assert is_optional(lock_repositories, bool), lock_repositories
1582
+ assert is_optional(exclude_attachments, bool), exclude_attachments
1583
+ post_parameters = NotSet.remove_unset_items(
1584
+ {
1585
+ "repositories": repos,
1586
+ "lock_repositories": lock_repositories,
1587
+ "exclude_attachments": exclude_attachments,
1588
+ }
1589
+ )
1590
+
1591
+ headers, data = await self._requester.requestJsonAndCheck(
1592
+ "POST",
1593
+ f"/orgs/{await self.login}/migrations",
1594
+ input=post_parameters,
1595
+ headers={"Accept": Consts.mediaTypeMigrationPreview},
1596
+ )
1597
+ return githubasyncio.Migration.Migration(self._requester, headers, data, completed=True)
1598
+
1599
+ async def get_migrations(self) -> PaginatedList[Migration]:
1600
+ """
1601
+ :calls: `GET /orgs/{org}/migrations <https://docs.github.com/en/rest/reference/migrations#list-organization-migrations>`_
1602
+ :rtype: :class:`PaginatedList` of :class:`githubasyncio.Migration.Migration`
1603
+ """
1604
+ return PaginatedList(
1605
+ githubasyncio.Migration.Migration,
1606
+ self._requester,
1607
+ f"/orgs/{await self.login}/migrations",
1608
+ None,
1609
+ headers={"Accept": Consts.mediaTypeMigrationPreview},
1610
+ )
1611
+
1612
+ async def get_installations(self) -> PaginatedList[Installation]:
1613
+ """
1614
+ :calls: `GET /orgs/{org}/installations <https://docs.github.com/en/rest/reference/orgs#list-app-installations-for-an-organization>`_
1615
+ :rtype: :class:`PaginatedList` of :class:`githubasyncio.Installation.Installation`
1616
+ """
1617
+ return PaginatedList(
1618
+ githubasyncio.Installation.Installation,
1619
+ self._requester,
1620
+ f"{await self.url}/installations",
1621
+ None,
1622
+ headers=None,
1623
+ list_item="installations",
1624
+ )
1625
+
1626
+ async def get_dependabot_alerts(
1627
+ self,
1628
+ state: Opt[str] = NotSet,
1629
+ severity: Opt[str] = NotSet,
1630
+ ecosystem: Opt[str] = NotSet,
1631
+ package: Opt[str] = NotSet,
1632
+ scope: Opt[str] = NotSet,
1633
+ sort: Opt[str] = NotSet,
1634
+ direction: Opt[str] = NotSet,
1635
+ ) -> PaginatedList[OrganizationDependabotAlert]:
1636
+ """
1637
+ :calls: `GET /orgs/{org}/dependabot/alerts <https://docs.github.com/en/rest/dependabot/alerts#list-dependabot-alerts-for-an-organization>`_
1638
+ :param state: Optional string
1639
+ :param severity: Optional string
1640
+ :param ecosystem: Optional string
1641
+ :param package: Optional string
1642
+ :param scope: Optional string
1643
+ :param sort: Optional string
1644
+ :param direction: Optional string
1645
+ :rtype: :class:`PaginatedList` of :class:`githubasyncio.DependabotAlert.DependabotAlert`
1646
+ """
1647
+ allowed_states = ["auto_dismissed", "dismissed", "fixed", "open"]
1648
+ allowed_severities = ["low", "medium", "high", "critical"]
1649
+ allowed_ecosystems = ["composer", "go", "maven", "npm", "nuget", "pip", "pub", "rubygems", "rust"]
1650
+ allowed_scopes = ["development", "runtime"]
1651
+ allowed_sorts = ["created", "updated"]
1652
+ allowed_directions = ["asc", "desc"]
1653
+ assert state in allowed_states + [NotSet], f"State can be one of {', '.join(allowed_states)}"
1654
+ assert severity in allowed_severities + [NotSet], f"Severity can be one of {', '.join(allowed_severities)}"
1655
+ assert ecosystem in allowed_ecosystems + [NotSet], f"Ecosystem can be one of {', '.join(allowed_ecosystems)}"
1656
+ assert scope in allowed_scopes + [NotSet], f"Scope can be one of {', '.join(allowed_scopes)}"
1657
+ assert sort in allowed_sorts + [NotSet], f"Sort can be one of {', '.join(allowed_sorts)}"
1658
+ assert direction in allowed_directions + [NotSet], f"Direction can be one of {', '.join(allowed_directions)}"
1659
+ url_parameters = NotSet.remove_unset_items(
1660
+ {
1661
+ "state": state,
1662
+ "severity": severity,
1663
+ "ecosystem": ecosystem,
1664
+ "package": package,
1665
+ "scope": scope,
1666
+ "sort": sort,
1667
+ "direction": direction,
1668
+ }
1669
+ )
1670
+ return PaginatedList(
1671
+ githubasyncio.OrganizationDependabotAlert.OrganizationDependabotAlert,
1672
+ self._requester,
1673
+ f"{await self.url}/dependabot/alerts",
1674
+ url_parameters,
1675
+ )
1676
+
1677
+ async def get_codescan_alerts(
1678
+ self,
1679
+ tool_name: Opt[str] = NotSet,
1680
+ tool_guid: Opt[str] = NotSet,
1681
+ ref: Opt[str] = NotSet,
1682
+ pr: Opt[int] = NotSet,
1683
+ sort: Opt[str] = NotSet,
1684
+ direction: Opt[str] = NotSet,
1685
+ state: Opt[str] = NotSet,
1686
+ severity: Opt[str] = NotSet,
1687
+ ) -> PaginatedList[OrganizationCodeScanAlert]:
1688
+ """
1689
+ :calls: `GET /orgs/{org}/code-scanning/alerts <https://docs.github.com/en/rest/code-scanning/code-scanning#list-code-scanning-alerts-for-an-organization>`_
1690
+ :param tool_name: Optional string
1691
+ :param tool_guid: Optional string
1692
+ :param ref: Optional string
1693
+ :param pr: Optional integer
1694
+ :param sort: Optional string
1695
+ :param direction: Optional string
1696
+ :param state: Optional string
1697
+ :param severity: Optional string
1698
+ :rtype: :class:`PaginatedList` of :class:`githubasyncio.CodeScanAlert.CodeScanAlert`
1699
+ """
1700
+ allowed_sorts = ["created", "updated"]
1701
+ allowed_directions = ["asc", "desc"]
1702
+ allowed_states = ["open", "closed", "dismissed", "fixed"]
1703
+ allowed_severities = ["critical", "high", "medium", "low", "warning", "note", "error"]
1704
+ assert is_optional(tool_name, str), tool_name
1705
+ assert is_optional(tool_guid, str), tool_guid
1706
+ assert is_undefined(tool_name) or is_undefined(tool_guid), (
1707
+ "You can specify the tool by using either tool_guid or tool_name, but not both."
1708
+ )
1709
+ assert is_optional(ref, str), ref
1710
+ assert is_optional(pr, int), pr
1711
+ assert sort in allowed_sorts + [NotSet], f"Sort can be one of {', '.join(allowed_sorts)}"
1712
+ assert direction in allowed_directions + [NotSet], f"Direction can be one of {', '.join(allowed_directions)}"
1713
+ assert state in allowed_states + [NotSet], f"State can be one of {', '.join(allowed_states)}"
1714
+ assert severity in allowed_severities + [NotSet], f"Severity can be one of {', '.join(allowed_severities)}"
1715
+ url_parameters = NotSet.remove_unset_items(
1716
+ {
1717
+ "tool_name": tool_name,
1718
+ "tool_guid": tool_guid,
1719
+ "ref": ref,
1720
+ "pr": pr,
1721
+ "sort": sort,
1722
+ "direction": direction,
1723
+ "state": state,
1724
+ "severity": severity,
1725
+ }
1726
+ )
1727
+ return PaginatedList(
1728
+ githubasyncio.OrganizationCodeScanAlert.OrganizationCodeScanAlert,
1729
+ self._requester,
1730
+ f"{await self.url}/code-scanning/alerts",
1731
+ url_parameters,
1732
+ )
1733
+
1734
+ async def get_secret_scanning_alerts(
1735
+ self,
1736
+ state: Opt[str] = NotSet,
1737
+ secret_type: Opt[str] = NotSet,
1738
+ resolution: Opt[str] = NotSet,
1739
+ sort: Opt[str] = NotSet,
1740
+ direction: Opt[str] = NotSet,
1741
+ validity: Opt[str] = NotSet,
1742
+ is_publicly_leaked: Opt[bool] = NotSet,
1743
+ is_multi_repo: Opt[bool] = NotSet,
1744
+ hide_secret: Opt[bool] = NotSet,
1745
+ ) -> PaginatedList[OrganizationSecretScanAlert]:
1746
+ """
1747
+ :calls: `GET /orgs/{org}/secret-scanning/alerts <https://docs.github.com/en/rest/secret-scanning/secret-scanning#list-secret-scanning-alerts-for-an-organization>`_
1748
+ :param state: Optional string
1749
+ :param secret_type: Optional string
1750
+ :param resolution: Optional string
1751
+ :param sort: Optional string
1752
+ :param direction: Optional string
1753
+ :param validity: Optional string
1754
+ :param is_publicly_leaked: Optional bool
1755
+ :param is_multi_repo: Optional bool
1756
+ :param hide_secret: Optional bool
1757
+ :rtype: :class:`PaginatedList` of :class:`githubasyncio.SecretScanAlert.SecretScanAlert`
1758
+ """
1759
+ allowed_states = ["open", "resolved"]
1760
+ # allowed_secret_types = ["http_basic_authentication_header", "http_bearer_authentication_header", ...]
1761
+ allowed_resolutions = [
1762
+ "false_positive",
1763
+ "wont_fix",
1764
+ "revoked",
1765
+ "pattern_edited",
1766
+ "pattern_deleted",
1767
+ "used_in_tests",
1768
+ ]
1769
+ allowed_sorts = ["created", "updated"]
1770
+ allowed_directions = ["asc", "desc"]
1771
+ allowed_validities = ["active", "inactive", "unknown"]
1772
+ assert state in allowed_states + [NotSet], f"State can be one of {', '.join(allowed_states)}"
1773
+ # assert secret_type in allowed_secret_types + [NotSet], \
1774
+ # "Secret_type can be one of the tokens listed on \
1775
+ # https://docs.github.com/en/code-security/secret-scanning/introduction/supported-secret-scanning-patterns#supported-secrets"
1776
+ assert resolution in allowed_resolutions + [NotSet], (
1777
+ f"Resolution can be one of {', '.join(allowed_resolutions)}"
1778
+ )
1779
+ assert sort in allowed_sorts + [NotSet], f"Sort can be one of {', '.join(allowed_sorts)}"
1780
+ assert direction in allowed_directions + [NotSet], f"Direction can be one of {', '.join(allowed_directions)}"
1781
+ assert validity in allowed_validities + [NotSet], f"Validity can be one of {', '.join(allowed_validities)}"
1782
+ assert is_optional(is_publicly_leaked, bool), is_publicly_leaked
1783
+ assert is_optional(is_multi_repo, bool), is_multi_repo
1784
+ assert is_optional(hide_secret, bool), hide_secret
1785
+ url_parameters = NotSet.remove_unset_items(
1786
+ {
1787
+ "state": state,
1788
+ "secret_type": secret_type,
1789
+ "resolution": resolution,
1790
+ "sort": sort,
1791
+ "direction": direction,
1792
+ "validity": validity,
1793
+ "is_publicly_leaked": is_publicly_leaked,
1794
+ "is_multi_repo": is_multi_repo,
1795
+ "hide_secret": hide_secret,
1796
+ }
1797
+ )
1798
+ return PaginatedList(
1799
+ githubasyncio.OrganizationSecretScanAlert.OrganizationSecretScanAlert,
1800
+ self._requester,
1801
+ f"{await self.url}/secret-scanning/alerts",
1802
+ url_parameters,
1803
+ )
1804
+
1805
+ async def get_custom_properties(self) -> PaginatedList[OrganizationCustomProperty]:
1806
+ """
1807
+ :calls: `GET /orgs/{org}/properties/schema <https://docs.github.com/en/rest/orgs/custom-properties#get-all-custom-properties-for-an-organization>`_
1808
+ :rtype: :class:`PaginatedList` of :class:`githubasyncio.OrganizationCustomProperty.OrganizationCustomProperty`
1809
+ """
1810
+ return PaginatedList(
1811
+ contentClass=githubasyncio.OrganizationCustomProperty.OrganizationCustomProperty,
1812
+ requester=self._requester,
1813
+ firstUrl=f"{await self.url}/properties/schema",
1814
+ firstParams=None,
1815
+ )
1816
+
1817
+ async def get_custom_property(self, property_name: str) -> OrganizationCustomProperty:
1818
+ """
1819
+ :calls: `GET /orgs/{org}/properties/schema/{custom_property_name} <https://docs.github.com/en/rest/orgs/custom-properties#get-a-custom-property-for-an-organization>`_
1820
+ :param property_name: string
1821
+ :rtype: :class:`githubasyncio.OrganizationCustomProperty.OrganizationCustomProperty`
1822
+ """
1823
+ assert isinstance(property_name, str), property_name
1824
+ headers, data = await self._requester.requestJsonAndCheck(
1825
+ "GET", f"{await self.url}/properties/schema/{urllib.parse.quote(property_name)}"
1826
+ )
1827
+ return githubasyncio.OrganizationCustomProperty.OrganizationCustomProperty(
1828
+ requester=self._requester,
1829
+ headers=headers,
1830
+ attributes=data,
1831
+ )
1832
+
1833
+ async def create_custom_properties(self, properties: list[CustomProperty]) -> list[OrganizationCustomProperty]:
1834
+ """
1835
+ Create or update custom properties for an organization
1836
+ :calls: `PATCH /orgs/{org}/properties/schema <https://docs.github.com/en/rest/orgs/custom-properties#create-or-update-custom-properties-for-an-organization>`_
1837
+ :param properties: list of :class:`githubasyncio.OrganizationCustomProperty.CustomProperty`
1838
+ :rtype: list of :class:`githubasyncio.OrganizationCustomProperty.OrganizationCustomProperty`
1839
+ """
1840
+ assert isinstance(properties, list), properties
1841
+ assert all(isinstance(p, githubasyncio.OrganizationCustomProperty.CustomProperty) for p in properties), (
1842
+ properties
1843
+ )
1844
+ patch_parameters = {"properties": [p.to_dict() for p in properties]}
1845
+ headers, data = await self._requester.requestJsonAndCheck(
1846
+ "PATCH", f"{await self.url}/properties/schema", input=patch_parameters
1847
+ )
1848
+ return [
1849
+ githubasyncio.OrganizationCustomProperty.OrganizationCustomProperty(
1850
+ requester=self._requester, headers=headers, attributes=property
1851
+ )
1852
+ for property in data
1853
+ ]
1854
+
1855
+ async def create_custom_property(self, property: CustomProperty) -> OrganizationCustomProperty:
1856
+ """
1857
+ Create or update a custom property for an organization
1858
+ :calls: `PUT /orgs/{org}/properties/schema/{custom_property_name} <https://docs.github.com/en/rest/orgs/custom-properties#create-or-update-a-custom-property-for-an-organization>`_
1859
+ :param property: :class:`githubasyncio.OrganizationCustomProperty.CustomProperty`
1860
+ :rtype: :class:`githubasyncio.OrganizationCustomProperty.OrganizationCustomProperty`
1861
+ """
1862
+ assert isinstance(property, githubasyncio.OrganizationCustomProperty.CustomProperty), property
1863
+
1864
+ post_parameters = property.to_dict()
1865
+ property_name = post_parameters.pop("property_name")
1866
+ headers, data = await self._requester.requestJsonAndCheck(
1867
+ "PUT", f"{await self.url}/properties/schema/{property_name}", input=post_parameters
1868
+ )
1869
+ return githubasyncio.OrganizationCustomProperty.OrganizationCustomProperty(
1870
+ requester=self._requester, headers=headers, attributes=data
1871
+ )
1872
+
1873
+ async def remove_custom_property(self, property_name: str) -> None:
1874
+ """
1875
+ :calls: `DELETE /orgs/{org}/properties/schema/{custom_property_name} <https://docs.github.com/en/rest/orgs/custom-properties#remove-a-custom-property-for-an-organization>`_
1876
+ :param property_name: string
1877
+ :rtype: None
1878
+ """
1879
+ assert isinstance(property_name, str), property_name
1880
+ await self._requester.requestJsonAndCheck("DELETE", f"{await self.url}/properties/schema/{property_name}")
1881
+
1882
+ async def list_custom_property_values(
1883
+ self, repository_query: Opt[str] = NotSet
1884
+ ) -> PaginatedList[RepositoryCustomPropertyValues]:
1885
+ """
1886
+ :calls: `GET /orgs/{org}/properties/values <https://docs.github.com/en/rest/orgs/custom-properties#list-custom-property-values-for-an-organization>`_
1887
+ :rtype: :class:`PaginatedList` of dict
1888
+ """
1889
+ return PaginatedList(
1890
+ contentClass=githubasyncio.OrganizationCustomProperty.RepositoryCustomPropertyValues,
1891
+ requester=self._requester,
1892
+ firstUrl=f"{await self.url}/properties/values",
1893
+ firstParams=NotSet.remove_unset_items({"repository_query": repository_query}),
1894
+ )
1895
+
1896
+ async def create_custom_property_values(
1897
+ self, repository_names: list[str], properties: dict[str, str | list | None]
1898
+ ) -> None:
1899
+ """
1900
+ Create or update custom property values for organization repositories
1901
+ :calls: `PATCH /orgs/{org}/properties/values <https://docs.github.com/en/rest/orgs/custom-properties#create-or-update-custom-property-values-for-organization-repositories>`_
1902
+ :param repository_names: list of strings
1903
+ :param properties: dict of string to string, list or None
1904
+ :rtype: None
1905
+ """
1906
+ assert isinstance(repository_names, list), repository_names
1907
+ assert all(isinstance(repo, str) for repo in repository_names), repository_names
1908
+ assert isinstance(properties, dict), properties
1909
+ assert all(isinstance(value, (str, list, type(None))) for value in properties.values()), properties
1910
+ patch_parameters = {
1911
+ "repository_names": repository_names,
1912
+ "properties": [{"property_name": k, "value": v} for k, v in properties.items()],
1913
+ }
1914
+ await self._requester.requestJsonAndCheck(
1915
+ "PATCH", f"{await self.url}/properties/values", input=patch_parameters
1916
+ )
1917
+
1918
+ async def get_code_security_configs(self, target_type: Opt[str] = NotSet) -> PaginatedList[CodeSecurityConfig]:
1919
+ """
1920
+ :calls: `GET /orgs/{org}/code-security/configurations <https://docs.github.com/en/rest/code-security/configurations#get-code-security-configurations-for-an-organization>`_
1921
+ :rtype: :class:`CodeSecurityConfig`
1922
+ """
1923
+ return PaginatedList(
1924
+ contentClass=githubasyncio.CodeSecurityConfig.CodeSecurityConfig,
1925
+ requester=self._requester,
1926
+ firstUrl=f"{await self.url}/code-security/configurations",
1927
+ firstParams=NotSet.remove_unset_items({"target_type": target_type}),
1928
+ )
1929
+
1930
+ async def create_code_security_config(
1931
+ self,
1932
+ name: str,
1933
+ description: str,
1934
+ advanced_security: Opt[str] = NotSet,
1935
+ dependency_graph: Opt[str] = NotSet,
1936
+ dependency_graph_autosubmit_action: Opt[str] = NotSet,
1937
+ dependabot_alerts: Opt[str] = NotSet,
1938
+ dependabot_security_updates: Opt[str] = NotSet,
1939
+ code_scanning_default_setup: Opt[str] = NotSet,
1940
+ secret_scanning: Opt[str] = NotSet,
1941
+ secret_scanning_push_protection: Opt[str] = NotSet,
1942
+ secret_scanning_delegated_bypass: Opt[str] = NotSet,
1943
+ secret_scanning_validity_checks: Opt[str] = NotSet,
1944
+ secret_scanning_non_provider_patterns: Opt[str] = NotSet,
1945
+ private_vulnerability_reporting: Opt[str] = NotSet,
1946
+ enforcement: Opt[str] = NotSet,
1947
+ ) -> CodeSecurityConfig:
1948
+ """
1949
+ :calls: `POST /orgs/{org}/code-security/configurations <https://docs.github.com/en/rest/code-security/configurations#create-a-code-security-configuration>`_
1950
+ :rtype: :class:`PaginatedList` of dict
1951
+ """
1952
+ assert isinstance(name, str), name
1953
+ assert isinstance(description, str), description
1954
+ assert is_optional(advanced_security, str), advanced_security
1955
+ assert is_optional(dependency_graph, str), dependency_graph
1956
+ assert is_optional(dependency_graph_autosubmit_action, str), dependency_graph_autosubmit_action
1957
+ assert is_optional(dependabot_alerts, str), dependabot_alerts
1958
+ assert is_optional(dependabot_security_updates, str), dependabot_security_updates
1959
+ assert is_optional(code_scanning_default_setup, str), code_scanning_default_setup
1960
+ assert is_optional(secret_scanning, str), secret_scanning
1961
+ assert is_optional(secret_scanning_push_protection, str), secret_scanning_push_protection
1962
+ assert is_optional(secret_scanning_delegated_bypass, str), secret_scanning_delegated_bypass
1963
+ assert is_optional(secret_scanning_validity_checks, str), secret_scanning_validity_checks
1964
+ assert is_optional(secret_scanning_non_provider_patterns, str), secret_scanning_non_provider_patterns
1965
+ assert is_optional(private_vulnerability_reporting, str), private_vulnerability_reporting
1966
+ assert is_optional(enforcement, str), enforcement
1967
+ post_parameters = NotSet.remove_unset_items(
1968
+ {
1969
+ "name": name,
1970
+ "description": description,
1971
+ "advanced_security": advanced_security,
1972
+ "dependency_graph": dependency_graph,
1973
+ "dependency_graph_autosubmit_action": dependency_graph_autosubmit_action,
1974
+ "dependabot_alerts": dependabot_alerts,
1975
+ "dependabot_security_updates": dependabot_security_updates,
1976
+ "code_scanning_default_setup": code_scanning_default_setup,
1977
+ "secret_scanning": secret_scanning,
1978
+ "secret_scanning_push_protection": secret_scanning_push_protection,
1979
+ "secret_scanning_delegated_bypass": secret_scanning_delegated_bypass,
1980
+ "secret_scanning_validity_checks": secret_scanning_validity_checks,
1981
+ "secret_scanning_non_provider_patterns": secret_scanning_non_provider_patterns,
1982
+ "private_vulnerability_reporting": private_vulnerability_reporting,
1983
+ "enforcement": enforcement,
1984
+ }
1985
+ )
1986
+
1987
+ headers, data = await self._requester.requestJsonAndCheck(
1988
+ "POST",
1989
+ f"{await self.url}/code-security/configurations",
1990
+ input=post_parameters,
1991
+ headers={"Accept": Consts.repoVisibilityPreview},
1992
+ )
1993
+ return githubasyncio.CodeSecurityConfig.CodeSecurityConfig(self._requester, headers, data)
1994
+
1995
+ async def edit_code_security_config(
1996
+ self,
1997
+ id: int,
1998
+ name: Opt[str] = NotSet,
1999
+ description: Opt[str] = NotSet,
2000
+ advanced_security: Opt[str] = NotSet,
2001
+ dependency_graph: Opt[str] = NotSet,
2002
+ dependency_graph_autosubmit_action: Opt[str] = NotSet,
2003
+ dependabot_alerts: Opt[str] = NotSet,
2004
+ dependabot_security_updates: Opt[str] = NotSet,
2005
+ code_scanning_default_setup: Opt[str] = NotSet,
2006
+ secret_scanning: Opt[str] = NotSet,
2007
+ secret_scanning_push_protection: Opt[str] = NotSet,
2008
+ secret_scanning_delegated_bypass: Opt[str] = NotSet,
2009
+ secret_scanning_validity_checks: Opt[str] = NotSet,
2010
+ secret_scanning_non_provider_patterns: Opt[str] = NotSet,
2011
+ private_vulnerability_reporting: Opt[str] = NotSet,
2012
+ enforcement: Opt[str] = NotSet,
2013
+ ) -> CodeSecurityConfig:
2014
+ """
2015
+ :calls: `PATCH /orgs/{org}/code-security/configurations/{configuration_id} <https://docs.github.com/en/rest/code-security/configurations#update-a-code-security-configuration>`_
2016
+ """
2017
+ assert isinstance(id, int), id
2018
+ assert is_optional(name, str), name
2019
+ assert is_optional(description, str), description
2020
+ assert is_optional(advanced_security, str), advanced_security
2021
+ assert is_optional(dependency_graph, str), dependency_graph
2022
+ assert is_optional(dependency_graph_autosubmit_action, str), dependency_graph_autosubmit_action
2023
+ assert is_optional(dependabot_alerts, str), dependabot_alerts
2024
+ assert is_optional(dependabot_security_updates, str), dependabot_security_updates
2025
+ assert is_optional(code_scanning_default_setup, str), code_scanning_default_setup
2026
+ assert is_optional(secret_scanning, str), secret_scanning
2027
+ assert is_optional(secret_scanning_push_protection, str), secret_scanning_push_protection
2028
+ assert is_optional(secret_scanning_delegated_bypass, str), secret_scanning_delegated_bypass
2029
+ assert is_optional(secret_scanning_validity_checks, str), secret_scanning_validity_checks
2030
+ assert is_optional(secret_scanning_non_provider_patterns, str), secret_scanning_non_provider_patterns
2031
+ assert is_optional(private_vulnerability_reporting, str), private_vulnerability_reporting
2032
+ assert is_optional(enforcement, str), enforcement
2033
+ post_parameters = NotSet.remove_unset_items(
2034
+ {
2035
+ "name": name,
2036
+ "description": description,
2037
+ "advanced_security": advanced_security,
2038
+ "dependency_graph": dependency_graph,
2039
+ "dependency_graph_autosubmit_action": dependency_graph_autosubmit_action,
2040
+ "dependabot_alerts": dependabot_alerts,
2041
+ "dependabot_security_updates": dependabot_security_updates,
2042
+ "code_scanning_default_setup": code_scanning_default_setup,
2043
+ "secret_scanning": secret_scanning,
2044
+ "secret_scanning_push_protection": secret_scanning_push_protection,
2045
+ "secret_scanning_delegated_bypass": secret_scanning_delegated_bypass,
2046
+ "secret_scanning_validity_checks": secret_scanning_validity_checks,
2047
+ "secret_scanning_non_provider_patterns": secret_scanning_non_provider_patterns,
2048
+ "private_vulnerability_reporting": private_vulnerability_reporting,
2049
+ "enforcement": enforcement,
2050
+ }
2051
+ )
2052
+
2053
+ headers, data = await self._requester.requestJsonAndCheck(
2054
+ "PATCH", f"{await self.url}/code-security/configurations/{id}", input=post_parameters
2055
+ )
2056
+ return githubasyncio.CodeSecurityConfig.CodeSecurityConfig(self._requester, headers, data)
2057
+
2058
+ async def delete_code_security_config(self, id: int) -> None:
2059
+ """
2060
+ :calls: `DELETE /orgs/{org}/code-security/configurations/{configuration_id} <https://docs.github.com/en/rest/code-security/configurations#delete-a-code-security-configuration>`_
2061
+ :param id: integer
2062
+ :rtype: None`
2063
+ """
2064
+ assert isinstance(id, int), id
2065
+ headers, data = await self._requester.requestJsonAndCheck(
2066
+ "DELETE", f"{await self.url}/code-security/configurations/{id}"
2067
+ )
2068
+
2069
+ async def get_code_security_config(self, id: int) -> CodeSecurityConfig:
2070
+ """
2071
+ :calls: `GET /orgs/{org}/code-security/configurations/{configuration_id} <https://docs.github.com/en/rest/code-security/configurations#get-a-code-security-configurationt>`_
2072
+ :param id: configuration_id
2073
+ :rtype: CodeSecurityConfig
2074
+ """
2075
+ assert isinstance(id, int), id
2076
+
2077
+ headers, data = await self._requester.requestJsonAndCheck(
2078
+ "GET", f"{await self.url}/code-security/configurations/{id}"
2079
+ )
2080
+ return githubasyncio.CodeSecurityConfig.CodeSecurityConfig(self._requester, headers, data)
2081
+
2082
+ async def set_default_code_security_config(self, id: int, default_for_new_repos: Opt[str] = NotSet) -> None:
2083
+ """
2084
+ :calls: `PUT /orgs/{org}/code-security/configurations/{configuration_id}/defaults <https://docs.github.com/en/rest/code-security/configurations#set-a-code-security-configuration-as-a-default-for-an-organization>`_
2085
+ """
2086
+ assert isinstance(id, int), id
2087
+ assert is_optional(default_for_new_repos, str), default_for_new_repos
2088
+ put_parameters = NotSet.remove_unset_items({"default_for_new_repos": default_for_new_repos})
2089
+ headers, data = await self._requester.requestJsonAndCheck(
2090
+ "PUT", f"{await self.url}/code-security/configurations/{id}/defaults", input=put_parameters
2091
+ )
2092
+
2093
+ async def get_default_code_security_configs(self) -> PaginatedList[DefaultCodeSecurityConfig]:
2094
+ """
2095
+ :calls: `GET /orgs/{org}/code-security/configurations/defaults <https://docs.github.com/en/rest/code-security/configurations#get-default-code-security-configurations>`_
2096
+ :rtype: :class:`githubasyncio.DefaultCodeSecurityConfig.DefaultCodeSecurityConfig`
2097
+ """
2098
+ return PaginatedList(
2099
+ contentClass=githubasyncio.DefaultCodeSecurityConfig.DefaultCodeSecurityConfig,
2100
+ requester=self._requester,
2101
+ firstUrl=f"{await self.url}/code-security/configurations/defaults",
2102
+ firstParams=None,
2103
+ )
2104
+
2105
+ async def attach_security_config_to_repositories(
2106
+ self, id: int, scope: str, selected_repository_ids: Opt[list[int]] = NotSet
2107
+ ) -> None:
2108
+ """
2109
+ :calls: `POST /orgs/{org}/code-security/configurations/{configuration_id}/attach <https://docs.github.com/en/rest/code-security/configurations#attach-a-configuration-to-repositories>`_
2110
+ """
2111
+ assert isinstance(id, int), id
2112
+ assert isinstance(scope, str), scope
2113
+ assert is_optional(selected_repository_ids, list), selected_repository_ids
2114
+ post_parameters: dict[str, Any] = NotSet.remove_unset_items(
2115
+ {
2116
+ "scope": scope,
2117
+ "selected_repository_ids": selected_repository_ids,
2118
+ }
2119
+ )
2120
+
2121
+ headers, data = await self._requester.requestJsonAndCheck(
2122
+ "POST",
2123
+ f"/orgs/{await self.login}/code-security/configurations/{id}/attach",
2124
+ input=post_parameters,
2125
+ headers={"Accept": Consts.repoVisibilityPreview},
2126
+ )
2127
+
2128
+ async def detach_security_config_from_repositories(self, selected_repository_ids: list[int]) -> None:
2129
+ """
2130
+ :calls: `DELETE /orgs/{org}/code-security/configurations/detach <https://docs.github.com/en/rest/code-security/configurations#detach-configurations-from-repositories>`_
2131
+ """
2132
+ assert isinstance(selected_repository_ids, list), selected_repository_ids
2133
+ delete_parameters: dict[str, Any] = NotSet.remove_unset_items(
2134
+ {
2135
+ "selected_repository_ids": selected_repository_ids,
2136
+ }
2137
+ )
2138
+ headers, data = await self._requester.requestJsonAndCheck(
2139
+ "DELETE",
2140
+ f"/orgs/{await self.login}/code-security/configurations/detach",
2141
+ input=delete_parameters,
2142
+ headers={"Accept": Consts.repoVisibilityPreview},
2143
+ )
2144
+
2145
+ async def get_repos_for_code_security_config(
2146
+ self, id: int, status: Opt[str] = NotSet
2147
+ ) -> PaginatedList[CodeSecurityConfigRepository]:
2148
+ """
2149
+ :calls: `GET /orgs/{org}/code-security/configurations/{configuration_id}/repositories <https://docs.github.com/en/rest/code-security/configurations#get-repositories-associated-with-a-code-security-configuration>`_
2150
+ """
2151
+ assert isinstance(id, int), id
2152
+ assert is_optional(status, str), status
2153
+
2154
+ url_parameters = NotSet.remove_unset_items({"status": status})
2155
+
2156
+ return PaginatedList(
2157
+ githubasyncio.CodeSecurityConfigRepository.CodeSecurityConfigRepository,
2158
+ self._requester,
2159
+ f"{await self.url}/code-security/configurations/{id}/repositories",
2160
+ url_parameters,
2161
+ headers={"Accept": Consts.repoVisibilityPreview},
2162
+ )
2163
+
2164
+ async def get_self_hosted_runners(self, name: Opt[str] = NotSet) -> PaginatedList[SelfHostedActionsRunner]:
2165
+ """
2166
+ :calls: `GET /orgs/{org}/actions/runners <https://docs.github.com/en/rest/actions/self-hosted-runners#list-self-hosted-runners-for-an-organization>`_
2167
+ """
2168
+ assert is_optional(name, str), name
2169
+
2170
+ url_parameters = NotSet.remove_unset_items({"name": name})
2171
+
2172
+ return PaginatedList(
2173
+ githubasyncio.SelfHostedActionsRunner.SelfHostedActionsRunner,
2174
+ self._requester,
2175
+ f"{await self.url}/actions/runners",
2176
+ url_parameters,
2177
+ headers={"Accept": Consts.repoVisibilityPreview},
2178
+ list_item="runners",
2179
+ )
2180
+
2181
+ async def get_self_hosted_runner_applications(self) -> PaginatedList[SelfHostedActionsRunnerApplication]:
2182
+ """
2183
+ :calls: `GET /orgs/{org}/actions/runners/downloads <https://docs.github.com/en/rest/actions/self-hosted-runners#list-runner-applications-for-an-organization>`_
2184
+ """
2185
+ return PaginatedList(
2186
+ githubasyncio.SelfHostedActionsRunnerApplication.SelfHostedActionsRunnerApplication,
2187
+ self._requester,
2188
+ f"{await self.url}/actions/runners/downloads",
2189
+ )
2190
+
2191
+ async def create_self_hosted_runner_jitconfig(
2192
+ self, name: str, runner_group_id: int, labels: list[str], work_folder: Opt[str] = NotSet
2193
+ ) -> SelfHostedActionsRunnerJitConfig:
2194
+ """
2195
+ :calls: `POST /orgs/{org}/actions/runners/generate-jitconfig <https://docs.github.com/en/rest/actions/self-hosted-runners#create-configuration-for-a-just-in-time-runner-for-an-organization>`_
2196
+ """
2197
+ body_parameters: dict[str, Any] = NotSet.remove_unset_items(
2198
+ {
2199
+ "name": name,
2200
+ "runner_group_id": runner_group_id,
2201
+ "labels": labels,
2202
+ "work_folder": work_folder,
2203
+ }
2204
+ )
2205
+ headers, data = await self._requester.requestJsonAndCheck(
2206
+ "POST",
2207
+ f"{await self.url}/actions/runners/generate-jitconfig",
2208
+ input=body_parameters,
2209
+ headers={"Accept": Consts.repoVisibilityPreview},
2210
+ )
2211
+ return githubasyncio.SelfHostedActionsRunnerJitConfig.SelfHostedActionsRunnerJitConfig(
2212
+ self._requester, headers, data
2213
+ )
2214
+
2215
+ async def create_self_hosted_runner_registration_token(self) -> SelfHostedActionsRunnerToken:
2216
+ """
2217
+ :calls: `POST /orgs/{org}/actions/runners/registration-token <https://docs.github.com/en/rest/actions/self-hosted-runners#create-a-registration-token-for-an-organization>`_
2218
+ """
2219
+ headers, data = await self._requester.requestJsonAndCheck(
2220
+ "POST",
2221
+ f"{await self.url}/actions/runners/registration-token",
2222
+ )
2223
+ return githubasyncio.SelfHostedActionsRunnerToken.SelfHostedActionsRunnerToken(self._requester, headers, data)
2224
+
2225
+ async def create_self_hosted_runner_remove_token(self) -> SelfHostedActionsRunnerToken:
2226
+ """
2227
+ :calls: `POST /orgs/{org}/actions/runners/remove-token <https://docs.github.com/en/rest/actions/self-hosted-runners#create-a-remove-token-for-an-organization>`_
2228
+ """
2229
+ headers, data = await self._requester.requestJsonAndCheck(
2230
+ "POST",
2231
+ f"{await self.url}/actions/runners/remove-token",
2232
+ )
2233
+ return githubasyncio.SelfHostedActionsRunnerToken.SelfHostedActionsRunnerToken(self._requester, headers, data)
2234
+
2235
+ async def get_self_hosted_runner(self, runner_id: int) -> SelfHostedActionsRunner:
2236
+ """
2237
+ :calls: `GET /orgs/{org}/actions/runners/{runner_id} <https://docs.github.com/en/rest/actions/self-hosted-runners#get-a-self-hosted-runner-for-an-organization>`_
2238
+ """
2239
+ headers, data = await self._requester.requestJsonAndCheck(
2240
+ "GET",
2241
+ f"{await self.url}/actions/runners/{runner_id}",
2242
+ )
2243
+ return githubasyncio.SelfHostedActionsRunner.SelfHostedActionsRunner(self._requester, headers, data)
2244
+
2245
+ async def delete_self_hosted_runner(self, runner_id: int) -> None:
2246
+ """
2247
+ :calls: `DELETE /orgs/{org}/actions/runners/{runner_id} <https://docs.github.com/en/rest/actions/self-hosted-runners#delete-a-self-hosted-runner-from-an-organization>`_
2248
+ """
2249
+ headers, data = await self._requester.requestJsonAndCheck(
2250
+ "DELETE",
2251
+ f"{await self.url}/actions/runners/{runner_id}",
2252
+ headers={"Accept": Consts.mediaType},
2253
+ )
2254
+
2255
+ def _useAttributes(self, attributes: dict[str, Any]) -> None:
2256
+ if "advanced_security_enabled_for_new_repositories" in attributes: # pragma no branch
2257
+ self._advanced_security_enabled_for_new_repositories = self._makeBoolAttribute(
2258
+ attributes["advanced_security_enabled_for_new_repositories"]
2259
+ )
2260
+ if "archived_at" in attributes: # pragma no branch
2261
+ assert attributes["archived_at"] is None or isinstance(attributes["archived_at"], str), attributes[
2262
+ "archived_at"
2263
+ ]
2264
+ self._archived_at = self._makeDatetimeAttribute(attributes["archived_at"])
2265
+ if "avatar_url" in attributes: # pragma no branch
2266
+ self._avatar_url = self._makeStringAttribute(attributes["avatar_url"])
2267
+ if "billing_email" in attributes: # pragma no branch
2268
+ self._billing_email = self._makeStringAttribute(attributes["billing_email"])
2269
+ if "blog" in attributes: # pragma no branch
2270
+ self._blog = self._makeStringAttribute(attributes["blog"])
2271
+ if "collaborators" in attributes: # pragma no branch
2272
+ self._collaborators = self._makeIntAttribute(attributes["collaborators"])
2273
+ if "company" in attributes: # pragma no branch
2274
+ self._company = self._makeStringAttribute(attributes["company"])
2275
+ if "created_at" in attributes: # pragma no branch
2276
+ self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
2277
+ if "default_repository_branch" in attributes: # pragma no branch
2278
+ self._default_repository_branch = self._makeStringAttribute(attributes["default_repository_branch"])
2279
+ if "default_repository_permission" in attributes: # pragma no branch
2280
+ self._default_repository_permission = self._makeStringAttribute(attributes["default_repository_permission"])
2281
+ if "dependabot_alerts_enabled_for_new_repositories" in attributes: # pragma no branch
2282
+ self._dependabot_alerts_enabled_for_new_repositories = self._makeBoolAttribute(
2283
+ attributes["dependabot_alerts_enabled_for_new_repositories"]
2284
+ )
2285
+ if "dependabot_security_updates_enabled_for_new_repositories" in attributes: # pragma no branch
2286
+ self._dependabot_security_updates_enabled_for_new_repositories = self._makeBoolAttribute(
2287
+ attributes["dependabot_security_updates_enabled_for_new_repositories"]
2288
+ )
2289
+ if "dependency_graph_enabled_for_new_repositories" in attributes: # pragma no branch
2290
+ self._dependency_graph_enabled_for_new_repositories = self._makeBoolAttribute(
2291
+ attributes["dependency_graph_enabled_for_new_repositories"]
2292
+ )
2293
+ if "deploy_keys_enabled_for_repositories" in attributes: # pragma no branch
2294
+ self._deploy_keys_enabled_for_repositories = self._makeBoolAttribute(
2295
+ attributes["deploy_keys_enabled_for_repositories"]
2296
+ )
2297
+ if "description" in attributes: # pragma no branch
2298
+ self._description = self._makeStringAttribute(attributes["description"])
2299
+ if "disk_usage" in attributes: # pragma no branch
2300
+ self._disk_usage = self._makeIntAttribute(attributes["disk_usage"])
2301
+ if "display_commenter_full_name_setting_enabled" in attributes: # pragma no branch
2302
+ self._display_commenter_full_name_setting_enabled = self._makeBoolAttribute(
2303
+ attributes["display_commenter_full_name_setting_enabled"]
2304
+ )
2305
+ if "display_login" in attributes: # pragma no branch
2306
+ self._display_login = self._makeStringAttribute(attributes["display_login"])
2307
+ if "email" in attributes: # pragma no branch
2308
+ self._email = self._makeStringAttribute(attributes["email"])
2309
+ if "events_url" in attributes: # pragma no branch
2310
+ self._events_url = self._makeStringAttribute(attributes["events_url"])
2311
+ if "followers" in attributes: # pragma no branch
2312
+ self._followers = self._makeIntAttribute(attributes["followers"])
2313
+ if "followers_url" in attributes: # pragma no branch
2314
+ self._followers_url = self._makeStringAttribute(attributes["followers_url"])
2315
+ if "following" in attributes: # pragma no branch
2316
+ self._following = self._makeIntAttribute(attributes["following"])
2317
+ if "following_url" in attributes: # pragma no branch
2318
+ self._following_url = self._makeStringAttribute(attributes["following_url"])
2319
+ if "gists_url" in attributes: # pragma no branch
2320
+ self._gists_url = self._makeStringAttribute(attributes["gists_url"])
2321
+ if "gravatar_id" in attributes: # pragma no branch
2322
+ self._gravatar_id = self._makeStringAttribute(attributes["gravatar_id"])
2323
+ if "has_organization_projects" in attributes: # pragma no branch
2324
+ self._has_organization_projects = self._makeBoolAttribute(attributes["has_organization_projects"])
2325
+ if "has_repository_projects" in attributes: # pragma no branch
2326
+ self._has_repository_projects = self._makeBoolAttribute(attributes["has_repository_projects"])
2327
+ if "hooks_url" in attributes: # pragma no branch
2328
+ self._hooks_url = self._makeStringAttribute(attributes["hooks_url"])
2329
+ if "html_url" in attributes: # pragma no branch
2330
+ self._html_url = self._makeStringAttribute(attributes["html_url"])
2331
+ if "id" in attributes: # pragma no branch
2332
+ self._id = self._makeIntAttribute(attributes["id"])
2333
+ if "is_verified" in attributes: # pragma no branch
2334
+ self._is_verified = self._makeBoolAttribute(attributes["is_verified"])
2335
+ if "issues_url" in attributes: # pragma no branch
2336
+ self._issues_url = self._makeStringAttribute(attributes["issues_url"])
2337
+ if "location" in attributes: # pragma no branch
2338
+ self._location = self._makeStringAttribute(attributes["location"])
2339
+ if "login" in attributes: # pragma no branch
2340
+ self._login = self._makeStringAttribute(attributes["login"])
2341
+ elif "url" in attributes:
2342
+ self._login = self._makeStringAttribute(attributes["url"].split("/")[-1])
2343
+ if "members_allowed_repository_creation_type" in attributes: # pragma no branch
2344
+ self._members_allowed_repository_creation_type = self._makeStringAttribute(
2345
+ attributes["members_allowed_repository_creation_type"]
2346
+ )
2347
+ if "members_can_change_repo_visibility" in attributes: # pragma no branch
2348
+ self._members_can_change_repo_visibility = self._makeBoolAttribute(
2349
+ attributes["members_can_change_repo_visibility"]
2350
+ )
2351
+ if "members_can_create_internal_repositories" in attributes: # pragma no branch
2352
+ self._members_can_create_internal_repositories = self._makeBoolAttribute(
2353
+ attributes["members_can_create_internal_repositories"]
2354
+ )
2355
+ if "members_can_create_pages" in attributes: # pragma no branch
2356
+ self._members_can_create_pages = self._makeBoolAttribute(attributes["members_can_create_pages"])
2357
+ if "members_can_create_private_pages" in attributes: # pragma no branch
2358
+ self._members_can_create_private_pages = self._makeBoolAttribute(
2359
+ attributes["members_can_create_private_pages"]
2360
+ )
2361
+ if "members_can_create_private_repositories" in attributes: # pragma no branch
2362
+ self._members_can_create_private_repositories = self._makeBoolAttribute(
2363
+ attributes["members_can_create_private_repositories"]
2364
+ )
2365
+ if "members_can_create_public_pages" in attributes: # pragma no branch
2366
+ self._members_can_create_public_pages = self._makeBoolAttribute(
2367
+ attributes["members_can_create_public_pages"]
2368
+ )
2369
+ if "members_can_create_public_repositories" in attributes: # pragma no branch
2370
+ self._members_can_create_public_repositories = self._makeBoolAttribute(
2371
+ attributes["members_can_create_public_repositories"]
2372
+ )
2373
+ if "members_can_create_repositories" in attributes: # pragma no branch
2374
+ self._members_can_create_repositories = self._makeBoolAttribute(
2375
+ attributes["members_can_create_repositories"]
2376
+ )
2377
+ if "members_can_create_teams" in attributes: # pragma no branch
2378
+ self._members_can_create_teams = self._makeBoolAttribute(attributes["members_can_create_teams"])
2379
+ if "members_can_delete_issues" in attributes: # pragma no branch
2380
+ self._members_can_delete_issues = self._makeBoolAttribute(attributes["members_can_delete_issues"])
2381
+ if "members_can_delete_repositories" in attributes: # pragma no branch
2382
+ self._members_can_delete_repositories = self._makeBoolAttribute(
2383
+ attributes["members_can_delete_repositories"]
2384
+ )
2385
+ if "members_can_fork_private_repositories" in attributes: # pragma no branch
2386
+ self._members_can_fork_private_repositories = self._makeBoolAttribute(
2387
+ attributes["members_can_fork_private_repositories"]
2388
+ )
2389
+ if "members_can_invite_outside_collaborators" in attributes: # pragma no branch
2390
+ self._members_can_invite_outside_collaborators = self._makeBoolAttribute(
2391
+ attributes["members_can_invite_outside_collaborators"]
2392
+ )
2393
+ if "members_can_view_dependency_insights" in attributes: # pragma no branch
2394
+ self._members_can_view_dependency_insights = self._makeBoolAttribute(
2395
+ attributes["members_can_view_dependency_insights"]
2396
+ )
2397
+ if "members_url" in attributes: # pragma no branch
2398
+ self._members_url = self._makeStringAttribute(attributes["members_url"])
2399
+ if "name" in attributes: # pragma no branch
2400
+ self._name = self._makeStringAttribute(attributes["name"])
2401
+ if "node_id" in attributes: # pragma no branch
2402
+ self._node_id = self._makeStringAttribute(attributes["node_id"])
2403
+ if "organizations_url" in attributes: # pragma no branch
2404
+ self._organizations_url = self._makeStringAttribute(attributes["organizations_url"])
2405
+ if "owned_private_repos" in attributes: # pragma no branch
2406
+ self._owned_private_repos = self._makeIntAttribute(attributes["owned_private_repos"])
2407
+ if "plan" in attributes: # pragma no branch
2408
+ self._plan = self._makeClassAttribute(githubasyncio.Plan.Plan, attributes["plan"])
2409
+ if "private_gists" in attributes: # pragma no branch
2410
+ self._private_gists = self._makeIntAttribute(attributes["private_gists"])
2411
+ if "public_gists" in attributes: # pragma no branch
2412
+ self._public_gists = self._makeIntAttribute(attributes["public_gists"])
2413
+ if "public_members_url" in attributes: # pragma no branch
2414
+ self._public_members_url = self._makeStringAttribute(attributes["public_members_url"])
2415
+ if "public_repos" in attributes: # pragma no branch
2416
+ self._public_repos = self._makeIntAttribute(attributes["public_repos"])
2417
+ if "readers_can_create_discussions" in attributes: # pragma no branch
2418
+ self._readers_can_create_discussions = self._makeBoolAttribute(attributes["readers_can_create_discussions"])
2419
+ if "received_events_url" in attributes: # pragma no branch
2420
+ self._received_events_url = self._makeStringAttribute(attributes["received_events_url"])
2421
+ if "repos_url" in attributes: # pragma no branch
2422
+ self._repos_url = self._makeStringAttribute(attributes["repos_url"])
2423
+ if "secret_scanning_enabled_for_new_repositories" in attributes: # pragma no branch
2424
+ self._secret_scanning_enabled_for_new_repositories = self._makeBoolAttribute(
2425
+ attributes["secret_scanning_enabled_for_new_repositories"]
2426
+ )
2427
+ if "secret_scanning_push_protection_custom_link" in attributes: # pragma no branch
2428
+ self._secret_scanning_push_protection_custom_link = self._makeStringAttribute(
2429
+ attributes["secret_scanning_push_protection_custom_link"]
2430
+ )
2431
+ if "secret_scanning_push_protection_custom_link_enabled" in attributes: # pragma no branch
2432
+ self._secret_scanning_push_protection_custom_link_enabled = self._makeBoolAttribute(
2433
+ attributes["secret_scanning_push_protection_custom_link_enabled"]
2434
+ )
2435
+ if "secret_scanning_push_protection_enabled_for_new_repositories" in attributes: # pragma no branch
2436
+ self._secret_scanning_push_protection_enabled_for_new_repositories = self._makeBoolAttribute(
2437
+ attributes["secret_scanning_push_protection_enabled_for_new_repositories"]
2438
+ )
2439
+ if "site_admin" in attributes: # pragma no branch
2440
+ self._site_admin = self._makeBoolAttribute(attributes["site_admin"])
2441
+ if "starred_at" in attributes: # pragma no branch
2442
+ self._starred_at = self._makeStringAttribute(attributes["starred_at"])
2443
+ if "starred_url" in attributes: # pragma no branch
2444
+ self._starred_url = self._makeStringAttribute(attributes["starred_url"])
2445
+ if "subscriptions_url" in attributes: # pragma no branch
2446
+ self._subscriptions_url = self._makeStringAttribute(attributes["subscriptions_url"])
2447
+ if "total_private_repos" in attributes: # pragma no branch
2448
+ self._total_private_repos = self._makeIntAttribute(attributes["total_private_repos"])
2449
+ if "twitter_username" in attributes: # pragma no branch
2450
+ self._twitter_username = self._makeStringAttribute(attributes["twitter_username"])
2451
+ if "two_factor_requirement_enabled" in attributes: # pragma no branch
2452
+ self._two_factor_requirement_enabled = self._makeBoolAttribute(attributes["two_factor_requirement_enabled"])
2453
+ if "type" in attributes: # pragma no branch
2454
+ self._type = self._makeStringAttribute(attributes["type"])
2455
+ if "updated_at" in attributes: # pragma no branch
2456
+ self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
2457
+ if "url" in attributes: # pragma no branch
2458
+ self._url = self._makeStringAttribute(attributes["url"])
2459
+ if "user_view_type" in attributes: # pragma no branch
2460
+ self._user_view_type = self._makeStringAttribute(attributes["user_view_type"])
2461
+ if "web_commit_signoff_required" in attributes: # pragma no branch
2462
+ self._web_commit_signoff_required = self._makeBoolAttribute(attributes["web_commit_signoff_required"])