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/Gist.py ADDED
@@ -0,0 +1,373 @@
1
+ # FILE AUTO GENERATED DO NOT TOUCH
2
+ ############################ Copyrights and license ############################
3
+ # #
4
+ # Copyright 2012 Steve English <steve.english@navetas.com> #
5
+ # Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
6
+ # Copyright 2012 Zearin <zearin@gonk.net> #
7
+ # Copyright 2013 AKFish <akfish@gmail.com> #
8
+ # Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
9
+ # Copyright 2014 Dale Jung <dale@dalejung.com> #
10
+ # Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
11
+ # Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
12
+ # Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
13
+ # Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
14
+ # Copyright 2018 sfdye <tsfdye@gmail.com> #
15
+ # Copyright 2018 羽 <Just4test@users.noreply.github.com> #
16
+ # Copyright 2019 Jon Dufresne <jon.dufresne@gmail.com> #
17
+ # Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
18
+ # Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
19
+ # Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
20
+ # Copyright 2021 Mark Walker <mark.walker@realbuzz.com> #
21
+ # Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
22
+ # Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
23
+ # Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
24
+ # Copyright 2023 Trim21 <trim21.me@gmail.com> #
25
+ # Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
26
+ # Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
27
+ # Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
28
+ # Copyright 2026 Enrico Minack <github@enrico.minack.dev> #
29
+ # #
30
+ # This file is part of PyGithub. #
31
+ # http://pygithub.readthedocs.io/ #
32
+ # #
33
+ # PyGithub is free software: you can redistribute it and/or modify it under #
34
+ # the terms of the GNU Lesser General Public License as published by the Free #
35
+ # Software Foundation, either version 3 of the License, or (at your option) #
36
+ # any later version. #
37
+ # #
38
+ # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
39
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
40
+ # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
41
+ # details. #
42
+ # #
43
+ # You should have received a copy of the GNU Lesser General Public License #
44
+ # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
45
+ # #
46
+ ################################################################################
47
+
48
+ from __future__ import annotations
49
+
50
+ import urllib.parse
51
+ from datetime import datetime
52
+ from typing import TYPE_CHECKING, Any
53
+
54
+ import githubasyncio.AuthenticatedUser
55
+ import githubasyncio.GistComment
56
+ import githubasyncio.GistFile
57
+ import githubasyncio.GistHistoryState
58
+ import githubasyncio.GithubObject
59
+ import githubasyncio.InputFileContent
60
+ import githubasyncio.NamedUser
61
+ import githubasyncio.Organization
62
+ import githubasyncio.PaginatedList
63
+ from githubasyncio.GithubObject import (
64
+ Attribute,
65
+ CompletableGithubObject,
66
+ NotSet,
67
+ Opt,
68
+ _NotSetType,
69
+ is_defined,
70
+ is_optional,
71
+ )
72
+ from githubasyncio.PaginatedList import PaginatedList
73
+
74
+ if TYPE_CHECKING:
75
+ from githubasyncio.GistComment import GistComment
76
+ from githubasyncio.GistFile import GistFile
77
+ from githubasyncio.GistHistoryState import GistHistoryState
78
+ from githubasyncio.InputFileContent import InputFileContent
79
+ from githubasyncio.NamedUser import NamedUser
80
+
81
+
82
+ class Gist(CompletableGithubObject):
83
+ """
84
+ This class represents Gists.
85
+
86
+ The reference can be found here
87
+ https://docs.github.com/en/rest/reference/gists
88
+
89
+ The OpenAPI schema can be found at
90
+
91
+ - /components/schemas/base-gist
92
+ - /components/schemas/gist-simple
93
+ - /components/schemas/gist-simple/properties/fork_of
94
+ - /components/schemas/gist-simple/properties/forks/items
95
+
96
+ """
97
+
98
+ def _initAttributes(self) -> None:
99
+ self._comments: Attribute[int] = NotSet
100
+ self._comments_enabled: Attribute[bool] = NotSet
101
+ self._comments_url: Attribute[str] = NotSet
102
+ self._commits_url: Attribute[str] = NotSet
103
+ self._created_at: Attribute[datetime] = NotSet
104
+ self._description: Attribute[str] = NotSet
105
+ self._files: Attribute[dict[str, GistFile]] = NotSet
106
+ self._fork_of: Attribute[Gist] = NotSet
107
+ self._forks: Attribute[list[Gist]] = NotSet
108
+ self._forks_url: Attribute[str] = NotSet
109
+ self._git_pull_url: Attribute[str] = NotSet
110
+ self._git_push_url: Attribute[str] = NotSet
111
+ self._history: Attribute[list[GistHistoryState]] = NotSet
112
+ self._html_url: Attribute[str] = NotSet
113
+ self._id: Attribute[str] = NotSet
114
+ self._node_id: Attribute[str] = NotSet
115
+ self._owner: Attribute[NamedUser] = NotSet
116
+ self._public: Attribute[bool] = NotSet
117
+ self._truncated: Attribute[bool] = NotSet
118
+ self._updated_at: Attribute[datetime] = NotSet
119
+ self._url: Attribute[str] = NotSet
120
+ self._user: Attribute[NamedUser] = NotSet
121
+
122
+ def __repr__(self) -> str:
123
+ return self.get__repr__({"id": self._id.value})
124
+
125
+ @property
126
+ async def comments(self) -> int:
127
+ await self._completeIfNotSet(self._comments)
128
+ return self._comments.value
129
+
130
+ @property
131
+ async def comments_enabled(self) -> bool:
132
+ await self._completeIfNotSet(self._comments_enabled)
133
+ return self._comments_enabled.value
134
+
135
+ @property
136
+ async def comments_url(self) -> str:
137
+ await self._completeIfNotSet(self._comments_url)
138
+ return self._comments_url.value
139
+
140
+ @property
141
+ async def commits_url(self) -> str:
142
+ await self._completeIfNotSet(self._commits_url)
143
+ return self._commits_url.value
144
+
145
+ @property
146
+ async def created_at(self) -> datetime:
147
+ await self._completeIfNotSet(self._created_at)
148
+ return self._created_at.value
149
+
150
+ @property
151
+ async def description(self) -> str:
152
+ await self._completeIfNotSet(self._description)
153
+ return self._description.value
154
+
155
+ @property
156
+ async def files(self) -> dict[str, GistFile]:
157
+ await self._completeIfNeeded()
158
+ return self._files.value
159
+
160
+ @property
161
+ async def fork_of(self) -> Gist:
162
+ await self._completeIfNotSet(self._fork_of)
163
+ return self._fork_of.value
164
+
165
+ @property
166
+ async def forks(self) -> list[Gist]:
167
+ await self._completeIfNotSet(self._forks)
168
+ return self._forks.value
169
+
170
+ @property
171
+ async def forks_url(self) -> str:
172
+ await self._completeIfNotSet(self._forks_url)
173
+ return self._forks_url.value
174
+
175
+ @property
176
+ async def git_pull_url(self) -> str:
177
+ await self._completeIfNotSet(self._git_pull_url)
178
+ return self._git_pull_url.value
179
+
180
+ @property
181
+ async def git_push_url(self) -> str:
182
+ await self._completeIfNotSet(self._git_push_url)
183
+ return self._git_push_url.value
184
+
185
+ @property
186
+ async def history(self) -> list[GistHistoryState]:
187
+ await self._completeIfNotSet(self._history)
188
+ return self._history.value
189
+
190
+ @property
191
+ async def html_url(self) -> str:
192
+ await self._completeIfNotSet(self._html_url)
193
+ return self._html_url.value
194
+
195
+ @property
196
+ async def id(self) -> str:
197
+ await self._completeIfNotSet(self._id)
198
+ return self._id.value
199
+
200
+ @property
201
+ async def node_id(self) -> str:
202
+ await self._completeIfNotSet(self._node_id)
203
+ return self._node_id.value
204
+
205
+ @property
206
+ async def owner(self) -> NamedUser:
207
+ await self._completeIfNotSet(self._owner)
208
+ return self._owner.value
209
+
210
+ @property
211
+ async def public(self) -> bool:
212
+ await self._completeIfNotSet(self._public)
213
+ return self._public.value
214
+
215
+ @property
216
+ async def truncated(self) -> bool:
217
+ await self._completeIfNotSet(self._truncated)
218
+ return self._truncated.value
219
+
220
+ @property
221
+ async def updated_at(self) -> datetime:
222
+ await self._completeIfNotSet(self._updated_at)
223
+ return self._updated_at.value
224
+
225
+ @property
226
+ async def url(self) -> str:
227
+ await self._completeIfNotSet(self._url)
228
+ return self._url.value
229
+
230
+ @property
231
+ async def user(self) -> NamedUser:
232
+ await self._completeIfNotSet(self._user)
233
+ return self._user.value
234
+
235
+ async def create_comment(self, body: str) -> GistComment:
236
+ """
237
+ :calls: `POST /gists/{gist_id}/comments <https://docs.github.com/en/rest/reference/gists#comments>`_
238
+ """
239
+ assert isinstance(body, str), body
240
+ post_parameters = {
241
+ "body": body,
242
+ }
243
+ headers, data = await self._requester.requestJsonAndCheck(
244
+ "POST", f"{await self.url}/comments", input=post_parameters
245
+ )
246
+ return githubasyncio.GistComment.GistComment(self._requester, headers, data, completed=True)
247
+
248
+ async def create_fork(self) -> Gist:
249
+ """
250
+ :calls: `POST /gists/{gist_id}/forks <https://docs.github.com/en/rest/reference/gists>`_
251
+ """
252
+ headers, data = await self._requester.requestJsonAndCheck("POST", f"{await self.url}/forks")
253
+ return Gist(self._requester, headers, data, completed=True)
254
+
255
+ async def delete(self) -> None:
256
+ """
257
+ :calls: `DELETE /gists/{gist_id} <https://docs.github.com/en/rest/reference/gists>`_
258
+ """
259
+ headers, data = await self._requester.requestJsonAndCheck("DELETE", await self.url)
260
+
261
+ async def edit(
262
+ self, description: Opt[str] = NotSet, files: Opt[dict[str, InputFileContent | None]] = NotSet
263
+ ) -> None:
264
+ """
265
+ :calls: `PATCH /gists/{gist_id} <https://docs.github.com/en/rest/reference/gists>`_
266
+ """
267
+ assert is_optional(description, str), description
268
+ # limitation of `TypeGuard`
269
+ assert isinstance(files, _NotSetType) or all(
270
+ element is None or isinstance(element, githubasyncio.InputFileContent.InputFileContent)
271
+ for element in files.values()
272
+ ), files
273
+ post_parameters: dict[str, Any] = {}
274
+ if is_defined(description):
275
+ post_parameters["description"] = description
276
+ if is_defined(files):
277
+ post_parameters["files"] = {key: None if value is None else value._identity for key, value in files.items()}
278
+ headers, data = await self._requester.requestJsonAndCheck("PATCH", await self.url, input=post_parameters)
279
+
280
+ self._useAttributes(data)
281
+ self._set_complete()
282
+
283
+ async def get_comment(self, id: int) -> GistComment:
284
+ """
285
+ :calls: `GET /gists/{gist_id}/comments/{comment_id} <https://docs.github.com/en/rest/reference/gists#comments>`_
286
+ """
287
+ assert isinstance(id, int), id
288
+ url = f"{await self.url}/comments/{id}"
289
+ return githubasyncio.GistComment.GistComment(self._requester, url=url)
290
+
291
+ async def get_comments(self) -> PaginatedList[GistComment]:
292
+ """
293
+ :calls: `GET /gists/{gist_id}/comments <https://docs.github.com/en/rest/reference/gists#comments>`_
294
+ """
295
+ return PaginatedList(
296
+ githubasyncio.GistComment.GistComment,
297
+ self._requester,
298
+ f"{await self.url}/comments",
299
+ None,
300
+ )
301
+
302
+ async def is_starred(self) -> bool:
303
+ """
304
+ :calls: `GET /gists/{gist_id}/star <https://docs.github.com/en/rest/reference/gists>`_
305
+ """
306
+ status, headers, data = await self._requester.requestJson("GET", f"{await self.url}/star")
307
+ return status == 204
308
+
309
+ async def reset_starred(self) -> None:
310
+ """
311
+ :calls: `DELETE /gists/{gist_id}/star <https://docs.github.com/en/rest/reference/gists>`_
312
+ """
313
+ headers, data = await self._requester.requestJsonAndCheck("DELETE", f"{await self.url}/star")
314
+
315
+ async def set_starred(self) -> None:
316
+ """
317
+ :calls: `PUT /gists/{gist_id}/star <https://docs.github.com/en/rest/reference/gists>`_
318
+ """
319
+ headers, data = await self._requester.requestJsonAndCheck("PUT", f"{await self.url}/star")
320
+
321
+ def _useAttributes(self, attributes: dict[str, Any]) -> None:
322
+ if "comments" in attributes: # pragma no branch
323
+ self._comments = self._makeIntAttribute(attributes["comments"])
324
+ if "comments_enabled" in attributes: # pragma no branch
325
+ self._comments_enabled = self._makeBoolAttribute(attributes["comments_enabled"])
326
+ if "comments_url" in attributes: # pragma no branch
327
+ self._comments_url = self._makeStringAttribute(attributes["comments_url"])
328
+ if "commits_url" in attributes: # pragma no branch
329
+ self._commits_url = self._makeStringAttribute(attributes["commits_url"])
330
+ if "created_at" in attributes: # pragma no branch
331
+ self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
332
+ if "description" in attributes: # pragma no branch
333
+ self._description = self._makeStringAttribute(attributes["description"])
334
+ if "files" in attributes: # pragma no branch
335
+ self._files = self._makeDictOfStringsToClassesAttribute(
336
+ githubasyncio.GistFile.GistFile, attributes["files"]
337
+ )
338
+ if "fork_of" in attributes: # pragma no branch
339
+ self._fork_of = self._makeClassAttribute(Gist, attributes["fork_of"])
340
+ if "forks" in attributes: # pragma no branch
341
+ self._forks = self._makeListOfClassesAttribute(Gist, attributes["forks"])
342
+ if "forks_url" in attributes: # pragma no branch
343
+ self._forks_url = self._makeStringAttribute(attributes["forks_url"])
344
+ if "git_pull_url" in attributes: # pragma no branch
345
+ self._git_pull_url = self._makeStringAttribute(attributes["git_pull_url"])
346
+ if "git_push_url" in attributes: # pragma no branch
347
+ self._git_push_url = self._makeStringAttribute(attributes["git_push_url"])
348
+ if "history" in attributes: # pragma no branch
349
+ self._history = self._makeListOfClassesAttribute(
350
+ githubasyncio.GistHistoryState.GistHistoryState, attributes["history"]
351
+ )
352
+ if "html_url" in attributes: # pragma no branch
353
+ self._html_url = self._makeStringAttribute(attributes["html_url"])
354
+ if "id" in attributes: # pragma no branch
355
+ self._id = self._makeStringAttribute(attributes["id"])
356
+ elif "url" in attributes and attributes["url"]:
357
+ quoted_id = attributes["url"].split("/")[-1]
358
+ id = urllib.parse.unquote(quoted_id)
359
+ self._id = self._makeStringAttribute(id)
360
+ if "node_id" in attributes: # pragma no branch
361
+ self._node_id = self._makeStringAttribute(attributes["node_id"])
362
+ if "owner" in attributes: # pragma no branch
363
+ self._owner = self._makeClassAttribute(githubasyncio.NamedUser.NamedUser, attributes["owner"])
364
+ if "public" in attributes: # pragma no branch
365
+ self._public = self._makeBoolAttribute(attributes["public"])
366
+ if "truncated" in attributes: # pragma no branch
367
+ self._truncated = self._makeBoolAttribute(attributes["truncated"])
368
+ if "updated_at" in attributes: # pragma no branch
369
+ self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
370
+ if "url" in attributes: # pragma no branch
371
+ self._url = self._makeStringAttribute(attributes["url"])
372
+ if "user" in attributes: # pragma no branch
373
+ self._user = self._makeClassAttribute(githubasyncio.NamedUser.NamedUser, attributes["user"])
@@ -0,0 +1,162 @@
1
+ # FILE AUTO GENERATED DO NOT TOUCH
2
+ ############################ Copyrights and license ############################
3
+ # #
4
+ # Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
5
+ # Copyright 2012 Zearin <zearin@gonk.net> #
6
+ # Copyright 2013 AKFish <akfish@gmail.com> #
7
+ # Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
8
+ # Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
9
+ # Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
10
+ # Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
11
+ # Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
12
+ # Copyright 2018 sfdye <tsfdye@gmail.com> #
13
+ # Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
14
+ # Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
15
+ # Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
16
+ # Copyright 2021 Mark Walker <mark.walker@realbuzz.com> #
17
+ # Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
18
+ # Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
19
+ # Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
20
+ # Copyright 2023 Trim21 <trim21.me@gmail.com> #
21
+ # Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
22
+ # Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
23
+ # Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
24
+ # Copyright 2026 Enrico Minack <github@enrico.minack.dev> #
25
+ # #
26
+ # This file is part of PyGithub. #
27
+ # http://pygithub.readthedocs.io/ #
28
+ # #
29
+ # PyGithub is free software: you can redistribute it and/or modify it under #
30
+ # the terms of the GNU Lesser General Public License as published by the Free #
31
+ # Software Foundation, either version 3 of the License, or (at your option) #
32
+ # any later version. #
33
+ # #
34
+ # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
35
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
36
+ # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
37
+ # details. #
38
+ # #
39
+ # You should have received a copy of the GNU Lesser General Public License #
40
+ # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
41
+ # #
42
+ ################################################################################
43
+
44
+ from __future__ import annotations
45
+
46
+ from datetime import datetime
47
+ from typing import TYPE_CHECKING, Any
48
+
49
+ import githubasyncio.GithubObject
50
+ import githubasyncio.NamedUser
51
+ import githubasyncio.Organization
52
+ from githubasyncio.GithubObject import Attribute, CompletableGithubObject, NotSet
53
+
54
+ if TYPE_CHECKING:
55
+ from githubasyncio.NamedUser import NamedUser
56
+
57
+
58
+ class GistComment(CompletableGithubObject):
59
+ """
60
+ This class represents GistComments.
61
+
62
+ The reference can be found here
63
+ https://docs.github.com/en/rest/reference/gists#comments
64
+
65
+ The OpenAPI schema can be found at
66
+
67
+ - /components/schemas/gist-comment
68
+
69
+ """
70
+
71
+ def _initAttributes(self) -> None:
72
+ self._author_association: Attribute[str] = NotSet
73
+ self._body: Attribute[str] = NotSet
74
+ self._created_at: Attribute[datetime] = NotSet
75
+ self._id: Attribute[int] = NotSet
76
+ self._node_id: Attribute[str] = NotSet
77
+ self._updated_at: Attribute[datetime] = NotSet
78
+ self._url: Attribute[str] = NotSet
79
+ self._user: Attribute[NamedUser] = NotSet
80
+
81
+ def __repr__(self) -> str:
82
+ return self.get__repr__({"id": self._id.value, "user": self._user.value})
83
+
84
+ @property
85
+ async def author_association(self) -> str:
86
+ await self._completeIfNotSet(self._author_association)
87
+ return self._author_association.value
88
+
89
+ @property
90
+ async def body(self) -> str:
91
+ await self._completeIfNotSet(self._body)
92
+ return self._body.value
93
+
94
+ @property
95
+ async def created_at(self) -> datetime:
96
+ await self._completeIfNotSet(self._created_at)
97
+ return self._created_at.value
98
+
99
+ @property
100
+ async def id(self) -> int:
101
+ await self._completeIfNotSet(self._id)
102
+ return self._id.value
103
+
104
+ @property
105
+ async def node_id(self) -> str:
106
+ await self._completeIfNotSet(self._node_id)
107
+ return self._node_id.value
108
+
109
+ @property
110
+ async def updated_at(self) -> datetime:
111
+ await self._completeIfNotSet(self._updated_at)
112
+ return self._updated_at.value
113
+
114
+ @property
115
+ async def url(self) -> str:
116
+ await self._completeIfNotSet(self._url)
117
+ return self._url.value
118
+
119
+ @property
120
+ async def user(self) -> NamedUser:
121
+ await self._completeIfNotSet(self._user)
122
+ return self._user.value
123
+
124
+ async def delete(self) -> None:
125
+ """
126
+ :calls: `DELETE /gists/{gist_id}/comments/{comment_id} <https://docs.github.com/en/rest/reference/gists#comments>`_
127
+ """
128
+ headers, data = await self._requester.requestJsonAndCheck("DELETE", await self.url)
129
+
130
+ async def edit(self, body: str) -> None:
131
+ """
132
+ :calls: `PATCH /gists/{gist_id}/comments/{comment_id} <https://docs.github.com/en/rest/reference/gists#comments>`_
133
+ """
134
+ assert isinstance(body, str), body
135
+ post_parameters = {
136
+ "body": body,
137
+ }
138
+ headers, data = await self._requester.requestJsonAndCheck("PATCH", await self.url, input=post_parameters)
139
+ self._useAttributes(data)
140
+ self._set_complete()
141
+
142
+ def _useAttributes(self, attributes: dict[str, Any]) -> None:
143
+ if "author_association" in attributes: # pragma no branch
144
+ self._author_association = self._makeStringAttribute(attributes["author_association"])
145
+ if "body" in attributes: # pragma no branch
146
+ self._body = self._makeStringAttribute(attributes["body"])
147
+ if "created_at" in attributes: # pragma no branch
148
+ self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
149
+ if "id" in attributes: # pragma no branch
150
+ self._id = self._makeIntAttribute(attributes["id"])
151
+ elif "url" in attributes and attributes["url"]:
152
+ id = attributes["url"].split("/")[-1]
153
+ if id.isnumeric():
154
+ self._id = self._makeIntAttribute(int(id))
155
+ if "node_id" in attributes: # pragma no branch
156
+ self._node_id = self._makeStringAttribute(attributes["node_id"])
157
+ if "updated_at" in attributes: # pragma no branch
158
+ self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
159
+ if "url" in attributes: # pragma no branch
160
+ self._url = self._makeStringAttribute(attributes["url"])
161
+ if "user" in attributes: # pragma no branch
162
+ self._user = self._makeClassAttribute(githubasyncio.NamedUser.NamedUser, attributes["user"])
@@ -0,0 +1,106 @@
1
+ # FILE AUTO GENERATED DO NOT TOUCH
2
+ ############################ Copyrights and license ############################
3
+ # #
4
+ # Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
5
+ # Copyright 2012 Zearin <zearin@gonk.net> #
6
+ # Copyright 2013 AKFish <akfish@gmail.com> #
7
+ # Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
8
+ # Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
9
+ # Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
10
+ # Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
11
+ # Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
12
+ # Copyright 2018 sfdye <tsfdye@gmail.com> #
13
+ # Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
14
+ # Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
15
+ # Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
16
+ # Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
17
+ # Copyright 2023 Trim21 <trim21.me@gmail.com> #
18
+ # Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
19
+ # Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
20
+ # Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
21
+ # #
22
+ # This file is part of PyGithub. #
23
+ # http://pygithub.readthedocs.io/ #
24
+ # #
25
+ # PyGithub is free software: you can redistribute it and/or modify it under #
26
+ # the terms of the GNU Lesser General Public License as published by the Free #
27
+ # Software Foundation, either version 3 of the License, or (at your option) #
28
+ # any later version. #
29
+ # #
30
+ # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
31
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
32
+ # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
33
+ # details. #
34
+ # #
35
+ # You should have received a copy of the GNU Lesser General Public License #
36
+ # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
37
+ # #
38
+ ################################################################################
39
+
40
+ from __future__ import annotations
41
+
42
+ from typing import Any
43
+
44
+ from githubasyncio.GithubObject import Attribute, NonCompletableGithubObject, NotSet
45
+
46
+
47
+ class GistFile(NonCompletableGithubObject):
48
+ """
49
+ This class represents GistFiles.
50
+
51
+ The OpenAPI schema can be found at
52
+
53
+ - /components/schemas/base-gist/properties/files
54
+ - /components/schemas/gist-simple/properties/files
55
+ - /components/schemas/gist-simple/properties/fork_of/properties/files
56
+
57
+ """
58
+
59
+ def _initAttributes(self) -> None:
60
+ self._content: Attribute[str] = NotSet
61
+ self._filename: Attribute[str] = NotSet
62
+ self._language: Attribute[str] = NotSet
63
+ self._raw_url: Attribute[str] = NotSet
64
+ self._size: Attribute[int] = NotSet
65
+ self._type: Attribute[str] = NotSet
66
+
67
+ def __repr__(self) -> str:
68
+ return self.get__repr__({"filename": self._filename.value})
69
+
70
+ @property
71
+ def content(self) -> str:
72
+ return self._content.value
73
+
74
+ @property
75
+ def filename(self) -> str:
76
+ return self._filename.value
77
+
78
+ @property
79
+ def language(self) -> str:
80
+ return self._language.value
81
+
82
+ @property
83
+ def raw_url(self) -> str:
84
+ return self._raw_url.value
85
+
86
+ @property
87
+ def size(self) -> int:
88
+ return self._size.value
89
+
90
+ @property
91
+ def type(self) -> str:
92
+ return self._type.value
93
+
94
+ def _useAttributes(self, attributes: dict[str, Any]) -> None:
95
+ if "content" in attributes: # pragma no branch
96
+ self._content = self._makeStringAttribute(attributes["content"])
97
+ if "filename" in attributes: # pragma no branch
98
+ self._filename = self._makeStringAttribute(attributes["filename"])
99
+ if "language" in attributes: # pragma no branch
100
+ self._language = self._makeStringAttribute(attributes["language"])
101
+ if "raw_url" in attributes: # pragma no branch
102
+ self._raw_url = self._makeStringAttribute(attributes["raw_url"])
103
+ if "size" in attributes: # pragma no branch
104
+ self._size = self._makeIntAttribute(attributes["size"])
105
+ if "type" in attributes: # pragma no branch
106
+ self._type = self._makeStringAttribute(attributes["type"])