ghnova 0.3.0__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.
- ghnova/__init__.py +8 -0
- ghnova/__main__.py +8 -0
- ghnova/cli/__init__.py +1 -0
- ghnova/cli/config/__init__.py +1 -0
- ghnova/cli/config/add.py +48 -0
- ghnova/cli/config/delete.py +50 -0
- ghnova/cli/config/list.py +40 -0
- ghnova/cli/config/main.py +27 -0
- ghnova/cli/config/update.py +59 -0
- ghnova/cli/issue/__init__.py +7 -0
- ghnova/cli/issue/create.py +155 -0
- ghnova/cli/issue/get.py +119 -0
- ghnova/cli/issue/list.py +267 -0
- ghnova/cli/issue/lock.py +110 -0
- ghnova/cli/issue/main.py +31 -0
- ghnova/cli/issue/unlock.py +101 -0
- ghnova/cli/issue/update.py +164 -0
- ghnova/cli/main.py +117 -0
- ghnova/cli/repository/__init__.py +1 -0
- ghnova/cli/repository/list.py +201 -0
- ghnova/cli/repository/main.py +21 -0
- ghnova/cli/user/__init__.py +1 -0
- ghnova/cli/user/ctx_info.py +105 -0
- ghnova/cli/user/get.py +98 -0
- ghnova/cli/user/list.py +78 -0
- ghnova/cli/user/main.py +27 -0
- ghnova/cli/user/update.py +164 -0
- ghnova/cli/utils/__init__.py +7 -0
- ghnova/cli/utils/auth.py +67 -0
- ghnova/client/__init__.py +8 -0
- ghnova/client/async_github.py +121 -0
- ghnova/client/base.py +78 -0
- ghnova/client/github.py +107 -0
- ghnova/config/__init__.py +8 -0
- ghnova/config/manager.py +209 -0
- ghnova/config/model.py +58 -0
- ghnova/issue/__init__.py +8 -0
- ghnova/issue/async_issue.py +554 -0
- ghnova/issue/base.py +469 -0
- ghnova/issue/issue.py +584 -0
- ghnova/repository/__init__.py +8 -0
- ghnova/repository/async_repository.py +134 -0
- ghnova/repository/base.py +124 -0
- ghnova/repository/repository.py +134 -0
- ghnova/resource/__init__.py +8 -0
- ghnova/resource/async_resource.py +88 -0
- ghnova/resource/resource.py +88 -0
- ghnova/user/__init__.py +8 -0
- ghnova/user/async_user.py +285 -0
- ghnova/user/base.py +214 -0
- ghnova/user/user.py +285 -0
- ghnova/utils/__init__.py +16 -0
- ghnova/utils/log.py +70 -0
- ghnova/utils/response.py +67 -0
- ghnova/version.py +11 -0
- ghnova-0.3.0.dist-info/METADATA +194 -0
- ghnova-0.3.0.dist-info/RECORD +60 -0
- ghnova-0.3.0.dist-info/WHEEL +4 -0
- ghnova-0.3.0.dist-info/entry_points.txt +2 -0
- ghnova-0.3.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,554 @@
|
|
|
1
|
+
"""Asynchronous issue handling module."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from datetime import datetime
|
|
6
|
+
from typing import Any, Literal, cast
|
|
7
|
+
|
|
8
|
+
from aiohttp import ClientResponse
|
|
9
|
+
|
|
10
|
+
from ghnova.issue.base import BaseIssue
|
|
11
|
+
from ghnova.resource.async_resource import AsyncResource
|
|
12
|
+
from ghnova.utils.response import process_async_response_with_last_modified
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class AsyncIssue(BaseIssue, AsyncResource):
|
|
16
|
+
"""GitHub Asynchronous Issue resource class."""
|
|
17
|
+
|
|
18
|
+
async def _list_issues( # noqa: PLR0913
|
|
19
|
+
self,
|
|
20
|
+
owner: str | None = None,
|
|
21
|
+
organization: str | None = None,
|
|
22
|
+
repository: str | None = None,
|
|
23
|
+
filter_by: Literal["assigned", "created", "mentioned", "subscribed", "all"] | None = None,
|
|
24
|
+
state: Literal["open", "closed", "all"] | None = None,
|
|
25
|
+
labels: list[str] | None = None,
|
|
26
|
+
sort: Literal["created", "updated", "comments"] | None = None,
|
|
27
|
+
direction: Literal["asc", "desc"] | None = None,
|
|
28
|
+
since: datetime | None = None,
|
|
29
|
+
collab: bool | None = None,
|
|
30
|
+
orgs: bool | None = None,
|
|
31
|
+
owned: bool | None = None,
|
|
32
|
+
pulls: bool | None = None,
|
|
33
|
+
issue_type: str | None = None,
|
|
34
|
+
milestone: str | None = None,
|
|
35
|
+
assignee: str | None = None,
|
|
36
|
+
creator: str | None = None,
|
|
37
|
+
mentioned: str | None = None,
|
|
38
|
+
per_page: int = 30,
|
|
39
|
+
page: int = 1,
|
|
40
|
+
**kwargs: Any,
|
|
41
|
+
) -> ClientResponse:
|
|
42
|
+
"""List issues with various filtering and sorting options.
|
|
43
|
+
|
|
44
|
+
Supported scenarios:
|
|
45
|
+
|
|
46
|
+
- Authenticated user: Do not provide owner, organization, or repository.
|
|
47
|
+
- Organization issues: Provide organization, but not owner or repository.
|
|
48
|
+
- Repository issues: Provide owner or organization along with repository.
|
|
49
|
+
|
|
50
|
+
Args:
|
|
51
|
+
owner: The owner of the repository.
|
|
52
|
+
organization: The organization name.
|
|
53
|
+
repository: The repository name.
|
|
54
|
+
filter_by: Filter issues by criteria.
|
|
55
|
+
state: The state of the issues to return.
|
|
56
|
+
labels: A list of labels to filter issues by.
|
|
57
|
+
sort: The field to sort issues by.
|
|
58
|
+
direction: The direction of the sort.
|
|
59
|
+
since: Only issues updated at or after this time are returned.
|
|
60
|
+
collab: Include issues from repositories the user collaborates on (for authenticated user issues).
|
|
61
|
+
orgs: Include issues from organizations the user is a member of (for authenticated user issues).
|
|
62
|
+
owned: Include issues from repositories owned by the user (for authenticated user issues).
|
|
63
|
+
pulls: Include pull requests in the issues list (for authenticated user issues).
|
|
64
|
+
issue_type: The type of issues to filter by (for organization issues).
|
|
65
|
+
milestone: Filter issues by milestone (for repository issues).
|
|
66
|
+
assignee: Filter issues by assignee (for repository issues).
|
|
67
|
+
creator: Filter issues by creator (for repository issues).
|
|
68
|
+
mentioned: Filter issues by mentioned user (for repository issues).
|
|
69
|
+
per_page: The number of issues per page.
|
|
70
|
+
page: The page number to retrieve.
|
|
71
|
+
**kwargs: Additional arguments for the request.
|
|
72
|
+
|
|
73
|
+
Returns:
|
|
74
|
+
The ClientResponse object containing the list of issues.
|
|
75
|
+
|
|
76
|
+
"""
|
|
77
|
+
endpoint, params, kwargs = self._list_issues_helper(
|
|
78
|
+
owner=owner,
|
|
79
|
+
organization=organization,
|
|
80
|
+
repository=repository,
|
|
81
|
+
filter_by=filter_by,
|
|
82
|
+
state=state,
|
|
83
|
+
labels=labels,
|
|
84
|
+
sort=sort,
|
|
85
|
+
direction=direction,
|
|
86
|
+
since=since,
|
|
87
|
+
collab=collab,
|
|
88
|
+
orgs=orgs,
|
|
89
|
+
owned=owned,
|
|
90
|
+
pulls=pulls,
|
|
91
|
+
issue_type=issue_type,
|
|
92
|
+
milestone=milestone,
|
|
93
|
+
assignee=assignee,
|
|
94
|
+
creator=creator,
|
|
95
|
+
mentioned=mentioned,
|
|
96
|
+
per_page=per_page,
|
|
97
|
+
page=page,
|
|
98
|
+
**kwargs,
|
|
99
|
+
)
|
|
100
|
+
return await self._get(endpoint=endpoint, params=params, **kwargs)
|
|
101
|
+
|
|
102
|
+
async def list_issues( # noqa: PLR0913
|
|
103
|
+
self,
|
|
104
|
+
owner: str | None = None,
|
|
105
|
+
organization: str | None = None,
|
|
106
|
+
repository: str | None = None,
|
|
107
|
+
filter_by: Literal["assigned", "created", "mentioned", "subscribed", "all"] | None = None,
|
|
108
|
+
state: Literal["open", "closed", "all"] | None = None,
|
|
109
|
+
labels: list[str] | None = None,
|
|
110
|
+
sort: Literal["created", "updated", "comments"] | None = None,
|
|
111
|
+
direction: Literal["asc", "desc"] | None = None,
|
|
112
|
+
since: datetime | None = None,
|
|
113
|
+
collab: bool | None = None,
|
|
114
|
+
orgs: bool | None = None,
|
|
115
|
+
owned: bool | None = None,
|
|
116
|
+
pulls: bool | None = None,
|
|
117
|
+
issue_type: str | None = None,
|
|
118
|
+
milestone: str | None = None,
|
|
119
|
+
assignee: str | None = None,
|
|
120
|
+
creator: str | None = None,
|
|
121
|
+
mentioned: str | None = None,
|
|
122
|
+
per_page: int = 30,
|
|
123
|
+
page: int = 1,
|
|
124
|
+
**kwargs: Any,
|
|
125
|
+
) -> tuple[list[dict[str, Any]], int, str | None, str | None]:
|
|
126
|
+
"""List issues with various filtering and sorting options.
|
|
127
|
+
|
|
128
|
+
Supported scenarios:
|
|
129
|
+
|
|
130
|
+
- Authenticated user: Do not provide owner, organization, or repository.
|
|
131
|
+
- Organization issues: Provide organization, but not owner or repository.
|
|
132
|
+
- Repository issues: Provide owner or organization along with repository.
|
|
133
|
+
|
|
134
|
+
Args:
|
|
135
|
+
owner: The owner of the repository.
|
|
136
|
+
organization: The organization name.
|
|
137
|
+
repository: The repository name.
|
|
138
|
+
filter_by: Filter issues by criteria.
|
|
139
|
+
state: The state of the issues to return.
|
|
140
|
+
labels: A list of labels to filter issues by.
|
|
141
|
+
sort: The field to sort issues by.
|
|
142
|
+
direction: The direction of the sort.
|
|
143
|
+
since: Only issues updated at or after this time are returned.
|
|
144
|
+
collab: Include issues from repositories the user collaborates on (for authenticated user issues).
|
|
145
|
+
orgs: Include issues from organizations the user is a member of (for authenticated user issues).
|
|
146
|
+
owned: Include issues from repositories owned by the user (for authenticated user issues).
|
|
147
|
+
pulls: Include pull requests in the issues list (for authenticated user issues).
|
|
148
|
+
issue_type: The type of issues to filter by (for organization issues).
|
|
149
|
+
milestone: Filter issues by milestone (for repository issues).
|
|
150
|
+
assignee: Filter issues by assignee (for repository issues).
|
|
151
|
+
creator: Filter issues by creator (for repository issues).
|
|
152
|
+
mentioned: Filter issues by mentioned user (for repository issues).
|
|
153
|
+
per_page: The number of issues per page.
|
|
154
|
+
page: The page number to retrieve.
|
|
155
|
+
**kwargs: Additional arguments for the request.
|
|
156
|
+
|
|
157
|
+
Returns:
|
|
158
|
+
A tuple containing:
|
|
159
|
+
|
|
160
|
+
- A list of issues as dictionaries.
|
|
161
|
+
- The HTTP status code of the response.
|
|
162
|
+
- The ETag value from the response headers (if present).
|
|
163
|
+
- The Last-Modified value from the response headers (if present).
|
|
164
|
+
|
|
165
|
+
"""
|
|
166
|
+
response = await self._list_issues(
|
|
167
|
+
owner=owner,
|
|
168
|
+
organization=organization,
|
|
169
|
+
repository=repository,
|
|
170
|
+
filter_by=filter_by,
|
|
171
|
+
state=state,
|
|
172
|
+
labels=labels,
|
|
173
|
+
sort=sort,
|
|
174
|
+
direction=direction,
|
|
175
|
+
since=since,
|
|
176
|
+
collab=collab,
|
|
177
|
+
orgs=orgs,
|
|
178
|
+
owned=owned,
|
|
179
|
+
pulls=pulls,
|
|
180
|
+
issue_type=issue_type,
|
|
181
|
+
milestone=milestone,
|
|
182
|
+
assignee=assignee,
|
|
183
|
+
creator=creator,
|
|
184
|
+
mentioned=mentioned,
|
|
185
|
+
per_page=per_page,
|
|
186
|
+
page=page,
|
|
187
|
+
**kwargs,
|
|
188
|
+
)
|
|
189
|
+
data, status_code, etag_value, last_modified_value = await process_async_response_with_last_modified(response)
|
|
190
|
+
return cast(list[dict[str, Any]], data), status_code, etag_value, last_modified_value
|
|
191
|
+
|
|
192
|
+
async def _create_issue( # noqa: PLR0913
|
|
193
|
+
self,
|
|
194
|
+
owner: str,
|
|
195
|
+
repository: str,
|
|
196
|
+
title: str,
|
|
197
|
+
body: str | None = None,
|
|
198
|
+
assignee: str | None = None,
|
|
199
|
+
milestone: str | int | None = None,
|
|
200
|
+
labels: list[str] | None = None,
|
|
201
|
+
assignees: list[str] | None = None,
|
|
202
|
+
issue_type: str | None = None,
|
|
203
|
+
**kwargs: Any,
|
|
204
|
+
) -> ClientResponse:
|
|
205
|
+
"""Create a new issue in a repository.
|
|
206
|
+
|
|
207
|
+
Args:
|
|
208
|
+
owner: The owner of the repository.
|
|
209
|
+
repository: The name of the repository.
|
|
210
|
+
title: The title of the issue.
|
|
211
|
+
body: The body content of the issue.
|
|
212
|
+
assignee: The username of the assignee.
|
|
213
|
+
milestone: The milestone number or title to associate with the issue.
|
|
214
|
+
labels: A list of labels to assign to the issue.
|
|
215
|
+
assignees: A list of usernames to assign to the issue.
|
|
216
|
+
issue_type: The type of issue.
|
|
217
|
+
**kwargs: Additional arguments for the request.
|
|
218
|
+
|
|
219
|
+
Returns:
|
|
220
|
+
The ClientResponse object containing the created issue.
|
|
221
|
+
|
|
222
|
+
"""
|
|
223
|
+
endpoint, payload, kwargs = self._create_issue_helper(
|
|
224
|
+
owner=owner,
|
|
225
|
+
repository=repository,
|
|
226
|
+
title=title,
|
|
227
|
+
body=body,
|
|
228
|
+
assignee=assignee,
|
|
229
|
+
milestone=milestone,
|
|
230
|
+
labels=labels,
|
|
231
|
+
assignees=assignees,
|
|
232
|
+
issue_type=issue_type,
|
|
233
|
+
**kwargs,
|
|
234
|
+
)
|
|
235
|
+
return await self._post(endpoint=endpoint, json=payload, **kwargs)
|
|
236
|
+
|
|
237
|
+
async def create_issue( # noqa: PLR0913
|
|
238
|
+
self,
|
|
239
|
+
owner: str,
|
|
240
|
+
repository: str,
|
|
241
|
+
title: str,
|
|
242
|
+
body: str | None = None,
|
|
243
|
+
assignee: str | None = None,
|
|
244
|
+
milestone: str | int | None = None,
|
|
245
|
+
labels: list[str] | None = None,
|
|
246
|
+
assignees: list[str] | None = None,
|
|
247
|
+
issue_type: str | None = None,
|
|
248
|
+
**kwargs: Any,
|
|
249
|
+
) -> tuple[dict[str, Any], int, str | None, str | None]:
|
|
250
|
+
"""Create a new issue in a repository.
|
|
251
|
+
|
|
252
|
+
Args:
|
|
253
|
+
owner: The owner of the repository.
|
|
254
|
+
repository: The name of the repository.
|
|
255
|
+
title: The title of the issue.
|
|
256
|
+
body: The body content of the issue.
|
|
257
|
+
assignee: The username of the assignee.
|
|
258
|
+
milestone: The milestone number or title to associate with the issue.
|
|
259
|
+
labels: A list of labels to assign to the issue.
|
|
260
|
+
assignees: A list of usernames to assign to the issue.
|
|
261
|
+
issue_type: The type of issue.
|
|
262
|
+
**kwargs: Additional arguments for the request.
|
|
263
|
+
|
|
264
|
+
Returns:
|
|
265
|
+
A tuple containing:
|
|
266
|
+
|
|
267
|
+
- The created issue as a dictionary.
|
|
268
|
+
- The HTTP status code of the response.
|
|
269
|
+
- The ETag value from the response headers (if present).
|
|
270
|
+
- The Last-Modified value from the response headers (if present).
|
|
271
|
+
|
|
272
|
+
"""
|
|
273
|
+
response = await self._create_issue(
|
|
274
|
+
owner=owner,
|
|
275
|
+
repository=repository,
|
|
276
|
+
title=title,
|
|
277
|
+
body=body,
|
|
278
|
+
assignee=assignee,
|
|
279
|
+
milestone=milestone,
|
|
280
|
+
labels=labels,
|
|
281
|
+
assignees=assignees,
|
|
282
|
+
issue_type=issue_type,
|
|
283
|
+
**kwargs,
|
|
284
|
+
)
|
|
285
|
+
data, status_code, etag_value, last_modified_value = await process_async_response_with_last_modified(response)
|
|
286
|
+
return cast(dict[str, Any], data), status_code, etag_value, last_modified_value
|
|
287
|
+
|
|
288
|
+
async def _get_issue(self, owner: str, repository: str, issue_number: int, **kwargs: Any) -> ClientResponse:
|
|
289
|
+
"""Get a specific issue by its number.
|
|
290
|
+
|
|
291
|
+
Args:
|
|
292
|
+
owner: The owner of the repository.
|
|
293
|
+
repository: The name of the repository.
|
|
294
|
+
issue_number: The number of the issue.
|
|
295
|
+
**kwargs: Additional arguments for the request.
|
|
296
|
+
|
|
297
|
+
Returns:
|
|
298
|
+
The ClientResponse object containing the issue.
|
|
299
|
+
|
|
300
|
+
"""
|
|
301
|
+
endpoint, kwargs = self._get_issue_helper(
|
|
302
|
+
owner=owner,
|
|
303
|
+
repository=repository,
|
|
304
|
+
issue_number=issue_number,
|
|
305
|
+
**kwargs,
|
|
306
|
+
)
|
|
307
|
+
return await self._get(endpoint=endpoint, **kwargs)
|
|
308
|
+
|
|
309
|
+
async def get_issue(
|
|
310
|
+
self, owner: str, repository: str, issue_number: int, **kwargs: Any
|
|
311
|
+
) -> tuple[dict[str, Any], int, str | None, str | None]:
|
|
312
|
+
"""Get a specific issue by its number.
|
|
313
|
+
|
|
314
|
+
Args:
|
|
315
|
+
owner: The owner of the repository.
|
|
316
|
+
repository: The name of the repository.
|
|
317
|
+
issue_number: The number of the issue.
|
|
318
|
+
**kwargs: Additional arguments for the request.
|
|
319
|
+
|
|
320
|
+
Returns:
|
|
321
|
+
A tuple containing:
|
|
322
|
+
|
|
323
|
+
- The issue as a dictionary.
|
|
324
|
+
- The HTTP status code of the response.
|
|
325
|
+
- The ETag value from the response headers (if present).
|
|
326
|
+
- The Last-Modified value from the response headers (if present).
|
|
327
|
+
|
|
328
|
+
"""
|
|
329
|
+
response = await self._get_issue(
|
|
330
|
+
owner=owner,
|
|
331
|
+
repository=repository,
|
|
332
|
+
issue_number=issue_number,
|
|
333
|
+
**kwargs,
|
|
334
|
+
)
|
|
335
|
+
data, status_code, etag_value, last_modified_value = await process_async_response_with_last_modified(response)
|
|
336
|
+
return cast(dict[str, Any], data), status_code, etag_value, last_modified_value
|
|
337
|
+
|
|
338
|
+
async def _update_issue( # noqa: PLR0913
|
|
339
|
+
self,
|
|
340
|
+
owner: str,
|
|
341
|
+
repository: str,
|
|
342
|
+
issue_number: int,
|
|
343
|
+
title: str | None = None,
|
|
344
|
+
body: str | None = None,
|
|
345
|
+
assignee: str | None = None,
|
|
346
|
+
milestone: str | int | None = None,
|
|
347
|
+
labels: list[str] | None = None,
|
|
348
|
+
assignees: list[str] | None = None,
|
|
349
|
+
state: Literal["open", "closed"] | None = None,
|
|
350
|
+
**kwargs: Any,
|
|
351
|
+
) -> ClientResponse:
|
|
352
|
+
"""Update an existing issue in a repository.
|
|
353
|
+
|
|
354
|
+
Args:
|
|
355
|
+
owner: The owner of the repository.
|
|
356
|
+
repository: The name of the repository.
|
|
357
|
+
issue_number: The number of the issue.
|
|
358
|
+
title: The new title of the issue.
|
|
359
|
+
body: The new body content of the issue.
|
|
360
|
+
assignee: The username of the new assignee.
|
|
361
|
+
milestone: The new milestone number or title to associate with the issue.
|
|
362
|
+
labels: A new list of labels to assign to the issue.
|
|
363
|
+
assignees: A new list of usernames to assign to the issue.
|
|
364
|
+
state: The new state of the issue.
|
|
365
|
+
**kwargs: Additional arguments for the request.
|
|
366
|
+
|
|
367
|
+
Returns:
|
|
368
|
+
A Response object from the API call.
|
|
369
|
+
|
|
370
|
+
"""
|
|
371
|
+
endpoint, payload, kwargs = self._update_issue_helper(
|
|
372
|
+
owner=owner,
|
|
373
|
+
repository=repository,
|
|
374
|
+
issue_number=issue_number,
|
|
375
|
+
title=title,
|
|
376
|
+
body=body,
|
|
377
|
+
assignee=assignee,
|
|
378
|
+
milestone=milestone,
|
|
379
|
+
labels=labels,
|
|
380
|
+
assignees=assignees,
|
|
381
|
+
state=state,
|
|
382
|
+
**kwargs,
|
|
383
|
+
)
|
|
384
|
+
return await self._patch(endpoint=endpoint, json=payload, **kwargs)
|
|
385
|
+
|
|
386
|
+
async def update_issue( # noqa: PLR0913
|
|
387
|
+
self,
|
|
388
|
+
owner: str,
|
|
389
|
+
repository: str,
|
|
390
|
+
issue_number: int,
|
|
391
|
+
title: str | None = None,
|
|
392
|
+
body: str | None = None,
|
|
393
|
+
assignee: str | None = None,
|
|
394
|
+
milestone: str | int | None = None,
|
|
395
|
+
labels: list[str] | None = None,
|
|
396
|
+
assignees: list[str] | None = None,
|
|
397
|
+
state: Literal["open", "closed"] | None = None,
|
|
398
|
+
**kwargs: Any,
|
|
399
|
+
) -> tuple[dict[str, Any], int, str | None, str | None]:
|
|
400
|
+
"""Update an existing issue in a repository.
|
|
401
|
+
|
|
402
|
+
Args:
|
|
403
|
+
owner: The owner of the repository.
|
|
404
|
+
repository: The name of the repository.
|
|
405
|
+
issue_number: The number of the issue.
|
|
406
|
+
title: The new title of the issue.
|
|
407
|
+
body: The new body content of the issue.
|
|
408
|
+
assignee: The username of the new assignee.
|
|
409
|
+
milestone: The new milestone number or title to associate with the issue.
|
|
410
|
+
labels: A new list of labels to assign to the issue.
|
|
411
|
+
assignees: A new list of usernames to assign to the issue.
|
|
412
|
+
state: The new state of the issue.
|
|
413
|
+
**kwargs: Additional arguments for the request.
|
|
414
|
+
|
|
415
|
+
Returns:
|
|
416
|
+
A tuple containing:
|
|
417
|
+
|
|
418
|
+
- The updated issue as a dictionary.
|
|
419
|
+
- The HTTP status code of the response.
|
|
420
|
+
- The ETag value from the response headers (if present).
|
|
421
|
+
- The Last-Modified value from the response headers (if present).
|
|
422
|
+
|
|
423
|
+
"""
|
|
424
|
+
response = await self._update_issue(
|
|
425
|
+
owner=owner,
|
|
426
|
+
repository=repository,
|
|
427
|
+
issue_number=issue_number,
|
|
428
|
+
title=title,
|
|
429
|
+
body=body,
|
|
430
|
+
assignee=assignee,
|
|
431
|
+
milestone=milestone,
|
|
432
|
+
labels=labels,
|
|
433
|
+
assignees=assignees,
|
|
434
|
+
state=state,
|
|
435
|
+
**kwargs,
|
|
436
|
+
)
|
|
437
|
+
data, status_code, etag_value, last_modified_value = await process_async_response_with_last_modified(response)
|
|
438
|
+
return cast(dict[str, Any], data), status_code, etag_value, last_modified_value
|
|
439
|
+
|
|
440
|
+
async def _lock_issue(
|
|
441
|
+
self,
|
|
442
|
+
owner: str,
|
|
443
|
+
repository: str,
|
|
444
|
+
issue_number: int,
|
|
445
|
+
lock_reason: Literal["off-topic", "too heated", "resolved", "spam"] | None = None,
|
|
446
|
+
**kwargs: Any,
|
|
447
|
+
) -> ClientResponse:
|
|
448
|
+
"""Lock an issue to prevent further comments.
|
|
449
|
+
|
|
450
|
+
Args:
|
|
451
|
+
owner: The owner of the repository.
|
|
452
|
+
repository: The name of the repository.
|
|
453
|
+
issue_number: The number of the issue.
|
|
454
|
+
lock_reason: The reason for locking the issue.
|
|
455
|
+
**kwargs: Additional arguments for the request.
|
|
456
|
+
|
|
457
|
+
Returns:
|
|
458
|
+
A ClientResponse object from the API call.
|
|
459
|
+
|
|
460
|
+
"""
|
|
461
|
+
endpoint, payload, kwargs = self._lock_issue_helper(
|
|
462
|
+
owner=owner,
|
|
463
|
+
repository=repository,
|
|
464
|
+
issue_number=issue_number,
|
|
465
|
+
lock_reason=lock_reason,
|
|
466
|
+
**kwargs,
|
|
467
|
+
)
|
|
468
|
+
return await self._put(endpoint=endpoint, json=payload, **kwargs)
|
|
469
|
+
|
|
470
|
+
async def lock_issue(
|
|
471
|
+
self,
|
|
472
|
+
owner: str,
|
|
473
|
+
repository: str,
|
|
474
|
+
issue_number: int,
|
|
475
|
+
lock_reason: Literal["off-topic", "too heated", "resolved", "spam"] | None = None,
|
|
476
|
+
**kwargs: Any,
|
|
477
|
+
) -> tuple[dict[str, Any], int, str | None, str | None]:
|
|
478
|
+
"""Lock an issue to prevent further comments.
|
|
479
|
+
|
|
480
|
+
Args:
|
|
481
|
+
owner: The owner of the repository.
|
|
482
|
+
repository: The name of the repository.
|
|
483
|
+
issue_number: The number of the issue.
|
|
484
|
+
lock_reason: The reason for locking the issue.
|
|
485
|
+
**kwargs: Additional arguments for the request.
|
|
486
|
+
|
|
487
|
+
Returns:
|
|
488
|
+
A tuple containing:
|
|
489
|
+
|
|
490
|
+
- An empty dictionary for 204 No Content responses.
|
|
491
|
+
- The HTTP status code of the response.
|
|
492
|
+
- The ETag value from the response headers (if present).
|
|
493
|
+
- The Last-Modified value from the response headers (if present).
|
|
494
|
+
|
|
495
|
+
"""
|
|
496
|
+
response = await self._lock_issue(
|
|
497
|
+
owner=owner,
|
|
498
|
+
repository=repository,
|
|
499
|
+
issue_number=issue_number,
|
|
500
|
+
lock_reason=lock_reason,
|
|
501
|
+
**kwargs,
|
|
502
|
+
)
|
|
503
|
+
data, status_code, etag_value, last_modified_value = await process_async_response_with_last_modified(response)
|
|
504
|
+
return cast(dict[str, Any], data), status_code, etag_value, last_modified_value
|
|
505
|
+
|
|
506
|
+
async def _unlock_issue(self, owner: str, repository: str, issue_number: int, **kwargs: Any) -> ClientResponse:
|
|
507
|
+
"""Unlock a previously locked issue.
|
|
508
|
+
|
|
509
|
+
Args:
|
|
510
|
+
owner: The owner of the repository.
|
|
511
|
+
repository: The name of the repository.
|
|
512
|
+
issue_number: The number of the issue.
|
|
513
|
+
**kwargs: Additional arguments for the request.
|
|
514
|
+
|
|
515
|
+
Returns:
|
|
516
|
+
A ClientResponse object from the API call.
|
|
517
|
+
|
|
518
|
+
"""
|
|
519
|
+
endpoint, kwargs = self._unlock_issue_helper(
|
|
520
|
+
owner=owner,
|
|
521
|
+
repository=repository,
|
|
522
|
+
issue_number=issue_number,
|
|
523
|
+
**kwargs,
|
|
524
|
+
)
|
|
525
|
+
return await self._delete(endpoint=endpoint, **kwargs)
|
|
526
|
+
|
|
527
|
+
async def unlock_issue(
|
|
528
|
+
self, owner: str, repository: str, issue_number: int, **kwargs: Any
|
|
529
|
+
) -> tuple[dict[str, Any], int, str | None, str | None]:
|
|
530
|
+
"""Unlock a previously locked issue.
|
|
531
|
+
|
|
532
|
+
Args:
|
|
533
|
+
owner: The owner of the repository.
|
|
534
|
+
repository: The name of the repository.
|
|
535
|
+
issue_number: The number of the issue.
|
|
536
|
+
**kwargs: Additional arguments for the request.
|
|
537
|
+
|
|
538
|
+
Returns:
|
|
539
|
+
A tuple containing:
|
|
540
|
+
|
|
541
|
+
- An empty dictionary for 204 No Content responses.
|
|
542
|
+
- The HTTP status code of the response.
|
|
543
|
+
- The ETag value from the response headers (if present).
|
|
544
|
+
- The Last-Modified value from the response headers (if present).
|
|
545
|
+
|
|
546
|
+
"""
|
|
547
|
+
response = await self._unlock_issue(
|
|
548
|
+
owner=owner,
|
|
549
|
+
repository=repository,
|
|
550
|
+
issue_number=issue_number,
|
|
551
|
+
**kwargs,
|
|
552
|
+
)
|
|
553
|
+
data, status_code, etag_value, last_modified_value = await process_async_response_with_last_modified(response)
|
|
554
|
+
return cast(dict[str, Any], data), status_code, etag_value, last_modified_value
|