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,1251 @@
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 Cameron White <cawhite@pdx.edu> #
9
+ # Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
10
+ # Copyright 2013 poulp <mathieu.nerv@gmail.com> #
11
+ # Copyright 2014 Tomas Radej <tradej@redhat.com> #
12
+ # Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
13
+ # Copyright 2016 E. Dunham <github@edunham.net> #
14
+ # Copyright 2016 Jannis Gebauer <ja.geb@me.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 2017 Jannis Gebauer <ja.geb@me.com> #
18
+ # Copyright 2017 Simon <spam@esemi.ru> #
19
+ # Copyright 2018 Alice GIRARD <bouhahah@gmail.com> #
20
+ # Copyright 2018 Bruce Richardson <itsbruce@workshy.org> #
21
+ # Copyright 2018 Riccardo Pittau <elfosardo@users.noreply.github.com> #
22
+ # Copyright 2018 Shubham Singh <41840111+singh811@users.noreply.github.com> #
23
+ # Copyright 2018 Steve Kowalik <steven@wedontsleep.org> #
24
+ # Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
25
+ # Copyright 2018 bryanhuntesl <31992054+bryanhuntesl@users.noreply.github.com> #
26
+ # Copyright 2018 sfdye <tsfdye@gmail.com> #
27
+ # Copyright 2019 Adam Baratz <adam.baratz@gmail.com> #
28
+ # Copyright 2019 Jamie van Brunschot <j.brunschot@coolblue.nl> #
29
+ # Copyright 2019 Jon Dufresne <jon.dufresne@gmail.com> #
30
+ # Copyright 2019 Pavan Kunisetty <nagapavan@users.noreply.github.com> #
31
+ # Copyright 2019 Rigas Papathanasopoulos <rigaspapas@gmail.com> #
32
+ # Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
33
+ # Copyright 2019 Surya Teja <94suryateja@gmail.com> #
34
+ # Copyright 2019 Wan Liuyang <tsfdye@gmail.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 2021 MeggyCal <MeggyCal@users.noreply.github.com> #
39
+ # Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
40
+ # Copyright 2021 Yuya Nakamura <yuyan7sh@gmail.com> #
41
+ # Copyright 2021 sshekdar-VMware <87147229+sshekdar-VMware@users.noreply.github.com>#
42
+ # Copyright 2021 秋葉 <ambiguous404@gmail.com> #
43
+ # Copyright 2022 KimSia Sim <245021+simkimsia@users.noreply.github.com> #
44
+ # Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
45
+ # Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
46
+ # Copyright 2023 Jonathan Leitschuh <jonathan.leitschuh@gmail.com> #
47
+ # Copyright 2023 Kevin Grandjean <Muscaw@users.noreply.github.com> #
48
+ # Copyright 2023 Mark Amery <markamery@btinternet.com> #
49
+ # Copyright 2023 Trim21 <trim21.me@gmail.com> #
50
+ # Copyright 2023 chantra <chantra@users.noreply.github.com> #
51
+ # Copyright 2024 Chris Wells <ping@cwlls.com> #
52
+ # Copyright 2024 Eduardo Ramírez <edu.rh90@gmail.com> #
53
+ # Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
54
+ # Copyright 2024 Oskar Jansson <56458534+janssonoskar@users.noreply.github.com>#
55
+ # Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
56
+ # Copyright 2026 Enrico Minack <github@enrico.minack.dev> #
57
+ # #
58
+ # This file is part of PyGithub. #
59
+ # http://pygithub.readthedocs.io/ #
60
+ # #
61
+ # PyGithub is free software: you can redistribute it and/or modify it under #
62
+ # the terms of the GNU Lesser General Public License as published by the Free #
63
+ # Software Foundation, either version 3 of the License, or (at your option) #
64
+ # any later version. #
65
+ # #
66
+ # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
67
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
68
+ # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
69
+ # details. #
70
+ # #
71
+ # You should have received a copy of the GNU Lesser General Public License #
72
+ # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
73
+ # #
74
+ ################################################################################
75
+
76
+ from __future__ import annotations
77
+
78
+ import urllib.parse
79
+ from datetime import datetime, timezone
80
+ from typing import TYPE_CHECKING, Any, NamedTuple
81
+
82
+ import githubasyncio.Authorization
83
+ import githubasyncio.Event
84
+ import githubasyncio.Gist
85
+ import githubasyncio.GithubObject
86
+ import githubasyncio.InputFileContent
87
+ import githubasyncio.Installation
88
+ import githubasyncio.Invitation
89
+ import githubasyncio.Issue
90
+ import githubasyncio.Label
91
+ import githubasyncio.Membership
92
+ import githubasyncio.Migration
93
+ import githubasyncio.NamedUser
94
+ import githubasyncio.Notification
95
+ import githubasyncio.Organization
96
+ import githubasyncio.Plan
97
+ import githubasyncio.Project
98
+ import githubasyncio.Repository
99
+ import githubasyncio.Team
100
+ import githubasyncio.UserKey
101
+ from githubasyncio import Consts
102
+ from githubasyncio.GithubObject import (
103
+ Attribute,
104
+ CompletableGithubObject,
105
+ NotSet,
106
+ Opt,
107
+ is_defined,
108
+ is_optional,
109
+ is_optional_list,
110
+ is_undefined,
111
+ )
112
+ from githubasyncio.PaginatedList import PaginatedList
113
+
114
+ if TYPE_CHECKING:
115
+ from githubasyncio.Authorization import Authorization
116
+ from githubasyncio.Event import Event
117
+ from githubasyncio.Gist import Gist
118
+ from githubasyncio.InputFileContent import InputFileContent
119
+ from githubasyncio.Installation import Installation
120
+ from githubasyncio.Invitation import Invitation
121
+ from githubasyncio.Issue import Issue
122
+ from githubasyncio.Label import Label
123
+ from githubasyncio.Membership import Membership
124
+ from githubasyncio.Migration import Migration
125
+ from githubasyncio.NamedUser import NamedUser
126
+ from githubasyncio.Notification import Notification
127
+ from githubasyncio.Organization import Organization
128
+ from githubasyncio.Plan import Plan
129
+ from githubasyncio.Project import Project
130
+ from githubasyncio.Repository import Repository
131
+ from githubasyncio.Team import Team
132
+ from githubasyncio.UserKey import UserKey
133
+
134
+
135
+ class EmailData(NamedTuple):
136
+ """
137
+ This class represents EmailData.
138
+
139
+ The reference can be found here
140
+ http://docs.github.com/en/rest/reference/users#emails
141
+
142
+ The OpenAPI schema can be found at
143
+
144
+ - /components/schemas/email
145
+
146
+ """
147
+
148
+ email: str
149
+ primary: bool
150
+ verified: bool
151
+ visibility: str
152
+
153
+
154
+ class AuthenticatedUser(CompletableGithubObject):
155
+ """
156
+ This class represents AuthenticatedUsers as returned by https://docs.github.com/en/rest/reference/users#get-the-authenticated-user
157
+
158
+ An AuthenticatedUser object can be created by calling ``get_user()`` on a Github object.
159
+
160
+ The OpenAPI schema can be found at
161
+
162
+ - /components/schemas/private-user
163
+ - /components/schemas/public-user
164
+
165
+ """
166
+
167
+ def _initAttributes(self) -> None:
168
+ self._avatar_url: Attribute[str] = NotSet
169
+ self._bio: Attribute[str] = NotSet
170
+ self._blog: Attribute[str] = NotSet
171
+ self._business_plus: Attribute[bool] = NotSet
172
+ self._collaborators: Attribute[int] = NotSet
173
+ self._company: Attribute[str] = NotSet
174
+ self._created_at: Attribute[datetime] = NotSet
175
+ self._disk_usage: Attribute[int] = NotSet
176
+ self._email: Attribute[str] = NotSet
177
+ self._events_url: Attribute[str] = NotSet
178
+ self._followers: Attribute[int] = NotSet
179
+ self._followers_url: Attribute[str] = NotSet
180
+ self._following: Attribute[int] = NotSet
181
+ self._following_url: Attribute[str] = NotSet
182
+ self._gists_url: Attribute[str] = NotSet
183
+ self._gravatar_id: Attribute[str] = NotSet
184
+ self._hireable: Attribute[bool] = NotSet
185
+ self._html_url: Attribute[str] = NotSet
186
+ self._id: Attribute[int] = NotSet
187
+ self._ldap_dn: Attribute[str] = NotSet
188
+ self._location: Attribute[str] = NotSet
189
+ self._login: Attribute[str] = NotSet
190
+ self._name: Attribute[str] = NotSet
191
+ self._node_id: Attribute[str] = NotSet
192
+ self._notification_email: Attribute[str] = NotSet
193
+ self._organizations_url: Attribute[str] = NotSet
194
+ self._owned_private_repos: Attribute[int] = NotSet
195
+ self._plan: Attribute[Plan] = NotSet
196
+ self._private_gists: Attribute[int] = NotSet
197
+ self._public_gists: Attribute[int] = NotSet
198
+ self._public_repos: Attribute[int] = NotSet
199
+ self._received_events_url: Attribute[str] = NotSet
200
+ self._repos_url: Attribute[str] = NotSet
201
+ self._site_admin: Attribute[bool] = NotSet
202
+ self._starred_url: Attribute[str] = NotSet
203
+ self._subscriptions_url: Attribute[str] = NotSet
204
+ self._total_private_repos: Attribute[int] = NotSet
205
+ self._twitter_username: Attribute[str] = NotSet
206
+ self._two_factor_authentication: Attribute[bool] = NotSet
207
+ self._type: Attribute[str] = NotSet
208
+ self._updated_at: Attribute[datetime] = NotSet
209
+ self._url: Attribute[str] = NotSet
210
+ self._user_view_type: Attribute[str] = NotSet
211
+
212
+ def __repr__(self) -> str:
213
+ return self.get__repr__({"login": self._login.value})
214
+
215
+ @property
216
+ async def avatar_url(self) -> str:
217
+ await self._completeIfNotSet(self._avatar_url)
218
+ return self._avatar_url.value
219
+
220
+ @property
221
+ async def bio(self) -> str:
222
+ await self._completeIfNotSet(self._bio)
223
+ return self._bio.value
224
+
225
+ @property
226
+ async def blog(self) -> str:
227
+ await self._completeIfNotSet(self._blog)
228
+ return self._blog.value
229
+
230
+ @property
231
+ async def business_plus(self) -> bool:
232
+ await self._completeIfNotSet(self._business_plus)
233
+ return self._business_plus.value
234
+
235
+ @property
236
+ async def collaborators(self) -> int:
237
+ await self._completeIfNotSet(self._collaborators)
238
+ return self._collaborators.value
239
+
240
+ @property
241
+ async def company(self) -> str:
242
+ await self._completeIfNotSet(self._company)
243
+ return self._company.value
244
+
245
+ @property
246
+ async def created_at(self) -> datetime:
247
+ await self._completeIfNotSet(self._created_at)
248
+ return self._created_at.value
249
+
250
+ @property
251
+ async def disk_usage(self) -> int:
252
+ await self._completeIfNotSet(self._disk_usage)
253
+ return self._disk_usage.value
254
+
255
+ @property
256
+ async def email(self) -> str:
257
+ await self._completeIfNotSet(self._email)
258
+ return self._email.value
259
+
260
+ @property
261
+ async def events_url(self) -> str:
262
+ await self._completeIfNotSet(self._events_url)
263
+ return self._events_url.value
264
+
265
+ @property
266
+ async def followers(self) -> int:
267
+ await self._completeIfNotSet(self._followers)
268
+ return self._followers.value
269
+
270
+ @property
271
+ async def followers_url(self) -> str:
272
+ await self._completeIfNotSet(self._followers_url)
273
+ return self._followers_url.value
274
+
275
+ @property
276
+ async def following(self) -> int:
277
+ await self._completeIfNotSet(self._following)
278
+ return self._following.value
279
+
280
+ @property
281
+ async def following_url(self) -> str:
282
+ await self._completeIfNotSet(self._following_url)
283
+ return self._following_url.value
284
+
285
+ @property
286
+ async def gists_url(self) -> str:
287
+ await self._completeIfNotSet(self._gists_url)
288
+ return self._gists_url.value
289
+
290
+ @property
291
+ async def gravatar_id(self) -> str:
292
+ await self._completeIfNotSet(self._gravatar_id)
293
+ return self._gravatar_id.value
294
+
295
+ @property
296
+ async def hireable(self) -> bool:
297
+ await self._completeIfNotSet(self._hireable)
298
+ return self._hireable.value
299
+
300
+ @property
301
+ async def html_url(self) -> str:
302
+ await self._completeIfNotSet(self._html_url)
303
+ return self._html_url.value
304
+
305
+ @property
306
+ async def id(self) -> int:
307
+ await self._completeIfNotSet(self._id)
308
+ return self._id.value
309
+
310
+ @property
311
+ async def ldap_dn(self) -> str:
312
+ await self._completeIfNotSet(self._ldap_dn)
313
+ return self._ldap_dn.value
314
+
315
+ @property
316
+ async def location(self) -> str:
317
+ await self._completeIfNotSet(self._location)
318
+ return self._location.value
319
+
320
+ @property
321
+ async def login(self) -> str:
322
+ await self._completeIfNotSet(self._login)
323
+ return self._login.value
324
+
325
+ @property
326
+ async def name(self) -> str:
327
+ await self._completeIfNotSet(self._name)
328
+ return self._name.value
329
+
330
+ @property
331
+ async def node_id(self) -> str:
332
+ await self._completeIfNotSet(self._node_id)
333
+ return self._node_id.value
334
+
335
+ @property
336
+ async def notification_email(self) -> str:
337
+ await self._completeIfNotSet(self._notification_email)
338
+ return self._notification_email.value
339
+
340
+ @property
341
+ async def organizations_url(self) -> str:
342
+ await self._completeIfNotSet(self._organizations_url)
343
+ return self._organizations_url.value
344
+
345
+ @property
346
+ async def owned_private_repos(self) -> int:
347
+ await self._completeIfNotSet(self._owned_private_repos)
348
+ return self._owned_private_repos.value
349
+
350
+ @property
351
+ async def plan(self) -> Plan:
352
+ await self._completeIfNotSet(self._plan)
353
+ return self._plan.value
354
+
355
+ @property
356
+ async def private_gists(self) -> int:
357
+ await self._completeIfNotSet(self._private_gists)
358
+ return self._private_gists.value
359
+
360
+ @property
361
+ async def public_gists(self) -> int:
362
+ await self._completeIfNotSet(self._public_gists)
363
+ return self._public_gists.value
364
+
365
+ @property
366
+ async def public_repos(self) -> int:
367
+ await self._completeIfNotSet(self._public_repos)
368
+ return self._public_repos.value
369
+
370
+ @property
371
+ async def received_events_url(self) -> str:
372
+ await self._completeIfNotSet(self._received_events_url)
373
+ return self._received_events_url.value
374
+
375
+ @property
376
+ async def repos_url(self) -> str:
377
+ await self._completeIfNotSet(self._repos_url)
378
+ return self._repos_url.value
379
+
380
+ @property
381
+ async def site_admin(self) -> bool:
382
+ await self._completeIfNotSet(self._site_admin)
383
+ return self._site_admin.value
384
+
385
+ @property
386
+ async def starred_url(self) -> str:
387
+ await self._completeIfNotSet(self._starred_url)
388
+ return self._starred_url.value
389
+
390
+ @property
391
+ async def subscriptions_url(self) -> str:
392
+ await self._completeIfNotSet(self._subscriptions_url)
393
+ return self._subscriptions_url.value
394
+
395
+ @property
396
+ async def total_private_repos(self) -> int:
397
+ await self._completeIfNotSet(self._total_private_repos)
398
+ return self._total_private_repos.value
399
+
400
+ @property
401
+ async def twitter_username(self) -> str:
402
+ await self._completeIfNotSet(self._twitter_username)
403
+ return self._twitter_username.value
404
+
405
+ @property
406
+ async def two_factor_authentication(self) -> bool:
407
+ await self._completeIfNotSet(self._two_factor_authentication)
408
+ return self._two_factor_authentication.value
409
+
410
+ @property
411
+ async def type(self) -> str:
412
+ await self._completeIfNotSet(self._type)
413
+ return self._type.value
414
+
415
+ @property
416
+ async def updated_at(self) -> datetime:
417
+ await self._completeIfNotSet(self._updated_at)
418
+ return self._updated_at.value
419
+
420
+ @property
421
+ async def url(self) -> str:
422
+ await self._completeIfNotSet(self._url)
423
+ return self._url.value
424
+
425
+ @property
426
+ async def user_view_type(self) -> str:
427
+ await self._completeIfNotSet(self._user_view_type)
428
+ return self._user_view_type.value
429
+
430
+ async def add_to_emails(self, *emails: str) -> None:
431
+ """
432
+ :calls: `POST /user/emails <http://docs.github.com/en/rest/reference/users#emails>`_
433
+ """
434
+ assert all(isinstance(element, str) for element in emails), emails
435
+ post_parameters = {"emails": emails}
436
+ headers, data = await self._requester.requestJsonAndCheck("POST", "/user/emails", input=post_parameters)
437
+
438
+ async def add_to_following(self, following: NamedUser) -> None:
439
+ """
440
+ :calls: `PUT /user/following/{username} <http://docs.github.com/en/rest/reference/users#followers>`_
441
+ """
442
+ assert isinstance(following, githubasyncio.NamedUser.NamedUser), following
443
+ headers, data = await self._requester.requestJsonAndCheck(
444
+ "PUT", f"/user/following/{(await following._identity)}"
445
+ )
446
+
447
+ async def add_to_starred(self, starred: Repository) -> None:
448
+ """
449
+ :calls: `PUT /user/starred/{owner}/{repo} <http://docs.github.com/en/rest/reference/activity#starring>`_
450
+ """
451
+ assert isinstance(starred, githubasyncio.Repository.Repository), starred
452
+ headers, data = await self._requester.requestJsonAndCheck("PUT", f"/user/starred/{(await starred._identity)}")
453
+
454
+ async def add_to_subscriptions(self, subscription: Repository) -> None:
455
+ """
456
+ :calls: `PUT /user/subscriptions/{owner}/{repo} <http://docs.github.com/en/rest/reference/activity#watching>`_
457
+ """
458
+ assert isinstance(subscription, githubasyncio.Repository.Repository), subscription
459
+ headers, data = await self._requester.requestJsonAndCheck(
460
+ "PUT", f"/user/subscriptions/{(await subscription._identity)}"
461
+ )
462
+
463
+ async def add_to_watched(self, watched: Repository) -> None:
464
+ """
465
+ :calls: `PUT /repos/{owner}/{repo}/subscription <http://docs.github.com/en/rest/reference/activity#watching>`_
466
+ """
467
+ assert isinstance(watched, githubasyncio.Repository.Repository), watched
468
+ headers, data = await self._requester.requestJsonAndCheck(
469
+ "PUT",
470
+ f"/repos/{(await watched._identity)}/subscription",
471
+ input={"subscribed": True},
472
+ )
473
+
474
+ async def create_authorization(
475
+ self,
476
+ scopes: Opt[list[str]] = NotSet,
477
+ note: Opt[str] = NotSet,
478
+ note_url: Opt[str] = NotSet,
479
+ client_id: Opt[str] = NotSet,
480
+ client_secret: Opt[str] = NotSet,
481
+ onetime_password: str | None = None,
482
+ ) -> Authorization:
483
+ """
484
+ :calls: `POST /authorizations <https://docs.github.com/en/developers/apps/authorizing-oauth-apps>`_
485
+ """
486
+ assert is_optional_list(scopes, str), scopes
487
+ assert is_optional(note, str), note
488
+ assert is_optional(note_url, str), note_url
489
+ assert is_optional(client_id, str), client_id
490
+ assert is_optional(client_secret, str), client_secret
491
+ assert onetime_password is None or isinstance(onetime_password, str), onetime_password
492
+ post_parameters: dict[str, Any] = NotSet.remove_unset_items(
493
+ {
494
+ "scopes": scopes,
495
+ "note": note,
496
+ "note_url": note_url,
497
+ "client_id": client_id,
498
+ "client_secret": client_secret,
499
+ }
500
+ )
501
+
502
+ if onetime_password is not None:
503
+ request_header = {Consts.headerOTP: onetime_password} # pragma no cover (Should be covered)
504
+ else:
505
+ request_header = None
506
+ headers, data = await self._requester.requestJsonAndCheck(
507
+ "POST",
508
+ "/authorizations",
509
+ input=post_parameters,
510
+ headers=request_header,
511
+ )
512
+ return githubasyncio.Authorization.Authorization(self._requester, headers, data, completed=True)
513
+
514
+ @staticmethod
515
+ async def create_fork(
516
+ repo: Repository,
517
+ name: Opt[str] = NotSet,
518
+ default_branch_only: Opt[bool] = NotSet,
519
+ ) -> Repository:
520
+ """
521
+ :calls: `POST /repos/{owner}/{repo}/forks <http://docs.github.com/en/rest/reference/repos#forks>`_
522
+ """
523
+ assert isinstance(repo, githubasyncio.Repository.Repository), repo
524
+ return await repo.create_fork(
525
+ organization=githubasyncio.GithubObject.NotSet,
526
+ name=name,
527
+ default_branch_only=default_branch_only,
528
+ )
529
+
530
+ async def create_repo_from_template(
531
+ self,
532
+ name: str,
533
+ repo: Repository,
534
+ description: Opt[str] = NotSet,
535
+ include_all_branches: Opt[bool] = NotSet,
536
+ private: Opt[bool] = NotSet,
537
+ ) -> Repository:
538
+ """
539
+ :calls: `POST /repos/{template_owner}/{template_repo}/generate <https://docs.github.com/en/rest/reference/repos#create-a-repository-using-a-template>`_
540
+ """
541
+ assert isinstance(name, str), name
542
+ assert isinstance(repo, githubasyncio.Repository.Repository), repo
543
+ assert is_optional(description, str), description
544
+ assert is_optional(include_all_branches, bool), include_all_branches
545
+ assert is_optional(private, bool), private
546
+ post_parameters: dict[str, Any] = NotSet.remove_unset_items(
547
+ {
548
+ "name": name,
549
+ "owner": await self.login,
550
+ "description": description,
551
+ "include_all_branches": include_all_branches,
552
+ "private": private,
553
+ }
554
+ )
555
+
556
+ headers, data = await self._requester.requestJsonAndCheck(
557
+ "POST",
558
+ f"/repos/{(await repo.full_name)}/generate",
559
+ input=post_parameters,
560
+ headers={"Accept": "application/vnd.github.v3+json"},
561
+ )
562
+ return githubasyncio.Repository.Repository(self._requester, headers, data, completed=True)
563
+
564
+ async def create_gist(
565
+ self,
566
+ public: bool,
567
+ files: dict[str, InputFileContent],
568
+ description: Opt[str] = NotSet,
569
+ ) -> Gist:
570
+ """
571
+ :calls: `POST /gists <http://docs.github.com/en/rest/reference/gists>`_
572
+ """
573
+ assert isinstance(public, bool), public
574
+ assert all(
575
+ isinstance(element, githubasyncio.InputFileContent.InputFileContent) for element in files.values()
576
+ ), files
577
+ assert is_undefined(description) or isinstance(description, str), description
578
+ post_parameters = {
579
+ "public": public,
580
+ "files": {key: value._identity for key, value in files.items()},
581
+ }
582
+ if is_defined(description):
583
+ post_parameters["description"] = description
584
+ headers, data = await self._requester.requestJsonAndCheck("POST", "/gists", input=post_parameters)
585
+ return githubasyncio.Gist.Gist(self._requester, headers, data, completed=True)
586
+
587
+ async def create_key(self, title: str, key: str) -> UserKey:
588
+ """
589
+ :calls: `POST /user/keys <http://docs.github.com/en/rest/reference/users#git-ssh-keys>`_
590
+ :param title: string
591
+ :param key: string
592
+ :rtype: :class:`githubasyncio.UserKey.UserKey`
593
+ """
594
+ assert isinstance(title, str), title
595
+ assert isinstance(key, str), key
596
+ post_parameters = {
597
+ "title": title,
598
+ "key": key,
599
+ }
600
+ headers, data = await self._requester.requestJsonAndCheck("POST", "/user/keys", input=post_parameters)
601
+ return githubasyncio.UserKey.UserKey(self._requester, headers, data, completed=True)
602
+
603
+ async def create_project(self, name: str, body: Opt[str] = NotSet) -> Project:
604
+ """
605
+ :calls: `POST /user/projects <https://docs.github.com/en/rest/reference/projects#create-a-user-project>`_
606
+ :param name: string
607
+ :param body: string
608
+ :rtype: :class:`githubasyncio.Project.Project`
609
+ """
610
+ assert isinstance(name, str), name
611
+ assert is_undefined(body) or isinstance(body, str), body
612
+ post_parameters = {
613
+ "name": name,
614
+ "body": body,
615
+ }
616
+ headers, data = await self._requester.requestJsonAndCheck(
617
+ "POST",
618
+ "/user/projects",
619
+ input=post_parameters,
620
+ headers={"Accept": Consts.mediaTypeProjectsPreview},
621
+ )
622
+ return githubasyncio.Project.Project(self._requester, headers, data, completed=True)
623
+
624
+ async def create_repo(
625
+ self,
626
+ name: str,
627
+ description: Opt[str] = NotSet,
628
+ homepage: Opt[str] = NotSet,
629
+ private: Opt[bool] = NotSet,
630
+ has_issues: Opt[bool] = NotSet,
631
+ has_wiki: Opt[bool] = NotSet,
632
+ has_downloads: Opt[bool] = NotSet,
633
+ has_projects: Opt[bool] = NotSet,
634
+ has_discussions: Opt[bool] = NotSet,
635
+ auto_init: Opt[bool] = NotSet,
636
+ license_template: Opt[str] = NotSet,
637
+ gitignore_template: Opt[str] = NotSet,
638
+ allow_squash_merge: Opt[bool] = NotSet,
639
+ allow_merge_commit: Opt[bool] = NotSet,
640
+ allow_rebase_merge: Opt[bool] = NotSet,
641
+ delete_branch_on_merge: Opt[bool] = NotSet,
642
+ ) -> Repository:
643
+ """
644
+ :calls: `POST /user/repos <http://docs.github.com/en/rest/reference/repos>`_
645
+ """
646
+ assert isinstance(name, str), name
647
+ assert is_optional(description, str), description
648
+ assert is_optional(homepage, str), homepage
649
+ assert is_optional(private, bool), private
650
+ assert is_optional(has_issues, bool), has_issues
651
+ assert is_optional(has_wiki, bool), has_wiki
652
+ assert is_optional(has_downloads, bool), has_downloads
653
+ assert is_optional(has_projects, bool), has_projects
654
+ assert is_optional(has_discussions, bool), has_discussions
655
+ assert is_optional(auto_init, bool), auto_init
656
+ assert is_optional(license_template, str), license_template
657
+ assert is_optional(gitignore_template, str), gitignore_template
658
+ assert is_optional(allow_squash_merge, bool), allow_squash_merge
659
+ assert is_optional(allow_merge_commit, bool), allow_merge_commit
660
+ assert is_optional(allow_rebase_merge, bool), allow_rebase_merge
661
+ assert is_optional(delete_branch_on_merge, bool), delete_branch_on_merge
662
+ post_parameters: dict[str, Any] = NotSet.remove_unset_items(
663
+ {
664
+ "name": name,
665
+ "description": description,
666
+ "homepage": homepage,
667
+ "private": private,
668
+ "has_issues": has_issues,
669
+ "has_wiki": has_wiki,
670
+ "has_downloads": has_downloads,
671
+ "has_projects": has_projects,
672
+ "has_discussions": has_discussions,
673
+ "auto_init": auto_init,
674
+ "license_template": license_template,
675
+ "gitignore_template": gitignore_template,
676
+ "allow_squash_merge": allow_squash_merge,
677
+ "allow_merge_commit": allow_merge_commit,
678
+ "allow_rebase_merge": allow_rebase_merge,
679
+ "delete_branch_on_merge": delete_branch_on_merge,
680
+ }
681
+ )
682
+
683
+ headers, data = await self._requester.requestJsonAndCheck("POST", "/user/repos", input=post_parameters)
684
+ return githubasyncio.Repository.Repository(self._requester, headers, data, completed=True)
685
+
686
+ async def edit(
687
+ self,
688
+ name: Opt[str] = NotSet,
689
+ email: Opt[str] = NotSet,
690
+ blog: Opt[str] = NotSet,
691
+ company: Opt[str] = NotSet,
692
+ location: Opt[str] = NotSet,
693
+ hireable: Opt[bool] = NotSet,
694
+ bio: Opt[str] = NotSet,
695
+ ) -> None:
696
+ """
697
+ :calls: `PATCH /user <http://docs.github.com/en/rest/reference/users>`_
698
+ """
699
+ assert is_optional(name, str), name
700
+ assert is_optional(email, str), email
701
+ assert is_optional(blog, str), blog
702
+ assert is_optional(company, str), company
703
+ assert is_optional(location, str), location
704
+ assert is_optional(hireable, bool), hireable
705
+ assert is_optional(bio, str), bio
706
+ post_parameters: dict[str, Any] = NotSet.remove_unset_items(
707
+ {
708
+ "name": name,
709
+ "email": email,
710
+ "blog": blog,
711
+ "company": company,
712
+ "location": location,
713
+ "hireable": hireable,
714
+ "bio": bio,
715
+ }
716
+ )
717
+
718
+ headers, data = await self._requester.requestJsonAndCheck("PATCH", "/user", input=post_parameters)
719
+ self._useAttributes(data)
720
+ self._set_complete()
721
+
722
+ async def get_authorization(self, id: int) -> Authorization:
723
+ """
724
+ :calls: `GET /authorizations/{id} <https://docs.github.com/en/developers/apps/authorizing-oauth-apps>`_
725
+ """
726
+ assert isinstance(id, int), id
727
+ headers, data = await self._requester.requestJsonAndCheck("GET", f"/authorizations/{id}")
728
+ return githubasyncio.Authorization.Authorization(self._requester, headers, data, completed=True)
729
+
730
+ def get_authorizations(self) -> PaginatedList[Authorization]:
731
+ """
732
+ :calls: `GET /authorizations <https://docs.github.com/en/developers/apps/authorizing-oauth-apps>`_
733
+ """
734
+ return PaginatedList(githubasyncio.Authorization.Authorization, self._requester, "/authorizations", None)
735
+
736
+ async def get_emails(self) -> list[EmailData]:
737
+ """
738
+ :calls: `GET /user/emails <http://docs.github.com/en/rest/reference/users#emails>`_
739
+ """
740
+ headers, data = await self._requester.requestJsonAndCheck("GET", "/user/emails")
741
+ return [EmailData(**item) for item in data]
742
+
743
+ def get_events(self) -> PaginatedList[Event]:
744
+ """
745
+ :calls: `GET /events <http://docs.github.com/en/rest/reference/activity#events>`_
746
+ """
747
+ return PaginatedList(githubasyncio.Event.Event, self._requester, "/events", None)
748
+
749
+ def get_followers(self) -> PaginatedList[NamedUser]:
750
+ """
751
+ :calls: `GET /user/followers <http://docs.github.com/en/rest/reference/users#followers>`_
752
+ """
753
+ return PaginatedList(githubasyncio.NamedUser.NamedUser, self._requester, "/user/followers", None)
754
+
755
+ def get_following(self) -> PaginatedList[NamedUser]:
756
+ """
757
+ :calls: `GET /user/following <http://docs.github.com/en/rest/reference/users#followers>`_
758
+ """
759
+ return PaginatedList(githubasyncio.NamedUser.NamedUser, self._requester, "/user/following", None)
760
+
761
+ def get_gists(self, since: Opt[datetime] = NotSet) -> PaginatedList[Gist]:
762
+ """
763
+ :calls: `GET /gists <http://docs.github.com/en/rest/reference/gists>`_
764
+ :param since: datetime format YYYY-MM-DDTHH:MM:SSZ
765
+ :rtype: :class:`PaginatedList` of :class:`githubasyncio.Gist.Gist`
766
+ """
767
+ assert is_optional(since, datetime), since
768
+ url_parameters: dict[str, Any] = {}
769
+ if is_defined(since):
770
+ url_parameters["since"] = since.strftime("%Y-%m-%dT%H:%M:%SZ")
771
+ return PaginatedList(githubasyncio.Gist.Gist, self._requester, "/gists", url_parameters)
772
+
773
+ async def get_issues(
774
+ self,
775
+ filter: Opt[str] = NotSet,
776
+ state: Opt[str] = NotSet,
777
+ labels: Opt[list[Label]] = NotSet,
778
+ sort: Opt[str] = NotSet,
779
+ direction: Opt[str] = NotSet,
780
+ since: Opt[datetime] = NotSet,
781
+ ) -> PaginatedList[Issue]:
782
+ """
783
+ :calls: `GET /issues <http://docs.github.com/en/rest/reference/issues>`_
784
+ """
785
+ assert is_optional(filter, str), filter
786
+ assert is_optional(state, str), state
787
+ assert is_optional_list(labels, githubasyncio.Label.Label), labels
788
+ assert is_optional(sort, str), sort
789
+ assert is_optional(direction, str), direction
790
+ assert is_optional(since, datetime), since
791
+ url_parameters: dict[str, Any] = {}
792
+ if is_defined(filter):
793
+ url_parameters["filter"] = filter
794
+ if is_defined(state):
795
+ url_parameters["state"] = state
796
+ if is_defined(labels):
797
+ url_parameters["labels"] = ",".join([(await label.name) for label in labels])
798
+ if is_defined(sort):
799
+ url_parameters["sort"] = sort
800
+ if is_defined(direction):
801
+ url_parameters["direction"] = direction
802
+ if is_defined(since):
803
+ url_parameters["since"] = since.strftime("%Y-%m-%dT%H:%M:%SZ")
804
+ return PaginatedList(githubasyncio.Issue.Issue, self._requester, "/issues", url_parameters)
805
+
806
+ async def get_user_issues(
807
+ self,
808
+ filter: Opt[str] = NotSet,
809
+ state: Opt[str] = NotSet,
810
+ labels: Opt[list[Label]] = NotSet,
811
+ sort: Opt[str] = NotSet,
812
+ direction: Opt[str] = NotSet,
813
+ since: Opt[datetime] = NotSet,
814
+ ) -> PaginatedList[Issue]:
815
+ """
816
+ :calls: `GET /user/issues <http://docs.github.com/en/rest/reference/issues>`_
817
+ """
818
+ assert is_optional(filter, str), filter
819
+ assert is_optional(state, str), state
820
+ assert is_optional_list(labels, githubasyncio.Label.Label), labels
821
+ assert is_optional(sort, str), sort
822
+ assert is_optional(direction, str), direction
823
+ assert is_optional(since, datetime), since
824
+ url_parameters: dict[str, Any] = {}
825
+ if is_defined(filter):
826
+ url_parameters["filter"] = filter
827
+ if is_defined(state):
828
+ url_parameters["state"] = state
829
+ if is_defined(labels):
830
+ url_parameters["labels"] = ",".join([(await label.name) for label in labels])
831
+ if is_defined(sort):
832
+ url_parameters["sort"] = sort
833
+ if is_defined(direction):
834
+ url_parameters["direction"] = direction
835
+ if is_defined(since):
836
+ url_parameters["since"] = since.strftime("%Y-%m-%dT%H:%M:%SZ")
837
+ return PaginatedList(githubasyncio.Issue.Issue, self._requester, "/user/issues", url_parameters)
838
+
839
+ async def get_key(self, id: int) -> UserKey:
840
+ """
841
+ :calls: `GET /user/keys/{key_id} <http://docs.github.com/en/rest/reference/users#git-ssh-keys>`_
842
+ """
843
+ assert isinstance(id, int), id
844
+ headers, data = await self._requester.requestJsonAndCheck("GET", f"/user/keys/{id}")
845
+ return githubasyncio.UserKey.UserKey(self._requester, headers, data, completed=True)
846
+
847
+ def get_keys(self) -> PaginatedList[UserKey]:
848
+ """
849
+ :calls: `GET /user/keys <http://docs.github.com/en/rest/reference/users#git-ssh-keys>`_
850
+ """
851
+ return PaginatedList(githubasyncio.UserKey.UserKey, self._requester, "/user/keys", None)
852
+
853
+ async def get_notification(self, id: str) -> Notification:
854
+ """
855
+ :calls: `GET /notifications/threads/{thread_id} <http://docs.github.com/en/rest/reference/activity#notifications>`_
856
+ """
857
+ assert isinstance(id, str), id
858
+ headers, data = await self._requester.requestJsonAndCheck("GET", f"/notifications/threads/{id}")
859
+ return githubasyncio.Notification.Notification(self._requester, headers, data, completed=True)
860
+
861
+ def get_notifications(
862
+ self,
863
+ all: Opt[bool] = NotSet,
864
+ participating: Opt[bool] = NotSet,
865
+ since: Opt[datetime] = NotSet,
866
+ before: Opt[datetime] = NotSet,
867
+ ) -> PaginatedList[Notification]:
868
+ """
869
+ :calls: `GET /notifications <http://docs.github.com/en/rest/reference/activity#notifications>`_
870
+ """
871
+ assert is_optional(all, bool), all
872
+ assert is_optional(participating, bool), participating
873
+ assert is_optional(since, datetime), since
874
+ assert is_optional(before, datetime), before
875
+
876
+ params: dict[str, Any] = {}
877
+ if is_defined(all):
878
+ # convert True, False to true, false for api parameters
879
+ params["all"] = "true" if all else "false"
880
+ if is_defined(participating):
881
+ # convert True, False to true, false for api parameters
882
+ params["participating"] = "true" if participating else "false"
883
+ if is_defined(since):
884
+ params["since"] = since.strftime("%Y-%m-%dT%H:%M:%SZ")
885
+ if is_defined(before):
886
+ params["before"] = before.strftime("%Y-%m-%dT%H:%M:%SZ")
887
+
888
+ return PaginatedList(githubasyncio.Notification.Notification, self._requester, "/notifications", params)
889
+
890
+ async def get_organization_events(self, org: Organization) -> PaginatedList[Event]:
891
+ """
892
+ :calls: `GET /users/{username}/events/orgs/{org} <http://docs.github.com/en/rest/reference/activity#events>`_
893
+ """
894
+ assert isinstance(org, githubasyncio.Organization.Organization), org
895
+ return PaginatedList(
896
+ githubasyncio.Event.Event,
897
+ self._requester,
898
+ f"/users/{await self.login}/events/orgs/{(await org.login)}",
899
+ None,
900
+ )
901
+
902
+ def get_orgs(self) -> PaginatedList[Organization]:
903
+ """
904
+ :calls: `GET /user/orgs <http://docs.github.com/en/rest/reference/orgs>`_
905
+ """
906
+ return PaginatedList(githubasyncio.Organization.Organization, self._requester, "/user/orgs", None)
907
+
908
+ async def get_repo(self, name: str) -> Repository:
909
+ """
910
+ :calls: `GET /repos/{owner}/{repo} <http://docs.github.com/en/rest/reference/repos>`_
911
+ """
912
+ assert isinstance(name, str), name
913
+ name = urllib.parse.quote(name, safe="")
914
+ url = f"/repos/{await self.login}/{name}"
915
+ return githubasyncio.Repository.Repository(self._requester, url=url)
916
+
917
+ def get_repos(
918
+ self,
919
+ visibility: Opt[str] = NotSet,
920
+ affiliation: Opt[str] = NotSet,
921
+ type: Opt[str] = NotSet,
922
+ sort: Opt[str] = NotSet,
923
+ direction: Opt[str] = NotSet,
924
+ ) -> PaginatedList[Repository]:
925
+ """
926
+ :calls: `GET /user/repos <http://docs.github.com/en/rest/reference/repos>`_
927
+ """
928
+ assert is_optional(visibility, str), visibility
929
+ assert is_optional(affiliation, str), affiliation
930
+ assert is_optional(type, str), type
931
+ assert is_optional(sort, str), sort
932
+ assert is_optional(direction, str), direction
933
+ url_parameters = NotSet.remove_unset_items(
934
+ {
935
+ "visibility": visibility,
936
+ "affiliation": affiliation,
937
+ "type": type,
938
+ "sort": sort,
939
+ "direction": direction,
940
+ }
941
+ )
942
+ return PaginatedList(githubasyncio.Repository.Repository, self._requester, "/user/repos", url_parameters)
943
+
944
+ def get_starred(self) -> PaginatedList[Repository]:
945
+ """
946
+ :calls: `GET /user/starred <http://docs.github.com/en/rest/reference/activity#starring>`_
947
+ """
948
+ return PaginatedList(githubasyncio.Repository.Repository, self._requester, "/user/starred", None)
949
+
950
+ def get_starred_gists(self) -> PaginatedList[Gist]:
951
+ """
952
+ :calls: `GET /gists/starred <http://docs.github.com/en/rest/reference/gists>`_
953
+ """
954
+ return PaginatedList(githubasyncio.Gist.Gist, self._requester, "/gists/starred", None)
955
+
956
+ def get_subscriptions(self) -> PaginatedList[Repository]:
957
+ """
958
+ :calls: `GET /user/subscriptions <http://docs.github.com/en/rest/reference/activity#watching>`_
959
+ """
960
+ return PaginatedList(githubasyncio.Repository.Repository, self._requester, "/user/subscriptions", None)
961
+
962
+ def get_teams(self) -> PaginatedList[Team]:
963
+ """
964
+ :calls: `GET /user/teams <http://docs.github.com/en/rest/reference/teams>`_
965
+ """
966
+ return PaginatedList(githubasyncio.Team.Team, self._requester, "/user/teams", None)
967
+
968
+ def get_watched(self) -> PaginatedList[Repository]:
969
+ """
970
+ :calls: `GET /user/subscriptions <http://docs.github.com/en/rest/reference/activity#watching>`_
971
+ """
972
+ return PaginatedList(githubasyncio.Repository.Repository, self._requester, "/user/subscriptions", None)
973
+
974
+ def get_installations(self) -> PaginatedList[Installation]:
975
+ """
976
+ :calls: `GET /user/installations <http://docs.github.com/en/rest/reference/apps>`_
977
+ """
978
+ return PaginatedList(
979
+ githubasyncio.Installation.Installation,
980
+ self._requester,
981
+ "/user/installations",
982
+ None,
983
+ headers={"Accept": Consts.mediaTypeIntegrationPreview},
984
+ list_item="installations",
985
+ )
986
+
987
+ async def has_in_following(self, following: NamedUser) -> bool:
988
+ """
989
+ :calls: `GET /user/following/{username} <http://docs.github.com/en/rest/reference/users#followers>`_
990
+ """
991
+ assert isinstance(following, githubasyncio.NamedUser.NamedUser), following
992
+ status, headers, data = await self._requester.requestJson(
993
+ "GET", f"/user/following/{(await following._identity)}"
994
+ )
995
+ return status == 204
996
+
997
+ async def has_in_starred(self, starred: Repository) -> bool:
998
+ """
999
+ :calls: `GET /user/starred/{owner}/{repo} <http://docs.github.com/en/rest/reference/activity#starring>`_
1000
+ """
1001
+ assert isinstance(starred, githubasyncio.Repository.Repository), starred
1002
+ status, headers, data = await self._requester.requestJson("GET", f"/user/starred/{(await starred._identity)}")
1003
+ return status == 204
1004
+
1005
+ async def has_in_subscriptions(self, subscription: Repository) -> bool:
1006
+ """
1007
+ :calls: `GET /user/subscriptions/{owner}/{repo} <http://docs.github.com/en/rest/reference/activity#watching>`_
1008
+ """
1009
+ assert isinstance(subscription, githubasyncio.Repository.Repository), subscription
1010
+ status, headers, data = await self._requester.requestJson(
1011
+ "GET", f"/user/subscriptions/{(await subscription._identity)}"
1012
+ )
1013
+ return status == 204
1014
+
1015
+ async def has_in_watched(self, watched: Repository) -> bool:
1016
+ """
1017
+ :calls: `GET /repos/{owner}/{repo}/subscription <http://docs.github.com/en/rest/reference/activity#watching>`_
1018
+ """
1019
+ assert isinstance(watched, githubasyncio.Repository.Repository), watched
1020
+ status, headers, data = await self._requester.requestJson(
1021
+ "GET", f"/repos/{(await watched._identity)}/subscription"
1022
+ )
1023
+ return status == 200
1024
+
1025
+ async def mark_notifications_as_read(self, last_read_at: datetime | None = None) -> None:
1026
+ """
1027
+ :calls: `PUT /notifications <https://docs.github.com/en/rest/reference/activity#notifications>`_
1028
+ """
1029
+ if last_read_at is None:
1030
+ last_read_at = datetime.now(timezone.utc)
1031
+ assert isinstance(last_read_at, datetime)
1032
+ put_parameters = {"last_read_at": last_read_at.strftime("%Y-%m-%dT%H:%M:%SZ")}
1033
+
1034
+ headers, data = await self._requester.requestJsonAndCheck("PUT", "/notifications", input=put_parameters)
1035
+
1036
+ async def remove_from_emails(self, *emails: str) -> None:
1037
+ """
1038
+ :calls: `DELETE /user/emails <http://docs.github.com/en/rest/reference/users#emails>`_
1039
+ """
1040
+ assert all(isinstance(element, str) for element in emails), emails
1041
+ post_parameters = {"emails": emails}
1042
+ headers, data = await self._requester.requestJsonAndCheck("DELETE", "/user/emails", input=post_parameters)
1043
+
1044
+ async def remove_from_following(self, following: NamedUser) -> None:
1045
+ """
1046
+ :calls: `DELETE /user/following/{username} <http://docs.github.com/en/rest/reference/users#followers>`_
1047
+ """
1048
+ assert isinstance(following, githubasyncio.NamedUser.NamedUser), following
1049
+ headers, data = await self._requester.requestJsonAndCheck(
1050
+ "DELETE", f"/user/following/{(await following._identity)}"
1051
+ )
1052
+
1053
+ async def remove_from_starred(self, starred: Repository) -> None:
1054
+ """
1055
+ :calls: `DELETE /user/starred/{owner}/{repo} <http://docs.github.com/en/rest/reference/activity#starring>`_
1056
+ """
1057
+ assert isinstance(starred, githubasyncio.Repository.Repository), starred
1058
+ headers, data = await self._requester.requestJsonAndCheck(
1059
+ "DELETE", f"/user/starred/{(await starred._identity)}"
1060
+ )
1061
+
1062
+ async def remove_from_subscriptions(self, subscription: Repository) -> None:
1063
+ """
1064
+ :calls: `DELETE /user/subscriptions/{owner}/{repo} <http://docs.github.com/en/rest/reference/activity#watching>`_
1065
+ """
1066
+ assert isinstance(subscription, githubasyncio.Repository.Repository), subscription
1067
+ headers, data = await self._requester.requestJsonAndCheck(
1068
+ "DELETE", f"/user/subscriptions/{(await subscription._identity)}"
1069
+ )
1070
+
1071
+ async def remove_from_watched(self, watched: Repository) -> None:
1072
+ """
1073
+ :calls: `DELETE /repos/{owner}/{repo}/subscription <http://docs.github.com/en/rest/reference/activity#watching>`_
1074
+ """
1075
+ assert isinstance(watched, githubasyncio.Repository.Repository), watched
1076
+ headers, data = await self._requester.requestJsonAndCheck(
1077
+ "DELETE", f"/repos/{(await watched._identity)}/subscription"
1078
+ )
1079
+
1080
+ async def accept_invitation(self, invitation: Invitation | int) -> None:
1081
+ """
1082
+ :calls: `PATCH /user/repository_invitations/{invitation_id} <https://docs.github.com/en/rest/reference/repos/invitations#>`_
1083
+ """
1084
+ assert isinstance(invitation, githubasyncio.Invitation.Invitation) or isinstance(invitation, int)
1085
+
1086
+ if isinstance(invitation, githubasyncio.Invitation.Invitation):
1087
+ invitation = await invitation.id
1088
+
1089
+ headers, data = await self._requester.requestJsonAndCheck(
1090
+ "PATCH", f"/user/repository_invitations/{invitation}", input={}
1091
+ )
1092
+
1093
+ def get_invitations(self) -> PaginatedList[Invitation]:
1094
+ """
1095
+ :calls: `GET /user/repository_invitations <https://docs.github.com/en/rest/reference/repos#invitations>`_
1096
+ """
1097
+ return PaginatedList(
1098
+ githubasyncio.Invitation.Invitation,
1099
+ self._requester,
1100
+ "/user/repository_invitations",
1101
+ None,
1102
+ )
1103
+
1104
+ async def create_migration(
1105
+ self,
1106
+ repos: list[Repository] | tuple[Repository],
1107
+ lock_repositories: Opt[bool] = NotSet,
1108
+ exclude_attachments: Opt[bool] = NotSet,
1109
+ ) -> Migration:
1110
+ """
1111
+ :calls: `POST /user/migrations <https://docs.github.com/en/rest/reference/migrations>`_
1112
+ """
1113
+ assert isinstance(repos, (list, tuple)), repos
1114
+ assert all(isinstance(repo, str) for repo in repos), repos
1115
+ assert is_optional(lock_repositories, bool), lock_repositories
1116
+ assert is_optional(exclude_attachments, bool), exclude_attachments
1117
+ post_parameters: dict[str, Any] = NotSet.remove_unset_items(
1118
+ {
1119
+ "repositories": repos,
1120
+ "lock_repositories": lock_repositories,
1121
+ "exclude_attachments": exclude_attachments,
1122
+ }
1123
+ )
1124
+
1125
+ headers, data = await self._requester.requestJsonAndCheck(
1126
+ "POST",
1127
+ "/user/migrations",
1128
+ input=post_parameters,
1129
+ headers={"Accept": Consts.mediaTypeMigrationPreview},
1130
+ )
1131
+ return githubasyncio.Migration.Migration(self._requester, headers, data, completed=True)
1132
+
1133
+ def get_migrations(self) -> PaginatedList[Migration]:
1134
+ """
1135
+ :calls: `GET /user/migrations <https://docs.github.com/en/rest/reference/migrations>`_
1136
+ """
1137
+ return PaginatedList(
1138
+ githubasyncio.Migration.Migration,
1139
+ self._requester,
1140
+ "/user/migrations",
1141
+ None,
1142
+ headers={"Accept": Consts.mediaTypeMigrationPreview},
1143
+ )
1144
+
1145
+ def get_organization_memberships(self) -> PaginatedList[Membership]:
1146
+ """
1147
+ :calls: `GET /user/memberships/orgs <https://docs.github.com/en/rest/orgs/members#list-organization-memberships-for-the-authenticated-user>`_
1148
+ """
1149
+ return PaginatedList(
1150
+ githubasyncio.Membership.Membership,
1151
+ self._requester,
1152
+ "/user/memberships/orgs",
1153
+ None,
1154
+ )
1155
+
1156
+ async def get_organization_membership(self, org: str) -> Membership:
1157
+ """
1158
+ :calls: `GET /user/memberships/orgs/{org} <https://docs.github.com/en/rest/reference/orgs#get-an-organization-membership-for-the-authenticated-user>`_
1159
+ """
1160
+ assert isinstance(org, str)
1161
+ org = urllib.parse.quote(org, safe="")
1162
+ headers, data = await self._requester.requestJsonAndCheck("GET", f"/user/memberships/orgs/{org}")
1163
+ return githubasyncio.Membership.Membership(self._requester, headers, data, completed=True)
1164
+
1165
+ def _useAttributes(self, attributes: dict[str, Any]) -> None:
1166
+ if "avatar_url" in attributes: # pragma no branch
1167
+ self._avatar_url = self._makeStringAttribute(attributes["avatar_url"])
1168
+ if "bio" in attributes: # pragma no branch
1169
+ self._bio = self._makeStringAttribute(attributes["bio"])
1170
+ if "blog" in attributes: # pragma no branch
1171
+ self._blog = self._makeStringAttribute(attributes["blog"])
1172
+ if "business_plus" in attributes: # pragma no branch
1173
+ self._business_plus = self._makeBoolAttribute(attributes["business_plus"])
1174
+ if "collaborators" in attributes: # pragma no branch
1175
+ self._collaborators = self._makeIntAttribute(attributes["collaborators"])
1176
+ if "company" in attributes: # pragma no branch
1177
+ self._company = self._makeStringAttribute(attributes["company"])
1178
+ if "created_at" in attributes: # pragma no branch
1179
+ self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
1180
+ if "disk_usage" in attributes: # pragma no branch
1181
+ self._disk_usage = self._makeIntAttribute(attributes["disk_usage"])
1182
+ if "email" in attributes: # pragma no branch
1183
+ self._email = self._makeStringAttribute(attributes["email"])
1184
+ if "events_url" in attributes: # pragma no branch
1185
+ self._events_url = self._makeStringAttribute(attributes["events_url"])
1186
+ if "followers" in attributes: # pragma no branch
1187
+ self._followers = self._makeIntAttribute(attributes["followers"])
1188
+ if "followers_url" in attributes: # pragma no branch
1189
+ self._followers_url = self._makeStringAttribute(attributes["followers_url"])
1190
+ if "following" in attributes: # pragma no branch
1191
+ self._following = self._makeIntAttribute(attributes["following"])
1192
+ if "following_url" in attributes: # pragma no branch
1193
+ self._following_url = self._makeStringAttribute(attributes["following_url"])
1194
+ if "gists_url" in attributes: # pragma no branch
1195
+ self._gists_url = self._makeStringAttribute(attributes["gists_url"])
1196
+ if "gravatar_id" in attributes: # pragma no branch
1197
+ self._gravatar_id = self._makeStringAttribute(attributes["gravatar_id"])
1198
+ if "hireable" in attributes: # pragma no branch
1199
+ self._hireable = self._makeBoolAttribute(attributes["hireable"])
1200
+ if "html_url" in attributes: # pragma no branch
1201
+ self._html_url = self._makeStringAttribute(attributes["html_url"])
1202
+ if "id" in attributes: # pragma no branch
1203
+ self._id = self._makeIntAttribute(attributes["id"])
1204
+ if "ldap_dn" in attributes: # pragma no branch
1205
+ self._ldap_dn = self._makeStringAttribute(attributes["ldap_dn"])
1206
+ if "location" in attributes: # pragma no branch
1207
+ self._location = self._makeStringAttribute(attributes["location"])
1208
+ if "login" in attributes: # pragma no branch
1209
+ self._login = self._makeStringAttribute(attributes["login"])
1210
+ if "name" in attributes: # pragma no branch
1211
+ self._name = self._makeStringAttribute(attributes["name"])
1212
+ if "node_id" in attributes: # pragma no branch
1213
+ self._node_id = self._makeStringAttribute(attributes["node_id"])
1214
+ if "notification_email" in attributes: # pragma no branch
1215
+ self._notification_email = self._makeStringAttribute(attributes["notification_email"])
1216
+ if "organizations_url" in attributes: # pragma no branch
1217
+ self._organizations_url = self._makeStringAttribute(attributes["organizations_url"])
1218
+ if "owned_private_repos" in attributes: # pragma no branch
1219
+ self._owned_private_repos = self._makeIntAttribute(attributes["owned_private_repos"])
1220
+ if "plan" in attributes: # pragma no branch
1221
+ self._plan = self._makeClassAttribute(githubasyncio.Plan.Plan, attributes["plan"])
1222
+ if "private_gists" in attributes: # pragma no branch
1223
+ self._private_gists = self._makeIntAttribute(attributes["private_gists"])
1224
+ if "public_gists" in attributes: # pragma no branch
1225
+ self._public_gists = self._makeIntAttribute(attributes["public_gists"])
1226
+ if "public_repos" in attributes: # pragma no branch
1227
+ self._public_repos = self._makeIntAttribute(attributes["public_repos"])
1228
+ if "received_events_url" in attributes: # pragma no branch
1229
+ self._received_events_url = self._makeStringAttribute(attributes["received_events_url"])
1230
+ if "repos_url" in attributes: # pragma no branch
1231
+ self._repos_url = self._makeStringAttribute(attributes["repos_url"])
1232
+ if "site_admin" in attributes: # pragma no branch
1233
+ self._site_admin = self._makeBoolAttribute(attributes["site_admin"])
1234
+ if "starred_url" in attributes: # pragma no branch
1235
+ self._starred_url = self._makeStringAttribute(attributes["starred_url"])
1236
+ if "subscriptions_url" in attributes: # pragma no branch
1237
+ self._subscriptions_url = self._makeStringAttribute(attributes["subscriptions_url"])
1238
+ if "total_private_repos" in attributes: # pragma no branch
1239
+ self._total_private_repos = self._makeIntAttribute(attributes["total_private_repos"])
1240
+ if "twitter_username" in attributes: # pragma no branch
1241
+ self._twitter_username = self._makeStringAttribute(attributes["twitter_username"])
1242
+ if "two_factor_authentication" in attributes:
1243
+ self._two_factor_authentication = self._makeBoolAttribute(attributes["two_factor_authentication"])
1244
+ if "type" in attributes: # pragma no branch
1245
+ self._type = self._makeStringAttribute(attributes["type"])
1246
+ if "updated_at" in attributes: # pragma no branch
1247
+ self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
1248
+ if "url" in attributes: # pragma no branch
1249
+ self._url = self._makeStringAttribute(attributes["url"])
1250
+ if "user_view_type" in attributes: # pragma no branch
1251
+ self._user_view_type = self._makeStringAttribute(attributes["user_view_type"])