python-gitea 0.6.0__py3-none-any.whl → 0.7.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.
Files changed (83) hide show
  1. gitea/cli/comment/add.py +79 -0
  2. gitea/cli/comment/delete.py +76 -0
  3. gitea/cli/comment/edit.py +79 -0
  4. gitea/cli/comment/list.py +88 -0
  5. gitea/cli/comment/main.py +27 -0
  6. gitea/cli/issue/create.py +125 -0
  7. gitea/cli/issue/dependency/__init__.py +1 -0
  8. gitea/cli/issue/dependency/add.py +94 -0
  9. gitea/cli/issue/dependency/list.py +88 -0
  10. gitea/cli/issue/dependency/main.py +25 -0
  11. gitea/cli/issue/dependency/remove.py +94 -0
  12. gitea/cli/issue/edit.py +1 -1
  13. gitea/cli/issue/get.py +1 -1
  14. gitea/cli/issue/list.py +1 -1
  15. gitea/cli/issue/main.py +4 -0
  16. gitea/cli/label/create.py +85 -0
  17. gitea/cli/label/delete.py +76 -0
  18. gitea/cli/label/list.py +85 -0
  19. gitea/cli/label/main.py +27 -0
  20. gitea/cli/label/update.py +94 -0
  21. gitea/cli/main.py +11 -1
  22. gitea/cli/milestone/create.py +95 -0
  23. gitea/cli/milestone/list.py +97 -0
  24. gitea/cli/milestone/main.py +23 -0
  25. gitea/cli/notification/__init__.py +1 -0
  26. gitea/cli/notification/list.py +138 -0
  27. gitea/cli/notification/main.py +23 -0
  28. gitea/cli/notification/read.py +117 -0
  29. gitea/cli/project/__init__.py +1 -0
  30. gitea/cli/project/column/__init__.py +1 -0
  31. gitea/cli/project/column/create.py +85 -0
  32. gitea/cli/project/column/list.py +88 -0
  33. gitea/cli/project/create.py +94 -0
  34. gitea/cli/project/delete.py +76 -0
  35. gitea/cli/project/edit.py +100 -0
  36. gitea/cli/project/get.py +76 -0
  37. gitea/cli/project/issue/__init__.py +1 -0
  38. gitea/cli/project/issue/add.py +82 -0
  39. gitea/cli/project/issue/move.py +88 -0
  40. gitea/cli/project/issue/remove.py +82 -0
  41. gitea/cli/project/list.py +91 -0
  42. gitea/cli/project/main.py +51 -0
  43. gitea/cli/pull_request/list.py +1 -1
  44. gitea/cli/user/update_settings.py +1 -1
  45. gitea/cli/utils/api.py +1 -1
  46. gitea/client/async_gitea.py +17 -6
  47. gitea/client/gitea.py +17 -6
  48. gitea/comment/__init__.py +8 -0
  49. gitea/comment/async_comment.py +251 -0
  50. gitea/comment/base.py +154 -0
  51. gitea/comment/comment.py +251 -0
  52. gitea/issue/async_issue.py +316 -4
  53. gitea/issue/base.py +185 -2
  54. gitea/issue/issue.py +316 -4
  55. gitea/label/__init__.py +8 -0
  56. gitea/label/async_label.py +263 -0
  57. gitea/label/base.py +171 -0
  58. gitea/label/label.py +263 -0
  59. gitea/milestone/__init__.py +8 -0
  60. gitea/milestone/async_milestone.py +160 -0
  61. gitea/milestone/base.py +109 -0
  62. gitea/milestone/milestone.py +160 -0
  63. gitea/notification/__init__.py +8 -0
  64. gitea/notification/async_notification.py +434 -0
  65. gitea/notification/base.py +253 -0
  66. gitea/notification/notification.py +434 -0
  67. gitea/project/__init__.py +8 -0
  68. gitea/project/async_project.py +1065 -0
  69. gitea/project/base.py +512 -0
  70. gitea/project/project.py +1065 -0
  71. gitea/pull_request/async_pull_request.py +2 -2
  72. gitea/pull_request/base.py +1 -1
  73. gitea/pull_request/pull_request.py +2 -2
  74. gitea/user/async_user.py +2 -2
  75. gitea/user/base.py +1 -1
  76. gitea/user/user.py +2 -2
  77. gitea/utils/response.py +19 -13
  78. {python_gitea-0.6.0.dist-info → python_gitea-0.7.0.dist-info}/METADATA +39 -57
  79. python_gitea-0.7.0.dist-info/RECORD +118 -0
  80. {python_gitea-0.6.0.dist-info → python_gitea-0.7.0.dist-info}/WHEEL +1 -1
  81. python_gitea-0.6.0.dist-info/RECORD +0 -61
  82. {python_gitea-0.6.0.dist-info → python_gitea-0.7.0.dist-info}/entry_points.txt +0 -0
  83. {python_gitea-0.6.0.dist-info → python_gitea-0.7.0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,79 @@
1
+ """Add comment command."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Annotated
6
+
7
+ import typer
8
+
9
+
10
+ def add_command(
11
+ ctx: typer.Context,
12
+ owner: Annotated[str, typer.Option("--owner", help="Owner of the repository.")],
13
+ repository: Annotated[str, typer.Option("--repository", help="Name of the repository.")],
14
+ index: Annotated[int, typer.Option("--index", help="Index of the issue.")],
15
+ body: Annotated[str, typer.Option("--body", help="Body of the comment.")],
16
+ account_name: Annotated[
17
+ str | None,
18
+ typer.Option(
19
+ "--account-name",
20
+ help="Name of the account to use for authentication.",
21
+ ),
22
+ ] = None,
23
+ token: Annotated[
24
+ str | None,
25
+ typer.Option(
26
+ "--token",
27
+ help="Token for authentication. If not provided, the token from the specified account will be used.",
28
+ ),
29
+ ] = None,
30
+ base_url: Annotated[
31
+ str | None,
32
+ typer.Option(
33
+ "--base-url",
34
+ help="Base URL of the Gitea platform. If not provided, the base URL from the specified account will be used.",
35
+ ),
36
+ ] = None,
37
+ ) -> None:
38
+ """Add a comment to an issue.
39
+
40
+ Args:
41
+ ctx: The Typer context.
42
+ owner: The owner of the repository.
43
+ repository: The name of the repository.
44
+ index: The index of the issue.
45
+ body: The body of the comment.
46
+ account_name: Name of the account to use for authentication.
47
+ token: Token for authentication.
48
+ base_url: Base URL of the Gitea platform.
49
+
50
+ """
51
+ from typing import Any # noqa: PLC0415
52
+
53
+ from gitea.cli.utils.api import execute_api_command # noqa: PLC0415
54
+ from gitea.cli.utils.auth import get_auth_params # noqa: PLC0415
55
+ from gitea.client.gitea import Gitea # noqa: PLC0415
56
+
57
+ token, base_url = get_auth_params(
58
+ config_path=ctx.obj.get("config_path"),
59
+ account_name=account_name,
60
+ token=token,
61
+ base_url=base_url,
62
+ )
63
+
64
+ def api_call() -> tuple[dict[str, Any] | list[dict[str, Any]], dict[str, Any]]:
65
+ """Add comment information.
66
+
67
+ Returns:
68
+ A tuple containing the comment data and metadata.
69
+
70
+ """
71
+ with Gitea(token=token, base_url=base_url) as client:
72
+ return client.comment.create_comment(
73
+ owner=owner,
74
+ repository=repository,
75
+ index=index,
76
+ body=body,
77
+ )
78
+
79
+ execute_api_command(api_call=api_call, command_name="gitea-cli comment add")
@@ -0,0 +1,76 @@
1
+ """Delete comment command."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Annotated
6
+
7
+ import typer
8
+
9
+
10
+ def delete_command(
11
+ ctx: typer.Context,
12
+ owner: Annotated[str, typer.Option("--owner", help="Owner of the repository.")],
13
+ repository: Annotated[str, typer.Option("--repository", help="Name of the repository.")],
14
+ comment_id: Annotated[int, typer.Option("--comment-id", help="ID of the comment.")],
15
+ account_name: Annotated[
16
+ str | None,
17
+ typer.Option(
18
+ "--account-name",
19
+ help="Name of the account to use for authentication.",
20
+ ),
21
+ ] = None,
22
+ token: Annotated[
23
+ str | None,
24
+ typer.Option(
25
+ "--token",
26
+ help="Token for authentication. If not provided, the token from the specified account will be used.",
27
+ ),
28
+ ] = None,
29
+ base_url: Annotated[
30
+ str | None,
31
+ typer.Option(
32
+ "--base-url",
33
+ help="Base URL of the Gitea platform. If not provided, the base URL from the specified account will be used.",
34
+ ),
35
+ ] = None,
36
+ ) -> None:
37
+ """Delete a comment.
38
+
39
+ Args:
40
+ ctx: The Typer context.
41
+ owner: The owner of the repository.
42
+ repository: The name of the repository.
43
+ comment_id: The ID of the comment.
44
+ account_name: Name of the account to use for authentication.
45
+ token: Token for authentication.
46
+ base_url: Base URL of the Gitea platform.
47
+
48
+ """
49
+ from typing import Any # noqa: PLC0415
50
+
51
+ from gitea.cli.utils.api import execute_api_command # noqa: PLC0415
52
+ from gitea.cli.utils.auth import get_auth_params # noqa: PLC0415
53
+ from gitea.client.gitea import Gitea # noqa: PLC0415
54
+
55
+ token, base_url = get_auth_params(
56
+ config_path=ctx.obj.get("config_path"),
57
+ account_name=account_name,
58
+ token=token,
59
+ base_url=base_url,
60
+ )
61
+
62
+ def api_call() -> tuple[dict[str, Any] | list[dict[str, Any]], dict[str, Any]]:
63
+ """Delete comment information.
64
+
65
+ Returns:
66
+ A tuple containing the comment data and metadata.
67
+
68
+ """
69
+ with Gitea(token=token, base_url=base_url) as client:
70
+ return client.comment.delete_comment(
71
+ owner=owner,
72
+ repository=repository,
73
+ comment_id=comment_id,
74
+ )
75
+
76
+ execute_api_command(api_call=api_call, command_name="gitea-cli comment delete")
@@ -0,0 +1,79 @@
1
+ """Edit comment command."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Annotated
6
+
7
+ import typer
8
+
9
+
10
+ def edit_command(
11
+ ctx: typer.Context,
12
+ owner: Annotated[str, typer.Option("--owner", help="Owner of the repository.")],
13
+ repository: Annotated[str, typer.Option("--repository", help="Name of the repository.")],
14
+ comment_id: Annotated[int, typer.Option("--comment-id", help="ID of the comment.")],
15
+ body: Annotated[str, typer.Option("--body", help="New body of the comment.")],
16
+ account_name: Annotated[
17
+ str | None,
18
+ typer.Option(
19
+ "--account-name",
20
+ help="Name of the account to use for authentication.",
21
+ ),
22
+ ] = None,
23
+ token: Annotated[
24
+ str | None,
25
+ typer.Option(
26
+ "--token",
27
+ help="Token for authentication. If not provided, the token from the specified account will be used.",
28
+ ),
29
+ ] = None,
30
+ base_url: Annotated[
31
+ str | None,
32
+ typer.Option(
33
+ "--base-url",
34
+ help="Base URL of the Gitea platform. If not provided, the base URL from the specified account will be used.",
35
+ ),
36
+ ] = None,
37
+ ) -> None:
38
+ """Edit a comment.
39
+
40
+ Args:
41
+ ctx: The Typer context.
42
+ owner: The owner of the repository.
43
+ repository: The name of the repository.
44
+ comment_id: The ID of the comment.
45
+ body: The new body of the comment.
46
+ account_name: Name of the account to use for authentication.
47
+ token: Token for authentication.
48
+ base_url: Base URL of the Gitea platform.
49
+
50
+ """
51
+ from typing import Any # noqa: PLC0415
52
+
53
+ from gitea.cli.utils.api import execute_api_command # noqa: PLC0415
54
+ from gitea.cli.utils.auth import get_auth_params # noqa: PLC0415
55
+ from gitea.client.gitea import Gitea # noqa: PLC0415
56
+
57
+ token, base_url = get_auth_params(
58
+ config_path=ctx.obj.get("config_path"),
59
+ account_name=account_name,
60
+ token=token,
61
+ base_url=base_url,
62
+ )
63
+
64
+ def api_call() -> tuple[dict[str, Any] | list[dict[str, Any]], dict[str, Any]]:
65
+ """Edit comment information.
66
+
67
+ Returns:
68
+ A tuple containing the comment data and metadata.
69
+
70
+ """
71
+ with Gitea(token=token, base_url=base_url) as client:
72
+ return client.comment.edit_comment(
73
+ owner=owner,
74
+ repository=repository,
75
+ comment_id=comment_id,
76
+ body=body,
77
+ )
78
+
79
+ execute_api_command(api_call=api_call, command_name="gitea-cli comment edit")
@@ -0,0 +1,88 @@
1
+ """List comments command."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Annotated
6
+
7
+ import typer
8
+
9
+
10
+ def list_command(
11
+ ctx: typer.Context,
12
+ owner: Annotated[str, typer.Option("--owner", help="Owner of the repository.")],
13
+ repository: Annotated[str, typer.Option("--repository", help="Name of the repository.")],
14
+ index: Annotated[int, typer.Option("--index", help="Index of the issue.")],
15
+ page: Annotated[
16
+ int | None,
17
+ typer.Option("--page", help="The page number for pagination."),
18
+ ] = None,
19
+ limit: Annotated[
20
+ int | None,
21
+ typer.Option("--limit", help="The number of comments per page."),
22
+ ] = None,
23
+ account_name: Annotated[
24
+ str | None,
25
+ typer.Option(
26
+ "--account-name",
27
+ help="Name of the account to use for authentication.",
28
+ ),
29
+ ] = None,
30
+ token: Annotated[
31
+ str | None,
32
+ typer.Option(
33
+ "--token",
34
+ help="Token for authentication. If not provided, the token from the specified account will be used.",
35
+ ),
36
+ ] = None,
37
+ base_url: Annotated[
38
+ str | None,
39
+ typer.Option(
40
+ "--base-url",
41
+ help="Base URL of the Gitea platform. If not provided, the base URL from the specified account will be used.",
42
+ ),
43
+ ] = None,
44
+ ) -> None:
45
+ """List comments on an issue.
46
+
47
+ Args:
48
+ ctx: The Typer context.
49
+ owner: The owner of the repository.
50
+ repository: The name of the repository.
51
+ index: The index of the issue.
52
+ page: The page number for pagination.
53
+ limit: The number of comments per page.
54
+ account_name: Name of the account to use for authentication.
55
+ token: Token for authentication.
56
+ base_url: Base URL of the Gitea platform.
57
+
58
+ """
59
+ from typing import Any # noqa: PLC0415
60
+
61
+ from gitea.cli.utils.api import execute_api_command # noqa: PLC0415
62
+ from gitea.cli.utils.auth import get_auth_params # noqa: PLC0415
63
+ from gitea.client.gitea import Gitea # noqa: PLC0415
64
+
65
+ token, base_url = get_auth_params(
66
+ config_path=ctx.obj.get("config_path"),
67
+ account_name=account_name,
68
+ token=token,
69
+ base_url=base_url,
70
+ )
71
+
72
+ def api_call() -> tuple[dict[str, Any] | list[dict[str, Any]], dict[str, Any]]:
73
+ """List comment information.
74
+
75
+ Returns:
76
+ A tuple containing the comment data and metadata.
77
+
78
+ """
79
+ with Gitea(token=token, base_url=base_url) as client:
80
+ return client.comment.list_comments(
81
+ owner=owner,
82
+ repository=repository,
83
+ index=index,
84
+ page=page,
85
+ limit=limit,
86
+ )
87
+
88
+ execute_api_command(api_call=api_call, command_name="gitea-cli comment list")
@@ -0,0 +1,27 @@
1
+ """CLI commands for managing comments."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import typer
6
+
7
+ comment_app = typer.Typer(
8
+ name="comment",
9
+ help="Commands for managing comments.",
10
+ rich_markup_mode="rich",
11
+ )
12
+
13
+
14
+ def register_commands() -> None:
15
+ """Register comment-related commands to the comment_app."""
16
+ from gitea.cli.comment.add import add_command # noqa: PLC0415
17
+ from gitea.cli.comment.delete import delete_command # noqa: PLC0415
18
+ from gitea.cli.comment.edit import edit_command # noqa: PLC0415
19
+ from gitea.cli.comment.list import list_command # noqa: PLC0415
20
+
21
+ comment_app.command("add", help="Add a comment to an issue.")(add_command)
22
+ comment_app.command("delete", help="Delete a comment.")(delete_command)
23
+ comment_app.command("edit", help="Edit a comment.")(edit_command)
24
+ comment_app.command("list", help="List comments on an issue.")(list_command)
25
+
26
+
27
+ register_commands()
@@ -0,0 +1,125 @@
1
+ """Create issues command."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from datetime import datetime
6
+ from typing import Annotated
7
+
8
+ import typer
9
+
10
+
11
+ def create_command(
12
+ ctx: typer.Context,
13
+ owner: Annotated[str, typer.Option("--owner", help="Owner of the repository.")],
14
+ repository: Annotated[str, typer.Option("--repository", help="Name of the repository.")],
15
+ title: Annotated[str, typer.Option("--title", help="Title of the new issue.")],
16
+ assignee: Annotated[
17
+ str | None,
18
+ typer.Option("--assignee", help="The username to assign the issue to."),
19
+ ] = None,
20
+ assignees: Annotated[
21
+ list[str] | None,
22
+ typer.Option("--assignees", help="The usernames to assign the issue to."),
23
+ ] = None,
24
+ body: Annotated[
25
+ str | None,
26
+ typer.Option("--body", help="The body of the new issue."),
27
+ ] = None,
28
+ closed: Annotated[
29
+ bool | None,
30
+ typer.Option("--closed", help="Whether the issue is created closed."),
31
+ ] = None,
32
+ due_date: Annotated[
33
+ datetime | None,
34
+ typer.Option("--due-date", help="The due date of the new issue."),
35
+ ] = None,
36
+ labels: Annotated[
37
+ list[int] | None,
38
+ typer.Option("--labels", help="The label IDs to apply to the new issue."),
39
+ ] = None,
40
+ milestone: Annotated[
41
+ int | None,
42
+ typer.Option("--milestone", help="The milestone ID to associate with the new issue."),
43
+ ] = None,
44
+ ref: Annotated[
45
+ str | None,
46
+ typer.Option("--ref", help="The reference of the new issue."),
47
+ ] = None,
48
+ account_name: Annotated[
49
+ str | None,
50
+ typer.Option(
51
+ "--account-name",
52
+ help="Name of the account to use for authentication.",
53
+ ),
54
+ ] = None,
55
+ token: Annotated[
56
+ str | None,
57
+ typer.Option(
58
+ "--token",
59
+ help="Token for authentication. If not provided, the token from the specified account will be used.",
60
+ ),
61
+ ] = None,
62
+ base_url: Annotated[
63
+ str | None,
64
+ typer.Option(
65
+ "--base-url",
66
+ help="Base URL of the Gitea platform. If not provided, the base URL from the specified account will be used.",
67
+ ),
68
+ ] = None,
69
+ ) -> None:
70
+ """Create a new issue in a repository.
71
+
72
+ Args:
73
+ ctx: The Typer context.
74
+ owner: The owner of the repository.
75
+ repository: The name of the repository.
76
+ title: The title of the new issue.
77
+ assignee: The username to assign the issue to.
78
+ assignees: The usernames to assign the issue to.
79
+ body: The body of the new issue.
80
+ closed: Whether the issue is created closed.
81
+ due_date: The due date of the new issue.
82
+ labels: The label IDs to apply to the new issue.
83
+ milestone: The milestone ID to associate with the new issue.
84
+ ref: The reference of the new issue.
85
+ account_name: Name of the account to use for authentication.
86
+ token: Token for authentication.
87
+ base_url: Base URL of the Gitea platform.
88
+
89
+ """
90
+ from typing import Any # noqa: PLC0415
91
+
92
+ from gitea.cli.utils.api import execute_api_command # noqa: PLC0415
93
+ from gitea.cli.utils.auth import get_auth_params # noqa: PLC0415
94
+ from gitea.client.gitea import Gitea # noqa: PLC0415
95
+
96
+ token, base_url = get_auth_params(
97
+ config_path=ctx.obj.get("config_path"),
98
+ account_name=account_name,
99
+ token=token,
100
+ base_url=base_url,
101
+ )
102
+
103
+ def api_call() -> tuple[dict[str, Any] | list[dict[str, Any]], dict[str, Any]]:
104
+ """Create issue information.
105
+
106
+ Returns:
107
+ A tuple containing the issue data and metadata.
108
+
109
+ """
110
+ with Gitea(token=token, base_url=base_url) as client:
111
+ return client.issue.create_issue(
112
+ owner=owner,
113
+ repository=repository,
114
+ title=title,
115
+ assignee=assignee,
116
+ assignees=assignees,
117
+ body=body,
118
+ closed=closed,
119
+ due_date=due_date,
120
+ labels=labels,
121
+ milestone=milestone,
122
+ ref=ref,
123
+ )
124
+
125
+ execute_api_command(api_call=api_call, command_name="gitea-cli issue create")
@@ -0,0 +1 @@
1
+ """CLI commands for managing issue dependencies."""
@@ -0,0 +1,94 @@
1
+ """Add issue dependency command."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Annotated
6
+
7
+ import typer
8
+
9
+
10
+ def add_command(
11
+ ctx: typer.Context,
12
+ owner: Annotated[str, typer.Option("--owner", help="Owner of the repository.")],
13
+ repository: Annotated[str, typer.Option("--repository", help="Name of the repository.")],
14
+ index: Annotated[int, typer.Option("--index", help="Index of the target issue.")],
15
+ dependency_owner: Annotated[
16
+ str,
17
+ typer.Option("--dependency-owner", help="Owner of the dependency issue's repository."),
18
+ ],
19
+ dependency_repository: Annotated[
20
+ str,
21
+ typer.Option("--dependency-repository", help="Name of the dependency issue's repository."),
22
+ ],
23
+ dependency_index: Annotated[
24
+ int,
25
+ typer.Option("--dependency-index", help="Index of the dependency issue."),
26
+ ],
27
+ account_name: Annotated[
28
+ str | None,
29
+ typer.Option(
30
+ "--account-name",
31
+ help="Name of the account to use for authentication.",
32
+ ),
33
+ ] = None,
34
+ token: Annotated[
35
+ str | None,
36
+ typer.Option(
37
+ "--token",
38
+ help="Token for authentication. If not provided, the token from the specified account will be used.",
39
+ ),
40
+ ] = None,
41
+ base_url: Annotated[
42
+ str | None,
43
+ typer.Option(
44
+ "--base-url",
45
+ help="Base URL of the Gitea platform. If not provided, the base URL from the specified account will be used.",
46
+ ),
47
+ ] = None,
48
+ ) -> None:
49
+ """Make an issue depend on another issue.
50
+
51
+ Args:
52
+ ctx: The Typer context.
53
+ owner: The owner of the repository.
54
+ repository: The name of the repository.
55
+ index: The index of the target issue.
56
+ dependency_owner: The owner of the dependency issue's repository.
57
+ dependency_repository: The name of the dependency issue's repository.
58
+ dependency_index: The index of the dependency issue.
59
+ account_name: Name of the account to use for authentication.
60
+ token: Token for authentication.
61
+ base_url: Base URL of the Gitea platform.
62
+
63
+ """
64
+ from typing import Any # noqa: PLC0415
65
+
66
+ from gitea.cli.utils.api import execute_api_command # noqa: PLC0415
67
+ from gitea.cli.utils.auth import get_auth_params # noqa: PLC0415
68
+ from gitea.client.gitea import Gitea # noqa: PLC0415
69
+
70
+ token, base_url = get_auth_params(
71
+ config_path=ctx.obj.get("config_path"),
72
+ account_name=account_name,
73
+ token=token,
74
+ base_url=base_url,
75
+ )
76
+
77
+ def api_call() -> tuple[dict[str, Any] | list[dict[str, Any]], dict[str, Any]]:
78
+ """Add issue dependency information.
79
+
80
+ Returns:
81
+ A tuple containing the target issue data and metadata.
82
+
83
+ """
84
+ with Gitea(token=token, base_url=base_url) as client:
85
+ return client.issue.create_issue_dependency(
86
+ owner=owner,
87
+ repository=repository,
88
+ index=index,
89
+ dependency_owner=dependency_owner,
90
+ dependency_repository=dependency_repository,
91
+ dependency_index=dependency_index,
92
+ )
93
+
94
+ execute_api_command(api_call=api_call, command_name="gitea-cli issue dependency add")
@@ -0,0 +1,88 @@
1
+ """List issue dependencies command."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Annotated
6
+
7
+ import typer
8
+
9
+
10
+ def list_command(
11
+ ctx: typer.Context,
12
+ owner: Annotated[str, typer.Option("--owner", help="Owner of the repository.")],
13
+ repository: Annotated[str, typer.Option("--repository", help="Name of the repository.")],
14
+ index: Annotated[int, typer.Option("--index", help="Index of the issue.")],
15
+ page: Annotated[
16
+ int | None,
17
+ typer.Option("--page", help="Page number for pagination."),
18
+ ] = None,
19
+ limit: Annotated[
20
+ int | None,
21
+ typer.Option("--limit", help="Number of dependencies per page."),
22
+ ] = None,
23
+ account_name: Annotated[
24
+ str | None,
25
+ typer.Option(
26
+ "--account-name",
27
+ help="Name of the account to use for authentication.",
28
+ ),
29
+ ] = None,
30
+ token: Annotated[
31
+ str | None,
32
+ typer.Option(
33
+ "--token",
34
+ help="Token for authentication. If not provided, the token from the specified account will be used.",
35
+ ),
36
+ ] = None,
37
+ base_url: Annotated[
38
+ str | None,
39
+ typer.Option(
40
+ "--base-url",
41
+ help="Base URL of the Gitea platform. If not provided, the base URL from the specified account will be used.",
42
+ ),
43
+ ] = None,
44
+ ) -> None:
45
+ """List an issue's dependencies.
46
+
47
+ Args:
48
+ ctx: The Typer context.
49
+ owner: The owner of the repository.
50
+ repository: The name of the repository.
51
+ index: The index of the issue.
52
+ page: The page number for pagination.
53
+ limit: The number of dependencies per page.
54
+ account_name: Name of the account to use for authentication.
55
+ token: Token for authentication.
56
+ base_url: Base URL of the Gitea platform.
57
+
58
+ """
59
+ from typing import Any # noqa: PLC0415
60
+
61
+ from gitea.cli.utils.api import execute_api_command # noqa: PLC0415
62
+ from gitea.cli.utils.auth import get_auth_params # noqa: PLC0415
63
+ from gitea.client.gitea import Gitea # noqa: PLC0415
64
+
65
+ token, base_url = get_auth_params(
66
+ config_path=ctx.obj.get("config_path"),
67
+ account_name=account_name,
68
+ token=token,
69
+ base_url=base_url,
70
+ )
71
+
72
+ def api_call() -> tuple[dict[str, Any] | list[dict[str, Any]], dict[str, Any]]:
73
+ """List issue dependency information.
74
+
75
+ Returns:
76
+ A tuple containing the dependency issues and metadata.
77
+
78
+ """
79
+ with Gitea(token=token, base_url=base_url) as client:
80
+ return client.issue.list_issue_dependencies(
81
+ owner=owner,
82
+ repository=repository,
83
+ index=index,
84
+ page=page,
85
+ limit=limit,
86
+ )
87
+
88
+ execute_api_command(api_call=api_call, command_name="gitea-cli issue dependency list")
@@ -0,0 +1,25 @@
1
+ """CLI commands for managing issue dependencies."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import typer
6
+
7
+ dependency_app = typer.Typer(
8
+ name="dependency",
9
+ help="Commands for managing issue dependencies.",
10
+ rich_markup_mode="rich",
11
+ )
12
+
13
+
14
+ def register_commands() -> None:
15
+ """Register dependency-related commands to the dependency_app."""
16
+ from gitea.cli.issue.dependency.add import add_command # noqa: PLC0415
17
+ from gitea.cli.issue.dependency.list import list_command # noqa: PLC0415
18
+ from gitea.cli.issue.dependency.remove import remove_command # noqa: PLC0415
19
+
20
+ dependency_app.command("add", help="Make an issue depend on another issue.")(add_command)
21
+ dependency_app.command("list", help="List an issue's dependencies.")(list_command)
22
+ dependency_app.command("remove", help="Remove an issue dependency.")(remove_command)
23
+
24
+
25
+ register_commands()