FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-gitlab/gitlab/v4/objects/todos.py at main · python-gitlab/python-gitlab · GitHub
python-gitlab
python-gitlab
Repository navigation
Code
Issues
16
(16)
Pull requests
15
(15)
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-gitlab
/
gitlab
/
v4
/
objects
/
todos.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
55 lines (42 loc) · 1.78 KB
Breadcrumbs
python-gitlab
/
gitlab
/
v4
/
objects
/
todos.py
Copy path
File metadata and controls
55 lines (42 loc) · 1.78 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
from
typing
import
Any
,
Dict
,
TYPE_CHECKING
from
gitlab
import
cli
from
gitlab
import
exceptions
as
exc
from
gitlab
.
base
import
RESTObject
from
gitlab
.
mixins
import
DeleteMixin
,
ListMixin
,
ObjectDeleteMixin
__all__
=
[
"Todo"
,
"TodoManager"
]
class
Todo
(
ObjectDeleteMixin
,
RESTObject
):
@
cli
.
register_custom_action
(
cls_names
=
"Todo"
)
@
exc
.
on_http_error
(
exc
.
GitlabTodoError
)
def
mark_as_done
(
self
,
**
kwargs
:
Any
)
->
Dict
[
str
,
Any
]:
"""Mark the todo as done.
Args:
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If authentication is not correct
GitlabTodoError: If the server failed to perform the request
Returns:
A dict with the result
"""
path
=
f"
{
self
.
manager
.
path
}
/
{
self
.
encoded_id
}
/mark_as_done"
server_data
=
self
.
manager
.
gitlab
.
http_post
(
path
,
**
kwargs
)
if
TYPE_CHECKING
:
assert
isinstance
(
server_data
,
dict
)
self
.
_update_attrs
(
server_data
)
return
server_data
class
TodoManager
(
ListMixin
[
Todo
],
DeleteMixin
[
Todo
]):
_path
=
"/todos"
_obj_cls
=
Todo
_list_filters
=
(
"action"
,
"author_id"
,
"project_id"
,
"state"
,
"type"
)
@
cli
.
register_custom_action
(
cls_names
=
"TodoManager"
)
@
exc
.
on_http_error
(
exc
.
GitlabTodoError
)
def
mark_all_as_done
(
self
,
**
kwargs
:
Any
)
->
None
:
"""Mark all the todos as done.
Args:
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If authentication is not correct
GitlabTodoError: If the server failed to perform the request
Returns:
The number of todos marked done
"""
self
.
gitlab
.
http_post
(
"/todos/mark_as_done"
,
**
kwargs
)
Back
|
FazBrowse Home
|
New Git URL