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
githubasyncio/Team.py ADDED
@@ -0,0 +1,618 @@
1
+ # FILE AUTO GENERATED DO NOT TOUCH
2
+ ############################ Copyrights and license ############################
3
+ # #
4
+ # Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
5
+ # Copyright 2012 Zearin <zearin@gonk.net> #
6
+ # Copyright 2013 AKFish <akfish@gmail.com> #
7
+ # Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
8
+ # Copyright 2013 martinqt <m.ki2@laposte.net> #
9
+ # Copyright 2014 Jan Orel <jan.orel@gooddata.com> #
10
+ # Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
11
+ # Copyright 2015 Aron Culotta <aronwc@gmail.com> #
12
+ # Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
13
+ # Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
14
+ # Copyright 2016 mattjmorrison <mattjmorrison@mattjmorrison.com> #
15
+ # Copyright 2018 Isuru Fernando <isuruf@gmail.com> #
16
+ # Copyright 2018 Jacopo Notarstefano <jacopo.notarstefano@gmail.com> #
17
+ # Copyright 2018 James D'Amato <james.j.damato@gmail.com> #
18
+ # Copyright 2018 Maarten Fonville <mfonville@users.noreply.github.com> #
19
+ # Copyright 2018 Manu Hortet <manuhortet@gmail.com> #
20
+ # Copyright 2018 Michał Górny <mgorny@gentoo.org> #
21
+ # Copyright 2018 Steve Kowalik <steven@wedontsleep.org> #
22
+ # Copyright 2018 Tim Boring <tboring@hearst.com> #
23
+ # Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
24
+ # Copyright 2018 sfdye <tsfdye@gmail.com> #
25
+ # Copyright 2019 Adam Baratz <adam.baratz@gmail.com> #
26
+ # Copyright 2019 Shibasis Patel <smartshibasish@gmail.com> #
27
+ # Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
28
+ # Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
29
+ # Copyright 2020 Adrian Bridgett <58699309+tl-adrian-bridgett@users.noreply.github.com>#
30
+ # Copyright 2020 Andy Grunwald <andygrunwald@gmail.com> #
31
+ # Copyright 2020 Gilad Shefer <giladshefer@gmail.com> #
32
+ # Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
33
+ # Copyright 2020 Tal Machani <12785464+talmachani@users.noreply.github.com> #
34
+ # Copyright 2021 Mark Walker <mark.walker@realbuzz.com> #
35
+ # Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
36
+ # Copyright 2021 秋葉 <ambiguous404@gmail.com> #
37
+ # Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
38
+ # Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
39
+ # Copyright 2023 Kevin Grandjean <Muscaw@users.noreply.github.com> #
40
+ # Copyright 2023 Mark Amery <markamery@btinternet.com> #
41
+ # Copyright 2023 Trim21 <trim21.me@gmail.com> #
42
+ # Copyright 2024 Andrii Kezikov <cheshirez@gmail.com> #
43
+ # Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
44
+ # Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
45
+ # Copyright 2025 Christoph Reiter <reiter.christoph@gmail.com> #
46
+ # Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
47
+ # Copyright 2025 Oscar van Leusen <oscarvanleusen@gmail.com> #
48
+ # Copyright 2026 Enrico Minack <github@enrico.minack.dev> #
49
+ # #
50
+ # This file is part of PyGithub. #
51
+ # http://pygithub.readthedocs.io/ #
52
+ # #
53
+ # PyGithub is free software: you can redistribute it and/or modify it under #
54
+ # the terms of the GNU Lesser General Public License as published by the Free #
55
+ # Software Foundation, either version 3 of the License, or (at your option) #
56
+ # any later version. #
57
+ # #
58
+ # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
59
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
60
+ # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
61
+ # details. #
62
+ # #
63
+ # You should have received a copy of the GNU Lesser General Public License #
64
+ # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
65
+ # #
66
+ ################################################################################
67
+
68
+ from __future__ import annotations
69
+
70
+ import urllib.parse
71
+ from datetime import datetime
72
+ from typing import TYPE_CHECKING, Any
73
+
74
+ import githubasyncio.Membership
75
+ import githubasyncio.NamedUser
76
+ import githubasyncio.Organization
77
+ import githubasyncio.PaginatedList
78
+ import githubasyncio.Permissions
79
+ import githubasyncio.Repository
80
+ import githubasyncio.TeamDiscussion
81
+ from githubasyncio import Consts
82
+ from githubasyncio.compat import deprecated
83
+ from githubasyncio.GithubException import UnknownObjectException
84
+ from githubasyncio.GithubObject import (
85
+ Attribute,
86
+ CompletableGithubObject,
87
+ NotSet,
88
+ Opt,
89
+ is_defined,
90
+ is_undefined,
91
+ method_returns,
92
+ )
93
+
94
+ if TYPE_CHECKING:
95
+ from githubasyncio.Membership import Membership
96
+ from githubasyncio.NamedUser import NamedUser, OrganizationInvitation
97
+ from githubasyncio.Organization import Organization
98
+ from githubasyncio.PaginatedList import PaginatedList
99
+ from githubasyncio.Permissions import Permissions
100
+ from githubasyncio.Repository import Repository
101
+ from githubasyncio.TeamDiscussion import TeamDiscussion
102
+
103
+
104
+ class Team(CompletableGithubObject):
105
+ """
106
+ This class represents Teams.
107
+
108
+ The reference can be found here
109
+ https://docs.github.com/en/rest/reference/teams
110
+
111
+ The OpenAPI schema can be found at
112
+
113
+ - /components/schemas/enterprise-team
114
+ - /components/schemas/nullable-team-simple
115
+ - /components/schemas/team
116
+ - /components/schemas/team-full
117
+ - /components/schemas/team-simple
118
+
119
+ """
120
+
121
+ def _initAttributes(self) -> None:
122
+ self._access_source: Attribute[str] = NotSet
123
+ self._created_at: Attribute[datetime] = NotSet
124
+ self._description: Attribute[str] = NotSet
125
+ self._enterprise_id: Attribute[int] = NotSet
126
+ self._group_id: Attribute[int] = NotSet
127
+ self._group_name: Attribute[str] = NotSet
128
+ self._html_url: Attribute[str] = NotSet
129
+ self._id: Attribute[int] = NotSet
130
+ self._ldap_dn: Attribute[str] = NotSet
131
+ self._members_count: Attribute[int] = NotSet
132
+ self._members_url: Attribute[str] = NotSet
133
+ self._name: Attribute[str] = NotSet
134
+ self._node_id: Attribute[str] = NotSet
135
+ self._notification_setting: Attribute[str] = NotSet
136
+ self._organization: Attribute[Organization] = NotSet
137
+ self._organization_id: Attribute[int] = NotSet
138
+ self._organization_selection_type: Attribute[str] = NotSet
139
+ self._parent: Attribute[Team] = NotSet
140
+ self._permission: Attribute[str] = NotSet
141
+ self._permissions: Attribute[Permissions] = NotSet
142
+ self._privacy: Attribute[str] = NotSet
143
+ self._repos_count: Attribute[int] = NotSet
144
+ self._repositories_url: Attribute[str] = NotSet
145
+ self._slug: Attribute[str] = NotSet
146
+ self._sync_to_organizations: Attribute[str] = NotSet
147
+ self._type: Attribute[str] = NotSet
148
+ self._updated_at: Attribute[datetime] = NotSet
149
+ self._url: Attribute[str] = NotSet
150
+
151
+ def __repr__(self) -> str:
152
+ return self.get__repr__({"id": self._id.value, "name": self._name.value})
153
+
154
+ @property
155
+ async def _identity(self) -> int:
156
+ return await self.id
157
+
158
+ @property
159
+ async def access_source(self) -> str:
160
+ await self._completeIfNotSet(self._access_source)
161
+ return self._access_source.value
162
+
163
+ @property
164
+ async def created_at(self) -> datetime:
165
+ await self._completeIfNotSet(self._created_at)
166
+ return self._created_at.value
167
+
168
+ @property
169
+ async def description(self) -> str:
170
+ await self._completeIfNotSet(self._description)
171
+ return self._description.value
172
+
173
+ @property
174
+ async def enterprise_id(self) -> int:
175
+ await self._completeIfNotSet(self._enterprise_id)
176
+ return self._enterprise_id.value
177
+
178
+ @property
179
+ async def group_id(self) -> int:
180
+ await self._completeIfNotSet(self._group_id)
181
+ return self._group_id.value
182
+
183
+ @property
184
+ async def group_name(self) -> str:
185
+ await self._completeIfNotSet(self._group_name)
186
+ return self._group_name.value
187
+
188
+ @property
189
+ async def html_url(self) -> str:
190
+ await self._completeIfNotSet(self._html_url)
191
+ return self._html_url.value
192
+
193
+ @property
194
+ async def id(self) -> int:
195
+ await self._completeIfNotSet(self._id)
196
+ return self._id.value
197
+
198
+ @property
199
+ async def ldap_dn(self) -> str:
200
+ await self._completeIfNotSet(self._ldap_dn)
201
+ return self._ldap_dn.value
202
+
203
+ @property
204
+ async def members_count(self) -> int:
205
+ await self._completeIfNotSet(self._members_count)
206
+ return self._members_count.value
207
+
208
+ @property
209
+ async def members_url(self) -> str:
210
+ await self._completeIfNotSet(self._members_url)
211
+ return self._members_url.value
212
+
213
+ @property
214
+ async def name(self) -> str:
215
+ await self._completeIfNotSet(self._name)
216
+ return self._name.value
217
+
218
+ @property
219
+ async def node_id(self) -> str:
220
+ await self._completeIfNotSet(self._node_id)
221
+ return self._node_id.value
222
+
223
+ @property
224
+ async def notification_setting(self) -> str:
225
+ await self._completeIfNotSet(self._notification_setting)
226
+ return self._notification_setting.value
227
+
228
+ @property
229
+ async def organization(self) -> Organization:
230
+ await self._completeIfNotSet(self._organization)
231
+ return self._organization.value
232
+
233
+ @property
234
+ async def organization_id(self) -> int:
235
+ await self._completeIfNotSet(self._organization_id)
236
+ return self._organization_id.value
237
+
238
+ @property
239
+ async def organization_selection_type(self) -> str:
240
+ await self._completeIfNotSet(self._organization_selection_type)
241
+ return self._organization_selection_type.value
242
+
243
+ @property
244
+ async def parent(self) -> Team:
245
+ await self._completeIfNotSet(self._parent)
246
+ return self._parent.value
247
+
248
+ @property
249
+ async def permission(self) -> str:
250
+ await self._completeIfNotSet(self._permission)
251
+ return self._permission.value
252
+
253
+ @property
254
+ async def permissions(self) -> Permissions:
255
+ await self._completeIfNotSet(self._permissions)
256
+ return self._permissions.value
257
+
258
+ @property
259
+ async def privacy(self) -> str:
260
+ await self._completeIfNotSet(self._privacy)
261
+ return self._privacy.value
262
+
263
+ @property
264
+ async def repos_count(self) -> int:
265
+ await self._completeIfNotSet(self._repos_count)
266
+ return self._repos_count.value
267
+
268
+ @property
269
+ async def repositories_url(self) -> str:
270
+ await self._completeIfNotSet(self._repositories_url)
271
+ return self._repositories_url.value
272
+
273
+ @property
274
+ async def slug(self) -> str:
275
+ await self._completeIfNotSet(self._slug)
276
+ return self._slug.value
277
+
278
+ @property
279
+ async def sync_to_organizations(self) -> str:
280
+ await self._completeIfNotSet(self._sync_to_organizations)
281
+ return self._sync_to_organizations.value
282
+
283
+ @property
284
+ async def type(self) -> str:
285
+ await self._completeIfNotSet(self._type)
286
+ return self._type.value
287
+
288
+ @property
289
+ async def updated_at(self) -> datetime:
290
+ await self._completeIfNotSet(self._updated_at)
291
+ return self._updated_at.value
292
+
293
+ @property
294
+ async def url(self) -> str:
295
+ await self._completeIfNotSet(self._url)
296
+ return self._url.value
297
+
298
+ @deprecated("Use add_membership instead")
299
+ async def add_to_members(self, member: NamedUser) -> None:
300
+ """
301
+ This API call is deprecated. Use `add_membership` instead.
302
+ https://docs.github.com/en/rest/reference/teams#add-or-update-team-membership-for-a-user-legacy
303
+
304
+ :calls: `PUT /teams/{team_id}/members/{username} <https://docs.github.com/en/rest/reference/teams>`_
305
+ """
306
+ assert isinstance(member, githubasyncio.NamedUser.NamedUser), member
307
+ headers, data = await self._requester.requestJsonAndCheck(
308
+ "PUT", f"{await self.url}/members/{(await member._identity)}"
309
+ )
310
+
311
+ async def add_membership(self, member: NamedUser, role: Opt[str] = NotSet) -> None:
312
+ """
313
+ :calls: `PUT /teams/{team_id}/memberships/{username} <https://docs.github.com/en/rest/reference/teams>`_
314
+ """
315
+ assert isinstance(member, githubasyncio.NamedUser.NamedUser), member
316
+ assert is_undefined(role) or isinstance(role, str), role
317
+ if is_defined(role):
318
+ assert role in ["member", "maintainer"]
319
+ put_parameters = {
320
+ "role": role,
321
+ }
322
+ else:
323
+ put_parameters = {
324
+ "role": "member",
325
+ }
326
+ headers, data = await self._requester.requestJsonAndCheck(
327
+ "PUT", f"{await self.url}/memberships/{(await member._identity)}", input=put_parameters
328
+ )
329
+
330
+ async def get_team_membership(self, member: str | NamedUser) -> Membership:
331
+ """
332
+ :calls: `GET /orgs/{org}/teams/{team_slug}/memberships/{username} <https://docs.github.com/en/rest/reference/teams#get-team-membership-for-a-user>`_
333
+ """
334
+ assert isinstance(member, str) or isinstance(member, githubasyncio.NamedUser.NamedUser), member
335
+ if isinstance(member, githubasyncio.NamedUser.NamedUser):
336
+ member = await member._identity
337
+ else:
338
+ member = urllib.parse.quote(member, safe="")
339
+ headers, data = await self._requester.requestJsonAndCheck("GET", f"{await self.url}/memberships/{member}")
340
+ return githubasyncio.Membership.Membership(self._requester, headers, data, completed=True)
341
+
342
+ async def add_to_repos(self, repo: str | Repository) -> None:
343
+ """
344
+ :calls: `PUT /teams/{team_id}/repos/{owner}/{repo} <https://docs.github.com/en/rest/reference/teams>`_
345
+ """
346
+ assert isinstance(repo, (str, githubasyncio.Repository.Repository)), repo
347
+ headers, data = await self._requester.requestJsonAndCheck(
348
+ "PUT", f"{await self.url}/repos/{await githubasyncio.Repository.Repository.as_url_param(repo)}"
349
+ )
350
+
351
+ @method_returns(schema_property="permissions")
352
+ async def get_repo_permission(self, repo: str | Repository) -> Permissions | None:
353
+ """
354
+ :calls: `GET /teams/{team_id}/repos/{owner}/{repo} <https://docs.github.com/en/rest/reference/teams>`_
355
+ """
356
+ assert isinstance(repo, (str, githubasyncio.Repository.Repository)), repo
357
+ try:
358
+ headers, data = await self._requester.requestJsonAndCheck(
359
+ "GET",
360
+ f"{await self.url}/repos/{await githubasyncio.Repository.Repository.as_url_param(repo)}",
361
+ headers={"Accept": Consts.teamRepositoryPermissions},
362
+ )
363
+ return githubasyncio.Permissions.Permissions(self._requester, headers, data["permissions"])
364
+ except UnknownObjectException:
365
+ return None
366
+
367
+ @deprecated(
368
+ """
369
+ Team.set_repo_permission() is deprecated, use Team.update_team_repository() instead.
370
+ """
371
+ )
372
+ async def set_repo_permission(self, repo: str | Repository, permission: str) -> None:
373
+ """
374
+ :calls: `PUT /teams/{team_id}/repos/{owner}/{repo} <https://docs.github.com/en/rest/reference/teams>`_
375
+ :param repo: :class:`githubasyncio.Repository.Repository`
376
+ :param permission: string
377
+ :rtype: None
378
+ """
379
+ assert isinstance(repo, (str, githubasyncio.Repository.Repository)), repo
380
+ put_parameters = {
381
+ "permission": permission,
382
+ }
383
+ headers, data = await self._requester.requestJsonAndCheck(
384
+ "PUT",
385
+ f"{await self.url}/repos/{await githubasyncio.Repository.Repository.as_url_param(repo)}",
386
+ input=put_parameters,
387
+ )
388
+
389
+ async def update_team_repository(self, repo: str | Repository, permission: str) -> bool:
390
+ """
391
+ :calls: `PUT /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} <https://docs.github.com/en/rest/reference/teams#check-team-permissions-for-a-repository>`_
392
+ """
393
+ assert isinstance(repo, (str, githubasyncio.Repository.Repository)), repo
394
+ assert isinstance(permission, str), permission
395
+ put_parameters = {
396
+ "permission": permission,
397
+ }
398
+ status, _, _ = await self._requester.requestJson(
399
+ "PUT",
400
+ f"{await (await self.organization).url}/teams/{await self.slug}/repos/{await githubasyncio.Repository.Repository.as_url_param(repo)}",
401
+ input=put_parameters,
402
+ )
403
+ return status == 204
404
+
405
+ async def delete(self) -> None:
406
+ """
407
+ :calls: `DELETE /teams/{team_id} <https://docs.github.com/en/rest/reference/teams#delete-a-team>`_
408
+ """
409
+ headers, data = await self._requester.requestJsonAndCheck("DELETE", await self.url)
410
+
411
+ async def edit(
412
+ self,
413
+ name: str,
414
+ description: Opt[str] = NotSet,
415
+ permission: Opt[str] = NotSet,
416
+ privacy: Opt[str] = NotSet,
417
+ parent_team_id: Opt[int] = NotSet,
418
+ notification_setting: Opt[str] = NotSet,
419
+ ) -> None:
420
+ """
421
+ :calls: `PATCH /teams/{team_id} <https://docs.github.com/en/rest/reference/teams#update-a-team>`_
422
+ """
423
+ assert isinstance(name, str), name
424
+ assert is_undefined(description) or isinstance(description, str), description
425
+ assert is_undefined(permission) or isinstance(permission, str), permission
426
+ assert is_undefined(privacy) or isinstance(privacy, str), privacy
427
+ assert is_undefined(parent_team_id) or isinstance(parent_team_id, (int, type(None))), parent_team_id
428
+ assert notification_setting in ["notifications_enabled", "notifications_disabled", NotSet], notification_setting
429
+ post_parameters = NotSet.remove_unset_items(
430
+ {
431
+ "name": name,
432
+ "description": description,
433
+ "permission": permission,
434
+ "privacy": privacy,
435
+ "parent_team_id": parent_team_id,
436
+ "notification_setting": notification_setting,
437
+ }
438
+ )
439
+
440
+ headers, data = await self._requester.requestJsonAndCheck("PATCH", await self.url, input=post_parameters)
441
+ self._useAttributes(data)
442
+ self._set_complete()
443
+
444
+ async def get_teams(self) -> PaginatedList[Team]:
445
+ """
446
+ :calls: `GET /teams/{team_id}/teams <https://docs.github.com/en/rest/reference/teams#list-teams>`_
447
+ """
448
+ return githubasyncio.PaginatedList.PaginatedList(
449
+ Team,
450
+ self._requester,
451
+ f"{await self.url}/teams",
452
+ None,
453
+ )
454
+
455
+ async def get_discussions(self) -> PaginatedList[TeamDiscussion]:
456
+ """
457
+ :calls: `GET /teams/{team_id}/discussions <https://docs.github.com/en/rest/reference/teams#list-discussions>`_
458
+ """
459
+ return githubasyncio.PaginatedList.PaginatedList(
460
+ githubasyncio.TeamDiscussion.TeamDiscussion,
461
+ self._requester,
462
+ f"{await self.url}/discussions",
463
+ None,
464
+ headers={"Accept": Consts.mediaTypeTeamDiscussionsPreview},
465
+ )
466
+
467
+ async def get_members(self, role: Opt[str] = NotSet) -> PaginatedList[NamedUser]:
468
+ """
469
+ :calls: `GET /teams/{team_id}/members <https://docs.github.com/en/rest/reference/teams#list-team-members>`_
470
+ """
471
+ assert is_undefined(role) or isinstance(role, str), role
472
+ url_parameters: dict[str, Any] = {}
473
+ if is_defined(role):
474
+ assert role in ["member", "maintainer", "all"]
475
+ url_parameters["role"] = role
476
+ return githubasyncio.PaginatedList.PaginatedList(
477
+ githubasyncio.NamedUser.NamedUser,
478
+ self._requester,
479
+ f"{await self.url}/members",
480
+ url_parameters,
481
+ )
482
+
483
+ async def get_repos(self) -> PaginatedList[Repository]:
484
+ """
485
+ :calls: `GET /teams/{team_id}/repos <https://docs.github.com/en/rest/reference/teams>`_
486
+ """
487
+ return githubasyncio.PaginatedList.PaginatedList(
488
+ githubasyncio.Repository.Repository, self._requester, f"{await self.url}/repos", None
489
+ )
490
+
491
+ async def invitations(self) -> PaginatedList[OrganizationInvitation]:
492
+ """
493
+ :calls: `GET /teams/{team_id}/invitations <https://docs.github.com/en/rest/reference/teams#members>`_
494
+ """
495
+ return githubasyncio.PaginatedList.PaginatedList(
496
+ githubasyncio.NamedUser.OrganizationInvitation,
497
+ self._requester,
498
+ f"{await self.url}/invitations",
499
+ None,
500
+ headers={"Accept": Consts.mediaTypeOrganizationInvitationPreview},
501
+ )
502
+
503
+ async def has_in_members(self, member: NamedUser) -> bool:
504
+ """
505
+ :calls: `GET /teams/{team_id}/members/{username} <https://docs.github.com/en/rest/reference/teams>`_
506
+ """
507
+ assert isinstance(member, githubasyncio.NamedUser.NamedUser), member
508
+ status, headers, data = await self._requester.requestJson(
509
+ "GET", f"{await self.url}/members/{(await member._identity)}"
510
+ )
511
+ return status == 204
512
+
513
+ async def has_in_repos(self, repo: str | Repository) -> bool:
514
+ """
515
+ :calls: `GET /teams/{team_id}/repos/{owner}/{repo} <https://docs.github.com/en/rest/reference/teams>`_
516
+ """
517
+ assert isinstance(repo, (str, githubasyncio.Repository.Repository)), repo
518
+ status, headers, data = await self._requester.requestJson(
519
+ "GET", f"{await self.url}/repos/{await githubasyncio.Repository.Repository.as_url_param(repo)}"
520
+ )
521
+ return status == 204
522
+
523
+ async def remove_membership(self, member: NamedUser) -> None:
524
+ """
525
+ :calls: `DELETE /teams/{team_id}/memberships/{username} <https://docs.github.com/en/rest/reference/teams#remove-team-membership-for-a-user>`_
526
+ """
527
+ assert isinstance(member, githubasyncio.NamedUser.NamedUser), member
528
+ headers, data = await self._requester.requestJsonAndCheck(
529
+ "DELETE", f"{await self.url}/memberships/{(await member._identity)}"
530
+ )
531
+
532
+ @deprecated("Use remove_membership instead")
533
+ async def remove_from_members(self, member: NamedUser) -> None:
534
+ """
535
+ This API call is deprecated. Use `remove_membership` instead:
536
+ https://docs.github.com/en/rest/reference/teams#add-or-update-team-membership-for-a-user-legacy
537
+
538
+ :calls: `DELETE /teams/{team_id}/members/{username} <https://docs.github.com/en/rest/reference/teams>`_
539
+ """
540
+ assert isinstance(member, githubasyncio.NamedUser.NamedUser), member
541
+ headers, data = await self._requester.requestJsonAndCheck(
542
+ "DELETE", f"{await self.url}/members/{(await member._identity)}"
543
+ )
544
+
545
+ async def remove_from_repos(self, repo: str | Repository) -> None:
546
+ """
547
+ :calls: `DELETE /teams/{team_id}/repos/{owner}/{repo} <https://docs.github.com/en/rest/reference/teams>`_
548
+ """
549
+ assert isinstance(repo, (str, githubasyncio.Repository.Repository)), repo
550
+ headers, data = await self._requester.requestJsonAndCheck(
551
+ "DELETE", f"{await self.url}/repos/{await githubasyncio.Repository.Repository.as_url_param(repo)}"
552
+ )
553
+
554
+ def _useAttributes(self, attributes: dict[str, Any]) -> None:
555
+ if "access_source" in attributes: # pragma no branch
556
+ self._access_source = self._makeStringAttribute(attributes["access_source"])
557
+ if "created_at" in attributes: # pragma no branch
558
+ self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
559
+ if "description" in attributes: # pragma no branch
560
+ self._description = self._makeStringAttribute(attributes["description"])
561
+ if "enterprise_id" in attributes: # pragma no branch
562
+ self._enterprise_id = self._makeIntAttribute(attributes["enterprise_id"])
563
+ if "group_id" in attributes: # pragma no branch
564
+ self._group_id = self._makeIntAttribute(attributes["group_id"])
565
+ if "group_name" in attributes: # pragma no branch
566
+ self._group_name = self._makeStringAttribute(attributes["group_name"])
567
+ if "html_url" in attributes:
568
+ self._html_url = self._makeStringAttribute(attributes["html_url"])
569
+ if "id" in attributes: # pragma no branch
570
+ self._id = self._makeIntAttribute(attributes["id"])
571
+ elif "url" in attributes and attributes["url"]:
572
+ id = attributes["url"].split("/")[-1]
573
+ if id.isnumeric():
574
+ self._id = self._makeIntAttribute(int(id))
575
+ if "ldap_dn" in attributes: # pragma no branch
576
+ self._ldap_dn = self._makeStringAttribute(attributes["ldap_dn"])
577
+ if "members_count" in attributes: # pragma no branch
578
+ self._members_count = self._makeIntAttribute(attributes["members_count"])
579
+ if "members_url" in attributes: # pragma no branch
580
+ self._members_url = self._makeStringAttribute(attributes["members_url"])
581
+ if "name" in attributes: # pragma no branch
582
+ self._name = self._makeStringAttribute(attributes["name"])
583
+ if "node_id" in attributes: # pragma no branch
584
+ self._node_id = self._makeStringAttribute(attributes["node_id"])
585
+ if "notification_setting" in attributes: # pragma no branch
586
+ self._notification_setting = self._makeStringAttribute(attributes["notification_setting"])
587
+ if "organization" in attributes: # pragma no branch
588
+ self._organization = self._makeClassAttribute(
589
+ githubasyncio.Organization.Organization, attributes["organization"]
590
+ )
591
+ if "organization_id" in attributes: # pragma no branch
592
+ self._organization_id = self._makeIntAttribute(attributes["organization_id"])
593
+ if "organization_selection_type" in attributes: # pragma no branch
594
+ self._organization_selection_type = self._makeStringAttribute(attributes["organization_selection_type"])
595
+ if "parent" in attributes: # pragma no branch
596
+ self._parent = self._makeClassAttribute(Team, attributes["parent"])
597
+ if "permission" in attributes: # pragma no branch
598
+ self._permission = self._makeStringAttribute(attributes["permission"])
599
+ if "permissions" in attributes: # pragma no branch
600
+ self._permissions = self._makeClassAttribute(
601
+ githubasyncio.Permissions.Permissions, attributes["permissions"]
602
+ )
603
+ if "privacy" in attributes: # pragma no branch
604
+ self._privacy = self._makeStringAttribute(attributes["privacy"])
605
+ if "repos_count" in attributes: # pragma no branch
606
+ self._repos_count = self._makeIntAttribute(attributes["repos_count"])
607
+ if "repositories_url" in attributes: # pragma no branch
608
+ self._repositories_url = self._makeStringAttribute(attributes["repositories_url"])
609
+ if "slug" in attributes: # pragma no branch
610
+ self._slug = self._makeStringAttribute(attributes["slug"])
611
+ if "sync_to_organizations" in attributes: # pragma no branch
612
+ self._sync_to_organizations = self._makeStringAttribute(attributes["sync_to_organizations"])
613
+ if "type" in attributes: # pragma no branch
614
+ self._type = self._makeStringAttribute(attributes["type"])
615
+ if "updated_at" in attributes: # pragma no branch
616
+ self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
617
+ if "url" in attributes: # pragma no branch
618
+ self._url = self._makeStringAttribute(attributes["url"])