taskbadger 1.6.3__tar.gz → 2.0.0__tar.gz

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 (61) hide show
  1. taskbadger-2.0.0/PKG-INFO +75 -0
  2. taskbadger-2.0.0/README.md +43 -0
  3. {taskbadger-1.6.3 → taskbadger-2.0.0}/pyproject.toml +12 -10
  4. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/__init__.py +3 -7
  5. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/celery.py +3 -2
  6. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/cli/utils.py +2 -2
  7. taskbadger-2.0.0/taskbadger/cli_main.py +107 -0
  8. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/config.py +14 -4
  9. taskbadger-2.0.0/taskbadger/internal/api/action_endpoints/__init__.py +1 -0
  10. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/internal/api/action_endpoints/action_cancel.py +1 -0
  11. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/internal/api/action_endpoints/action_create.py +2 -2
  12. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/internal/api/action_endpoints/action_get.py +1 -0
  13. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/internal/api/action_endpoints/action_list.py +1 -0
  14. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/internal/api/action_endpoints/action_partial_update.py +2 -2
  15. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/internal/api/action_endpoints/action_update.py +2 -2
  16. taskbadger-2.0.0/taskbadger/internal/api/task_endpoints/__init__.py +1 -0
  17. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/internal/api/task_endpoints/task_cancel.py +1 -0
  18. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/internal/api/task_endpoints/task_create.py +2 -2
  19. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/internal/api/task_endpoints/task_get.py +1 -0
  20. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/internal/api/task_endpoints/task_list.py +1 -0
  21. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/internal/api/task_endpoints/task_partial_update.py +2 -2
  22. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/internal/api/task_endpoints/task_update.py +2 -2
  23. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/internal/models/action.py +3 -2
  24. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/internal/models/action_request.py +3 -2
  25. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/internal/models/paginated_task_list.py +3 -2
  26. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/internal/models/patched_action_request.py +3 -2
  27. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/internal/models/patched_task_request.py +24 -2
  28. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/internal/models/patched_task_request_tags.py +3 -2
  29. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/internal/models/task.py +24 -2
  30. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/internal/models/task_request.py +24 -2
  31. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/internal/models/task_request_tags.py +3 -2
  32. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/internal/models/task_tags.py +3 -2
  33. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/internal/types.py +13 -5
  34. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/mug.py +4 -4
  35. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/safe_sdk.py +3 -8
  36. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/sdk.py +41 -18
  37. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/utils.py +1 -1
  38. taskbadger-1.6.3/PKG-INFO +0 -140
  39. taskbadger-1.6.3/README.md +0 -109
  40. taskbadger-1.6.3/taskbadger/cli_main.py +0 -89
  41. taskbadger-1.6.3/taskbadger/internal/api/action_endpoints/__init__.py +0 -0
  42. taskbadger-1.6.3/taskbadger/internal/api/task_endpoints/__init__.py +0 -0
  43. {taskbadger-1.6.3 → taskbadger-2.0.0}/.gitignore +0 -0
  44. {taskbadger-1.6.3 → taskbadger-2.0.0}/LICENSE +0 -0
  45. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/cli/__init__.py +0 -0
  46. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/cli/basics.py +0 -0
  47. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/cli/list_tasks.py +0 -0
  48. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/cli/wrapper.py +0 -0
  49. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/decorators.py +0 -0
  50. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/exceptions.py +0 -0
  51. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/integrations.py +0 -0
  52. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/internal/__init__.py +0 -0
  53. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/internal/api/__init__.py +0 -0
  54. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/internal/client.py +0 -0
  55. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/internal/errors.py +0 -0
  56. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/internal/models/__init__.py +0 -0
  57. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/internal/models/status_enum.py +0 -0
  58. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/internal/py.typed +0 -0
  59. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/process.py +0 -0
  60. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/systems/__init__.py +0 -0
  61. {taskbadger-1.6.3 → taskbadger-2.0.0}/taskbadger/systems/celery.py +0 -0
@@ -0,0 +1,75 @@
1
+ Metadata-Version: 2.4
2
+ Name: taskbadger
3
+ Version: 2.0.0
4
+ Summary: The official Python SDK for Task Badger
5
+ Project-URL: Changelog, https://github.com/taskbadger/taskbadger-python/releases
6
+ Project-URL: homepage, https://taskbadger.net/
7
+ Project-URL: repository, https://github.com/taskbadger/taskbadger-python
8
+ Project-URL: documentation, https://docs.taskbadger.net/
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Web Environment
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Requires-Python: >=3.10
22
+ Requires-Dist: attrs>=21.3.0
23
+ Requires-Dist: httpx>=0.20.0
24
+ Requires-Dist: python-dateutil>=2.8.0
25
+ Requires-Dist: tomlkit>=0.12.5
26
+ Provides-Extra: celery
27
+ Requires-Dist: celery<6.0.0,>=4.0.0; extra == 'celery'
28
+ Provides-Extra: cli
29
+ Requires-Dist: rich>=13.0; extra == 'cli'
30
+ Requires-Dist: typer>=0.12; extra == 'cli'
31
+ Description-Content-Type: text/markdown
32
+
33
+ # Task Badger Python Client
34
+
35
+ This is the official Python SDK for [Task Badger](https://taskbadger.net/).
36
+
37
+ For full documentation go to https://docs.taskbadger.net/python/.
38
+
39
+ ![Integration Tests](https://github.com/taskbadger/taskbadger-python/actions/workflows/integration_tests.yml/badge.svg)
40
+
41
+ ---
42
+
43
+ ## Getting Started
44
+
45
+ ### Install
46
+
47
+ ```bash
48
+ pip install taskbadger
49
+ ```
50
+
51
+ To use the `taskbadger` command-line tool, install the `cli` extra:
52
+
53
+ ```bash
54
+ pip install 'taskbadger[cli]'
55
+ ```
56
+
57
+ ### Client Usage
58
+
59
+ ```python
60
+ import taskbadger
61
+ from taskbadger.systems import CelerySystemIntegration
62
+
63
+ taskbadger.init(
64
+ token="***",
65
+ systems=[CelerySystemIntegration()],
66
+ tags={"environment": "production"}
67
+ )
68
+ ```
69
+
70
+ ### CLI Usage
71
+
72
+ ```shell
73
+ $ export TASKBADGER_API_KEY=***
74
+ $ taskbadger run "nightly-backup" -- ./backup.sh
75
+ ```
@@ -0,0 +1,43 @@
1
+ # Task Badger Python Client
2
+
3
+ This is the official Python SDK for [Task Badger](https://taskbadger.net/).
4
+
5
+ For full documentation go to https://docs.taskbadger.net/python/.
6
+
7
+ ![Integration Tests](https://github.com/taskbadger/taskbadger-python/actions/workflows/integration_tests.yml/badge.svg)
8
+
9
+ ---
10
+
11
+ ## Getting Started
12
+
13
+ ### Install
14
+
15
+ ```bash
16
+ pip install taskbadger
17
+ ```
18
+
19
+ To use the `taskbadger` command-line tool, install the `cli` extra:
20
+
21
+ ```bash
22
+ pip install 'taskbadger[cli]'
23
+ ```
24
+
25
+ ### Client Usage
26
+
27
+ ```python
28
+ import taskbadger
29
+ from taskbadger.systems import CelerySystemIntegration
30
+
31
+ taskbadger.init(
32
+ token="***",
33
+ systems=[CelerySystemIntegration()],
34
+ tags={"environment": "production"}
35
+ )
36
+ ```
37
+
38
+ ### CLI Usage
39
+
40
+ ```shell
41
+ $ export TASKBADGER_API_KEY=***
42
+ $ taskbadger run "nightly-backup" -- ./backup.sh
43
+ ```
@@ -1,8 +1,8 @@
1
1
  [project]
2
2
  name = "taskbadger"
3
- version = "1.6.3"
3
+ version = "2.0.0"
4
4
  description = "The official Python SDK for Task Badger"
5
- requires-python = ">=3.9"
5
+ requires-python = ">=3.10"
6
6
  authors = []
7
7
  readme = "README.md"
8
8
  classifiers = [
@@ -11,10 +11,11 @@ classifiers = [
11
11
  "Intended Audience :: Developers",
12
12
  "Operating System :: OS Independent",
13
13
  "Programming Language :: Python",
14
- "Programming Language :: Python :: 3.9",
15
14
  "Programming Language :: Python :: 3.10",
16
15
  "Programming Language :: Python :: 3.11",
17
16
  "Programming Language :: Python :: 3.12",
17
+ "Programming Language :: Python :: 3.13",
18
+ "Programming Language :: Python :: 3.14",
18
19
  "Topic :: Software Development :: Libraries :: Python Modules",
19
20
  ]
20
21
 
@@ -22,10 +23,7 @@ dependencies = [
22
23
  "httpx >=0.20.0",
23
24
  "attrs >=21.3.0",
24
25
  "python-dateutil >=2.8.0",
25
- "typer[all] <0.10.0",
26
26
  "tomlkit >=0.12.5",
27
- "importlib-metadata >=1.0; python_version < '3.8'",
28
- "typing-extensions >=4.7.1; python_version <= '3.9'",
29
27
  ]
30
28
 
31
29
  [build-system]
@@ -42,6 +40,10 @@ include = [
42
40
  celery = [
43
41
  "celery>=4.0.0,<6.0.0",
44
42
  ]
43
+ cli = [
44
+ "typer >=0.12",
45
+ "rich >=13.0",
46
+ ]
45
47
 
46
48
  [tool.uv]
47
49
  package = true
@@ -55,8 +57,6 @@ documentation = "https://docs.taskbadger.net/"
55
57
 
56
58
  [dependency-groups]
57
59
  dev = [
58
- "black",
59
- "isort",
60
60
  "pre-commit",
61
61
  "pytest",
62
62
  "pytest-httpx",
@@ -64,6 +64,7 @@ dev = [
64
64
  "pytest-celery",
65
65
  "redis",
66
66
  "openapi-python-client",
67
+ "taskbadger[cli]",
67
68
  ]
68
69
 
69
70
  [project.scripts]
@@ -82,7 +83,7 @@ exclude = [
82
83
  ]
83
84
  line-length = 120
84
85
  indent-width = 4
85
- target-version = "py39"
86
+ target-version = "py310"
86
87
 
87
88
  [tool.ruff.lint]
88
89
  select = ["E", "F", "I", "UP", "DJ", "PT"]
@@ -97,4 +98,5 @@ skip-magic-trailing-comma = false
97
98
  line-ending = "auto"
98
99
 
99
100
  [tool.ruff.lint.per-file-ignores]
100
- "taskbadger/internal/*" = ["E501"]
101
+ # taskbadger/internal/ is generated by openapi-python-client; lint is best-effort
102
+ "taskbadger/internal/*" = ["E501", "UP", "F"]
@@ -23,15 +23,11 @@ __all__ = [
23
23
  "update_task",
24
24
  ]
25
25
 
26
- try:
27
- import importlib.metadata as importlib_metadata
28
- except ModuleNotFoundError:
29
- import importlib_metadata
30
-
26
+ from importlib.metadata import PackageNotFoundError, version
31
27
 
32
28
  try:
33
- __version__ = importlib_metadata.version(__name__)
34
- except importlib_metadata.PackageNotFoundError:
29
+ __version__ = version(__name__)
30
+ except PackageNotFoundError:
35
31
  __version__ = "dev"
36
32
 
37
33
 
@@ -131,7 +131,8 @@ class Task(celery.Task):
131
131
 
132
132
  result = super().apply_async(*args, **kwargs)
133
133
 
134
- tb_task_id = result.info.get(TB_TASK_ID) if result.info else None
134
+ info = result.info
135
+ tb_task_id = info.get(TB_TASK_ID) if isinstance(info, dict) else None
135
136
  setattr(result, TB_TASK_ID, tb_task_id)
136
137
 
137
138
  _get_task = functools.partial(get_task, tb_task_id) if tb_task_id else lambda: None
@@ -262,7 +263,7 @@ def _maybe_create_task(signal_sender):
262
263
  inner_task = celery.current_app.tasks.get(task_name)
263
264
  items = signal_sender.request.kwargs.get("it", [])
264
265
  # Convert to list if needed for counting and potential recording
265
- items_list = list(items) if not isinstance(items, (list, tuple)) else items
266
+ items_list = list(items) if not isinstance(items, list | tuple) else items
266
267
  item_count = len(items_list)
267
268
  # Append canvas type and item count to task name
268
269
  task_name = f"{task_name} ({canvas_type} {item_count})"
@@ -28,9 +28,9 @@ def get_actions(action_def: tuple[str, str, str]) -> list[Action]:
28
28
  return []
29
29
 
30
30
 
31
- def merge_kv_json(metadata_kv: list[str], metadata_json: str) -> dict:
31
+ def merge_kv_json(metadata_kv: list[str] | None, metadata_json: str) -> dict:
32
32
  metadata = {}
33
- for kv in metadata_kv:
33
+ for kv in metadata_kv or []:
34
34
  k, v = kv.strip().split("=", 1)
35
35
  metadata[k] = v
36
36
 
@@ -0,0 +1,107 @@
1
+ import sys
2
+ from typing import Optional
3
+
4
+ try:
5
+ import typer
6
+ from rich import print
7
+ except ImportError as exc:
8
+ _missing = exc.name or "typer"
9
+
10
+ def app() -> None:
11
+ sys.stderr.write(
12
+ f"The Task Badger CLI requires the '{_missing}' package, which is not installed.\n"
13
+ "Install the CLI extras with:\n\n"
14
+ " pip install 'taskbadger[cli]'\n"
15
+ )
16
+ sys.exit(1)
17
+ else:
18
+ from taskbadger import __version__
19
+ from taskbadger.cli import create, get, list_tasks_command, run, update
20
+ from taskbadger.config import get_config, write_config
21
+ from taskbadger.sdk import _parse_token
22
+
23
+ app = typer.Typer(
24
+ rich_markup_mode="rich",
25
+ context_settings={"help_option_names": ["-h", "--help"]},
26
+ )
27
+
28
+ app.command(context_settings={"allow_extra_args": True, "ignore_unknown_options": False})(run)
29
+ app.command(context_settings={"ignore_unknown_options": False})(get)
30
+ app.command(context_settings={"ignore_unknown_options": False})(create)
31
+ app.command(context_settings={"ignore_unknown_options": False})(update)
32
+ app.command("list", context_settings={"ignore_unknown_options": False})(list_tasks_command)
33
+
34
+ def version_callback(value: bool):
35
+ if value:
36
+ print(f"Task Badger CLI Version: {__version__}")
37
+ raise typer.Exit()
38
+
39
+ @app.command()
40
+ def configure(ctx: typer.Context):
41
+ """Update CLI configuration."""
42
+ config = ctx.meta["tb_config"]
43
+ token = typer.prompt("API Key", default=config.token)
44
+ parsed = _parse_token(token)
45
+ if parsed:
46
+ org_slug, project_slug, api_key = parsed
47
+ print(
48
+ f"Project key detected — organization: [green]{org_slug}[/green], "
49
+ f"project: [green]{project_slug}[/green]"
50
+ )
51
+ config.organization_slug = org_slug
52
+ config.project_slug = project_slug
53
+ config.token = token
54
+ else:
55
+ config.organization_slug = typer.prompt("Organization slug", default=config.organization_slug)
56
+ config.project_slug = typer.prompt("Project slug", default=config.project_slug)
57
+ config.token = token
58
+ path = write_config(config)
59
+ print(f"Config written to [green]{path}[/green]")
60
+
61
+ @app.command()
62
+ def docs():
63
+ """Open Task Badger docs in a browser."""
64
+ typer.launch("https://docs.taskbadger.net")
65
+
66
+ @app.command()
67
+ def info(ctx: typer.Context):
68
+ """Show CLI configuration."""
69
+ config = ctx.meta["tb_config"]
70
+ print(str(config))
71
+
72
+ @app.callback()
73
+ def main(
74
+ ctx: typer.Context,
75
+ org: str | None = typer.Option(
76
+ None,
77
+ "--org",
78
+ "-o",
79
+ metavar="TASKBADGER_ORG",
80
+ show_default=False,
81
+ help="Organization Slug. This will override values from the config file and environment variables.",
82
+ ),
83
+ project: str | None = typer.Option(
84
+ None,
85
+ "--project",
86
+ "-p",
87
+ show_envvar=False,
88
+ metavar="TASKBADGER_PROJECT",
89
+ show_default=False,
90
+ help="Project Slug. This will override values from the config file and environment variables.",
91
+ ),
92
+ version: Optional[bool] = typer.Option( # noqa
93
+ None,
94
+ "--version",
95
+ callback=version_callback,
96
+ is_eager=True,
97
+ help="Show CLI Version",
98
+ ),
99
+ ):
100
+ """
101
+ Task Badger CLI
102
+ """
103
+ config = get_config(org=org, project=project)
104
+ ctx.meta["tb_config"] = config
105
+
106
+ if __name__ == "__main__":
107
+ app()
@@ -7,7 +7,7 @@ import tomlkit
7
7
  import typer
8
8
  from tomlkit import document, table
9
9
 
10
- from taskbadger.sdk import _TB_HOST, _init
10
+ from taskbadger.sdk import _TB_HOST, _init, _parse_token
11
11
 
12
12
  APP_NAME = "taskbadger"
13
13
 
@@ -47,10 +47,20 @@ class Config:
47
47
  """
48
48
  defaults = config_dict.get("defaults", {})
49
49
  auth = config_dict.get("auth", {})
50
+ token = overrides.get("token") or _from_env("API_KEY", auth.get("token"))
51
+ organization_slug = overrides.get("org") or _from_env("ORG", defaults.get("org"))
52
+ project_slug = overrides.get("project") or _from_env("PROJECT", defaults.get("project"))
53
+
54
+ if token:
55
+ parsed = _parse_token(token)
56
+ if parsed:
57
+ organization_slug = parsed[0]
58
+ project_slug = parsed[1]
59
+
50
60
  return Config(
51
- token=overrides.get("token") or _from_env("API_KEY", auth.get("token")),
52
- organization_slug=overrides.get("org") or _from_env("ORG", defaults.get("org")),
53
- project_slug=overrides.get("project") or _from_env("PROJECT", defaults.get("project")),
61
+ token=token,
62
+ organization_slug=organization_slug,
63
+ project_slug=project_slug,
54
64
  host=overrides.get("host") or auth.get("host"),
55
65
  tags=config_dict.get("tags", {}),
56
66
  )
@@ -0,0 +1 @@
1
+ """Contains endpoint functions for accessing the API"""
@@ -26,6 +26,7 @@ def _get_kwargs(
26
26
  def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
27
27
  if response.status_code == 204:
28
28
  return None
29
+
29
30
  if client.raise_on_unexpected_status:
30
31
  raise errors.UnexpectedStatus(response.status_code, response.content)
31
32
  else:
@@ -24,9 +24,8 @@ def _get_kwargs(
24
24
  "url": f"/api/{organization_slug}/{project_slug}/tasks/{task_id}/actions/",
25
25
  }
26
26
 
27
- _body = body.to_dict()
27
+ _kwargs["json"] = body.to_dict()
28
28
 
29
- _kwargs["json"] = _body
30
29
  headers["Content-Type"] = "application/json"
31
30
 
32
31
  _kwargs["headers"] = headers
@@ -38,6 +37,7 @@ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: htt
38
37
  response_201 = Action.from_dict(response.json())
39
38
 
40
39
  return response_201
40
+
41
41
  if client.raise_on_unexpected_status:
42
42
  raise errors.UnexpectedStatus(response.status_code, response.content)
43
43
  else:
@@ -29,6 +29,7 @@ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: htt
29
29
  response_200 = Action.from_dict(response.json())
30
30
 
31
31
  return response_200
32
+
32
33
  if client.raise_on_unexpected_status:
33
34
  raise errors.UnexpectedStatus(response.status_code, response.content)
34
35
  else:
@@ -34,6 +34,7 @@ def _parse_response(
34
34
  response_200.append(response_200_item)
35
35
 
36
36
  return response_200
37
+
37
38
  if client.raise_on_unexpected_status:
38
39
  raise errors.UnexpectedStatus(response.status_code, response.content)
39
40
  else:
@@ -26,9 +26,8 @@ def _get_kwargs(
26
26
  "url": f"/api/{organization_slug}/{project_slug}/tasks/{task_id}/actions/{id}/",
27
27
  }
28
28
 
29
- _body = body.to_dict()
29
+ _kwargs["json"] = body.to_dict()
30
30
 
31
- _kwargs["json"] = _body
32
31
  headers["Content-Type"] = "application/json"
33
32
 
34
33
  _kwargs["headers"] = headers
@@ -40,6 +39,7 @@ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: htt
40
39
  response_200 = Action.from_dict(response.json())
41
40
 
42
41
  return response_200
42
+
43
43
  if client.raise_on_unexpected_status:
44
44
  raise errors.UnexpectedStatus(response.status_code, response.content)
45
45
  else:
@@ -26,9 +26,8 @@ def _get_kwargs(
26
26
  "url": f"/api/{organization_slug}/{project_slug}/tasks/{task_id}/actions/{id}/",
27
27
  }
28
28
 
29
- _body = body.to_dict()
29
+ _kwargs["json"] = body.to_dict()
30
30
 
31
- _kwargs["json"] = _body
32
31
  headers["Content-Type"] = "application/json"
33
32
 
34
33
  _kwargs["headers"] = headers
@@ -40,6 +39,7 @@ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: htt
40
39
  response_200 = Action.from_dict(response.json())
41
40
 
42
41
  return response_200
42
+
43
43
  if client.raise_on_unexpected_status:
44
44
  raise errors.UnexpectedStatus(response.status_code, response.content)
45
45
  else:
@@ -0,0 +1 @@
1
+ """Contains endpoint functions for accessing the API"""
@@ -25,6 +25,7 @@ def _get_kwargs(
25
25
  def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
26
26
  if response.status_code == 204:
27
27
  return None
28
+
28
29
  if client.raise_on_unexpected_status:
29
30
  raise errors.UnexpectedStatus(response.status_code, response.content)
30
31
  else:
@@ -27,9 +27,8 @@ def _get_kwargs(
27
27
  "url": f"/api/{organization_slug}/{project_slug}/tasks/",
28
28
  }
29
29
 
30
- _body = body.to_dict()
30
+ _kwargs["json"] = body.to_dict()
31
31
 
32
- _kwargs["json"] = _body
33
32
  headers["Content-Type"] = "application/json"
34
33
 
35
34
  _kwargs["headers"] = headers
@@ -41,6 +40,7 @@ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: htt
41
40
  response_201 = Task.from_dict(response.json())
42
41
 
43
42
  return response_201
43
+
44
44
  if client.raise_on_unexpected_status:
45
45
  raise errors.UnexpectedStatus(response.status_code, response.content)
46
46
  else:
@@ -28,6 +28,7 @@ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: htt
28
28
  response_200 = Task.from_dict(response.json())
29
29
 
30
30
  return response_200
31
+
31
32
  if client.raise_on_unexpected_status:
32
33
  raise errors.UnexpectedStatus(response.status_code, response.content)
33
34
  else:
@@ -40,6 +40,7 @@ def _parse_response(
40
40
  response_200 = PaginatedTaskList.from_dict(response.json())
41
41
 
42
42
  return response_200
43
+
43
44
  if client.raise_on_unexpected_status:
44
45
  raise errors.UnexpectedStatus(response.status_code, response.content)
45
46
  else:
@@ -25,9 +25,8 @@ def _get_kwargs(
25
25
  "url": f"/api/{organization_slug}/{project_slug}/tasks/{id}/",
26
26
  }
27
27
 
28
- _body = body.to_dict()
28
+ _kwargs["json"] = body.to_dict()
29
29
 
30
- _kwargs["json"] = _body
31
30
  headers["Content-Type"] = "application/json"
32
31
 
33
32
  _kwargs["headers"] = headers
@@ -39,6 +38,7 @@ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: htt
39
38
  response_200 = Task.from_dict(response.json())
40
39
 
41
40
  return response_200
41
+
42
42
  if client.raise_on_unexpected_status:
43
43
  raise errors.UnexpectedStatus(response.status_code, response.content)
44
44
  else:
@@ -25,9 +25,8 @@ def _get_kwargs(
25
25
  "url": f"/api/{organization_slug}/{project_slug}/tasks/{id}/",
26
26
  }
27
27
 
28
- _body = body.to_dict()
28
+ _kwargs["json"] = body.to_dict()
29
29
 
30
- _kwargs["json"] = _body
31
30
  headers["Content-Type"] = "application/json"
32
31
 
33
32
  _kwargs["headers"] = headers
@@ -39,6 +38,7 @@ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: htt
39
38
  response_200 = Task.from_dict(response.json())
40
39
 
41
40
  return response_200
41
+
42
42
  if client.raise_on_unexpected_status:
43
43
  raise errors.UnexpectedStatus(response.status_code, response.content)
44
44
  else:
@@ -1,4 +1,5 @@
1
1
  import datetime
2
+ from collections.abc import Mapping
2
3
  from typing import Any, TypeVar, Union
3
4
 
4
5
  from attrs import define as _attrs_define
@@ -70,8 +71,8 @@ class Action:
70
71
  return field_dict
71
72
 
72
73
  @classmethod
73
- def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
74
- d = src_dict.copy()
74
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
75
+ d = dict(src_dict)
75
76
  id = d.pop("id")
76
77
 
77
78
  task = d.pop("task")
@@ -1,3 +1,4 @@
1
+ from collections.abc import Mapping
1
2
  from typing import Any, TypeVar, Union
2
3
 
3
4
  from attrs import define as _attrs_define
@@ -43,8 +44,8 @@ class ActionRequest:
43
44
  return field_dict
44
45
 
45
46
  @classmethod
46
- def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
47
- d = src_dict.copy()
47
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
48
+ d = dict(src_dict)
48
49
  trigger = d.pop("trigger")
49
50
 
50
51
  integration = d.pop("integration")
@@ -1,3 +1,4 @@
1
+ from collections.abc import Mapping
1
2
  from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
2
3
 
3
4
  from attrs import define as _attrs_define
@@ -59,10 +60,10 @@ class PaginatedTaskList:
59
60
  return field_dict
60
61
 
61
62
  @classmethod
62
- def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
63
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
63
64
  from ..models.task import Task
64
65
 
65
- d = src_dict.copy()
66
+ d = dict(src_dict)
66
67
  results = []
67
68
  _results = d.pop("results")
68
69
  for results_item_data in _results:
@@ -1,3 +1,4 @@
1
+ from collections.abc import Mapping
1
2
  from typing import Any, TypeVar, Union
2
3
 
3
4
  from attrs import define as _attrs_define
@@ -42,8 +43,8 @@ class PatchedActionRequest:
42
43
  return field_dict
43
44
 
44
45
  @classmethod
45
- def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
46
- d = src_dict.copy()
46
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
47
+ d = dict(src_dict)
47
48
  trigger = d.pop("trigger", UNSET)
48
49
 
49
50
  integration = d.pop("integration", UNSET)