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,476 @@
1
+ # FILE AUTO GENERATED DO NOT TOUCH
2
+ ############################ Copyrights and license ############################
3
+ # #
4
+ # Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
5
+ # Copyright 2012 Zearin <zearin@gonk.net> #
6
+ # Copyright 2013 AKFish <akfish@gmail.com> #
7
+ # Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> #
8
+ # Copyright 2013 martinqt <m.ki2@laposte.net> #
9
+ # Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> #
10
+ # Copyright 2015 Ed Holland <eholland@alertlogic.com> #
11
+ # Copyright 2016 Benjamin Whitney <benjamin.whitney@ironnetcybersecurity.com> #
12
+ # Copyright 2016 Jannis Gebauer <ja.geb@me.com> #
13
+ # Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> #
14
+ # Copyright 2017 Chris McBride <thehighlander@users.noreply.github.com> #
15
+ # Copyright 2017 Simon <spam@esemi.ru> #
16
+ # Copyright 2018 Daniel Kesler <kesler.daniel@gmail.com> #
17
+ # Copyright 2018 Ggicci <ggicci.t@gmail.com> #
18
+ # Copyright 2018 Kuba <jakub.glapa@adspired.com> #
19
+ # Copyright 2018 Maarten Fonville <mfonville@users.noreply.github.com> #
20
+ # Copyright 2018 Shinichi TAMURA <shnch.tmr@gmail.com> #
21
+ # Copyright 2018 Wan Liuyang <tsfdye@gmail.com> #
22
+ # Copyright 2018 edquist <edquist@users.noreply.github.com> #
23
+ # Copyright 2018 nurupo <nurupo.contributions@gmail.com> #
24
+ # Copyright 2018 sfdye <tsfdye@gmail.com> #
25
+ # Copyright 2019 Steve Kowalik <steven@wedontsleep.org> #
26
+ # Copyright 2019 Wan Liuyang <tsfdye@gmail.com> #
27
+ # Copyright 2020 Alice GIRARD <bouhahah@gmail.com> #
28
+ # Copyright 2020 Jesse Li <jesse.li2002@gmail.com> #
29
+ # Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
30
+ # Copyright 2021 Mark Walker <mark.walker@realbuzz.com> #
31
+ # Copyright 2021 Steve Kowalik <steven@wedontsleep.org> #
32
+ # Copyright 2023 Enrico Minack <github@enrico.minack.dev> #
33
+ # Copyright 2023 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
34
+ # Copyright 2023 Mikhail f. Shiryaev <mr.felixoid@gmail.com> #
35
+ # Copyright 2023 Trim21 <trim21.me@gmail.com> #
36
+ # Copyright 2023 Wojciech Barczyński <104033489+WojciechBarczynski@users.noreply.github.com>#
37
+ # Copyright 2024 Benjamin K <53038537+treee111@users.noreply.github.com> #
38
+ # Copyright 2024 Enrico Minack <github@enrico.minack.dev> #
39
+ # Copyright 2024 Jirka Borovec <6035284+Borda@users.noreply.github.com> #
40
+ # Copyright 2025 Aidan McNay <acm289@cornell.edu> #
41
+ # Copyright 2025 Enrico Minack <github@enrico.minack.dev> #
42
+ # Copyright 2026 Enrico Minack <github@enrico.minack.dev> #
43
+ # Copyright 2026 Mathieu Parent <math.parent@etik.com> #
44
+ # #
45
+ # This file is part of PyGithub. #
46
+ # http://pygithub.readthedocs.io/ #
47
+ # #
48
+ # PyGithub is free software: you can redistribute it and/or modify it under #
49
+ # the terms of the GNU Lesser General Public License as published by the Free #
50
+ # Software Foundation, either version 3 of the License, or (at your option) #
51
+ # any later version. #
52
+ # #
53
+ # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
54
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
55
+ # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
56
+ # details. #
57
+ # #
58
+ # You should have received a copy of the GNU Lesser General Public License #
59
+ # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
60
+ # #
61
+ ################################################################################
62
+
63
+ from __future__ import annotations
64
+
65
+ import urllib.parse
66
+ from datetime import datetime
67
+ from os.path import basename
68
+ from typing import TYPE_CHECKING, Any, BinaryIO
69
+
70
+ import githubasyncio.GitReleaseAsset
71
+ import githubasyncio.NamedUser
72
+ import githubasyncio.PaginatedList
73
+ from githubasyncio.compat import deprecated
74
+ from githubasyncio.GithubObject import (
75
+ Attribute,
76
+ CompletableGithubObject,
77
+ NotSet,
78
+ Opt,
79
+ is_defined,
80
+ is_optional,
81
+ is_undefined,
82
+ )
83
+ from githubasyncio.PaginatedList import PaginatedList
84
+
85
+ from . import Consts
86
+
87
+ if TYPE_CHECKING:
88
+ from githubasyncio.GitReleaseAsset import GitReleaseAsset
89
+ from githubasyncio.NamedUser import NamedUser
90
+
91
+
92
+ class GitRelease(CompletableGithubObject):
93
+ """
94
+ This class represents GitReleases.
95
+
96
+ The reference can be found here
97
+ https://docs.github.com/en/rest/reference/repos#releases
98
+
99
+ The OpenAPI schema can be found at
100
+
101
+ - /components/schemas/release
102
+
103
+ """
104
+
105
+ def _initAttributes(self) -> None:
106
+ self._assets: Attribute[list[GitReleaseAsset]] = NotSet
107
+ self._assets_url: Attribute[str] = NotSet
108
+ self._author: Attribute[NamedUser] = NotSet
109
+ self._body: Attribute[str] = NotSet
110
+ self._body_html: Attribute[str] = NotSet
111
+ self._body_text: Attribute[str] = NotSet
112
+ self._created_at: Attribute[datetime] = NotSet
113
+ self._discussion_url: Attribute[str] = NotSet
114
+ self._documentation_url: Attribute[str] = NotSet
115
+ self._draft: Attribute[bool] = NotSet
116
+ self._generate_release_notes: Attribute[bool] = NotSet
117
+ self._html_url: Attribute[str] = NotSet
118
+ self._id: Attribute[int] = NotSet
119
+ self._immutable: Attribute[bool] = NotSet
120
+ self._mentions_count: Attribute[int] = NotSet
121
+ self._message: Attribute[str] = NotSet
122
+ self._name: Attribute[str] = NotSet
123
+ self._node_id: Attribute[str] = NotSet
124
+ self._prerelease: Attribute[bool] = NotSet
125
+ self._published_at: Attribute[datetime] = NotSet
126
+ self._reactions: Attribute[dict[str, Any]] = NotSet
127
+ self._status: Attribute[str] = NotSet
128
+ self._tag_name: Attribute[str] = NotSet
129
+ self._tarball_url: Attribute[str] = NotSet
130
+ self._target_commitish: Attribute[str] = NotSet
131
+ self._updated_at: Attribute[datetime] = NotSet
132
+ self._upload_url: Attribute[str] = NotSet
133
+ self._url: Attribute[str] = NotSet
134
+ self._zipball_url: Attribute[str] = NotSet
135
+
136
+ def __repr__(self) -> str:
137
+ return self.get__repr__({"name": self._name.value})
138
+
139
+ @property
140
+ async def assets(self) -> list[GitReleaseAsset]:
141
+ await self._completeIfNotSet(self._assets)
142
+ return self._assets.value
143
+
144
+ @property
145
+ async def assets_url(self) -> str:
146
+ await self._completeIfNotSet(self._assets_url)
147
+ return self._assets_url.value
148
+
149
+ @property
150
+ async def author(self) -> NamedUser:
151
+ await self._completeIfNotSet(self._author)
152
+ return self._author.value
153
+
154
+ @property
155
+ async def body(self) -> str:
156
+ await self._completeIfNotSet(self._body)
157
+ return self._body.value
158
+
159
+ @property
160
+ async def body_html(self) -> str:
161
+ await self._completeIfNotSet(self._body_html)
162
+ return self._body_html.value
163
+
164
+ @property
165
+ async def body_text(self) -> str:
166
+ await self._completeIfNotSet(self._body_text)
167
+ return self._body_text.value
168
+
169
+ @property
170
+ async def created_at(self) -> datetime:
171
+ await self._completeIfNotSet(self._created_at)
172
+ return self._created_at.value
173
+
174
+ @property
175
+ async def discussion_url(self) -> str:
176
+ await self._completeIfNotSet(self._discussion_url)
177
+ return self._discussion_url.value
178
+
179
+ @property
180
+ async def documentation_url(self) -> str:
181
+ await self._completeIfNotSet(self._documentation_url)
182
+ return self._documentation_url.value
183
+
184
+ @property
185
+ async def draft(self) -> bool:
186
+ await self._completeIfNotSet(self._draft)
187
+ return self._draft.value
188
+
189
+ @property
190
+ async def html_url(self) -> str:
191
+ await self._completeIfNotSet(self._html_url)
192
+ return self._html_url.value
193
+
194
+ @property
195
+ async def id(self) -> int:
196
+ await self._completeIfNotSet(self._id)
197
+ return self._id.value
198
+
199
+ @property
200
+ async def immutable(self) -> bool:
201
+ await self._completeIfNotSet(self._immutable)
202
+ return self._immutable.value
203
+
204
+ @property
205
+ async def mentions_count(self) -> int:
206
+ await self._completeIfNotSet(self._mentions_count)
207
+ return self._mentions_count.value
208
+
209
+ @property
210
+ async def message(self) -> str:
211
+ await self._completeIfNotSet(self._message)
212
+ return self._message.value
213
+
214
+ @property
215
+ async def name(self) -> str:
216
+ await self._completeIfNotSet(self._name)
217
+ return self._name.value
218
+
219
+ @property
220
+ async def node_id(self) -> str:
221
+ await self._completeIfNotSet(self._node_id)
222
+ return self._node_id.value
223
+
224
+ @property
225
+ async def prerelease(self) -> bool:
226
+ await self._completeIfNotSet(self._prerelease)
227
+ return self._prerelease.value
228
+
229
+ @property
230
+ async def published_at(self) -> datetime:
231
+ await self._completeIfNotSet(self._published_at)
232
+ return self._published_at.value
233
+
234
+ @property
235
+ async def reactions(self) -> dict[str, Any]:
236
+ await self._completeIfNotSet(self._reactions)
237
+ return self._reactions.value
238
+
239
+ @property
240
+ async def status(self) -> str:
241
+ await self._completeIfNotSet(self._status)
242
+ return self._status.value
243
+
244
+ @property
245
+ async def tag_name(self) -> str:
246
+ await self._completeIfNotSet(self._tag_name)
247
+ return self._tag_name.value
248
+
249
+ @property
250
+ async def tarball_url(self) -> str:
251
+ await self._completeIfNotSet(self._tarball_url)
252
+ return self._tarball_url.value
253
+
254
+ @property
255
+ async def target_commitish(self) -> str:
256
+ await self._completeIfNotSet(self._target_commitish)
257
+ return self._target_commitish.value
258
+
259
+ @property
260
+ @deprecated("Use name instead")
261
+ async def title(self) -> str:
262
+ # alias for name
263
+ return await self.name
264
+
265
+ @property
266
+ async def updated_at(self) -> datetime:
267
+ await self._completeIfNotSet(self._updated_at)
268
+ return self._updated_at.value
269
+
270
+ @property
271
+ async def upload_url(self) -> str:
272
+ await self._completeIfNotSet(self._upload_url)
273
+ return self._upload_url.value
274
+
275
+ @property
276
+ async def url(self) -> str:
277
+ await self._completeIfNotSet(self._url)
278
+ return self._url.value
279
+
280
+ @property
281
+ async def zipball_url(self) -> str:
282
+ await self._completeIfNotSet(self._zipball_url)
283
+ return self._zipball_url.value
284
+
285
+ async def delete_release(self) -> None:
286
+ """
287
+ :calls: `DELETE /repos/{owner}/{repo}/releases/{release_id} <https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#delete-a-release>`_
288
+ """
289
+ headers, data = await self._requester.requestJsonAndCheck("DELETE", await self.url)
290
+
291
+ async def update_release(
292
+ self,
293
+ name: str,
294
+ message: str,
295
+ draft: bool = False,
296
+ prerelease: bool = False,
297
+ tag_name: Opt[str] = NotSet,
298
+ target_commitish: Opt[str] = NotSet,
299
+ make_latest: Opt[str] = NotSet,
300
+ discussion_category_name: Opt[str] = NotSet,
301
+ ) -> GitRelease:
302
+ """
303
+ :calls: `PATCH /repos/{owner}/{repo}/releases/{release_id} <https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#update-a-release>`_
304
+ """
305
+ assert isinstance(name, str), name
306
+ assert isinstance(message, str), message
307
+ assert isinstance(draft, bool), draft
308
+ assert isinstance(prerelease, bool), prerelease
309
+ assert is_optional(tag_name, str), "tag_name must be a str/unicode object"
310
+ assert is_optional(target_commitish, str), "target_commitish must be a str/unicode object"
311
+ assert make_latest in ["true", "false", "legacy", NotSet], make_latest
312
+ assert is_optional(discussion_category_name, str), discussion_category_name
313
+ # default tag_name with instance attribute if not given to the method
314
+ if is_undefined(tag_name):
315
+ tag_name = await self.tag_name
316
+ post_parameters = {
317
+ "tag_name": tag_name,
318
+ "name": name,
319
+ "body": message,
320
+ "draft": draft,
321
+ "prerelease": prerelease,
322
+ }
323
+ # Do not set target_commitish to self.target_commitish when omitted, just don't send it
324
+ # altogether in that case, in order to match the Github API behaviour. Only send it when set.
325
+ if is_defined(target_commitish):
326
+ post_parameters["target_commitish"] = target_commitish
327
+ if is_defined(make_latest):
328
+ post_parameters["make_latest"] = make_latest
329
+ if is_defined(discussion_category_name):
330
+ post_parameters["discussion_category_name"] = discussion_category_name
331
+ headers, data = await self._requester.requestJsonAndCheck("PATCH", await self.url, input=post_parameters)
332
+ return GitRelease(self._requester, headers, data, completed=True)
333
+
334
+ async def upload_asset(
335
+ self, path: str, label: str = "", content_type: Opt[str] = NotSet, name: Opt[str] = NotSet
336
+ ) -> GitReleaseAsset:
337
+ """
338
+ :calls: `POST /repos/{owner}/{repo}/releases/{release_id}/assets <https://docs.github.com/en/rest/releases/assets?apiVersion=2022-11-28#upload-a-release-assett>`__
339
+ """
340
+ assert isinstance(path, str), path
341
+ assert isinstance(label, str), label
342
+ assert is_undefined(name) or isinstance(name, str), name
343
+
344
+ post_parameters: dict[str, Any] = {"label": label}
345
+ if is_undefined(name):
346
+ post_parameters["name"] = basename(path)
347
+ else:
348
+ post_parameters["name"] = name
349
+ headers: dict[str, Any] = {}
350
+ if is_defined(content_type):
351
+ headers["Content-Type"] = content_type
352
+ resp_headers, data = await self._requester.requestBlobAndCheck(
353
+ "POST",
354
+ (await self.upload_url).split("{?")[0],
355
+ parameters=post_parameters,
356
+ headers=headers,
357
+ input=path,
358
+ )
359
+ return githubasyncio.GitReleaseAsset.GitReleaseAsset(self._requester, resp_headers, data, completed=True)
360
+
361
+ async def upload_asset_from_memory(
362
+ self,
363
+ file_like: BinaryIO,
364
+ file_size: int,
365
+ name: str,
366
+ content_type: Opt[str] = NotSet,
367
+ label: str = "",
368
+ ) -> GitReleaseAsset:
369
+ """
370
+ Uploads an asset.
371
+
372
+ Unlike ``upload_asset()`` this method allows you to pass in a file-like object to upload.
373
+ Note that this method is more strict and requires you to specify the ``name``, since there's no file name to infer these from.
374
+ :calls: `POST /repos/{owner}/{repo}/releases/{release_id}/assets <https://docs.github.com/en/rest/reference/repos#upload-a-release-asset>`__
375
+ :param file_like: binary file-like object, such as those returned by ``open("file_name", "rb")``. At the very minimum, this object must implement ``read()``.
376
+ :param file_size: int, size in bytes of ``file_like``
377
+
378
+ """
379
+ assert isinstance(name, str), name
380
+ assert isinstance(file_size, int), file_size
381
+ assert isinstance(label, str), label
382
+
383
+ post_parameters = {"label": label, "name": name}
384
+ content_type = content_type if is_defined(content_type) else Consts.defaultMediaType
385
+ headers = {"Content-Type": content_type, "Content-Length": str(file_size)}
386
+
387
+ resp_headers, data = await self._requester.requestMemoryBlobAndCheck(
388
+ "POST",
389
+ (await self.upload_url).split("{?")[0],
390
+ parameters=post_parameters,
391
+ headers=headers,
392
+ file_like=file_like,
393
+ )
394
+ return githubasyncio.GitReleaseAsset.GitReleaseAsset(self._requester, resp_headers, data, completed=True)
395
+
396
+ async def get_assets(self) -> PaginatedList[GitReleaseAsset]:
397
+ """
398
+ :calls: `GET /repos/{owner}/{repo}/releases/{release_id}/assets <https://docs.github.com/en/rest/releases/assets?apiVersion=2022-11-28#get-a-release-asset>`_
399
+ """
400
+ return githubasyncio.PaginatedList.PaginatedList(
401
+ githubasyncio.GitReleaseAsset.GitReleaseAsset,
402
+ self._requester,
403
+ f"{await self.url}/assets",
404
+ None,
405
+ )
406
+
407
+ def _useAttributes(self, attributes: dict[str, Any]) -> None:
408
+ if "assets" in attributes:
409
+ self._assets = self._makeListOfClassesAttribute(
410
+ githubasyncio.GitReleaseAsset.GitReleaseAsset, attributes["assets"]
411
+ )
412
+ if "assets_url" in attributes: # pragma no branch
413
+ self._assets_url = self._makeStringAttribute(attributes["assets_url"])
414
+ if "author" in attributes:
415
+ self._author = self._makeClassAttribute(githubasyncio.NamedUser.NamedUser, attributes["author"])
416
+ if "body" in attributes:
417
+ self._body = self._makeStringAttribute(attributes["body"])
418
+ if "body_html" in attributes: # pragma no branch
419
+ self._body_html = self._makeStringAttribute(attributes["body_html"])
420
+ if "body_text" in attributes: # pragma no branch
421
+ self._body_text = self._makeStringAttribute(attributes["body_text"])
422
+ if "created_at" in attributes:
423
+ self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
424
+ if "discussion_url" in attributes: # pragma no branch
425
+ self._discussion_url = self._makeStringAttribute(attributes["discussion_url"])
426
+ if "documentation_url" in attributes: # pragma no branch
427
+ self._documentation_url = self._makeStringAttribute(attributes["documentation_url"])
428
+ if "draft" in attributes:
429
+ self._draft = self._makeBoolAttribute(attributes["draft"])
430
+ if "generate_release_notes" in attributes:
431
+ self._generate_release_notes = self._makeBoolAttribute(attributes["generate_release_notes"])
432
+ if "html_url" in attributes:
433
+ self._html_url = self._makeStringAttribute(attributes["html_url"])
434
+ if "id" in attributes:
435
+ self._id = self._makeIntAttribute(attributes["id"])
436
+ elif "url" in attributes and attributes["url"]:
437
+ id = attributes["url"].split("/")[-1]
438
+ if id.isnumeric():
439
+ self._id = self._makeIntAttribute(int(id))
440
+ if "immutable" in attributes: # pragma no branch
441
+ self._immutable = self._makeBoolAttribute(attributes["immutable"])
442
+ if "mentions_count" in attributes: # pragma no branch
443
+ self._mentions_count = self._makeIntAttribute(attributes["mentions_count"])
444
+ if "message" in attributes: # pragma no branch
445
+ self._message = self._makeStringAttribute(attributes["message"])
446
+ if "name" in attributes:
447
+ self._name = self._makeStringAttribute(attributes["name"])
448
+ if "node_id" in attributes: # pragma no branch
449
+ self._node_id = self._makeStringAttribute(attributes["node_id"])
450
+ if "prerelease" in attributes:
451
+ self._prerelease = self._makeBoolAttribute(attributes["prerelease"])
452
+ if "published_at" in attributes:
453
+ self._published_at = self._makeDatetimeAttribute(attributes["published_at"])
454
+ if "reactions" in attributes: # pragma no branch
455
+ self._reactions = self._makeDictAttribute(attributes["reactions"])
456
+ if "status" in attributes: # pragma no branch
457
+ self._status = self._makeStringAttribute(attributes["status"])
458
+ if "tag_name" in attributes:
459
+ self._tag_name = self._makeStringAttribute(attributes["tag_name"])
460
+ elif "url" in attributes and attributes["url"] and isinstance(attributes["url"], str):
461
+ quoted_tag_name = attributes["url"].split("/")[-1]
462
+ tag_name = urllib.parse.unquote(quoted_tag_name)
463
+ if tag_name != "latest":
464
+ self._tag_name = self._makeStringAttribute(tag_name)
465
+ if "tarball_url" in attributes:
466
+ self._tarball_url = self._makeStringAttribute(attributes["tarball_url"])
467
+ if "target_commitish" in attributes:
468
+ self._target_commitish = self._makeStringAttribute(attributes["target_commitish"])
469
+ if "updated_at" in attributes: # pragma no branch
470
+ self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
471
+ if "upload_url" in attributes:
472
+ self._upload_url = self._makeStringAttribute(attributes["upload_url"])
473
+ if "url" in attributes:
474
+ self._url = self._makeStringAttribute(attributes["url"])
475
+ if "zipball_url" in attributes:
476
+ self._zipball_url = self._makeStringAttribute(attributes["zipball_url"])