├── .env.example
├── .gitattributes
├── .gitignore
├── LICENSE
├── README.md
├── admin
├── README.md
├── make-api.sh
├── make-deploy.sh
└── make-lambda-layer.sh
├── dart
├── __init__.py
├── dart.py
├── exception.py
├── generated
│ ├── __init__.py
│ ├── api
│ │ ├── __init__.py
│ │ ├── comment
│ │ │ ├── __init__.py
│ │ │ └── create_comment.py
│ │ ├── config
│ │ │ ├── __init__.py
│ │ │ └── get_config.py
│ │ ├── dartboard
│ │ │ ├── __init__.py
│ │ │ └── retrieve_dartboard.py
│ │ ├── doc
│ │ │ ├── __init__.py
│ │ │ ├── create_doc.py
│ │ │ ├── delete_doc.py
│ │ │ ├── list_docs.py
│ │ │ ├── retrieve_doc.py
│ │ │ └── update_doc.py
│ │ ├── folder
│ │ │ ├── __init__.py
│ │ │ └── retrieve_folder.py
│ │ ├── task
│ │ │ ├── __init__.py
│ │ │ ├── create_task.py
│ │ │ ├── delete_task.py
│ │ │ ├── list_tasks.py
│ │ │ ├── retrieve_task.py
│ │ │ └── update_task.py
│ │ └── view
│ │ │ ├── __init__.py
│ │ │ └── retrieve_view.py
│ ├── client.py
│ ├── errors.py
│ ├── models
│ │ ├── __init__.py
│ │ ├── comment.py
│ │ ├── comment_create.py
│ │ ├── concise_doc.py
│ │ ├── concise_task.py
│ │ ├── dartboard.py
│ │ ├── doc.py
│ │ ├── doc_create.py
│ │ ├── doc_update.py
│ │ ├── folder.py
│ │ ├── list_docs_o_item.py
│ │ ├── paginated_concise_doc_list.py
│ │ ├── paginated_concise_task_list.py
│ │ ├── priority.py
│ │ ├── task.py
│ │ ├── task_create.py
│ │ ├── task_update.py
│ │ ├── user.py
│ │ ├── user_space_configuration.py
│ │ ├── view.py
│ │ ├── wrapped_comment.py
│ │ ├── wrapped_comment_create.py
│ │ ├── wrapped_dartboard.py
│ │ ├── wrapped_doc.py
│ │ ├── wrapped_doc_create.py
│ │ ├── wrapped_doc_update.py
│ │ ├── wrapped_folder.py
│ │ ├── wrapped_task.py
│ │ ├── wrapped_task_create.py
│ │ ├── wrapped_task_update.py
│ │ └── wrapped_view.py
│ ├── py.typed
│ └── types.py
├── old.py
├── order_manager.py
└── webhook.py
├── examples
├── replicate_space.py
├── replicate_space_and_more.js
├── upload_attachment.py
├── watch_for_status_change.py
└── webhook_server.py
├── makefile
├── pyproject.toml
└── uv.lock
/.env.example:
--------------------------------------------------------------------------------
1 | DART_TOKEN='' # your authentication token from https://app.itsdart.com/?settings=account
2 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | **/generated/** linguist-generated=true
2 | **/uv.lock linguist-generated=true
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | build/
12 | develop-eggs/
13 | dist/
14 | downloads/
15 | eggs/
16 | .eggs/
17 | lib/
18 | lib64/
19 | parts/
20 | sdist/
21 | var/
22 | wheels/
23 | pip-wheel-metadata/
24 | share/python-wheels/
25 | *.egg-info/
26 | .installed.cfg
27 | *.egg
28 | MANIFEST
29 |
30 | # PyInstaller
31 | # Usually these files are written by a python script from a template
32 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
33 | *.manifest
34 | *.spec
35 |
36 | # Installer logs
37 | pip-log.txt
38 | pip-delete-this-directory.txt
39 |
40 | # Unit test / coverage reports
41 | htmlcov/
42 | .tox/
43 | .nox/
44 | .coverage
45 | .coverage.*
46 | .cache
47 | nosetests.xml
48 | coverage.xml
49 | *.cover
50 | *.py,cover
51 | .hypothesis/
52 | .pytest_cache/
53 |
54 | # Translations
55 | *.mo
56 | *.pot
57 |
58 | # Django stuff:
59 | *.log
60 | local_settings.py
61 | db.sqlite3
62 | db.sqlite3-journal
63 |
64 | # Flask stuff:
65 | instance/
66 | .webassets-cache
67 |
68 | # Scrapy stuff:
69 | .scrapy
70 |
71 | # Sphinx documentation
72 | docs/_build/
73 |
74 | # PyBuilder
75 | target/
76 |
77 | # Jupyter Notebook
78 | .ipynb_checkpoints
79 |
80 | # IPython
81 | profile_default/
82 | ipython_config.py
83 |
84 | # pyenv
85 | .python-version
86 |
87 | # pipenv
88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies
90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not
91 | # install all needed dependencies.
92 | #Pipfile.lock
93 |
94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95 | __pypackages__/
96 |
97 | # Celery stuff
98 | celerybeat-schedule
99 | celerybeat.pid
100 |
101 | # SageMath parsed files
102 | *.sage.py
103 |
104 | # Environments
105 | .env
106 | .venv
107 | env/
108 | venv/
109 | ENV/
110 | env.bak/
111 | venv.bak/
112 |
113 | # Spyder project settings
114 | .spyderproject
115 | .spyproject
116 |
117 | # Rope project settings
118 | .ropeproject
119 |
120 | # mkdocs documentation
121 | /site
122 |
123 | # mypy
124 | .mypy_cache/
125 | .dmypy.json
126 | dmypy.json
127 |
128 | # Pyre type checker
129 | .pyre/
130 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2025 Dart
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
Dart Tools
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | [Dart](https://itsdart.com?nr=1) is Project Management powered by AI.
11 |
12 | `dart-tools` is the Dart CLI and Python Library. It enables direct integration with Dart through a terminal CLI or through Python.
13 |
14 | - [Installation](#installation)
15 | - [Naming conflicts](#naming-conflicts)
16 | - [Using the CLI](#using-the-cli)
17 | - [Using the Python Library](#using-the-python-library)
18 | - [Using the Python Library in AWS Lambda Functions](#using-the-python-library-in-aws-lambda-functions)
19 | - [Navigate to the directory containing your `lambda_function.py` source file. In this example, the directory is named `my_function`.](#navigate-to-the-directory-containing-your-lambda_functionpy-source-file-in-this-example-the-directory-is-named-my_function)
20 | - [Create a Deployment Package](#create-a-deployment-package)
21 | - [Zip the contents of the `package` directory along with your `lambda_function.py`](#zip-the-contents-of-the-package-directory-along-with-your-lambda_functionpy)
22 | - [Deploy the Lambda function](#deploy-the-lambda-function)
23 | - [Help and Resources](#help-and-resources)
24 | - [Contributing](#contributing)
25 | - [License](#license)
26 |
27 | ## Installation
28 |
29 | In the terminal, install by running
30 |
31 | ```sh
32 | pip install dart-tools
33 | ```
34 |
35 | ### Naming conflicts
36 |
37 | If you have a preexisting shell command named `dart`, a quick fix is to run `which -a dart` and fine the path for this `dart` application. Then you can create an alias and add it to your shell profile file (`.zshrc`, `.bashrc`, etc.). For example, open `~/.zshrc` and add a line like `alias dartai="/path/to/dart"`, save it, and restart your terminal.
38 |
39 | ## Using the CLI
40 |
41 | Start off by setting up authentication with
42 |
43 | ```sh
44 | dart login
45 | ```
46 |
47 | Then, you can create a new task with a command along the lines of
48 |
49 | ```sh
50 | dart task-create "Update the landing page" -p0 --tag marketing
51 | ```
52 |
53 | which will make a new task called 'Update the landing page' with priority 'Critical' (i.e. P0) and with the 'marketing' tag.
54 |
55 | You can explore all of these options and many more with `dart --help` or the more specific help for subcommands, in this case `dart task-create --help`.
56 |
57 | Another common workflow is to updating a preexisting task. To do this, run something like
58 |
59 | ```sh
60 | dart task-update [ID] -s Done
61 | ```
62 |
63 | This command will mark the referenced task 'Done'. Here `[ID]` is meant to be replaced (including the brackets) with the ID of an existing task. You can get a ID from any existing task in a number of ways, such as by copying it from the end of a task's URL or by clicking the '...' button in a task page in Dart and then choosing 'Copy ID'.
64 |
65 | ## Using the Python Library
66 |
67 | First, set up authentication. Run `dart login` in the terminal for an interactive process. Alternatively, copy your authentication token from [your Dart profile](https://app.itsdart.com/?settings=account) and save that as the `DART_TOKEN` environment variable.
68 |
69 | Then, you can run something like
70 |
71 | ```python
72 | import os
73 | from dart import create_task, is_logged_in, update_task
74 |
75 | # Check that auth is set up and stop if not, can remove this once everything is set up
76 | is_logged_in(should_raise=True)
77 |
78 | # Create a new task called 'Update the landing page' with priority 'Critical' (i.e. p0) and with the 'marketing' tag
79 | new_task = create_task(
80 | "Update the landing page", priority_int=0, tag_titles=["marketing"]
81 | )
82 |
83 | # Update the task to be 'Done'
84 | update_task(new_task.id, status_title="Done")
85 | ```
86 |
87 | ## Using the Python Library in AWS Lambda Functions
88 |
89 | To use the `dart-tools` Python library in an AWS Lambda function, you need to package the library with your Lambda deployment package (see more details at [Working with .zip file archives for Python Lambda functions](https://docs.aws.amazon.com/lambda/latest/dg/python-package.html)). Follow these steps:
90 |
91 | ### Navigate to the directory containing your `lambda_function.py` source file. In this example, the directory is named `my_function`.
92 |
93 | ```sh
94 | cd my_function
95 | ```
96 |
97 | ### Create a Deployment Package
98 |
99 | Use Docker to create a deployment package that includes the `dart-tools` library. Run the following commands in your terminal, ensuring that the `RUNTIME_PYTHON_VERSION` and `RUNTIME_ARCHITECTURE` environment variables match the runtime settings of your Lambda function:
100 |
101 | ```sh
102 | export RUNTIME_PYTHON_VERSION=3.12
103 | export RUNTIME_ARCHITECTURE=x86_64
104 | docker run --rm --volume ${PWD}:/app --entrypoint /bin/bash public.ecr.aws/lambda/python:${RUNTIME_PYTHON_VERSION}-${RUNTIME_ARCHITECTURE} -c "pip install --target /app/package dart-tools"
105 | ```
106 |
107 | This command installs the `dart-tools` library into a directory named `package` in your current working directory.
108 |
109 | ### Zip the contents of the `package` directory along with your `lambda_function.py`
110 |
111 | ```sh
112 | cd package
113 | zip -r ../my_deployment_package.zip .
114 | cd ..
115 | zip -r my_deployment_package.zip lambda_function.py
116 | ```
117 |
118 | ### Deploy the Lambda function
119 |
120 | Upload the `my_deployment_package.zip` file to AWS Lambda using the AWS Management Console or the AWS CLI.
121 |
122 | By following these steps, you can use the `dart-tools` Python library within your AWS Lambda functions.
123 |
124 | ## Help and Resources
125 |
126 | - [Homepage](https://itsdart.com/?nr=1)
127 | - [Web App](https://app.itsdart.com/)
128 | - [Help Center](https://help.itsdart.com/)
129 | - [Bugs and Features](https://app.itsdart.com/p/r/JFyPnhL9En61)
130 | - [Library Source](https://github.com/its-dart/dart-tools-py/)
131 | - [Chat on Discord](https://discord.gg/RExv8jEkSh)
132 | - Email us at [support@itsdart.com](mailto:support@itsdart.com)
133 |
134 |
135 | ## Contributing
136 |
137 | Contributions are welcome! Please open an issue or submit a pull request.
138 |
139 |
140 | ## License
141 |
142 | This project is licensed under [the MIT License](LICENSE).
143 |
--------------------------------------------------------------------------------
/admin/README.md:
--------------------------------------------------------------------------------
1 | # Admin functionality
2 |
3 | - [Admin functionality](#admin-functionality)
4 | - [Install local version](#install-local-version)
5 | - [Test with a different Python version](#test-with-a-different-python-version)
6 | - [Sync API](#sync-api)
7 | - [Deploy setup](#deploy-setup)
8 | - [Deploy](#deploy)
9 | - [Dependency updating](#dependency-updating)
10 |
11 | ## Install local version
12 |
13 | 1. Run `uv sync` as needed
14 | 2. Install with `uv pip install .`
15 |
16 | ## Test with a different Python version
17 |
18 | 1. Choose the version with `uv venv --python 3.x`
19 | 2. Run `uv sync`
20 |
21 | ## Sync API
22 |
23 | 1. Run `uv sync` as needed
24 | 2. Run `make api`
25 |
26 | ## Deploy setup
27 |
28 | 1. Run `uv sync` as needed
29 | 2. Get an existing PyPI token or [make a new one](https://pypi.org/manage/account/token/)
30 | 3. Set the `UV_PUBLISH_TOKEN` environment variable, for example, by running `export UV_PUBLISH_TOKEN=`
31 |
32 | ## Deploy
33 |
34 | 1. Bump the version in `pyproject.toml`
35 | 2. Run `uv sync`
36 | 3. Run `make deploy`
37 | 4. Commit and push all local changes to GitHub
38 |
39 | ## Dependency updating
40 |
41 | 1. Manually bump versions in `pyproject.toml`
42 | 1. Bump the dependencies in `dependencies` to be `>=` the lowest functional minor version
43 | 2. Bump the dependencies in `[dependency-groups]` to be `==` the latest patch version
44 | 2. Run `make req-up-all`
45 |
--------------------------------------------------------------------------------
/admin/make-api.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # -*- coding: utf-8 -*-
3 |
4 | set -e
5 |
6 | rm -rf dart/generated
7 | uv run openapi-python-client generate --url https://app.itsdart.com/api/v0/public/schema/ --overwrite
8 | mv dart-public-api-client/dart_public_api_client dart/generated
9 | rm -rf dart-public-api-client
10 |
11 | # Optimize API import paths
12 | api_dir="dart/generated/api"
13 | init_file="$api_dir/__init__.py"
14 |
15 | find "$api_dir" -type f -name "*.py" ! -name "__init__.py" | while read -r file; do
16 | service=$(basename "$(dirname "$file")")
17 | method=$(basename "$file" .py)
18 | echo "from .$service import $method" >> "$init_file"
19 | done
20 |
--------------------------------------------------------------------------------
/admin/make-deploy.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # -*- coding: utf-8 -*-
3 |
4 | set -e
5 |
6 | rm -rf dist
7 | uv build
8 | uv publish
9 |
--------------------------------------------------------------------------------
/admin/make-lambda-layer.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # -*- coding: utf-8 -*-
3 |
4 | set -e
5 |
6 | rm -rf layer.zip || true
7 |
8 | cat << 'EOF' > Dockerfile
9 | FROM public.ecr.aws/lambda/python:3.12
10 | RUN dnf install -y gcc zip
11 | WORKDIR /layer
12 | RUN pip install dart-tools -t python/lib/python3.12/site-packages
13 | RUN zip -r layer.zip python/
14 | ENTRYPOINT []
15 | CMD ["sleep", "1"]
16 | EOF
17 |
18 | docker build --no-cache --platform linux/amd64 -t layer-builder .
19 | docker create --name layer layer-builder
20 | docker cp layer:/layer/layer.zip ./layer.zip
21 | docker rm layer
22 |
23 | rm Dockerfile
24 |
--------------------------------------------------------------------------------
/dart/__init__.py:
--------------------------------------------------------------------------------
1 | # Required for type hinting compatibility when using Python 3.9
2 | from __future__ import annotations
3 |
4 | from .dart import (
5 | Dart,
6 | begin_task,
7 | cli,
8 | create_comment,
9 | create_doc,
10 | create_task,
11 | delete_doc,
12 | delete_task,
13 | get_host,
14 | is_logged_in,
15 | login,
16 | set_host,
17 | update_doc,
18 | update_task,
19 | )
20 | from .generated.models import *
21 | from .old import get_dartboards, get_folders, replicate_dartboard, replicate_space, update_dartboard, update_folder
22 | from .webhook import is_signature_correct
23 |
--------------------------------------------------------------------------------
/dart/exception.py:
--------------------------------------------------------------------------------
1 | class DartException(Exception):
2 | pass
3 |
4 |
5 | class OrderException(Exception):
6 | pass
7 |
--------------------------------------------------------------------------------
/dart/generated/__init__.py:
--------------------------------------------------------------------------------
1 | """A client library for accessing Dart Public API"""
2 |
3 | from .client import AuthenticatedClient, Client
4 |
5 | __all__ = (
6 | "AuthenticatedClient",
7 | "Client",
8 | )
9 |
--------------------------------------------------------------------------------
/dart/generated/api/__init__.py:
--------------------------------------------------------------------------------
1 | """Contains methods for accessing the API"""
2 | from .config import get_config
3 | from .comment import create_comment
4 | from .folder import retrieve_folder
5 | from .dartboard import retrieve_dartboard
6 | from .task import create_task
7 | from .task import delete_task
8 | from .task import update_task
9 | from .task import retrieve_task
10 | from .task import list_tasks
11 | from .view import retrieve_view
12 | from .doc import create_doc
13 | from .doc import delete_doc
14 | from .doc import update_doc
15 | from .doc import list_docs
16 | from .doc import retrieve_doc
17 |
--------------------------------------------------------------------------------
/dart/generated/api/comment/__init__.py:
--------------------------------------------------------------------------------
1 | """Contains endpoint functions for accessing the API"""
2 |
--------------------------------------------------------------------------------
/dart/generated/api/comment/create_comment.py:
--------------------------------------------------------------------------------
1 | from http import HTTPStatus
2 | from typing import Any, Optional, Union, cast
3 |
4 | import httpx
5 |
6 | from ... import errors
7 | from ...client import AuthenticatedClient, Client
8 | from ...models.wrapped_comment import WrappedComment
9 | from ...models.wrapped_comment_create import WrappedCommentCreate
10 | from ...types import Response
11 |
12 |
13 | def _get_kwargs(
14 | *,
15 | body: WrappedCommentCreate,
16 | ) -> dict[str, Any]:
17 | headers: dict[str, Any] = {}
18 |
19 | _kwargs: dict[str, Any] = {
20 | "method": "post",
21 | "url": "/comments",
22 | }
23 |
24 | _body = body.to_dict()
25 |
26 | _kwargs["json"] = _body
27 | headers["Content-Type"] = "application/json"
28 |
29 | _kwargs["headers"] = headers
30 | return _kwargs
31 |
32 |
33 | def _parse_response(
34 | *, client: Union[AuthenticatedClient, Client], response: httpx.Response
35 | ) -> Optional[Union[Any, WrappedComment]]:
36 | if response.status_code == 200:
37 | response_200 = WrappedComment.from_dict(response.json())
38 |
39 | return response_200
40 | if response.status_code == 400:
41 | response_400 = cast(Any, None)
42 | return response_400
43 | if client.raise_on_unexpected_status:
44 | raise errors.UnexpectedStatus(response.status_code, response.content)
45 | else:
46 | return None
47 |
48 |
49 | def _build_response(
50 | *, client: Union[AuthenticatedClient, Client], response: httpx.Response
51 | ) -> Response[Union[Any, WrappedComment]]:
52 | return Response(
53 | status_code=HTTPStatus(response.status_code),
54 | content=response.content,
55 | headers=response.headers,
56 | parsed=_parse_response(client=client, response=response),
57 | )
58 |
59 |
60 | def sync_detailed(
61 | *,
62 | client: Union[AuthenticatedClient, Client],
63 | body: WrappedCommentCreate,
64 | ) -> Response[Union[Any, WrappedComment]]:
65 | """Create a new comment
66 |
67 | Record a new comment that the user intends to add to a given task. This will save the comment in
68 | Dart for later access, search, etc.
69 |
70 | Args:
71 | body (WrappedCommentCreate):
72 |
73 | Raises:
74 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
75 | httpx.TimeoutException: If the request takes longer than Client.timeout.
76 |
77 | Returns:
78 | Response[Union[Any, WrappedComment]]
79 | """
80 |
81 | kwargs = _get_kwargs(
82 | body=body,
83 | )
84 |
85 | response = client.get_httpx_client().request(
86 | **kwargs,
87 | )
88 |
89 | return _build_response(client=client, response=response)
90 |
91 |
92 | def sync(
93 | *,
94 | client: Union[AuthenticatedClient, Client],
95 | body: WrappedCommentCreate,
96 | ) -> Optional[Union[Any, WrappedComment]]:
97 | """Create a new comment
98 |
99 | Record a new comment that the user intends to add to a given task. This will save the comment in
100 | Dart for later access, search, etc.
101 |
102 | Args:
103 | body (WrappedCommentCreate):
104 |
105 | Raises:
106 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
107 | httpx.TimeoutException: If the request takes longer than Client.timeout.
108 |
109 | Returns:
110 | Union[Any, WrappedComment]
111 | """
112 |
113 | return sync_detailed(
114 | client=client,
115 | body=body,
116 | ).parsed
117 |
118 |
119 | async def asyncio_detailed(
120 | *,
121 | client: Union[AuthenticatedClient, Client],
122 | body: WrappedCommentCreate,
123 | ) -> Response[Union[Any, WrappedComment]]:
124 | """Create a new comment
125 |
126 | Record a new comment that the user intends to add to a given task. This will save the comment in
127 | Dart for later access, search, etc.
128 |
129 | Args:
130 | body (WrappedCommentCreate):
131 |
132 | Raises:
133 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
134 | httpx.TimeoutException: If the request takes longer than Client.timeout.
135 |
136 | Returns:
137 | Response[Union[Any, WrappedComment]]
138 | """
139 |
140 | kwargs = _get_kwargs(
141 | body=body,
142 | )
143 |
144 | response = await client.get_async_httpx_client().request(**kwargs)
145 |
146 | return _build_response(client=client, response=response)
147 |
148 |
149 | async def asyncio(
150 | *,
151 | client: Union[AuthenticatedClient, Client],
152 | body: WrappedCommentCreate,
153 | ) -> Optional[Union[Any, WrappedComment]]:
154 | """Create a new comment
155 |
156 | Record a new comment that the user intends to add to a given task. This will save the comment in
157 | Dart for later access, search, etc.
158 |
159 | Args:
160 | body (WrappedCommentCreate):
161 |
162 | Raises:
163 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
164 | httpx.TimeoutException: If the request takes longer than Client.timeout.
165 |
166 | Returns:
167 | Union[Any, WrappedComment]
168 | """
169 |
170 | return (
171 | await asyncio_detailed(
172 | client=client,
173 | body=body,
174 | )
175 | ).parsed
176 |
--------------------------------------------------------------------------------
/dart/generated/api/config/__init__.py:
--------------------------------------------------------------------------------
1 | """Contains endpoint functions for accessing the API"""
2 |
--------------------------------------------------------------------------------
/dart/generated/api/config/get_config.py:
--------------------------------------------------------------------------------
1 | from http import HTTPStatus
2 | from typing import Any, Optional, Union
3 |
4 | import httpx
5 |
6 | from ... import errors
7 | from ...client import AuthenticatedClient, Client
8 | from ...models.user_space_configuration import UserSpaceConfiguration
9 | from ...types import Response
10 |
11 |
12 | def _get_kwargs() -> dict[str, Any]:
13 | _kwargs: dict[str, Any] = {
14 | "method": "get",
15 | "url": "/config",
16 | }
17 |
18 | return _kwargs
19 |
20 |
21 | def _parse_response(
22 | *, client: Union[AuthenticatedClient, Client], response: httpx.Response
23 | ) -> Optional[UserSpaceConfiguration]:
24 | if response.status_code == 200:
25 | response_200 = UserSpaceConfiguration.from_dict(response.json())
26 |
27 | return response_200
28 | if client.raise_on_unexpected_status:
29 | raise errors.UnexpectedStatus(response.status_code, response.content)
30 | else:
31 | return None
32 |
33 |
34 | def _build_response(
35 | *, client: Union[AuthenticatedClient, Client], response: httpx.Response
36 | ) -> Response[UserSpaceConfiguration]:
37 | return Response(
38 | status_code=HTTPStatus(response.status_code),
39 | content=response.content,
40 | headers=response.headers,
41 | parsed=_parse_response(client=client, response=response),
42 | )
43 |
44 |
45 | def sync_detailed(
46 | *,
47 | client: Union[AuthenticatedClient, Client],
48 | ) -> Response[UserSpaceConfiguration]:
49 | """Get user space configuration
50 |
51 | Get information about the user's space, including all of the possible values that can be provided to
52 | other endpoints.
53 |
54 | Raises:
55 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
56 | httpx.TimeoutException: If the request takes longer than Client.timeout.
57 |
58 | Returns:
59 | Response[UserSpaceConfiguration]
60 | """
61 |
62 | kwargs = _get_kwargs()
63 |
64 | response = client.get_httpx_client().request(
65 | **kwargs,
66 | )
67 |
68 | return _build_response(client=client, response=response)
69 |
70 |
71 | def sync(
72 | *,
73 | client: Union[AuthenticatedClient, Client],
74 | ) -> Optional[UserSpaceConfiguration]:
75 | """Get user space configuration
76 |
77 | Get information about the user's space, including all of the possible values that can be provided to
78 | other endpoints.
79 |
80 | Raises:
81 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
82 | httpx.TimeoutException: If the request takes longer than Client.timeout.
83 |
84 | Returns:
85 | UserSpaceConfiguration
86 | """
87 |
88 | return sync_detailed(
89 | client=client,
90 | ).parsed
91 |
92 |
93 | async def asyncio_detailed(
94 | *,
95 | client: Union[AuthenticatedClient, Client],
96 | ) -> Response[UserSpaceConfiguration]:
97 | """Get user space configuration
98 |
99 | Get information about the user's space, including all of the possible values that can be provided to
100 | other endpoints.
101 |
102 | Raises:
103 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
104 | httpx.TimeoutException: If the request takes longer than Client.timeout.
105 |
106 | Returns:
107 | Response[UserSpaceConfiguration]
108 | """
109 |
110 | kwargs = _get_kwargs()
111 |
112 | response = await client.get_async_httpx_client().request(**kwargs)
113 |
114 | return _build_response(client=client, response=response)
115 |
116 |
117 | async def asyncio(
118 | *,
119 | client: Union[AuthenticatedClient, Client],
120 | ) -> Optional[UserSpaceConfiguration]:
121 | """Get user space configuration
122 |
123 | Get information about the user's space, including all of the possible values that can be provided to
124 | other endpoints.
125 |
126 | Raises:
127 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
128 | httpx.TimeoutException: If the request takes longer than Client.timeout.
129 |
130 | Returns:
131 | UserSpaceConfiguration
132 | """
133 |
134 | return (
135 | await asyncio_detailed(
136 | client=client,
137 | )
138 | ).parsed
139 |
--------------------------------------------------------------------------------
/dart/generated/api/dartboard/__init__.py:
--------------------------------------------------------------------------------
1 | """Contains endpoint functions for accessing the API"""
2 |
--------------------------------------------------------------------------------
/dart/generated/api/dartboard/retrieve_dartboard.py:
--------------------------------------------------------------------------------
1 | from http import HTTPStatus
2 | from typing import Any, Optional, Union, cast
3 |
4 | import httpx
5 |
6 | from ... import errors
7 | from ...client import AuthenticatedClient, Client
8 | from ...models.wrapped_dartboard import WrappedDartboard
9 | from ...types import Response
10 |
11 |
12 | def _get_kwargs(
13 | id: str,
14 | ) -> dict[str, Any]:
15 | _kwargs: dict[str, Any] = {
16 | "method": "get",
17 | "url": f"/dartboards/{id}",
18 | }
19 |
20 | return _kwargs
21 |
22 |
23 | def _parse_response(
24 | *, client: Union[AuthenticatedClient, Client], response: httpx.Response
25 | ) -> Optional[Union[Any, WrappedDartboard]]:
26 | if response.status_code == 200:
27 | response_200 = WrappedDartboard.from_dict(response.json())
28 |
29 | return response_200
30 | if response.status_code == 400:
31 | response_400 = cast(Any, None)
32 | return response_400
33 | if response.status_code == 404:
34 | response_404 = cast(Any, None)
35 | return response_404
36 | if client.raise_on_unexpected_status:
37 | raise errors.UnexpectedStatus(response.status_code, response.content)
38 | else:
39 | return None
40 |
41 |
42 | def _build_response(
43 | *, client: Union[AuthenticatedClient, Client], response: httpx.Response
44 | ) -> Response[Union[Any, WrappedDartboard]]:
45 | return Response(
46 | status_code=HTTPStatus(response.status_code),
47 | content=response.content,
48 | headers=response.headers,
49 | parsed=_parse_response(client=client, response=response),
50 | )
51 |
52 |
53 | def sync_detailed(
54 | id: str,
55 | *,
56 | client: Union[AuthenticatedClient, Client],
57 | ) -> Response[Union[Any, WrappedDartboard]]:
58 | """Retrieve an existing dartboard
59 |
60 | Retrieve an existing dartboard. This will return the dartboard's information, including the title,
61 | description, all tasks within it, and others.
62 |
63 | Args:
64 | id (str):
65 |
66 | Raises:
67 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
68 | httpx.TimeoutException: If the request takes longer than Client.timeout.
69 |
70 | Returns:
71 | Response[Union[Any, WrappedDartboard]]
72 | """
73 |
74 | kwargs = _get_kwargs(
75 | id=id,
76 | )
77 |
78 | response = client.get_httpx_client().request(
79 | **kwargs,
80 | )
81 |
82 | return _build_response(client=client, response=response)
83 |
84 |
85 | def sync(
86 | id: str,
87 | *,
88 | client: Union[AuthenticatedClient, Client],
89 | ) -> Optional[Union[Any, WrappedDartboard]]:
90 | """Retrieve an existing dartboard
91 |
92 | Retrieve an existing dartboard. This will return the dartboard's information, including the title,
93 | description, all tasks within it, and others.
94 |
95 | Args:
96 | id (str):
97 |
98 | Raises:
99 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
100 | httpx.TimeoutException: If the request takes longer than Client.timeout.
101 |
102 | Returns:
103 | Union[Any, WrappedDartboard]
104 | """
105 |
106 | return sync_detailed(
107 | id=id,
108 | client=client,
109 | ).parsed
110 |
111 |
112 | async def asyncio_detailed(
113 | id: str,
114 | *,
115 | client: Union[AuthenticatedClient, Client],
116 | ) -> Response[Union[Any, WrappedDartboard]]:
117 | """Retrieve an existing dartboard
118 |
119 | Retrieve an existing dartboard. This will return the dartboard's information, including the title,
120 | description, all tasks within it, and others.
121 |
122 | Args:
123 | id (str):
124 |
125 | Raises:
126 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
127 | httpx.TimeoutException: If the request takes longer than Client.timeout.
128 |
129 | Returns:
130 | Response[Union[Any, WrappedDartboard]]
131 | """
132 |
133 | kwargs = _get_kwargs(
134 | id=id,
135 | )
136 |
137 | response = await client.get_async_httpx_client().request(**kwargs)
138 |
139 | return _build_response(client=client, response=response)
140 |
141 |
142 | async def asyncio(
143 | id: str,
144 | *,
145 | client: Union[AuthenticatedClient, Client],
146 | ) -> Optional[Union[Any, WrappedDartboard]]:
147 | """Retrieve an existing dartboard
148 |
149 | Retrieve an existing dartboard. This will return the dartboard's information, including the title,
150 | description, all tasks within it, and others.
151 |
152 | Args:
153 | id (str):
154 |
155 | Raises:
156 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
157 | httpx.TimeoutException: If the request takes longer than Client.timeout.
158 |
159 | Returns:
160 | Union[Any, WrappedDartboard]
161 | """
162 |
163 | return (
164 | await asyncio_detailed(
165 | id=id,
166 | client=client,
167 | )
168 | ).parsed
169 |
--------------------------------------------------------------------------------
/dart/generated/api/doc/__init__.py:
--------------------------------------------------------------------------------
1 | """Contains endpoint functions for accessing the API"""
2 |
--------------------------------------------------------------------------------
/dart/generated/api/doc/create_doc.py:
--------------------------------------------------------------------------------
1 | from http import HTTPStatus
2 | from typing import Any, Optional, Union, cast
3 |
4 | import httpx
5 |
6 | from ... import errors
7 | from ...client import AuthenticatedClient, Client
8 | from ...models.wrapped_doc import WrappedDoc
9 | from ...models.wrapped_doc_create import WrappedDocCreate
10 | from ...types import Response
11 |
12 |
13 | def _get_kwargs(
14 | *,
15 | body: WrappedDocCreate,
16 | ) -> dict[str, Any]:
17 | headers: dict[str, Any] = {}
18 |
19 | _kwargs: dict[str, Any] = {
20 | "method": "post",
21 | "url": "/docs",
22 | }
23 |
24 | _body = body.to_dict()
25 |
26 | _kwargs["json"] = _body
27 | headers["Content-Type"] = "application/json"
28 |
29 | _kwargs["headers"] = headers
30 | return _kwargs
31 |
32 |
33 | def _parse_response(
34 | *, client: Union[AuthenticatedClient, Client], response: httpx.Response
35 | ) -> Optional[Union[Any, WrappedDoc]]:
36 | if response.status_code == 200:
37 | response_200 = WrappedDoc.from_dict(response.json())
38 |
39 | return response_200
40 | if response.status_code == 400:
41 | response_400 = cast(Any, None)
42 | return response_400
43 | if client.raise_on_unexpected_status:
44 | raise errors.UnexpectedStatus(response.status_code, response.content)
45 | else:
46 | return None
47 |
48 |
49 | def _build_response(
50 | *, client: Union[AuthenticatedClient, Client], response: httpx.Response
51 | ) -> Response[Union[Any, WrappedDoc]]:
52 | return Response(
53 | status_code=HTTPStatus(response.status_code),
54 | content=response.content,
55 | headers=response.headers,
56 | parsed=_parse_response(client=client, response=response),
57 | )
58 |
59 |
60 | def sync_detailed(
61 | *,
62 | client: Union[AuthenticatedClient, Client],
63 | body: WrappedDocCreate,
64 | ) -> Response[Union[Any, WrappedDoc]]:
65 | """Create a new doc
66 |
67 | Record a new doc that the user intends to write down. This will save the doc in Dart for later
68 | access, search, etc. By default the created doc will be in the Docs folder. More information can be
69 | included in the text.
70 |
71 | Args:
72 | body (WrappedDocCreate):
73 |
74 | Raises:
75 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
76 | httpx.TimeoutException: If the request takes longer than Client.timeout.
77 |
78 | Returns:
79 | Response[Union[Any, WrappedDoc]]
80 | """
81 |
82 | kwargs = _get_kwargs(
83 | body=body,
84 | )
85 |
86 | response = client.get_httpx_client().request(
87 | **kwargs,
88 | )
89 |
90 | return _build_response(client=client, response=response)
91 |
92 |
93 | def sync(
94 | *,
95 | client: Union[AuthenticatedClient, Client],
96 | body: WrappedDocCreate,
97 | ) -> Optional[Union[Any, WrappedDoc]]:
98 | """Create a new doc
99 |
100 | Record a new doc that the user intends to write down. This will save the doc in Dart for later
101 | access, search, etc. By default the created doc will be in the Docs folder. More information can be
102 | included in the text.
103 |
104 | Args:
105 | body (WrappedDocCreate):
106 |
107 | Raises:
108 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
109 | httpx.TimeoutException: If the request takes longer than Client.timeout.
110 |
111 | Returns:
112 | Union[Any, WrappedDoc]
113 | """
114 |
115 | return sync_detailed(
116 | client=client,
117 | body=body,
118 | ).parsed
119 |
120 |
121 | async def asyncio_detailed(
122 | *,
123 | client: Union[AuthenticatedClient, Client],
124 | body: WrappedDocCreate,
125 | ) -> Response[Union[Any, WrappedDoc]]:
126 | """Create a new doc
127 |
128 | Record a new doc that the user intends to write down. This will save the doc in Dart for later
129 | access, search, etc. By default the created doc will be in the Docs folder. More information can be
130 | included in the text.
131 |
132 | Args:
133 | body (WrappedDocCreate):
134 |
135 | Raises:
136 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
137 | httpx.TimeoutException: If the request takes longer than Client.timeout.
138 |
139 | Returns:
140 | Response[Union[Any, WrappedDoc]]
141 | """
142 |
143 | kwargs = _get_kwargs(
144 | body=body,
145 | )
146 |
147 | response = await client.get_async_httpx_client().request(**kwargs)
148 |
149 | return _build_response(client=client, response=response)
150 |
151 |
152 | async def asyncio(
153 | *,
154 | client: Union[AuthenticatedClient, Client],
155 | body: WrappedDocCreate,
156 | ) -> Optional[Union[Any, WrappedDoc]]:
157 | """Create a new doc
158 |
159 | Record a new doc that the user intends to write down. This will save the doc in Dart for later
160 | access, search, etc. By default the created doc will be in the Docs folder. More information can be
161 | included in the text.
162 |
163 | Args:
164 | body (WrappedDocCreate):
165 |
166 | Raises:
167 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
168 | httpx.TimeoutException: If the request takes longer than Client.timeout.
169 |
170 | Returns:
171 | Union[Any, WrappedDoc]
172 | """
173 |
174 | return (
175 | await asyncio_detailed(
176 | client=client,
177 | body=body,
178 | )
179 | ).parsed
180 |
--------------------------------------------------------------------------------
/dart/generated/api/doc/delete_doc.py:
--------------------------------------------------------------------------------
1 | from http import HTTPStatus
2 | from typing import Any, Optional, Union, cast
3 |
4 | import httpx
5 |
6 | from ... import errors
7 | from ...client import AuthenticatedClient, Client
8 | from ...models.wrapped_doc import WrappedDoc
9 | from ...types import Response
10 |
11 |
12 | def _get_kwargs(
13 | id: str,
14 | ) -> dict[str, Any]:
15 | _kwargs: dict[str, Any] = {
16 | "method": "delete",
17 | "url": f"/docs/{id}",
18 | }
19 |
20 | return _kwargs
21 |
22 |
23 | def _parse_response(
24 | *, client: Union[AuthenticatedClient, Client], response: httpx.Response
25 | ) -> Optional[Union[Any, WrappedDoc]]:
26 | if response.status_code == 200:
27 | response_200 = WrappedDoc.from_dict(response.json())
28 |
29 | return response_200
30 | if response.status_code == 400:
31 | response_400 = cast(Any, None)
32 | return response_400
33 | if response.status_code == 404:
34 | response_404 = cast(Any, None)
35 | return response_404
36 | if client.raise_on_unexpected_status:
37 | raise errors.UnexpectedStatus(response.status_code, response.content)
38 | else:
39 | return None
40 |
41 |
42 | def _build_response(
43 | *, client: Union[AuthenticatedClient, Client], response: httpx.Response
44 | ) -> Response[Union[Any, WrappedDoc]]:
45 | return Response(
46 | status_code=HTTPStatus(response.status_code),
47 | content=response.content,
48 | headers=response.headers,
49 | parsed=_parse_response(client=client, response=response),
50 | )
51 |
52 |
53 | def sync_detailed(
54 | id: str,
55 | *,
56 | client: Union[AuthenticatedClient, Client],
57 | ) -> Response[Union[Any, WrappedDoc]]:
58 | """Delete an existing doc
59 |
60 | Move an existing doc to the trash, where it can be recovered if needed. Nothing else about the doc
61 | will be changed.
62 |
63 | Args:
64 | id (str):
65 |
66 | Raises:
67 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
68 | httpx.TimeoutException: If the request takes longer than Client.timeout.
69 |
70 | Returns:
71 | Response[Union[Any, WrappedDoc]]
72 | """
73 |
74 | kwargs = _get_kwargs(
75 | id=id,
76 | )
77 |
78 | response = client.get_httpx_client().request(
79 | **kwargs,
80 | )
81 |
82 | return _build_response(client=client, response=response)
83 |
84 |
85 | def sync(
86 | id: str,
87 | *,
88 | client: Union[AuthenticatedClient, Client],
89 | ) -> Optional[Union[Any, WrappedDoc]]:
90 | """Delete an existing doc
91 |
92 | Move an existing doc to the trash, where it can be recovered if needed. Nothing else about the doc
93 | will be changed.
94 |
95 | Args:
96 | id (str):
97 |
98 | Raises:
99 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
100 | httpx.TimeoutException: If the request takes longer than Client.timeout.
101 |
102 | Returns:
103 | Union[Any, WrappedDoc]
104 | """
105 |
106 | return sync_detailed(
107 | id=id,
108 | client=client,
109 | ).parsed
110 |
111 |
112 | async def asyncio_detailed(
113 | id: str,
114 | *,
115 | client: Union[AuthenticatedClient, Client],
116 | ) -> Response[Union[Any, WrappedDoc]]:
117 | """Delete an existing doc
118 |
119 | Move an existing doc to the trash, where it can be recovered if needed. Nothing else about the doc
120 | will be changed.
121 |
122 | Args:
123 | id (str):
124 |
125 | Raises:
126 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
127 | httpx.TimeoutException: If the request takes longer than Client.timeout.
128 |
129 | Returns:
130 | Response[Union[Any, WrappedDoc]]
131 | """
132 |
133 | kwargs = _get_kwargs(
134 | id=id,
135 | )
136 |
137 | response = await client.get_async_httpx_client().request(**kwargs)
138 |
139 | return _build_response(client=client, response=response)
140 |
141 |
142 | async def asyncio(
143 | id: str,
144 | *,
145 | client: Union[AuthenticatedClient, Client],
146 | ) -> Optional[Union[Any, WrappedDoc]]:
147 | """Delete an existing doc
148 |
149 | Move an existing doc to the trash, where it can be recovered if needed. Nothing else about the doc
150 | will be changed.
151 |
152 | Args:
153 | id (str):
154 |
155 | Raises:
156 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
157 | httpx.TimeoutException: If the request takes longer than Client.timeout.
158 |
159 | Returns:
160 | Union[Any, WrappedDoc]
161 | """
162 |
163 | return (
164 | await asyncio_detailed(
165 | id=id,
166 | client=client,
167 | )
168 | ).parsed
169 |
--------------------------------------------------------------------------------
/dart/generated/api/doc/list_docs.py:
--------------------------------------------------------------------------------
1 | from http import HTTPStatus
2 | from typing import Any, Optional, Union
3 |
4 | import httpx
5 |
6 | from ... import errors
7 | from ...client import AuthenticatedClient, Client
8 | from ...models.list_docs_o_item import ListDocsOItem
9 | from ...models.paginated_concise_doc_list import PaginatedConciseDocList
10 | from ...types import UNSET, Response, Unset
11 |
12 |
13 | def _get_kwargs(
14 | *,
15 | folder: Union[Unset, str] = UNSET,
16 | folder_id: Union[Unset, str] = UNSET,
17 | ids: Union[Unset, str] = UNSET,
18 | in_trash: Union[Unset, bool] = UNSET,
19 | limit: Union[Unset, int] = UNSET,
20 | o: Union[Unset, list[ListDocsOItem]] = UNSET,
21 | offset: Union[Unset, int] = UNSET,
22 | s: Union[Unset, str] = UNSET,
23 | text: Union[Unset, str] = UNSET,
24 | title: Union[Unset, str] = UNSET,
25 | ) -> dict[str, Any]:
26 | params: dict[str, Any] = {}
27 |
28 | params["folder"] = folder
29 |
30 | params["folder_id"] = folder_id
31 |
32 | params["ids"] = ids
33 |
34 | params["in_trash"] = in_trash
35 |
36 | params["limit"] = limit
37 |
38 | json_o: Union[Unset, list[str]] = UNSET
39 | if not isinstance(o, Unset):
40 | json_o = []
41 | for o_item_data in o:
42 | o_item = o_item_data.value
43 | json_o.append(o_item)
44 |
45 | params["o"] = json_o
46 |
47 | params["offset"] = offset
48 |
49 | params["s"] = s
50 |
51 | params["text"] = text
52 |
53 | params["title"] = title
54 |
55 | params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
56 |
57 | _kwargs: dict[str, Any] = {
58 | "method": "get",
59 | "url": "/docs/list",
60 | "params": params,
61 | }
62 |
63 | return _kwargs
64 |
65 |
66 | def _parse_response(
67 | *, client: Union[AuthenticatedClient, Client], response: httpx.Response
68 | ) -> Optional[PaginatedConciseDocList]:
69 | if response.status_code == 200:
70 | response_200 = PaginatedConciseDocList.from_dict(response.json())
71 |
72 | return response_200
73 | if client.raise_on_unexpected_status:
74 | raise errors.UnexpectedStatus(response.status_code, response.content)
75 | else:
76 | return None
77 |
78 |
79 | def _build_response(
80 | *, client: Union[AuthenticatedClient, Client], response: httpx.Response
81 | ) -> Response[PaginatedConciseDocList]:
82 | return Response(
83 | status_code=HTTPStatus(response.status_code),
84 | content=response.content,
85 | headers=response.headers,
86 | parsed=_parse_response(client=client, response=response),
87 | )
88 |
89 |
90 | def sync_detailed(
91 | *,
92 | client: Union[AuthenticatedClient, Client],
93 | folder: Union[Unset, str] = UNSET,
94 | folder_id: Union[Unset, str] = UNSET,
95 | ids: Union[Unset, str] = UNSET,
96 | in_trash: Union[Unset, bool] = UNSET,
97 | limit: Union[Unset, int] = UNSET,
98 | o: Union[Unset, list[ListDocsOItem]] = UNSET,
99 | offset: Union[Unset, int] = UNSET,
100 | s: Union[Unset, str] = UNSET,
101 | text: Union[Unset, str] = UNSET,
102 | title: Union[Unset, str] = UNSET,
103 | ) -> Response[PaginatedConciseDocList]:
104 | """List all docs that the user has access to. This will return a list of docs, including the title,
105 | folder, text and others.
106 |
107 | Args:
108 | folder (Union[Unset, str]):
109 | folder_id (Union[Unset, str]):
110 | ids (Union[Unset, str]):
111 | in_trash (Union[Unset, bool]):
112 | limit (Union[Unset, int]):
113 | o (Union[Unset, list[ListDocsOItem]]):
114 | offset (Union[Unset, int]):
115 | s (Union[Unset, str]):
116 | text (Union[Unset, str]):
117 | title (Union[Unset, str]):
118 |
119 | Raises:
120 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
121 | httpx.TimeoutException: If the request takes longer than Client.timeout.
122 |
123 | Returns:
124 | Response[PaginatedConciseDocList]
125 | """
126 |
127 | kwargs = _get_kwargs(
128 | folder=folder,
129 | folder_id=folder_id,
130 | ids=ids,
131 | in_trash=in_trash,
132 | limit=limit,
133 | o=o,
134 | offset=offset,
135 | s=s,
136 | text=text,
137 | title=title,
138 | )
139 |
140 | response = client.get_httpx_client().request(
141 | **kwargs,
142 | )
143 |
144 | return _build_response(client=client, response=response)
145 |
146 |
147 | def sync(
148 | *,
149 | client: Union[AuthenticatedClient, Client],
150 | folder: Union[Unset, str] = UNSET,
151 | folder_id: Union[Unset, str] = UNSET,
152 | ids: Union[Unset, str] = UNSET,
153 | in_trash: Union[Unset, bool] = UNSET,
154 | limit: Union[Unset, int] = UNSET,
155 | o: Union[Unset, list[ListDocsOItem]] = UNSET,
156 | offset: Union[Unset, int] = UNSET,
157 | s: Union[Unset, str] = UNSET,
158 | text: Union[Unset, str] = UNSET,
159 | title: Union[Unset, str] = UNSET,
160 | ) -> Optional[PaginatedConciseDocList]:
161 | """List all docs that the user has access to. This will return a list of docs, including the title,
162 | folder, text and others.
163 |
164 | Args:
165 | folder (Union[Unset, str]):
166 | folder_id (Union[Unset, str]):
167 | ids (Union[Unset, str]):
168 | in_trash (Union[Unset, bool]):
169 | limit (Union[Unset, int]):
170 | o (Union[Unset, list[ListDocsOItem]]):
171 | offset (Union[Unset, int]):
172 | s (Union[Unset, str]):
173 | text (Union[Unset, str]):
174 | title (Union[Unset, str]):
175 |
176 | Raises:
177 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
178 | httpx.TimeoutException: If the request takes longer than Client.timeout.
179 |
180 | Returns:
181 | PaginatedConciseDocList
182 | """
183 |
184 | return sync_detailed(
185 | client=client,
186 | folder=folder,
187 | folder_id=folder_id,
188 | ids=ids,
189 | in_trash=in_trash,
190 | limit=limit,
191 | o=o,
192 | offset=offset,
193 | s=s,
194 | text=text,
195 | title=title,
196 | ).parsed
197 |
198 |
199 | async def asyncio_detailed(
200 | *,
201 | client: Union[AuthenticatedClient, Client],
202 | folder: Union[Unset, str] = UNSET,
203 | folder_id: Union[Unset, str] = UNSET,
204 | ids: Union[Unset, str] = UNSET,
205 | in_trash: Union[Unset, bool] = UNSET,
206 | limit: Union[Unset, int] = UNSET,
207 | o: Union[Unset, list[ListDocsOItem]] = UNSET,
208 | offset: Union[Unset, int] = UNSET,
209 | s: Union[Unset, str] = UNSET,
210 | text: Union[Unset, str] = UNSET,
211 | title: Union[Unset, str] = UNSET,
212 | ) -> Response[PaginatedConciseDocList]:
213 | """List all docs that the user has access to. This will return a list of docs, including the title,
214 | folder, text and others.
215 |
216 | Args:
217 | folder (Union[Unset, str]):
218 | folder_id (Union[Unset, str]):
219 | ids (Union[Unset, str]):
220 | in_trash (Union[Unset, bool]):
221 | limit (Union[Unset, int]):
222 | o (Union[Unset, list[ListDocsOItem]]):
223 | offset (Union[Unset, int]):
224 | s (Union[Unset, str]):
225 | text (Union[Unset, str]):
226 | title (Union[Unset, str]):
227 |
228 | Raises:
229 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
230 | httpx.TimeoutException: If the request takes longer than Client.timeout.
231 |
232 | Returns:
233 | Response[PaginatedConciseDocList]
234 | """
235 |
236 | kwargs = _get_kwargs(
237 | folder=folder,
238 | folder_id=folder_id,
239 | ids=ids,
240 | in_trash=in_trash,
241 | limit=limit,
242 | o=o,
243 | offset=offset,
244 | s=s,
245 | text=text,
246 | title=title,
247 | )
248 |
249 | response = await client.get_async_httpx_client().request(**kwargs)
250 |
251 | return _build_response(client=client, response=response)
252 |
253 |
254 | async def asyncio(
255 | *,
256 | client: Union[AuthenticatedClient, Client],
257 | folder: Union[Unset, str] = UNSET,
258 | folder_id: Union[Unset, str] = UNSET,
259 | ids: Union[Unset, str] = UNSET,
260 | in_trash: Union[Unset, bool] = UNSET,
261 | limit: Union[Unset, int] = UNSET,
262 | o: Union[Unset, list[ListDocsOItem]] = UNSET,
263 | offset: Union[Unset, int] = UNSET,
264 | s: Union[Unset, str] = UNSET,
265 | text: Union[Unset, str] = UNSET,
266 | title: Union[Unset, str] = UNSET,
267 | ) -> Optional[PaginatedConciseDocList]:
268 | """List all docs that the user has access to. This will return a list of docs, including the title,
269 | folder, text and others.
270 |
271 | Args:
272 | folder (Union[Unset, str]):
273 | folder_id (Union[Unset, str]):
274 | ids (Union[Unset, str]):
275 | in_trash (Union[Unset, bool]):
276 | limit (Union[Unset, int]):
277 | o (Union[Unset, list[ListDocsOItem]]):
278 | offset (Union[Unset, int]):
279 | s (Union[Unset, str]):
280 | text (Union[Unset, str]):
281 | title (Union[Unset, str]):
282 |
283 | Raises:
284 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
285 | httpx.TimeoutException: If the request takes longer than Client.timeout.
286 |
287 | Returns:
288 | PaginatedConciseDocList
289 | """
290 |
291 | return (
292 | await asyncio_detailed(
293 | client=client,
294 | folder=folder,
295 | folder_id=folder_id,
296 | ids=ids,
297 | in_trash=in_trash,
298 | limit=limit,
299 | o=o,
300 | offset=offset,
301 | s=s,
302 | text=text,
303 | title=title,
304 | )
305 | ).parsed
306 |
--------------------------------------------------------------------------------
/dart/generated/api/doc/retrieve_doc.py:
--------------------------------------------------------------------------------
1 | from http import HTTPStatus
2 | from typing import Any, Optional, Union, cast
3 |
4 | import httpx
5 |
6 | from ... import errors
7 | from ...client import AuthenticatedClient, Client
8 | from ...models.wrapped_doc import WrappedDoc
9 | from ...types import Response
10 |
11 |
12 | def _get_kwargs(
13 | id: str,
14 | ) -> dict[str, Any]:
15 | _kwargs: dict[str, Any] = {
16 | "method": "get",
17 | "url": f"/docs/{id}",
18 | }
19 |
20 | return _kwargs
21 |
22 |
23 | def _parse_response(
24 | *, client: Union[AuthenticatedClient, Client], response: httpx.Response
25 | ) -> Optional[Union[Any, WrappedDoc]]:
26 | if response.status_code == 200:
27 | response_200 = WrappedDoc.from_dict(response.json())
28 |
29 | return response_200
30 | if response.status_code == 400:
31 | response_400 = cast(Any, None)
32 | return response_400
33 | if response.status_code == 404:
34 | response_404 = cast(Any, None)
35 | return response_404
36 | if client.raise_on_unexpected_status:
37 | raise errors.UnexpectedStatus(response.status_code, response.content)
38 | else:
39 | return None
40 |
41 |
42 | def _build_response(
43 | *, client: Union[AuthenticatedClient, Client], response: httpx.Response
44 | ) -> Response[Union[Any, WrappedDoc]]:
45 | return Response(
46 | status_code=HTTPStatus(response.status_code),
47 | content=response.content,
48 | headers=response.headers,
49 | parsed=_parse_response(client=client, response=response),
50 | )
51 |
52 |
53 | def sync_detailed(
54 | id: str,
55 | *,
56 | client: Union[AuthenticatedClient, Client],
57 | ) -> Response[Union[Any, WrappedDoc]]:
58 | """Retrieve an existing doc
59 |
60 | Retrieve an existing doc. This will return the doc's information, including the title, folder, text
61 | and others.
62 |
63 | Args:
64 | id (str):
65 |
66 | Raises:
67 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
68 | httpx.TimeoutException: If the request takes longer than Client.timeout.
69 |
70 | Returns:
71 | Response[Union[Any, WrappedDoc]]
72 | """
73 |
74 | kwargs = _get_kwargs(
75 | id=id,
76 | )
77 |
78 | response = client.get_httpx_client().request(
79 | **kwargs,
80 | )
81 |
82 | return _build_response(client=client, response=response)
83 |
84 |
85 | def sync(
86 | id: str,
87 | *,
88 | client: Union[AuthenticatedClient, Client],
89 | ) -> Optional[Union[Any, WrappedDoc]]:
90 | """Retrieve an existing doc
91 |
92 | Retrieve an existing doc. This will return the doc's information, including the title, folder, text
93 | and others.
94 |
95 | Args:
96 | id (str):
97 |
98 | Raises:
99 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
100 | httpx.TimeoutException: If the request takes longer than Client.timeout.
101 |
102 | Returns:
103 | Union[Any, WrappedDoc]
104 | """
105 |
106 | return sync_detailed(
107 | id=id,
108 | client=client,
109 | ).parsed
110 |
111 |
112 | async def asyncio_detailed(
113 | id: str,
114 | *,
115 | client: Union[AuthenticatedClient, Client],
116 | ) -> Response[Union[Any, WrappedDoc]]:
117 | """Retrieve an existing doc
118 |
119 | Retrieve an existing doc. This will return the doc's information, including the title, folder, text
120 | and others.
121 |
122 | Args:
123 | id (str):
124 |
125 | Raises:
126 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
127 | httpx.TimeoutException: If the request takes longer than Client.timeout.
128 |
129 | Returns:
130 | Response[Union[Any, WrappedDoc]]
131 | """
132 |
133 | kwargs = _get_kwargs(
134 | id=id,
135 | )
136 |
137 | response = await client.get_async_httpx_client().request(**kwargs)
138 |
139 | return _build_response(client=client, response=response)
140 |
141 |
142 | async def asyncio(
143 | id: str,
144 | *,
145 | client: Union[AuthenticatedClient, Client],
146 | ) -> Optional[Union[Any, WrappedDoc]]:
147 | """Retrieve an existing doc
148 |
149 | Retrieve an existing doc. This will return the doc's information, including the title, folder, text
150 | and others.
151 |
152 | Args:
153 | id (str):
154 |
155 | Raises:
156 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
157 | httpx.TimeoutException: If the request takes longer than Client.timeout.
158 |
159 | Returns:
160 | Union[Any, WrappedDoc]
161 | """
162 |
163 | return (
164 | await asyncio_detailed(
165 | id=id,
166 | client=client,
167 | )
168 | ).parsed
169 |
--------------------------------------------------------------------------------
/dart/generated/api/doc/update_doc.py:
--------------------------------------------------------------------------------
1 | from http import HTTPStatus
2 | from typing import Any, Optional, Union, cast
3 |
4 | import httpx
5 |
6 | from ... import errors
7 | from ...client import AuthenticatedClient, Client
8 | from ...models.wrapped_doc import WrappedDoc
9 | from ...models.wrapped_doc_update import WrappedDocUpdate
10 | from ...types import Response
11 |
12 |
13 | def _get_kwargs(
14 | id: str,
15 | *,
16 | body: WrappedDocUpdate,
17 | ) -> dict[str, Any]:
18 | headers: dict[str, Any] = {}
19 |
20 | _kwargs: dict[str, Any] = {
21 | "method": "put",
22 | "url": f"/docs/{id}",
23 | }
24 |
25 | _body = body.to_dict()
26 |
27 | _kwargs["json"] = _body
28 | headers["Content-Type"] = "application/json"
29 |
30 | _kwargs["headers"] = headers
31 | return _kwargs
32 |
33 |
34 | def _parse_response(
35 | *, client: Union[AuthenticatedClient, Client], response: httpx.Response
36 | ) -> Optional[Union[Any, WrappedDoc]]:
37 | if response.status_code == 200:
38 | response_200 = WrappedDoc.from_dict(response.json())
39 |
40 | return response_200
41 | if response.status_code == 400:
42 | response_400 = cast(Any, None)
43 | return response_400
44 | if response.status_code == 404:
45 | response_404 = cast(Any, None)
46 | return response_404
47 | if client.raise_on_unexpected_status:
48 | raise errors.UnexpectedStatus(response.status_code, response.content)
49 | else:
50 | return None
51 |
52 |
53 | def _build_response(
54 | *, client: Union[AuthenticatedClient, Client], response: httpx.Response
55 | ) -> Response[Union[Any, WrappedDoc]]:
56 | return Response(
57 | status_code=HTTPStatus(response.status_code),
58 | content=response.content,
59 | headers=response.headers,
60 | parsed=_parse_response(client=client, response=response),
61 | )
62 |
63 |
64 | def sync_detailed(
65 | id: str,
66 | *,
67 | client: Union[AuthenticatedClient, Client],
68 | body: WrappedDocUpdate,
69 | ) -> Response[Union[Any, WrappedDoc]]:
70 | """Update an existing doc
71 |
72 | Update certain properties of an existing doc. This will save the doc in Dart for later access,
73 | search, etc. Any properties that are not specified will not be changed.
74 |
75 | Args:
76 | id (str):
77 | body (WrappedDocUpdate):
78 |
79 | Raises:
80 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
81 | httpx.TimeoutException: If the request takes longer than Client.timeout.
82 |
83 | Returns:
84 | Response[Union[Any, WrappedDoc]]
85 | """
86 |
87 | kwargs = _get_kwargs(
88 | id=id,
89 | body=body,
90 | )
91 |
92 | response = client.get_httpx_client().request(
93 | **kwargs,
94 | )
95 |
96 | return _build_response(client=client, response=response)
97 |
98 |
99 | def sync(
100 | id: str,
101 | *,
102 | client: Union[AuthenticatedClient, Client],
103 | body: WrappedDocUpdate,
104 | ) -> Optional[Union[Any, WrappedDoc]]:
105 | """Update an existing doc
106 |
107 | Update certain properties of an existing doc. This will save the doc in Dart for later access,
108 | search, etc. Any properties that are not specified will not be changed.
109 |
110 | Args:
111 | id (str):
112 | body (WrappedDocUpdate):
113 |
114 | Raises:
115 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
116 | httpx.TimeoutException: If the request takes longer than Client.timeout.
117 |
118 | Returns:
119 | Union[Any, WrappedDoc]
120 | """
121 |
122 | return sync_detailed(
123 | id=id,
124 | client=client,
125 | body=body,
126 | ).parsed
127 |
128 |
129 | async def asyncio_detailed(
130 | id: str,
131 | *,
132 | client: Union[AuthenticatedClient, Client],
133 | body: WrappedDocUpdate,
134 | ) -> Response[Union[Any, WrappedDoc]]:
135 | """Update an existing doc
136 |
137 | Update certain properties of an existing doc. This will save the doc in Dart for later access,
138 | search, etc. Any properties that are not specified will not be changed.
139 |
140 | Args:
141 | id (str):
142 | body (WrappedDocUpdate):
143 |
144 | Raises:
145 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
146 | httpx.TimeoutException: If the request takes longer than Client.timeout.
147 |
148 | Returns:
149 | Response[Union[Any, WrappedDoc]]
150 | """
151 |
152 | kwargs = _get_kwargs(
153 | id=id,
154 | body=body,
155 | )
156 |
157 | response = await client.get_async_httpx_client().request(**kwargs)
158 |
159 | return _build_response(client=client, response=response)
160 |
161 |
162 | async def asyncio(
163 | id: str,
164 | *,
165 | client: Union[AuthenticatedClient, Client],
166 | body: WrappedDocUpdate,
167 | ) -> Optional[Union[Any, WrappedDoc]]:
168 | """Update an existing doc
169 |
170 | Update certain properties of an existing doc. This will save the doc in Dart for later access,
171 | search, etc. Any properties that are not specified will not be changed.
172 |
173 | Args:
174 | id (str):
175 | body (WrappedDocUpdate):
176 |
177 | Raises:
178 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
179 | httpx.TimeoutException: If the request takes longer than Client.timeout.
180 |
181 | Returns:
182 | Union[Any, WrappedDoc]
183 | """
184 |
185 | return (
186 | await asyncio_detailed(
187 | id=id,
188 | client=client,
189 | body=body,
190 | )
191 | ).parsed
192 |
--------------------------------------------------------------------------------
/dart/generated/api/folder/__init__.py:
--------------------------------------------------------------------------------
1 | """Contains endpoint functions for accessing the API"""
2 |
--------------------------------------------------------------------------------
/dart/generated/api/folder/retrieve_folder.py:
--------------------------------------------------------------------------------
1 | from http import HTTPStatus
2 | from typing import Any, Optional, Union, cast
3 |
4 | import httpx
5 |
6 | from ... import errors
7 | from ...client import AuthenticatedClient, Client
8 | from ...models.wrapped_folder import WrappedFolder
9 | from ...types import Response
10 |
11 |
12 | def _get_kwargs(
13 | id: str,
14 | ) -> dict[str, Any]:
15 | _kwargs: dict[str, Any] = {
16 | "method": "get",
17 | "url": f"/folders/{id}",
18 | }
19 |
20 | return _kwargs
21 |
22 |
23 | def _parse_response(
24 | *, client: Union[AuthenticatedClient, Client], response: httpx.Response
25 | ) -> Optional[Union[Any, WrappedFolder]]:
26 | if response.status_code == 200:
27 | response_200 = WrappedFolder.from_dict(response.json())
28 |
29 | return response_200
30 | if response.status_code == 400:
31 | response_400 = cast(Any, None)
32 | return response_400
33 | if response.status_code == 404:
34 | response_404 = cast(Any, None)
35 | return response_404
36 | if client.raise_on_unexpected_status:
37 | raise errors.UnexpectedStatus(response.status_code, response.content)
38 | else:
39 | return None
40 |
41 |
42 | def _build_response(
43 | *, client: Union[AuthenticatedClient, Client], response: httpx.Response
44 | ) -> Response[Union[Any, WrappedFolder]]:
45 | return Response(
46 | status_code=HTTPStatus(response.status_code),
47 | content=response.content,
48 | headers=response.headers,
49 | parsed=_parse_response(client=client, response=response),
50 | )
51 |
52 |
53 | def sync_detailed(
54 | id: str,
55 | *,
56 | client: Union[AuthenticatedClient, Client],
57 | ) -> Response[Union[Any, WrappedFolder]]:
58 | """Retrieve an existing folder
59 |
60 | Retrieve an existing folder. This will return the folder's information, including the title,
61 | description, all docs within it, and others.
62 |
63 | Args:
64 | id (str):
65 |
66 | Raises:
67 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
68 | httpx.TimeoutException: If the request takes longer than Client.timeout.
69 |
70 | Returns:
71 | Response[Union[Any, WrappedFolder]]
72 | """
73 |
74 | kwargs = _get_kwargs(
75 | id=id,
76 | )
77 |
78 | response = client.get_httpx_client().request(
79 | **kwargs,
80 | )
81 |
82 | return _build_response(client=client, response=response)
83 |
84 |
85 | def sync(
86 | id: str,
87 | *,
88 | client: Union[AuthenticatedClient, Client],
89 | ) -> Optional[Union[Any, WrappedFolder]]:
90 | """Retrieve an existing folder
91 |
92 | Retrieve an existing folder. This will return the folder's information, including the title,
93 | description, all docs within it, and others.
94 |
95 | Args:
96 | id (str):
97 |
98 | Raises:
99 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
100 | httpx.TimeoutException: If the request takes longer than Client.timeout.
101 |
102 | Returns:
103 | Union[Any, WrappedFolder]
104 | """
105 |
106 | return sync_detailed(
107 | id=id,
108 | client=client,
109 | ).parsed
110 |
111 |
112 | async def asyncio_detailed(
113 | id: str,
114 | *,
115 | client: Union[AuthenticatedClient, Client],
116 | ) -> Response[Union[Any, WrappedFolder]]:
117 | """Retrieve an existing folder
118 |
119 | Retrieve an existing folder. This will return the folder's information, including the title,
120 | description, all docs within it, and others.
121 |
122 | Args:
123 | id (str):
124 |
125 | Raises:
126 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
127 | httpx.TimeoutException: If the request takes longer than Client.timeout.
128 |
129 | Returns:
130 | Response[Union[Any, WrappedFolder]]
131 | """
132 |
133 | kwargs = _get_kwargs(
134 | id=id,
135 | )
136 |
137 | response = await client.get_async_httpx_client().request(**kwargs)
138 |
139 | return _build_response(client=client, response=response)
140 |
141 |
142 | async def asyncio(
143 | id: str,
144 | *,
145 | client: Union[AuthenticatedClient, Client],
146 | ) -> Optional[Union[Any, WrappedFolder]]:
147 | """Retrieve an existing folder
148 |
149 | Retrieve an existing folder. This will return the folder's information, including the title,
150 | description, all docs within it, and others.
151 |
152 | Args:
153 | id (str):
154 |
155 | Raises:
156 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
157 | httpx.TimeoutException: If the request takes longer than Client.timeout.
158 |
159 | Returns:
160 | Union[Any, WrappedFolder]
161 | """
162 |
163 | return (
164 | await asyncio_detailed(
165 | id=id,
166 | client=client,
167 | )
168 | ).parsed
169 |
--------------------------------------------------------------------------------
/dart/generated/api/task/__init__.py:
--------------------------------------------------------------------------------
1 | """Contains endpoint functions for accessing the API"""
2 |
--------------------------------------------------------------------------------
/dart/generated/api/task/create_task.py:
--------------------------------------------------------------------------------
1 | from http import HTTPStatus
2 | from typing import Any, Optional, Union
3 |
4 | import httpx
5 |
6 | from ... import errors
7 | from ...client import AuthenticatedClient, Client
8 | from ...models.wrapped_task import WrappedTask
9 | from ...models.wrapped_task_create import WrappedTaskCreate
10 | from ...types import Response
11 |
12 |
13 | def _get_kwargs(
14 | *,
15 | body: WrappedTaskCreate,
16 | ) -> dict[str, Any]:
17 | headers: dict[str, Any] = {}
18 |
19 | _kwargs: dict[str, Any] = {
20 | "method": "post",
21 | "url": "/tasks",
22 | }
23 |
24 | _body = body.to_dict()
25 |
26 | _kwargs["json"] = _body
27 | headers["Content-Type"] = "application/json"
28 |
29 | _kwargs["headers"] = headers
30 | return _kwargs
31 |
32 |
33 | def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[WrappedTask]:
34 | if response.status_code == 200:
35 | response_200 = WrappedTask.from_dict(response.json())
36 |
37 | return response_200
38 | if client.raise_on_unexpected_status:
39 | raise errors.UnexpectedStatus(response.status_code, response.content)
40 | else:
41 | return None
42 |
43 |
44 | def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[WrappedTask]:
45 | return Response(
46 | status_code=HTTPStatus(response.status_code),
47 | content=response.content,
48 | headers=response.headers,
49 | parsed=_parse_response(client=client, response=response),
50 | )
51 |
52 |
53 | def sync_detailed(
54 | *,
55 | client: Union[AuthenticatedClient, Client],
56 | body: WrappedTaskCreate,
57 | ) -> Response[WrappedTask]:
58 | """Create a new task
59 |
60 | Record a new task that the user intends to do. This will save the task in Dart for later access,
61 | search, etc. By default the created task will be assigned to the user, with a status of to-do, with
62 | no parent, in the Active dartboard. More information can be included in the description.
63 |
64 | Args:
65 | body (WrappedTaskCreate):
66 |
67 | Raises:
68 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
69 | httpx.TimeoutException: If the request takes longer than Client.timeout.
70 |
71 | Returns:
72 | Response[WrappedTask]
73 | """
74 |
75 | kwargs = _get_kwargs(
76 | body=body,
77 | )
78 |
79 | response = client.get_httpx_client().request(
80 | **kwargs,
81 | )
82 |
83 | return _build_response(client=client, response=response)
84 |
85 |
86 | def sync(
87 | *,
88 | client: Union[AuthenticatedClient, Client],
89 | body: WrappedTaskCreate,
90 | ) -> Optional[WrappedTask]:
91 | """Create a new task
92 |
93 | Record a new task that the user intends to do. This will save the task in Dart for later access,
94 | search, etc. By default the created task will be assigned to the user, with a status of to-do, with
95 | no parent, in the Active dartboard. More information can be included in the description.
96 |
97 | Args:
98 | body (WrappedTaskCreate):
99 |
100 | Raises:
101 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
102 | httpx.TimeoutException: If the request takes longer than Client.timeout.
103 |
104 | Returns:
105 | WrappedTask
106 | """
107 |
108 | return sync_detailed(
109 | client=client,
110 | body=body,
111 | ).parsed
112 |
113 |
114 | async def asyncio_detailed(
115 | *,
116 | client: Union[AuthenticatedClient, Client],
117 | body: WrappedTaskCreate,
118 | ) -> Response[WrappedTask]:
119 | """Create a new task
120 |
121 | Record a new task that the user intends to do. This will save the task in Dart for later access,
122 | search, etc. By default the created task will be assigned to the user, with a status of to-do, with
123 | no parent, in the Active dartboard. More information can be included in the description.
124 |
125 | Args:
126 | body (WrappedTaskCreate):
127 |
128 | Raises:
129 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
130 | httpx.TimeoutException: If the request takes longer than Client.timeout.
131 |
132 | Returns:
133 | Response[WrappedTask]
134 | """
135 |
136 | kwargs = _get_kwargs(
137 | body=body,
138 | )
139 |
140 | response = await client.get_async_httpx_client().request(**kwargs)
141 |
142 | return _build_response(client=client, response=response)
143 |
144 |
145 | async def asyncio(
146 | *,
147 | client: Union[AuthenticatedClient, Client],
148 | body: WrappedTaskCreate,
149 | ) -> Optional[WrappedTask]:
150 | """Create a new task
151 |
152 | Record a new task that the user intends to do. This will save the task in Dart for later access,
153 | search, etc. By default the created task will be assigned to the user, with a status of to-do, with
154 | no parent, in the Active dartboard. More information can be included in the description.
155 |
156 | Args:
157 | body (WrappedTaskCreate):
158 |
159 | Raises:
160 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
161 | httpx.TimeoutException: If the request takes longer than Client.timeout.
162 |
163 | Returns:
164 | WrappedTask
165 | """
166 |
167 | return (
168 | await asyncio_detailed(
169 | client=client,
170 | body=body,
171 | )
172 | ).parsed
173 |
--------------------------------------------------------------------------------
/dart/generated/api/task/delete_task.py:
--------------------------------------------------------------------------------
1 | from http import HTTPStatus
2 | from typing import Any, Optional, Union, cast
3 |
4 | import httpx
5 |
6 | from ... import errors
7 | from ...client import AuthenticatedClient, Client
8 | from ...models.wrapped_task import WrappedTask
9 | from ...types import Response
10 |
11 |
12 | def _get_kwargs(
13 | id: str,
14 | ) -> dict[str, Any]:
15 | _kwargs: dict[str, Any] = {
16 | "method": "delete",
17 | "url": f"/tasks/{id}",
18 | }
19 |
20 | return _kwargs
21 |
22 |
23 | def _parse_response(
24 | *, client: Union[AuthenticatedClient, Client], response: httpx.Response
25 | ) -> Optional[Union[Any, WrappedTask]]:
26 | if response.status_code == 200:
27 | response_200 = WrappedTask.from_dict(response.json())
28 |
29 | return response_200
30 | if response.status_code == 400:
31 | response_400 = cast(Any, None)
32 | return response_400
33 | if response.status_code == 404:
34 | response_404 = cast(Any, None)
35 | return response_404
36 | if client.raise_on_unexpected_status:
37 | raise errors.UnexpectedStatus(response.status_code, response.content)
38 | else:
39 | return None
40 |
41 |
42 | def _build_response(
43 | *, client: Union[AuthenticatedClient, Client], response: httpx.Response
44 | ) -> Response[Union[Any, WrappedTask]]:
45 | return Response(
46 | status_code=HTTPStatus(response.status_code),
47 | content=response.content,
48 | headers=response.headers,
49 | parsed=_parse_response(client=client, response=response),
50 | )
51 |
52 |
53 | def sync_detailed(
54 | id: str,
55 | *,
56 | client: Union[AuthenticatedClient, Client],
57 | ) -> Response[Union[Any, WrappedTask]]:
58 | """Delete an existing task
59 |
60 | Move an existing task to the trash, where it can be recovered if needed. Nothing else about the task
61 | will be changed.
62 |
63 | Args:
64 | id (str):
65 |
66 | Raises:
67 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
68 | httpx.TimeoutException: If the request takes longer than Client.timeout.
69 |
70 | Returns:
71 | Response[Union[Any, WrappedTask]]
72 | """
73 |
74 | kwargs = _get_kwargs(
75 | id=id,
76 | )
77 |
78 | response = client.get_httpx_client().request(
79 | **kwargs,
80 | )
81 |
82 | return _build_response(client=client, response=response)
83 |
84 |
85 | def sync(
86 | id: str,
87 | *,
88 | client: Union[AuthenticatedClient, Client],
89 | ) -> Optional[Union[Any, WrappedTask]]:
90 | """Delete an existing task
91 |
92 | Move an existing task to the trash, where it can be recovered if needed. Nothing else about the task
93 | will be changed.
94 |
95 | Args:
96 | id (str):
97 |
98 | Raises:
99 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
100 | httpx.TimeoutException: If the request takes longer than Client.timeout.
101 |
102 | Returns:
103 | Union[Any, WrappedTask]
104 | """
105 |
106 | return sync_detailed(
107 | id=id,
108 | client=client,
109 | ).parsed
110 |
111 |
112 | async def asyncio_detailed(
113 | id: str,
114 | *,
115 | client: Union[AuthenticatedClient, Client],
116 | ) -> Response[Union[Any, WrappedTask]]:
117 | """Delete an existing task
118 |
119 | Move an existing task to the trash, where it can be recovered if needed. Nothing else about the task
120 | will be changed.
121 |
122 | Args:
123 | id (str):
124 |
125 | Raises:
126 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
127 | httpx.TimeoutException: If the request takes longer than Client.timeout.
128 |
129 | Returns:
130 | Response[Union[Any, WrappedTask]]
131 | """
132 |
133 | kwargs = _get_kwargs(
134 | id=id,
135 | )
136 |
137 | response = await client.get_async_httpx_client().request(**kwargs)
138 |
139 | return _build_response(client=client, response=response)
140 |
141 |
142 | async def asyncio(
143 | id: str,
144 | *,
145 | client: Union[AuthenticatedClient, Client],
146 | ) -> Optional[Union[Any, WrappedTask]]:
147 | """Delete an existing task
148 |
149 | Move an existing task to the trash, where it can be recovered if needed. Nothing else about the task
150 | will be changed.
151 |
152 | Args:
153 | id (str):
154 |
155 | Raises:
156 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
157 | httpx.TimeoutException: If the request takes longer than Client.timeout.
158 |
159 | Returns:
160 | Union[Any, WrappedTask]
161 | """
162 |
163 | return (
164 | await asyncio_detailed(
165 | id=id,
166 | client=client,
167 | )
168 | ).parsed
169 |
--------------------------------------------------------------------------------
/dart/generated/api/task/retrieve_task.py:
--------------------------------------------------------------------------------
1 | from http import HTTPStatus
2 | from typing import Any, Optional, Union, cast
3 |
4 | import httpx
5 |
6 | from ... import errors
7 | from ...client import AuthenticatedClient, Client
8 | from ...models.wrapped_task import WrappedTask
9 | from ...types import Response
10 |
11 |
12 | def _get_kwargs(
13 | id: str,
14 | ) -> dict[str, Any]:
15 | _kwargs: dict[str, Any] = {
16 | "method": "get",
17 | "url": f"/tasks/{id}",
18 | }
19 |
20 | return _kwargs
21 |
22 |
23 | def _parse_response(
24 | *, client: Union[AuthenticatedClient, Client], response: httpx.Response
25 | ) -> Optional[Union[Any, WrappedTask]]:
26 | if response.status_code == 200:
27 | response_200 = WrappedTask.from_dict(response.json())
28 |
29 | return response_200
30 | if response.status_code == 400:
31 | response_400 = cast(Any, None)
32 | return response_400
33 | if response.status_code == 404:
34 | response_404 = cast(Any, None)
35 | return response_404
36 | if client.raise_on_unexpected_status:
37 | raise errors.UnexpectedStatus(response.status_code, response.content)
38 | else:
39 | return None
40 |
41 |
42 | def _build_response(
43 | *, client: Union[AuthenticatedClient, Client], response: httpx.Response
44 | ) -> Response[Union[Any, WrappedTask]]:
45 | return Response(
46 | status_code=HTTPStatus(response.status_code),
47 | content=response.content,
48 | headers=response.headers,
49 | parsed=_parse_response(client=client, response=response),
50 | )
51 |
52 |
53 | def sync_detailed(
54 | id: str,
55 | *,
56 | client: Union[AuthenticatedClient, Client],
57 | ) -> Response[Union[Any, WrappedTask]]:
58 | """Retrieve an existing task
59 |
60 | Retrieve an existing task. This will return the task's information, including the title, dartboard,
61 | status, description and others.
62 |
63 | Args:
64 | id (str):
65 |
66 | Raises:
67 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
68 | httpx.TimeoutException: If the request takes longer than Client.timeout.
69 |
70 | Returns:
71 | Response[Union[Any, WrappedTask]]
72 | """
73 |
74 | kwargs = _get_kwargs(
75 | id=id,
76 | )
77 |
78 | response = client.get_httpx_client().request(
79 | **kwargs,
80 | )
81 |
82 | return _build_response(client=client, response=response)
83 |
84 |
85 | def sync(
86 | id: str,
87 | *,
88 | client: Union[AuthenticatedClient, Client],
89 | ) -> Optional[Union[Any, WrappedTask]]:
90 | """Retrieve an existing task
91 |
92 | Retrieve an existing task. This will return the task's information, including the title, dartboard,
93 | status, description and others.
94 |
95 | Args:
96 | id (str):
97 |
98 | Raises:
99 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
100 | httpx.TimeoutException: If the request takes longer than Client.timeout.
101 |
102 | Returns:
103 | Union[Any, WrappedTask]
104 | """
105 |
106 | return sync_detailed(
107 | id=id,
108 | client=client,
109 | ).parsed
110 |
111 |
112 | async def asyncio_detailed(
113 | id: str,
114 | *,
115 | client: Union[AuthenticatedClient, Client],
116 | ) -> Response[Union[Any, WrappedTask]]:
117 | """Retrieve an existing task
118 |
119 | Retrieve an existing task. This will return the task's information, including the title, dartboard,
120 | status, description and others.
121 |
122 | Args:
123 | id (str):
124 |
125 | Raises:
126 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
127 | httpx.TimeoutException: If the request takes longer than Client.timeout.
128 |
129 | Returns:
130 | Response[Union[Any, WrappedTask]]
131 | """
132 |
133 | kwargs = _get_kwargs(
134 | id=id,
135 | )
136 |
137 | response = await client.get_async_httpx_client().request(**kwargs)
138 |
139 | return _build_response(client=client, response=response)
140 |
141 |
142 | async def asyncio(
143 | id: str,
144 | *,
145 | client: Union[AuthenticatedClient, Client],
146 | ) -> Optional[Union[Any, WrappedTask]]:
147 | """Retrieve an existing task
148 |
149 | Retrieve an existing task. This will return the task's information, including the title, dartboard,
150 | status, description and others.
151 |
152 | Args:
153 | id (str):
154 |
155 | Raises:
156 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
157 | httpx.TimeoutException: If the request takes longer than Client.timeout.
158 |
159 | Returns:
160 | Union[Any, WrappedTask]
161 | """
162 |
163 | return (
164 | await asyncio_detailed(
165 | id=id,
166 | client=client,
167 | )
168 | ).parsed
169 |
--------------------------------------------------------------------------------
/dart/generated/api/task/update_task.py:
--------------------------------------------------------------------------------
1 | from http import HTTPStatus
2 | from typing import Any, Optional, Union, cast
3 |
4 | import httpx
5 |
6 | from ... import errors
7 | from ...client import AuthenticatedClient, Client
8 | from ...models.wrapped_task import WrappedTask
9 | from ...models.wrapped_task_update import WrappedTaskUpdate
10 | from ...types import Response
11 |
12 |
13 | def _get_kwargs(
14 | id: str,
15 | *,
16 | body: WrappedTaskUpdate,
17 | ) -> dict[str, Any]:
18 | headers: dict[str, Any] = {}
19 |
20 | _kwargs: dict[str, Any] = {
21 | "method": "put",
22 | "url": f"/tasks/{id}",
23 | }
24 |
25 | _body = body.to_dict()
26 |
27 | _kwargs["json"] = _body
28 | headers["Content-Type"] = "application/json"
29 |
30 | _kwargs["headers"] = headers
31 | return _kwargs
32 |
33 |
34 | def _parse_response(
35 | *, client: Union[AuthenticatedClient, Client], response: httpx.Response
36 | ) -> Optional[Union[Any, WrappedTask]]:
37 | if response.status_code == 200:
38 | response_200 = WrappedTask.from_dict(response.json())
39 |
40 | return response_200
41 | if response.status_code == 400:
42 | response_400 = cast(Any, None)
43 | return response_400
44 | if response.status_code == 404:
45 | response_404 = cast(Any, None)
46 | return response_404
47 | if client.raise_on_unexpected_status:
48 | raise errors.UnexpectedStatus(response.status_code, response.content)
49 | else:
50 | return None
51 |
52 |
53 | def _build_response(
54 | *, client: Union[AuthenticatedClient, Client], response: httpx.Response
55 | ) -> Response[Union[Any, WrappedTask]]:
56 | return Response(
57 | status_code=HTTPStatus(response.status_code),
58 | content=response.content,
59 | headers=response.headers,
60 | parsed=_parse_response(client=client, response=response),
61 | )
62 |
63 |
64 | def sync_detailed(
65 | id: str,
66 | *,
67 | client: Union[AuthenticatedClient, Client],
68 | body: WrappedTaskUpdate,
69 | ) -> Response[Union[Any, WrappedTask]]:
70 | """Update an existing task
71 |
72 | Update certain properties of an existing task. This will save the task in Dart for later access,
73 | search, etc. Any properties that are not specified will not be changed.
74 |
75 | Args:
76 | id (str):
77 | body (WrappedTaskUpdate):
78 |
79 | Raises:
80 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
81 | httpx.TimeoutException: If the request takes longer than Client.timeout.
82 |
83 | Returns:
84 | Response[Union[Any, WrappedTask]]
85 | """
86 |
87 | kwargs = _get_kwargs(
88 | id=id,
89 | body=body,
90 | )
91 |
92 | response = client.get_httpx_client().request(
93 | **kwargs,
94 | )
95 |
96 | return _build_response(client=client, response=response)
97 |
98 |
99 | def sync(
100 | id: str,
101 | *,
102 | client: Union[AuthenticatedClient, Client],
103 | body: WrappedTaskUpdate,
104 | ) -> Optional[Union[Any, WrappedTask]]:
105 | """Update an existing task
106 |
107 | Update certain properties of an existing task. This will save the task in Dart for later access,
108 | search, etc. Any properties that are not specified will not be changed.
109 |
110 | Args:
111 | id (str):
112 | body (WrappedTaskUpdate):
113 |
114 | Raises:
115 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
116 | httpx.TimeoutException: If the request takes longer than Client.timeout.
117 |
118 | Returns:
119 | Union[Any, WrappedTask]
120 | """
121 |
122 | return sync_detailed(
123 | id=id,
124 | client=client,
125 | body=body,
126 | ).parsed
127 |
128 |
129 | async def asyncio_detailed(
130 | id: str,
131 | *,
132 | client: Union[AuthenticatedClient, Client],
133 | body: WrappedTaskUpdate,
134 | ) -> Response[Union[Any, WrappedTask]]:
135 | """Update an existing task
136 |
137 | Update certain properties of an existing task. This will save the task in Dart for later access,
138 | search, etc. Any properties that are not specified will not be changed.
139 |
140 | Args:
141 | id (str):
142 | body (WrappedTaskUpdate):
143 |
144 | Raises:
145 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
146 | httpx.TimeoutException: If the request takes longer than Client.timeout.
147 |
148 | Returns:
149 | Response[Union[Any, WrappedTask]]
150 | """
151 |
152 | kwargs = _get_kwargs(
153 | id=id,
154 | body=body,
155 | )
156 |
157 | response = await client.get_async_httpx_client().request(**kwargs)
158 |
159 | return _build_response(client=client, response=response)
160 |
161 |
162 | async def asyncio(
163 | id: str,
164 | *,
165 | client: Union[AuthenticatedClient, Client],
166 | body: WrappedTaskUpdate,
167 | ) -> Optional[Union[Any, WrappedTask]]:
168 | """Update an existing task
169 |
170 | Update certain properties of an existing task. This will save the task in Dart for later access,
171 | search, etc. Any properties that are not specified will not be changed.
172 |
173 | Args:
174 | id (str):
175 | body (WrappedTaskUpdate):
176 |
177 | Raises:
178 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
179 | httpx.TimeoutException: If the request takes longer than Client.timeout.
180 |
181 | Returns:
182 | Union[Any, WrappedTask]
183 | """
184 |
185 | return (
186 | await asyncio_detailed(
187 | id=id,
188 | client=client,
189 | body=body,
190 | )
191 | ).parsed
192 |
--------------------------------------------------------------------------------
/dart/generated/api/view/__init__.py:
--------------------------------------------------------------------------------
1 | """Contains endpoint functions for accessing the API"""
2 |
--------------------------------------------------------------------------------
/dart/generated/api/view/retrieve_view.py:
--------------------------------------------------------------------------------
1 | from http import HTTPStatus
2 | from typing import Any, Optional, Union, cast
3 |
4 | import httpx
5 |
6 | from ... import errors
7 | from ...client import AuthenticatedClient, Client
8 | from ...models.wrapped_view import WrappedView
9 | from ...types import Response
10 |
11 |
12 | def _get_kwargs(
13 | id: str,
14 | ) -> dict[str, Any]:
15 | _kwargs: dict[str, Any] = {
16 | "method": "get",
17 | "url": f"/views/{id}",
18 | }
19 |
20 | return _kwargs
21 |
22 |
23 | def _parse_response(
24 | *, client: Union[AuthenticatedClient, Client], response: httpx.Response
25 | ) -> Optional[Union[Any, WrappedView]]:
26 | if response.status_code == 200:
27 | response_200 = WrappedView.from_dict(response.json())
28 |
29 | return response_200
30 | if response.status_code == 400:
31 | response_400 = cast(Any, None)
32 | return response_400
33 | if response.status_code == 404:
34 | response_404 = cast(Any, None)
35 | return response_404
36 | if client.raise_on_unexpected_status:
37 | raise errors.UnexpectedStatus(response.status_code, response.content)
38 | else:
39 | return None
40 |
41 |
42 | def _build_response(
43 | *, client: Union[AuthenticatedClient, Client], response: httpx.Response
44 | ) -> Response[Union[Any, WrappedView]]:
45 | return Response(
46 | status_code=HTTPStatus(response.status_code),
47 | content=response.content,
48 | headers=response.headers,
49 | parsed=_parse_response(client=client, response=response),
50 | )
51 |
52 |
53 | def sync_detailed(
54 | id: str,
55 | *,
56 | client: Union[AuthenticatedClient, Client],
57 | ) -> Response[Union[Any, WrappedView]]:
58 | """Retrieve an existing view
59 |
60 | Retrieve an existing view. This will return the view's information, including the title,
61 | description, all tasks within it, and others.
62 |
63 | Args:
64 | id (str):
65 |
66 | Raises:
67 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
68 | httpx.TimeoutException: If the request takes longer than Client.timeout.
69 |
70 | Returns:
71 | Response[Union[Any, WrappedView]]
72 | """
73 |
74 | kwargs = _get_kwargs(
75 | id=id,
76 | )
77 |
78 | response = client.get_httpx_client().request(
79 | **kwargs,
80 | )
81 |
82 | return _build_response(client=client, response=response)
83 |
84 |
85 | def sync(
86 | id: str,
87 | *,
88 | client: Union[AuthenticatedClient, Client],
89 | ) -> Optional[Union[Any, WrappedView]]:
90 | """Retrieve an existing view
91 |
92 | Retrieve an existing view. This will return the view's information, including the title,
93 | description, all tasks within it, and others.
94 |
95 | Args:
96 | id (str):
97 |
98 | Raises:
99 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
100 | httpx.TimeoutException: If the request takes longer than Client.timeout.
101 |
102 | Returns:
103 | Union[Any, WrappedView]
104 | """
105 |
106 | return sync_detailed(
107 | id=id,
108 | client=client,
109 | ).parsed
110 |
111 |
112 | async def asyncio_detailed(
113 | id: str,
114 | *,
115 | client: Union[AuthenticatedClient, Client],
116 | ) -> Response[Union[Any, WrappedView]]:
117 | """Retrieve an existing view
118 |
119 | Retrieve an existing view. This will return the view's information, including the title,
120 | description, all tasks within it, and others.
121 |
122 | Args:
123 | id (str):
124 |
125 | Raises:
126 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
127 | httpx.TimeoutException: If the request takes longer than Client.timeout.
128 |
129 | Returns:
130 | Response[Union[Any, WrappedView]]
131 | """
132 |
133 | kwargs = _get_kwargs(
134 | id=id,
135 | )
136 |
137 | response = await client.get_async_httpx_client().request(**kwargs)
138 |
139 | return _build_response(client=client, response=response)
140 |
141 |
142 | async def asyncio(
143 | id: str,
144 | *,
145 | client: Union[AuthenticatedClient, Client],
146 | ) -> Optional[Union[Any, WrappedView]]:
147 | """Retrieve an existing view
148 |
149 | Retrieve an existing view. This will return the view's information, including the title,
150 | description, all tasks within it, and others.
151 |
152 | Args:
153 | id (str):
154 |
155 | Raises:
156 | errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
157 | httpx.TimeoutException: If the request takes longer than Client.timeout.
158 |
159 | Returns:
160 | Union[Any, WrappedView]
161 | """
162 |
163 | return (
164 | await asyncio_detailed(
165 | id=id,
166 | client=client,
167 | )
168 | ).parsed
169 |
--------------------------------------------------------------------------------
/dart/generated/errors.py:
--------------------------------------------------------------------------------
1 | """Contains shared errors types that can be raised from API functions"""
2 |
3 |
4 | class UnexpectedStatus(Exception):
5 | """Raised by api functions when the response status an undocumented status and Client.raise_on_unexpected_status is True"""
6 |
7 | def __init__(self, status_code: int, content: bytes):
8 | self.status_code = status_code
9 | self.content = content
10 |
11 | super().__init__(
12 | f"Unexpected status code: {status_code}\n\nResponse content:\n{content.decode(errors='ignore')}"
13 | )
14 |
15 |
16 | __all__ = ["UnexpectedStatus"]
17 |
--------------------------------------------------------------------------------
/dart/generated/models/__init__.py:
--------------------------------------------------------------------------------
1 | """Contains all the data models used in inputs/outputs"""
2 |
3 | from .comment import Comment
4 | from .comment_create import CommentCreate
5 | from .concise_doc import ConciseDoc
6 | from .concise_task import ConciseTask
7 | from .dartboard import Dartboard
8 | from .doc import Doc
9 | from .doc_create import DocCreate
10 | from .doc_update import DocUpdate
11 | from .folder import Folder
12 | from .list_docs_o_item import ListDocsOItem
13 | from .paginated_concise_doc_list import PaginatedConciseDocList
14 | from .paginated_concise_task_list import PaginatedConciseTaskList
15 | from .priority import Priority
16 | from .task import Task
17 | from .task_create import TaskCreate
18 | from .task_update import TaskUpdate
19 | from .user import User
20 | from .user_space_configuration import UserSpaceConfiguration
21 | from .view import View
22 | from .wrapped_comment import WrappedComment
23 | from .wrapped_comment_create import WrappedCommentCreate
24 | from .wrapped_dartboard import WrappedDartboard
25 | from .wrapped_doc import WrappedDoc
26 | from .wrapped_doc_create import WrappedDocCreate
27 | from .wrapped_doc_update import WrappedDocUpdate
28 | from .wrapped_folder import WrappedFolder
29 | from .wrapped_task import WrappedTask
30 | from .wrapped_task_create import WrappedTaskCreate
31 | from .wrapped_task_update import WrappedTaskUpdate
32 | from .wrapped_view import WrappedView
33 |
34 | __all__ = (
35 | "Comment",
36 | "CommentCreate",
37 | "ConciseDoc",
38 | "ConciseTask",
39 | "Dartboard",
40 | "Doc",
41 | "DocCreate",
42 | "DocUpdate",
43 | "Folder",
44 | "ListDocsOItem",
45 | "PaginatedConciseDocList",
46 | "PaginatedConciseTaskList",
47 | "Priority",
48 | "Task",
49 | "TaskCreate",
50 | "TaskUpdate",
51 | "User",
52 | "UserSpaceConfiguration",
53 | "View",
54 | "WrappedComment",
55 | "WrappedCommentCreate",
56 | "WrappedDartboard",
57 | "WrappedDoc",
58 | "WrappedDocCreate",
59 | "WrappedDocUpdate",
60 | "WrappedFolder",
61 | "WrappedTask",
62 | "WrappedTaskCreate",
63 | "WrappedTaskUpdate",
64 | "WrappedView",
65 | )
66 |
--------------------------------------------------------------------------------
/dart/generated/models/comment.py:
--------------------------------------------------------------------------------
1 | from collections.abc import Mapping
2 | from typing import Any, TypeVar
3 |
4 | from attrs import define as _attrs_define
5 | from attrs import field as _attrs_field
6 |
7 | T = TypeVar("T", bound="Comment")
8 |
9 |
10 | @_attrs_define
11 | class Comment:
12 | """
13 | Attributes:
14 | id (str): The universal, unique ID of the comment.
15 | html_url (str): The URL that can be used to open the comment in the Dart web UI.
16 | task_id (str): The universal, unique ID of the task that the comment is associated with.
17 | author (str): The name or email of the user that authored the comment.
18 | text (str): The full content of the comment, which can include markdown formatting.
19 | """
20 |
21 | id: str
22 | html_url: str
23 | task_id: str
24 | author: str
25 | text: str
26 | additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
27 |
28 | def to_dict(self) -> dict[str, Any]:
29 | id = self.id
30 |
31 | html_url = self.html_url
32 |
33 | task_id = self.task_id
34 |
35 | author = self.author
36 |
37 | text = self.text
38 |
39 | field_dict: dict[str, Any] = {}
40 | field_dict.update(self.additional_properties)
41 | field_dict.update(
42 | {
43 | "id": id,
44 | "htmlUrl": html_url,
45 | "taskId": task_id,
46 | "author": author,
47 | "text": text,
48 | }
49 | )
50 |
51 | return field_dict
52 |
53 | @classmethod
54 | def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
55 | d = dict(src_dict)
56 | id = d.pop("id")
57 |
58 | html_url = d.pop("htmlUrl")
59 |
60 | task_id = d.pop("taskId")
61 |
62 | author = d.pop("author")
63 |
64 | text = d.pop("text")
65 |
66 | comment = cls(
67 | id=id,
68 | html_url=html_url,
69 | task_id=task_id,
70 | author=author,
71 | text=text,
72 | )
73 |
74 | comment.additional_properties = d
75 | return comment
76 |
77 | @property
78 | def additional_keys(self) -> list[str]:
79 | return list(self.additional_properties.keys())
80 |
81 | def __getitem__(self, key: str) -> Any:
82 | return self.additional_properties[key]
83 |
84 | def __setitem__(self, key: str, value: Any) -> None:
85 | self.additional_properties[key] = value
86 |
87 | def __delitem__(self, key: str) -> None:
88 | del self.additional_properties[key]
89 |
90 | def __contains__(self, key: str) -> bool:
91 | return key in self.additional_properties
92 |
--------------------------------------------------------------------------------
/dart/generated/models/comment_create.py:
--------------------------------------------------------------------------------
1 | from collections.abc import Mapping
2 | from typing import Any, TypeVar
3 |
4 | from attrs import define as _attrs_define
5 | from attrs import field as _attrs_field
6 |
7 | T = TypeVar("T", bound="CommentCreate")
8 |
9 |
10 | @_attrs_define
11 | class CommentCreate:
12 | """
13 | Attributes:
14 | task_id (str): The universal, unique ID of the task that the comment is associated with.
15 | text (str): The full content of the comment, which can include markdown formatting.
16 | """
17 |
18 | task_id: str
19 | text: str
20 | additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
21 |
22 | def to_dict(self) -> dict[str, Any]:
23 | task_id = self.task_id
24 |
25 | text = self.text
26 |
27 | field_dict: dict[str, Any] = {}
28 | field_dict.update(self.additional_properties)
29 | field_dict.update(
30 | {
31 | "taskId": task_id,
32 | "text": text,
33 | }
34 | )
35 |
36 | return field_dict
37 |
38 | @classmethod
39 | def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
40 | d = dict(src_dict)
41 | task_id = d.pop("taskId")
42 |
43 | text = d.pop("text")
44 |
45 | comment_create = cls(
46 | task_id=task_id,
47 | text=text,
48 | )
49 |
50 | comment_create.additional_properties = d
51 | return comment_create
52 |
53 | @property
54 | def additional_keys(self) -> list[str]:
55 | return list(self.additional_properties.keys())
56 |
57 | def __getitem__(self, key: str) -> Any:
58 | return self.additional_properties[key]
59 |
60 | def __setitem__(self, key: str, value: Any) -> None:
61 | self.additional_properties[key] = value
62 |
63 | def __delitem__(self, key: str) -> None:
64 | del self.additional_properties[key]
65 |
66 | def __contains__(self, key: str) -> bool:
67 | return key in self.additional_properties
68 |
--------------------------------------------------------------------------------
/dart/generated/models/concise_doc.py:
--------------------------------------------------------------------------------
1 | from collections.abc import Mapping
2 | from typing import Any, TypeVar
3 |
4 | from attrs import define as _attrs_define
5 | from attrs import field as _attrs_field
6 |
7 | T = TypeVar("T", bound="ConciseDoc")
8 |
9 |
10 | @_attrs_define
11 | class ConciseDoc:
12 | """This concise doc serializer is going to be used in docs listing view only.
13 |
14 | Attributes:
15 | id (str): The universal, unique ID of the doc.
16 | html_url (str): The URL that can be used to open the doc in the Dart web UI.
17 | title (str): The title, which is a short description of the doc.
18 | folder (str): The full title of the folder, which is a project or list of docs.
19 | """
20 |
21 | id: str
22 | html_url: str
23 | title: str
24 | folder: str
25 | additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
26 |
27 | def to_dict(self) -> dict[str, Any]:
28 | id = self.id
29 |
30 | html_url = self.html_url
31 |
32 | title = self.title
33 |
34 | folder = self.folder
35 |
36 | field_dict: dict[str, Any] = {}
37 | field_dict.update(self.additional_properties)
38 | field_dict.update(
39 | {
40 | "id": id,
41 | "htmlUrl": html_url,
42 | "title": title,
43 | "folder": folder,
44 | }
45 | )
46 |
47 | return field_dict
48 |
49 | @classmethod
50 | def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
51 | d = dict(src_dict)
52 | id = d.pop("id")
53 |
54 | html_url = d.pop("htmlUrl")
55 |
56 | title = d.pop("title")
57 |
58 | folder = d.pop("folder")
59 |
60 | concise_doc = cls(
61 | id=id,
62 | html_url=html_url,
63 | title=title,
64 | folder=folder,
65 | )
66 |
67 | concise_doc.additional_properties = d
68 | return concise_doc
69 |
70 | @property
71 | def additional_keys(self) -> list[str]:
72 | return list(self.additional_properties.keys())
73 |
74 | def __getitem__(self, key: str) -> Any:
75 | return self.additional_properties[key]
76 |
77 | def __setitem__(self, key: str, value: Any) -> None:
78 | self.additional_properties[key] = value
79 |
80 | def __delitem__(self, key: str) -> None:
81 | del self.additional_properties[key]
82 |
83 | def __contains__(self, key: str) -> bool:
84 | return key in self.additional_properties
85 |
--------------------------------------------------------------------------------
/dart/generated/models/concise_task.py:
--------------------------------------------------------------------------------
1 | from collections.abc import Mapping
2 | from typing import Any, TypeVar, Union, cast
3 |
4 | from attrs import define as _attrs_define
5 | from attrs import field as _attrs_field
6 |
7 | from ..models.priority import Priority
8 | from ..types import UNSET, Unset
9 |
10 | T = TypeVar("T", bound="ConciseTask")
11 |
12 |
13 | @_attrs_define
14 | class ConciseTask:
15 | """This concise task serializer is going to be used in tasks listing view only.
16 |
17 | Attributes:
18 | id (str): The universal, unique ID of the task.
19 | html_url (str): The URL that can be used to open the task in the Dart web UI.
20 | title (str): The title, which is a short description of what needs to be done.
21 | parent_id (Union[None, str]): The universal, unique ID of the parent task. This can be null.
22 | dartboard (str): The full title of the dartboard, which is a project or list of tasks.
23 | type_ (str): The title of the type of the task.
24 | status (str): The status from the list of available statuses.
25 | assignees (Union[Unset, list[str]]): The names or emails of the users that the task is assigned to. Either this
26 | or assignee must be included, depending on whether the workspaces allows multiple assignees or not.
27 | assignee (Union[None, Unset, str]): The name or email of the user that the task is assigned to. Either this or
28 | assignees must be included, depending on whether the workspaces allows multiple assignees or not.
29 | tags (Union[Unset, list[str]]): Any tags that should be applied to the task, which can be used to filter and
30 | search for tasks. Tags are also known as labels or components and are strings that can be anything, but should
31 | be short and descriptive. This list can be empty.
32 | priority (Union[None, Priority, Unset]): The priority, which is a string that can be one of the specified
33 | options. This is used to sort tasks and determine which tasks should be done first.
34 | start_at (Union[None, Unset, str]): The start date, which is a date that the task should be started by in ISO
35 | format, like YYYY-MM-DD.
36 | due_at (Union[None, Unset, str]): The due date, which is a date that the task should be completed by in ISO
37 | format, like YYYY-MM-DD.
38 | size (Union[None, Unset, int, str]): The size, which represents the amount of work that needs to be done. This
39 | is used to determine how long the task will take to complete.
40 | time_tracking (Union[Unset, str]): The time tracking, which is a string that indicates the amount of time spent
41 | on the task in hh:mm:ss format (or an empty string if no time has been tracked).
42 | """
43 |
44 | id: str
45 | html_url: str
46 | title: str
47 | parent_id: Union[None, str]
48 | dartboard: str
49 | type_: str
50 | status: str
51 | assignees: Union[Unset, list[str]] = UNSET
52 | assignee: Union[None, Unset, str] = UNSET
53 | tags: Union[Unset, list[str]] = UNSET
54 | priority: Union[None, Priority, Unset] = UNSET
55 | start_at: Union[None, Unset, str] = UNSET
56 | due_at: Union[None, Unset, str] = UNSET
57 | size: Union[None, Unset, int, str] = UNSET
58 | time_tracking: Union[Unset, str] = UNSET
59 | additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
60 |
61 | def to_dict(self) -> dict[str, Any]:
62 | id = self.id
63 |
64 | html_url = self.html_url
65 |
66 | title = self.title
67 |
68 | parent_id: Union[None, str]
69 | parent_id = self.parent_id
70 |
71 | dartboard = self.dartboard
72 |
73 | type_ = self.type_
74 |
75 | status = self.status
76 |
77 | assignees: Union[Unset, list[str]] = UNSET
78 | if not isinstance(self.assignees, Unset):
79 | assignees = self.assignees
80 |
81 | assignee: Union[None, Unset, str]
82 | if isinstance(self.assignee, Unset):
83 | assignee = UNSET
84 | else:
85 | assignee = self.assignee
86 |
87 | tags: Union[Unset, list[str]] = UNSET
88 | if not isinstance(self.tags, Unset):
89 | tags = self.tags
90 |
91 | priority: Union[None, Unset, str]
92 | if isinstance(self.priority, Unset):
93 | priority = UNSET
94 | elif isinstance(self.priority, Priority):
95 | priority = self.priority.value
96 | else:
97 | priority = self.priority
98 |
99 | start_at: Union[None, Unset, str]
100 | if isinstance(self.start_at, Unset):
101 | start_at = UNSET
102 | else:
103 | start_at = self.start_at
104 |
105 | due_at: Union[None, Unset, str]
106 | if isinstance(self.due_at, Unset):
107 | due_at = UNSET
108 | else:
109 | due_at = self.due_at
110 |
111 | size: Union[None, Unset, int, str]
112 | if isinstance(self.size, Unset):
113 | size = UNSET
114 | else:
115 | size = self.size
116 |
117 | time_tracking = self.time_tracking
118 |
119 | field_dict: dict[str, Any] = {}
120 | field_dict.update(self.additional_properties)
121 | field_dict.update(
122 | {
123 | "id": id,
124 | "htmlUrl": html_url,
125 | "title": title,
126 | "parentId": parent_id,
127 | "dartboard": dartboard,
128 | "type": type_,
129 | "status": status,
130 | }
131 | )
132 | if assignees is not UNSET:
133 | field_dict["assignees"] = assignees
134 | if assignee is not UNSET:
135 | field_dict["assignee"] = assignee
136 | if tags is not UNSET:
137 | field_dict["tags"] = tags
138 | if priority is not UNSET:
139 | field_dict["priority"] = priority
140 | if start_at is not UNSET:
141 | field_dict["startAt"] = start_at
142 | if due_at is not UNSET:
143 | field_dict["dueAt"] = due_at
144 | if size is not UNSET:
145 | field_dict["size"] = size
146 | if time_tracking is not UNSET:
147 | field_dict["timeTracking"] = time_tracking
148 |
149 | return field_dict
150 |
151 | @classmethod
152 | def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
153 | d = dict(src_dict)
154 | id = d.pop("id")
155 |
156 | html_url = d.pop("htmlUrl")
157 |
158 | title = d.pop("title")
159 |
160 | def _parse_parent_id(data: object) -> Union[None, str]:
161 | if data is None:
162 | return data
163 | return cast(Union[None, str], data)
164 |
165 | parent_id = _parse_parent_id(d.pop("parentId"))
166 |
167 | dartboard = d.pop("dartboard")
168 |
169 | type_ = d.pop("type")
170 |
171 | status = d.pop("status")
172 |
173 | assignees = cast(list[str], d.pop("assignees", UNSET))
174 |
175 | def _parse_assignee(data: object) -> Union[None, Unset, str]:
176 | if data is None:
177 | return data
178 | if isinstance(data, Unset):
179 | return data
180 | return cast(Union[None, Unset, str], data)
181 |
182 | assignee = _parse_assignee(d.pop("assignee", UNSET))
183 |
184 | tags = cast(list[str], d.pop("tags", UNSET))
185 |
186 | def _parse_priority(data: object) -> Union[None, Priority, Unset]:
187 | if data is None:
188 | return data
189 | if isinstance(data, Unset):
190 | return data
191 | try:
192 | if not isinstance(data, str):
193 | raise TypeError()
194 | priority_type_0 = Priority(data)
195 |
196 | return priority_type_0
197 | except: # noqa: E722
198 | pass
199 | return cast(Union[None, Priority, Unset], data)
200 |
201 | priority = _parse_priority(d.pop("priority", UNSET))
202 |
203 | def _parse_start_at(data: object) -> Union[None, Unset, str]:
204 | if data is None:
205 | return data
206 | if isinstance(data, Unset):
207 | return data
208 | return cast(Union[None, Unset, str], data)
209 |
210 | start_at = _parse_start_at(d.pop("startAt", UNSET))
211 |
212 | def _parse_due_at(data: object) -> Union[None, Unset, str]:
213 | if data is None:
214 | return data
215 | if isinstance(data, Unset):
216 | return data
217 | return cast(Union[None, Unset, str], data)
218 |
219 | due_at = _parse_due_at(d.pop("dueAt", UNSET))
220 |
221 | def _parse_size(data: object) -> Union[None, Unset, int, str]:
222 | if data is None:
223 | return data
224 | if isinstance(data, Unset):
225 | return data
226 | return cast(Union[None, Unset, int, str], data)
227 |
228 | size = _parse_size(d.pop("size", UNSET))
229 |
230 | time_tracking = d.pop("timeTracking", UNSET)
231 |
232 | concise_task = cls(
233 | id=id,
234 | html_url=html_url,
235 | title=title,
236 | parent_id=parent_id,
237 | dartboard=dartboard,
238 | type_=type_,
239 | status=status,
240 | assignees=assignees,
241 | assignee=assignee,
242 | tags=tags,
243 | priority=priority,
244 | start_at=start_at,
245 | due_at=due_at,
246 | size=size,
247 | time_tracking=time_tracking,
248 | )
249 |
250 | concise_task.additional_properties = d
251 | return concise_task
252 |
253 | @property
254 | def additional_keys(self) -> list[str]:
255 | return list(self.additional_properties.keys())
256 |
257 | def __getitem__(self, key: str) -> Any:
258 | return self.additional_properties[key]
259 |
260 | def __setitem__(self, key: str, value: Any) -> None:
261 | self.additional_properties[key] = value
262 |
263 | def __delitem__(self, key: str) -> None:
264 | del self.additional_properties[key]
265 |
266 | def __contains__(self, key: str) -> bool:
267 | return key in self.additional_properties
268 |
--------------------------------------------------------------------------------
/dart/generated/models/dartboard.py:
--------------------------------------------------------------------------------
1 | from collections.abc import Mapping
2 | from typing import TYPE_CHECKING, Any, TypeVar
3 |
4 | from attrs import define as _attrs_define
5 | from attrs import field as _attrs_field
6 |
7 | if TYPE_CHECKING:
8 | from ..models.task import Task
9 |
10 |
11 | T = TypeVar("T", bound="Dartboard")
12 |
13 |
14 | @_attrs_define
15 | class Dartboard:
16 | """
17 | Attributes:
18 | id (str): The universal, unique ID of the dartboard.
19 | html_url (str): The URL that can be used to open the dartboard in the Dart web UI.
20 | title (str): The title, which is a short description of the dartboard.
21 | description (str): The description, which is a longer description of the dartboard.
22 | tasks (list['Task']): The list of all of the tasks in the dartboard.
23 | """
24 |
25 | id: str
26 | html_url: str
27 | title: str
28 | description: str
29 | tasks: list["Task"]
30 | additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
31 |
32 | def to_dict(self) -> dict[str, Any]:
33 | id = self.id
34 |
35 | html_url = self.html_url
36 |
37 | title = self.title
38 |
39 | description = self.description
40 |
41 | tasks = []
42 | for tasks_item_data in self.tasks:
43 | tasks_item = tasks_item_data.to_dict()
44 | tasks.append(tasks_item)
45 |
46 | field_dict: dict[str, Any] = {}
47 | field_dict.update(self.additional_properties)
48 | field_dict.update(
49 | {
50 | "id": id,
51 | "htmlUrl": html_url,
52 | "title": title,
53 | "description": description,
54 | "tasks": tasks,
55 | }
56 | )
57 |
58 | return field_dict
59 |
60 | @classmethod
61 | def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
62 | from ..models.task import Task
63 |
64 | d = dict(src_dict)
65 | id = d.pop("id")
66 |
67 | html_url = d.pop("htmlUrl")
68 |
69 | title = d.pop("title")
70 |
71 | description = d.pop("description")
72 |
73 | tasks = []
74 | _tasks = d.pop("tasks")
75 | for tasks_item_data in _tasks:
76 | tasks_item = Task.from_dict(tasks_item_data)
77 |
78 | tasks.append(tasks_item)
79 |
80 | dartboard = cls(
81 | id=id,
82 | html_url=html_url,
83 | title=title,
84 | description=description,
85 | tasks=tasks,
86 | )
87 |
88 | dartboard.additional_properties = d
89 | return dartboard
90 |
91 | @property
92 | def additional_keys(self) -> list[str]:
93 | return list(self.additional_properties.keys())
94 |
95 | def __getitem__(self, key: str) -> Any:
96 | return self.additional_properties[key]
97 |
98 | def __setitem__(self, key: str, value: Any) -> None:
99 | self.additional_properties[key] = value
100 |
101 | def __delitem__(self, key: str) -> None:
102 | del self.additional_properties[key]
103 |
104 | def __contains__(self, key: str) -> bool:
105 | return key in self.additional_properties
106 |
--------------------------------------------------------------------------------
/dart/generated/models/doc.py:
--------------------------------------------------------------------------------
1 | from collections.abc import Mapping
2 | from typing import Any, TypeVar
3 |
4 | from attrs import define as _attrs_define
5 | from attrs import field as _attrs_field
6 |
7 | T = TypeVar("T", bound="Doc")
8 |
9 |
10 | @_attrs_define
11 | class Doc:
12 | """
13 | Attributes:
14 | id (str): The universal, unique ID of the doc.
15 | html_url (str): The URL that can be used to open the doc in the Dart web UI.
16 | title (str): The title, which is a short description of the doc.
17 | folder (str): The full title of the folder, which is a project or list of docs.
18 | text (str): The full content of the doc, which can include markdown formatting.
19 | """
20 |
21 | id: str
22 | html_url: str
23 | title: str
24 | folder: str
25 | text: str
26 | additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
27 |
28 | def to_dict(self) -> dict[str, Any]:
29 | id = self.id
30 |
31 | html_url = self.html_url
32 |
33 | title = self.title
34 |
35 | folder = self.folder
36 |
37 | text = self.text
38 |
39 | field_dict: dict[str, Any] = {}
40 | field_dict.update(self.additional_properties)
41 | field_dict.update(
42 | {
43 | "id": id,
44 | "htmlUrl": html_url,
45 | "title": title,
46 | "folder": folder,
47 | "text": text,
48 | }
49 | )
50 |
51 | return field_dict
52 |
53 | @classmethod
54 | def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
55 | d = dict(src_dict)
56 | id = d.pop("id")
57 |
58 | html_url = d.pop("htmlUrl")
59 |
60 | title = d.pop("title")
61 |
62 | folder = d.pop("folder")
63 |
64 | text = d.pop("text")
65 |
66 | doc = cls(
67 | id=id,
68 | html_url=html_url,
69 | title=title,
70 | folder=folder,
71 | text=text,
72 | )
73 |
74 | doc.additional_properties = d
75 | return doc
76 |
77 | @property
78 | def additional_keys(self) -> list[str]:
79 | return list(self.additional_properties.keys())
80 |
81 | def __getitem__(self, key: str) -> Any:
82 | return self.additional_properties[key]
83 |
84 | def __setitem__(self, key: str, value: Any) -> None:
85 | self.additional_properties[key] = value
86 |
87 | def __delitem__(self, key: str) -> None:
88 | del self.additional_properties[key]
89 |
90 | def __contains__(self, key: str) -> bool:
91 | return key in self.additional_properties
92 |
--------------------------------------------------------------------------------
/dart/generated/models/doc_create.py:
--------------------------------------------------------------------------------
1 | from collections.abc import Mapping
2 | from typing import Any, TypeVar, Union
3 |
4 | from attrs import define as _attrs_define
5 | from attrs import field as _attrs_field
6 |
7 | from ..types import UNSET, Unset
8 |
9 | T = TypeVar("T", bound="DocCreate")
10 |
11 |
12 | @_attrs_define
13 | class DocCreate:
14 | """
15 | Attributes:
16 | title (str): The title, which is a short description of the doc.
17 | folder (Union[Unset, str]): The full title of the folder, which is a project or list of docs.
18 | text (Union[Unset, str]): The full content of the doc, which can include markdown formatting.
19 | """
20 |
21 | title: str
22 | folder: Union[Unset, str] = UNSET
23 | text: Union[Unset, str] = UNSET
24 | additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
25 |
26 | def to_dict(self) -> dict[str, Any]:
27 | title = self.title
28 |
29 | folder = self.folder
30 |
31 | text = self.text
32 |
33 | field_dict: dict[str, Any] = {}
34 | field_dict.update(self.additional_properties)
35 | field_dict.update(
36 | {
37 | "title": title,
38 | }
39 | )
40 | if folder is not UNSET:
41 | field_dict["folder"] = folder
42 | if text is not UNSET:
43 | field_dict["text"] = text
44 |
45 | return field_dict
46 |
47 | @classmethod
48 | def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
49 | d = dict(src_dict)
50 | title = d.pop("title")
51 |
52 | folder = d.pop("folder", UNSET)
53 |
54 | text = d.pop("text", UNSET)
55 |
56 | doc_create = cls(
57 | title=title,
58 | folder=folder,
59 | text=text,
60 | )
61 |
62 | doc_create.additional_properties = d
63 | return doc_create
64 |
65 | @property
66 | def additional_keys(self) -> list[str]:
67 | return list(self.additional_properties.keys())
68 |
69 | def __getitem__(self, key: str) -> Any:
70 | return self.additional_properties[key]
71 |
72 | def __setitem__(self, key: str, value: Any) -> None:
73 | self.additional_properties[key] = value
74 |
75 | def __delitem__(self, key: str) -> None:
76 | del self.additional_properties[key]
77 |
78 | def __contains__(self, key: str) -> bool:
79 | return key in self.additional_properties
80 |
--------------------------------------------------------------------------------
/dart/generated/models/doc_update.py:
--------------------------------------------------------------------------------
1 | from collections.abc import Mapping
2 | from typing import Any, TypeVar, Union
3 |
4 | from attrs import define as _attrs_define
5 | from attrs import field as _attrs_field
6 |
7 | from ..types import UNSET, Unset
8 |
9 | T = TypeVar("T", bound="DocUpdate")
10 |
11 |
12 | @_attrs_define
13 | class DocUpdate:
14 | """
15 | Attributes:
16 | id (str): The universal, unique ID of the doc.
17 | title (Union[Unset, str]): The title, which is a short description of the doc.
18 | folder (Union[Unset, str]): The full title of the folder, which is a project or list of docs.
19 | text (Union[Unset, str]): The full content of the doc, which can include markdown formatting.
20 | """
21 |
22 | id: str
23 | title: Union[Unset, str] = UNSET
24 | folder: Union[Unset, str] = UNSET
25 | text: Union[Unset, str] = UNSET
26 | additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
27 |
28 | def to_dict(self) -> dict[str, Any]:
29 | id = self.id
30 |
31 | title = self.title
32 |
33 | folder = self.folder
34 |
35 | text = self.text
36 |
37 | field_dict: dict[str, Any] = {}
38 | field_dict.update(self.additional_properties)
39 | field_dict.update(
40 | {
41 | "id": id,
42 | }
43 | )
44 | if title is not UNSET:
45 | field_dict["title"] = title
46 | if folder is not UNSET:
47 | field_dict["folder"] = folder
48 | if text is not UNSET:
49 | field_dict["text"] = text
50 |
51 | return field_dict
52 |
53 | @classmethod
54 | def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
55 | d = dict(src_dict)
56 | id = d.pop("id")
57 |
58 | title = d.pop("title", UNSET)
59 |
60 | folder = d.pop("folder", UNSET)
61 |
62 | text = d.pop("text", UNSET)
63 |
64 | doc_update = cls(
65 | id=id,
66 | title=title,
67 | folder=folder,
68 | text=text,
69 | )
70 |
71 | doc_update.additional_properties = d
72 | return doc_update
73 |
74 | @property
75 | def additional_keys(self) -> list[str]:
76 | return list(self.additional_properties.keys())
77 |
78 | def __getitem__(self, key: str) -> Any:
79 | return self.additional_properties[key]
80 |
81 | def __setitem__(self, key: str, value: Any) -> None:
82 | self.additional_properties[key] = value
83 |
84 | def __delitem__(self, key: str) -> None:
85 | del self.additional_properties[key]
86 |
87 | def __contains__(self, key: str) -> bool:
88 | return key in self.additional_properties
89 |
--------------------------------------------------------------------------------
/dart/generated/models/folder.py:
--------------------------------------------------------------------------------
1 | from collections.abc import Mapping
2 | from typing import TYPE_CHECKING, Any, TypeVar
3 |
4 | from attrs import define as _attrs_define
5 | from attrs import field as _attrs_field
6 |
7 | if TYPE_CHECKING:
8 | from ..models.doc import Doc
9 |
10 |
11 | T = TypeVar("T", bound="Folder")
12 |
13 |
14 | @_attrs_define
15 | class Folder:
16 | """
17 | Attributes:
18 | id (str): The universal, unique ID of the folder.
19 | html_url (str): The URL that can be used to open the folder in the Dart web UI.
20 | title (str): The title, which is a short description of the folder.
21 | description (str): The description, which is a longer description of the folder.
22 | docs (list['Doc']): The list of all of the docs in the folder.
23 | """
24 |
25 | id: str
26 | html_url: str
27 | title: str
28 | description: str
29 | docs: list["Doc"]
30 | additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
31 |
32 | def to_dict(self) -> dict[str, Any]:
33 | id = self.id
34 |
35 | html_url = self.html_url
36 |
37 | title = self.title
38 |
39 | description = self.description
40 |
41 | docs = []
42 | for docs_item_data in self.docs:
43 | docs_item = docs_item_data.to_dict()
44 | docs.append(docs_item)
45 |
46 | field_dict: dict[str, Any] = {}
47 | field_dict.update(self.additional_properties)
48 | field_dict.update(
49 | {
50 | "id": id,
51 | "htmlUrl": html_url,
52 | "title": title,
53 | "description": description,
54 | "docs": docs,
55 | }
56 | )
57 |
58 | return field_dict
59 |
60 | @classmethod
61 | def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
62 | from ..models.doc import Doc
63 |
64 | d = dict(src_dict)
65 | id = d.pop("id")
66 |
67 | html_url = d.pop("htmlUrl")
68 |
69 | title = d.pop("title")
70 |
71 | description = d.pop("description")
72 |
73 | docs = []
74 | _docs = d.pop("docs")
75 | for docs_item_data in _docs:
76 | docs_item = Doc.from_dict(docs_item_data)
77 |
78 | docs.append(docs_item)
79 |
80 | folder = cls(
81 | id=id,
82 | html_url=html_url,
83 | title=title,
84 | description=description,
85 | docs=docs,
86 | )
87 |
88 | folder.additional_properties = d
89 | return folder
90 |
91 | @property
92 | def additional_keys(self) -> list[str]:
93 | return list(self.additional_properties.keys())
94 |
95 | def __getitem__(self, key: str) -> Any:
96 | return self.additional_properties[key]
97 |
98 | def __setitem__(self, key: str, value: Any) -> None:
99 | self.additional_properties[key] = value
100 |
101 | def __delitem__(self, key: str) -> None:
102 | del self.additional_properties[key]
103 |
104 | def __contains__(self, key: str) -> bool:
105 | return key in self.additional_properties
106 |
--------------------------------------------------------------------------------
/dart/generated/models/list_docs_o_item.py:
--------------------------------------------------------------------------------
1 | from enum import Enum
2 |
3 |
4 | class ListDocsOItem(str, Enum):
5 | CREATED_AT = "created_at"
6 | ORDER = "order"
7 | TITLE = "title"
8 | UPDATED_AT = "updated_at"
9 | VALUE_0 = "-created_at"
10 | VALUE_1 = "-order"
11 | VALUE_2 = "-title"
12 | VALUE_3 = "-updated_at"
13 |
14 | def __str__(self) -> str:
15 | return str(self.value)
16 |
--------------------------------------------------------------------------------
/dart/generated/models/paginated_concise_doc_list.py:
--------------------------------------------------------------------------------
1 | from collections.abc import Mapping
2 | from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
3 |
4 | from attrs import define as _attrs_define
5 | from attrs import field as _attrs_field
6 |
7 | from ..types import UNSET, Unset
8 |
9 | if TYPE_CHECKING:
10 | from ..models.concise_doc import ConciseDoc
11 |
12 |
13 | T = TypeVar("T", bound="PaginatedConciseDocList")
14 |
15 |
16 | @_attrs_define
17 | class PaginatedConciseDocList:
18 | """
19 | Attributes:
20 | count (int): Example: 123.
21 | results (list['ConciseDoc']):
22 | next_ (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=400&limit=100.
23 | previous (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=200&limit=100.
24 | """
25 |
26 | count: int
27 | results: list["ConciseDoc"]
28 | next_: Union[None, Unset, str] = UNSET
29 | previous: Union[None, Unset, str] = UNSET
30 | additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
31 |
32 | def to_dict(self) -> dict[str, Any]:
33 | count = self.count
34 |
35 | results = []
36 | for results_item_data in self.results:
37 | results_item = results_item_data.to_dict()
38 | results.append(results_item)
39 |
40 | next_: Union[None, Unset, str]
41 | if isinstance(self.next_, Unset):
42 | next_ = UNSET
43 | else:
44 | next_ = self.next_
45 |
46 | previous: Union[None, Unset, str]
47 | if isinstance(self.previous, Unset):
48 | previous = UNSET
49 | else:
50 | previous = self.previous
51 |
52 | field_dict: dict[str, Any] = {}
53 | field_dict.update(self.additional_properties)
54 | field_dict.update(
55 | {
56 | "count": count,
57 | "results": results,
58 | }
59 | )
60 | if next_ is not UNSET:
61 | field_dict["next"] = next_
62 | if previous is not UNSET:
63 | field_dict["previous"] = previous
64 |
65 | return field_dict
66 |
67 | @classmethod
68 | def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
69 | from ..models.concise_doc import ConciseDoc
70 |
71 | d = dict(src_dict)
72 | count = d.pop("count")
73 |
74 | results = []
75 | _results = d.pop("results")
76 | for results_item_data in _results:
77 | results_item = ConciseDoc.from_dict(results_item_data)
78 |
79 | results.append(results_item)
80 |
81 | def _parse_next_(data: object) -> Union[None, Unset, str]:
82 | if data is None:
83 | return data
84 | if isinstance(data, Unset):
85 | return data
86 | return cast(Union[None, Unset, str], data)
87 |
88 | next_ = _parse_next_(d.pop("next", UNSET))
89 |
90 | def _parse_previous(data: object) -> Union[None, Unset, str]:
91 | if data is None:
92 | return data
93 | if isinstance(data, Unset):
94 | return data
95 | return cast(Union[None, Unset, str], data)
96 |
97 | previous = _parse_previous(d.pop("previous", UNSET))
98 |
99 | paginated_concise_doc_list = cls(
100 | count=count,
101 | results=results,
102 | next_=next_,
103 | previous=previous,
104 | )
105 |
106 | paginated_concise_doc_list.additional_properties = d
107 | return paginated_concise_doc_list
108 |
109 | @property
110 | def additional_keys(self) -> list[str]:
111 | return list(self.additional_properties.keys())
112 |
113 | def __getitem__(self, key: str) -> Any:
114 | return self.additional_properties[key]
115 |
116 | def __setitem__(self, key: str, value: Any) -> None:
117 | self.additional_properties[key] = value
118 |
119 | def __delitem__(self, key: str) -> None:
120 | del self.additional_properties[key]
121 |
122 | def __contains__(self, key: str) -> bool:
123 | return key in self.additional_properties
124 |
--------------------------------------------------------------------------------
/dart/generated/models/paginated_concise_task_list.py:
--------------------------------------------------------------------------------
1 | from collections.abc import Mapping
2 | from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
3 |
4 | from attrs import define as _attrs_define
5 | from attrs import field as _attrs_field
6 |
7 | from ..types import UNSET, Unset
8 |
9 | if TYPE_CHECKING:
10 | from ..models.concise_task import ConciseTask
11 |
12 |
13 | T = TypeVar("T", bound="PaginatedConciseTaskList")
14 |
15 |
16 | @_attrs_define
17 | class PaginatedConciseTaskList:
18 | """
19 | Attributes:
20 | count (int): Example: 123.
21 | results (list['ConciseTask']):
22 | next_ (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=400&limit=100.
23 | previous (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=200&limit=100.
24 | """
25 |
26 | count: int
27 | results: list["ConciseTask"]
28 | next_: Union[None, Unset, str] = UNSET
29 | previous: Union[None, Unset, str] = UNSET
30 | additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
31 |
32 | def to_dict(self) -> dict[str, Any]:
33 | count = self.count
34 |
35 | results = []
36 | for results_item_data in self.results:
37 | results_item = results_item_data.to_dict()
38 | results.append(results_item)
39 |
40 | next_: Union[None, Unset, str]
41 | if isinstance(self.next_, Unset):
42 | next_ = UNSET
43 | else:
44 | next_ = self.next_
45 |
46 | previous: Union[None, Unset, str]
47 | if isinstance(self.previous, Unset):
48 | previous = UNSET
49 | else:
50 | previous = self.previous
51 |
52 | field_dict: dict[str, Any] = {}
53 | field_dict.update(self.additional_properties)
54 | field_dict.update(
55 | {
56 | "count": count,
57 | "results": results,
58 | }
59 | )
60 | if next_ is not UNSET:
61 | field_dict["next"] = next_
62 | if previous is not UNSET:
63 | field_dict["previous"] = previous
64 |
65 | return field_dict
66 |
67 | @classmethod
68 | def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
69 | from ..models.concise_task import ConciseTask
70 |
71 | d = dict(src_dict)
72 | count = d.pop("count")
73 |
74 | results = []
75 | _results = d.pop("results")
76 | for results_item_data in _results:
77 | results_item = ConciseTask.from_dict(results_item_data)
78 |
79 | results.append(results_item)
80 |
81 | def _parse_next_(data: object) -> Union[None, Unset, str]:
82 | if data is None:
83 | return data
84 | if isinstance(data, Unset):
85 | return data
86 | return cast(Union[None, Unset, str], data)
87 |
88 | next_ = _parse_next_(d.pop("next", UNSET))
89 |
90 | def _parse_previous(data: object) -> Union[None, Unset, str]:
91 | if data is None:
92 | return data
93 | if isinstance(data, Unset):
94 | return data
95 | return cast(Union[None, Unset, str], data)
96 |
97 | previous = _parse_previous(d.pop("previous", UNSET))
98 |
99 | paginated_concise_task_list = cls(
100 | count=count,
101 | results=results,
102 | next_=next_,
103 | previous=previous,
104 | )
105 |
106 | paginated_concise_task_list.additional_properties = d
107 | return paginated_concise_task_list
108 |
109 | @property
110 | def additional_keys(self) -> list[str]:
111 | return list(self.additional_properties.keys())
112 |
113 | def __getitem__(self, key: str) -> Any:
114 | return self.additional_properties[key]
115 |
116 | def __setitem__(self, key: str, value: Any) -> None:
117 | self.additional_properties[key] = value
118 |
119 | def __delitem__(self, key: str) -> None:
120 | del self.additional_properties[key]
121 |
122 | def __contains__(self, key: str) -> bool:
123 | return key in self.additional_properties
124 |
--------------------------------------------------------------------------------
/dart/generated/models/priority.py:
--------------------------------------------------------------------------------
1 | from enum import Enum
2 |
3 |
4 | class Priority(str, Enum):
5 | CRITICAL = "Critical"
6 | HIGH = "High"
7 | LOW = "Low"
8 | MEDIUM = "Medium"
9 |
10 | def __str__(self) -> str:
11 | return str(self.value)
12 |
--------------------------------------------------------------------------------
/dart/generated/models/task.py:
--------------------------------------------------------------------------------
1 | from collections.abc import Mapping
2 | from typing import Any, TypeVar, Union, cast
3 |
4 | from attrs import define as _attrs_define
5 | from attrs import field as _attrs_field
6 |
7 | from ..models.priority import Priority
8 | from ..types import UNSET, Unset
9 |
10 | T = TypeVar("T", bound="Task")
11 |
12 |
13 | @_attrs_define
14 | class Task:
15 | """
16 | Attributes:
17 | id (str): The universal, unique ID of the task.
18 | html_url (str): The URL that can be used to open the task in the Dart web UI.
19 | title (str): The title, which is a short description of what needs to be done.
20 | parent_id (Union[None, str]): The universal, unique ID of the parent task. This can be null.
21 | dartboard (str): The full title of the dartboard, which is a project or list of tasks.
22 | type_ (str): The title of the type of the task.
23 | status (str): The status from the list of available statuses.
24 | description (str): A longer description of the task, which can include markdown formatting.
25 | assignees (Union[Unset, list[str]]): The names or emails of the users that the task is assigned to. Either this
26 | or assignee must be included, depending on whether the workspaces allows multiple assignees or not.
27 | assignee (Union[None, Unset, str]): The name or email of the user that the task is assigned to. Either this or
28 | assignees must be included, depending on whether the workspaces allows multiple assignees or not.
29 | tags (Union[Unset, list[str]]): Any tags that should be applied to the task, which can be used to filter and
30 | search for tasks. Tags are also known as labels or components and are strings that can be anything, but should
31 | be short and descriptive. This list can be empty.
32 | priority (Union[None, Priority, Unset]): The priority, which is a string that can be one of the specified
33 | options. This is used to sort tasks and determine which tasks should be done first.
34 | start_at (Union[None, Unset, str]): The start date, which is a date that the task should be started by in ISO
35 | format, like YYYY-MM-DD.
36 | due_at (Union[None, Unset, str]): The due date, which is a date that the task should be completed by in ISO
37 | format, like YYYY-MM-DD.
38 | size (Union[None, Unset, int, str]): The size, which represents the amount of work that needs to be done. This
39 | is used to determine how long the task will take to complete.
40 | time_tracking (Union[Unset, str]): The time tracking, which is a string that indicates the amount of time spent
41 | on the task in hh:mm:ss format (or an empty string if no time has been tracked).
42 | """
43 |
44 | id: str
45 | html_url: str
46 | title: str
47 | parent_id: Union[None, str]
48 | dartboard: str
49 | type_: str
50 | status: str
51 | description: str
52 | assignees: Union[Unset, list[str]] = UNSET
53 | assignee: Union[None, Unset, str] = UNSET
54 | tags: Union[Unset, list[str]] = UNSET
55 | priority: Union[None, Priority, Unset] = UNSET
56 | start_at: Union[None, Unset, str] = UNSET
57 | due_at: Union[None, Unset, str] = UNSET
58 | size: Union[None, Unset, int, str] = UNSET
59 | time_tracking: Union[Unset, str] = UNSET
60 | additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
61 |
62 | def to_dict(self) -> dict[str, Any]:
63 | id = self.id
64 |
65 | html_url = self.html_url
66 |
67 | title = self.title
68 |
69 | parent_id: Union[None, str]
70 | parent_id = self.parent_id
71 |
72 | dartboard = self.dartboard
73 |
74 | type_ = self.type_
75 |
76 | status = self.status
77 |
78 | description = self.description
79 |
80 | assignees: Union[Unset, list[str]] = UNSET
81 | if not isinstance(self.assignees, Unset):
82 | assignees = self.assignees
83 |
84 | assignee: Union[None, Unset, str]
85 | if isinstance(self.assignee, Unset):
86 | assignee = UNSET
87 | else:
88 | assignee = self.assignee
89 |
90 | tags: Union[Unset, list[str]] = UNSET
91 | if not isinstance(self.tags, Unset):
92 | tags = self.tags
93 |
94 | priority: Union[None, Unset, str]
95 | if isinstance(self.priority, Unset):
96 | priority = UNSET
97 | elif isinstance(self.priority, Priority):
98 | priority = self.priority.value
99 | else:
100 | priority = self.priority
101 |
102 | start_at: Union[None, Unset, str]
103 | if isinstance(self.start_at, Unset):
104 | start_at = UNSET
105 | else:
106 | start_at = self.start_at
107 |
108 | due_at: Union[None, Unset, str]
109 | if isinstance(self.due_at, Unset):
110 | due_at = UNSET
111 | else:
112 | due_at = self.due_at
113 |
114 | size: Union[None, Unset, int, str]
115 | if isinstance(self.size, Unset):
116 | size = UNSET
117 | else:
118 | size = self.size
119 |
120 | time_tracking = self.time_tracking
121 |
122 | field_dict: dict[str, Any] = {}
123 | field_dict.update(self.additional_properties)
124 | field_dict.update(
125 | {
126 | "id": id,
127 | "htmlUrl": html_url,
128 | "title": title,
129 | "parentId": parent_id,
130 | "dartboard": dartboard,
131 | "type": type_,
132 | "status": status,
133 | "description": description,
134 | }
135 | )
136 | if assignees is not UNSET:
137 | field_dict["assignees"] = assignees
138 | if assignee is not UNSET:
139 | field_dict["assignee"] = assignee
140 | if tags is not UNSET:
141 | field_dict["tags"] = tags
142 | if priority is not UNSET:
143 | field_dict["priority"] = priority
144 | if start_at is not UNSET:
145 | field_dict["startAt"] = start_at
146 | if due_at is not UNSET:
147 | field_dict["dueAt"] = due_at
148 | if size is not UNSET:
149 | field_dict["size"] = size
150 | if time_tracking is not UNSET:
151 | field_dict["timeTracking"] = time_tracking
152 |
153 | return field_dict
154 |
155 | @classmethod
156 | def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
157 | d = dict(src_dict)
158 | id = d.pop("id")
159 |
160 | html_url = d.pop("htmlUrl")
161 |
162 | title = d.pop("title")
163 |
164 | def _parse_parent_id(data: object) -> Union[None, str]:
165 | if data is None:
166 | return data
167 | return cast(Union[None, str], data)
168 |
169 | parent_id = _parse_parent_id(d.pop("parentId"))
170 |
171 | dartboard = d.pop("dartboard")
172 |
173 | type_ = d.pop("type")
174 |
175 | status = d.pop("status")
176 |
177 | description = d.pop("description")
178 |
179 | assignees = cast(list[str], d.pop("assignees", UNSET))
180 |
181 | def _parse_assignee(data: object) -> Union[None, Unset, str]:
182 | if data is None:
183 | return data
184 | if isinstance(data, Unset):
185 | return data
186 | return cast(Union[None, Unset, str], data)
187 |
188 | assignee = _parse_assignee(d.pop("assignee", UNSET))
189 |
190 | tags = cast(list[str], d.pop("tags", UNSET))
191 |
192 | def _parse_priority(data: object) -> Union[None, Priority, Unset]:
193 | if data is None:
194 | return data
195 | if isinstance(data, Unset):
196 | return data
197 | try:
198 | if not isinstance(data, str):
199 | raise TypeError()
200 | priority_type_0 = Priority(data)
201 |
202 | return priority_type_0
203 | except: # noqa: E722
204 | pass
205 | return cast(Union[None, Priority, Unset], data)
206 |
207 | priority = _parse_priority(d.pop("priority", UNSET))
208 |
209 | def _parse_start_at(data: object) -> Union[None, Unset, str]:
210 | if data is None:
211 | return data
212 | if isinstance(data, Unset):
213 | return data
214 | return cast(Union[None, Unset, str], data)
215 |
216 | start_at = _parse_start_at(d.pop("startAt", UNSET))
217 |
218 | def _parse_due_at(data: object) -> Union[None, Unset, str]:
219 | if data is None:
220 | return data
221 | if isinstance(data, Unset):
222 | return data
223 | return cast(Union[None, Unset, str], data)
224 |
225 | due_at = _parse_due_at(d.pop("dueAt", UNSET))
226 |
227 | def _parse_size(data: object) -> Union[None, Unset, int, str]:
228 | if data is None:
229 | return data
230 | if isinstance(data, Unset):
231 | return data
232 | return cast(Union[None, Unset, int, str], data)
233 |
234 | size = _parse_size(d.pop("size", UNSET))
235 |
236 | time_tracking = d.pop("timeTracking", UNSET)
237 |
238 | task = cls(
239 | id=id,
240 | html_url=html_url,
241 | title=title,
242 | parent_id=parent_id,
243 | dartboard=dartboard,
244 | type_=type_,
245 | status=status,
246 | description=description,
247 | assignees=assignees,
248 | assignee=assignee,
249 | tags=tags,
250 | priority=priority,
251 | start_at=start_at,
252 | due_at=due_at,
253 | size=size,
254 | time_tracking=time_tracking,
255 | )
256 |
257 | task.additional_properties = d
258 | return task
259 |
260 | @property
261 | def additional_keys(self) -> list[str]:
262 | return list(self.additional_properties.keys())
263 |
264 | def __getitem__(self, key: str) -> Any:
265 | return self.additional_properties[key]
266 |
267 | def __setitem__(self, key: str, value: Any) -> None:
268 | self.additional_properties[key] = value
269 |
270 | def __delitem__(self, key: str) -> None:
271 | del self.additional_properties[key]
272 |
273 | def __contains__(self, key: str) -> bool:
274 | return key in self.additional_properties
275 |
--------------------------------------------------------------------------------
/dart/generated/models/task_create.py:
--------------------------------------------------------------------------------
1 | from collections.abc import Mapping
2 | from typing import Any, TypeVar, Union, cast
3 |
4 | from attrs import define as _attrs_define
5 | from attrs import field as _attrs_field
6 |
7 | from ..models.priority import Priority
8 | from ..types import UNSET, Unset
9 |
10 | T = TypeVar("T", bound="TaskCreate")
11 |
12 |
13 | @_attrs_define
14 | class TaskCreate:
15 | """
16 | Attributes:
17 | title (str): The title, which is a short description of what needs to be done.
18 | parent_id (Union[None, Unset, str]): The universal, unique ID of the parent task. This can be null.
19 | dartboard (Union[Unset, str]): The full title of the dartboard, which is a project or list of tasks.
20 | type_ (Union[Unset, str]): The title of the type of the task.
21 | status (Union[Unset, str]): The status from the list of available statuses.
22 | description (Union[Unset, str]): A longer description of the task, which can include markdown formatting.
23 | assignees (Union[Unset, list[str]]): The names or emails of the users that the task is assigned to. Either this
24 | or assignee must be included, depending on whether the workspaces allows multiple assignees or not.
25 | assignee (Union[None, Unset, str]): The name or email of the user that the task is assigned to. Either this or
26 | assignees must be included, depending on whether the workspaces allows multiple assignees or not.
27 | tags (Union[Unset, list[str]]): Any tags that should be applied to the task, which can be used to filter and
28 | search for tasks. Tags are also known as labels or components and are strings that can be anything, but should
29 | be short and descriptive. This list can be empty.
30 | priority (Union[None, Priority, Unset]): The priority, which is a string that can be one of the specified
31 | options. This is used to sort tasks and determine which tasks should be done first.
32 | start_at (Union[None, Unset, str]): The start date, which is a date that the task should be started by in ISO
33 | format, like YYYY-MM-DD.
34 | due_at (Union[None, Unset, str]): The due date, which is a date that the task should be completed by in ISO
35 | format, like YYYY-MM-DD.
36 | size (Union[None, Unset, int, str]): The size, which represents the amount of work that needs to be done. This
37 | is used to determine how long the task will take to complete.
38 | time_tracking (Union[Unset, str]): The time tracking, which is a string that indicates the amount of time spent
39 | on the task in hh:mm:ss format (or an empty string if no time has been tracked).
40 | """
41 |
42 | title: str
43 | parent_id: Union[None, Unset, str] = UNSET
44 | dartboard: Union[Unset, str] = UNSET
45 | type_: Union[Unset, str] = UNSET
46 | status: Union[Unset, str] = UNSET
47 | description: Union[Unset, str] = UNSET
48 | assignees: Union[Unset, list[str]] = UNSET
49 | assignee: Union[None, Unset, str] = UNSET
50 | tags: Union[Unset, list[str]] = UNSET
51 | priority: Union[None, Priority, Unset] = UNSET
52 | start_at: Union[None, Unset, str] = UNSET
53 | due_at: Union[None, Unset, str] = UNSET
54 | size: Union[None, Unset, int, str] = UNSET
55 | time_tracking: Union[Unset, str] = UNSET
56 | additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
57 |
58 | def to_dict(self) -> dict[str, Any]:
59 | title = self.title
60 |
61 | parent_id: Union[None, Unset, str]
62 | if isinstance(self.parent_id, Unset):
63 | parent_id = UNSET
64 | else:
65 | parent_id = self.parent_id
66 |
67 | dartboard = self.dartboard
68 |
69 | type_ = self.type_
70 |
71 | status = self.status
72 |
73 | description = self.description
74 |
75 | assignees: Union[Unset, list[str]] = UNSET
76 | if not isinstance(self.assignees, Unset):
77 | assignees = self.assignees
78 |
79 | assignee: Union[None, Unset, str]
80 | if isinstance(self.assignee, Unset):
81 | assignee = UNSET
82 | else:
83 | assignee = self.assignee
84 |
85 | tags: Union[Unset, list[str]] = UNSET
86 | if not isinstance(self.tags, Unset):
87 | tags = self.tags
88 |
89 | priority: Union[None, Unset, str]
90 | if isinstance(self.priority, Unset):
91 | priority = UNSET
92 | elif isinstance(self.priority, Priority):
93 | priority = self.priority.value
94 | else:
95 | priority = self.priority
96 |
97 | start_at: Union[None, Unset, str]
98 | if isinstance(self.start_at, Unset):
99 | start_at = UNSET
100 | else:
101 | start_at = self.start_at
102 |
103 | due_at: Union[None, Unset, str]
104 | if isinstance(self.due_at, Unset):
105 | due_at = UNSET
106 | else:
107 | due_at = self.due_at
108 |
109 | size: Union[None, Unset, int, str]
110 | if isinstance(self.size, Unset):
111 | size = UNSET
112 | else:
113 | size = self.size
114 |
115 | time_tracking = self.time_tracking
116 |
117 | field_dict: dict[str, Any] = {}
118 | field_dict.update(self.additional_properties)
119 | field_dict.update(
120 | {
121 | "title": title,
122 | }
123 | )
124 | if parent_id is not UNSET:
125 | field_dict["parentId"] = parent_id
126 | if dartboard is not UNSET:
127 | field_dict["dartboard"] = dartboard
128 | if type_ is not UNSET:
129 | field_dict["type"] = type_
130 | if status is not UNSET:
131 | field_dict["status"] = status
132 | if description is not UNSET:
133 | field_dict["description"] = description
134 | if assignees is not UNSET:
135 | field_dict["assignees"] = assignees
136 | if assignee is not UNSET:
137 | field_dict["assignee"] = assignee
138 | if tags is not UNSET:
139 | field_dict["tags"] = tags
140 | if priority is not UNSET:
141 | field_dict["priority"] = priority
142 | if start_at is not UNSET:
143 | field_dict["startAt"] = start_at
144 | if due_at is not UNSET:
145 | field_dict["dueAt"] = due_at
146 | if size is not UNSET:
147 | field_dict["size"] = size
148 | if time_tracking is not UNSET:
149 | field_dict["timeTracking"] = time_tracking
150 |
151 | return field_dict
152 |
153 | @classmethod
154 | def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
155 | d = dict(src_dict)
156 | title = d.pop("title")
157 |
158 | def _parse_parent_id(data: object) -> Union[None, Unset, str]:
159 | if data is None:
160 | return data
161 | if isinstance(data, Unset):
162 | return data
163 | return cast(Union[None, Unset, str], data)
164 |
165 | parent_id = _parse_parent_id(d.pop("parentId", UNSET))
166 |
167 | dartboard = d.pop("dartboard", UNSET)
168 |
169 | type_ = d.pop("type", UNSET)
170 |
171 | status = d.pop("status", UNSET)
172 |
173 | description = d.pop("description", UNSET)
174 |
175 | assignees = cast(list[str], d.pop("assignees", UNSET))
176 |
177 | def _parse_assignee(data: object) -> Union[None, Unset, str]:
178 | if data is None:
179 | return data
180 | if isinstance(data, Unset):
181 | return data
182 | return cast(Union[None, Unset, str], data)
183 |
184 | assignee = _parse_assignee(d.pop("assignee", UNSET))
185 |
186 | tags = cast(list[str], d.pop("tags", UNSET))
187 |
188 | def _parse_priority(data: object) -> Union[None, Priority, Unset]:
189 | if data is None:
190 | return data
191 | if isinstance(data, Unset):
192 | return data
193 | try:
194 | if not isinstance(data, str):
195 | raise TypeError()
196 | priority_type_0 = Priority(data)
197 |
198 | return priority_type_0
199 | except: # noqa: E722
200 | pass
201 | return cast(Union[None, Priority, Unset], data)
202 |
203 | priority = _parse_priority(d.pop("priority", UNSET))
204 |
205 | def _parse_start_at(data: object) -> Union[None, Unset, str]:
206 | if data is None:
207 | return data
208 | if isinstance(data, Unset):
209 | return data
210 | return cast(Union[None, Unset, str], data)
211 |
212 | start_at = _parse_start_at(d.pop("startAt", UNSET))
213 |
214 | def _parse_due_at(data: object) -> Union[None, Unset, str]:
215 | if data is None:
216 | return data
217 | if isinstance(data, Unset):
218 | return data
219 | return cast(Union[None, Unset, str], data)
220 |
221 | due_at = _parse_due_at(d.pop("dueAt", UNSET))
222 |
223 | def _parse_size(data: object) -> Union[None, Unset, int, str]:
224 | if data is None:
225 | return data
226 | if isinstance(data, Unset):
227 | return data
228 | return cast(Union[None, Unset, int, str], data)
229 |
230 | size = _parse_size(d.pop("size", UNSET))
231 |
232 | time_tracking = d.pop("timeTracking", UNSET)
233 |
234 | task_create = cls(
235 | title=title,
236 | parent_id=parent_id,
237 | dartboard=dartboard,
238 | type_=type_,
239 | status=status,
240 | description=description,
241 | assignees=assignees,
242 | assignee=assignee,
243 | tags=tags,
244 | priority=priority,
245 | start_at=start_at,
246 | due_at=due_at,
247 | size=size,
248 | time_tracking=time_tracking,
249 | )
250 |
251 | task_create.additional_properties = d
252 | return task_create
253 |
254 | @property
255 | def additional_keys(self) -> list[str]:
256 | return list(self.additional_properties.keys())
257 |
258 | def __getitem__(self, key: str) -> Any:
259 | return self.additional_properties[key]
260 |
261 | def __setitem__(self, key: str, value: Any) -> None:
262 | self.additional_properties[key] = value
263 |
264 | def __delitem__(self, key: str) -> None:
265 | del self.additional_properties[key]
266 |
267 | def __contains__(self, key: str) -> bool:
268 | return key in self.additional_properties
269 |
--------------------------------------------------------------------------------
/dart/generated/models/user.py:
--------------------------------------------------------------------------------
1 | from collections.abc import Mapping
2 | from typing import Any, TypeVar
3 |
4 | from attrs import define as _attrs_define
5 | from attrs import field as _attrs_field
6 |
7 | T = TypeVar("T", bound="User")
8 |
9 |
10 | @_attrs_define
11 | class User:
12 | """
13 | Attributes:
14 | name (str):
15 | email (str):
16 | """
17 |
18 | name: str
19 | email: str
20 | additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
21 |
22 | def to_dict(self) -> dict[str, Any]:
23 | name = self.name
24 |
25 | email = self.email
26 |
27 | field_dict: dict[str, Any] = {}
28 | field_dict.update(self.additional_properties)
29 | field_dict.update(
30 | {
31 | "name": name,
32 | "email": email,
33 | }
34 | )
35 |
36 | return field_dict
37 |
38 | @classmethod
39 | def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
40 | d = dict(src_dict)
41 | name = d.pop("name")
42 |
43 | email = d.pop("email")
44 |
45 | user = cls(
46 | name=name,
47 | email=email,
48 | )
49 |
50 | user.additional_properties = d
51 | return user
52 |
53 | @property
54 | def additional_keys(self) -> list[str]:
55 | return list(self.additional_properties.keys())
56 |
57 | def __getitem__(self, key: str) -> Any:
58 | return self.additional_properties[key]
59 |
60 | def __setitem__(self, key: str, value: Any) -> None:
61 | self.additional_properties[key] = value
62 |
63 | def __delitem__(self, key: str) -> None:
64 | del self.additional_properties[key]
65 |
66 | def __contains__(self, key: str) -> bool:
67 | return key in self.additional_properties
68 |
--------------------------------------------------------------------------------
/dart/generated/models/user_space_configuration.py:
--------------------------------------------------------------------------------
1 | import datetime
2 | from collections.abc import Mapping
3 | from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
4 |
5 | from attrs import define as _attrs_define
6 | from attrs import field as _attrs_field
7 | from dateutil.parser import isoparse
8 |
9 | if TYPE_CHECKING:
10 | from ..models.user import User
11 |
12 |
13 | T = TypeVar("T", bound="UserSpaceConfiguration")
14 |
15 |
16 | @_attrs_define
17 | class UserSpaceConfiguration:
18 | """
19 | Attributes:
20 | today (datetime.date):
21 | user (User):
22 | dartboards (list[str]):
23 | folders (list[str]):
24 | types (list[str]):
25 | statuses (list[str]):
26 | assignees (list['User']):
27 | tags (list[str]):
28 | priorities (list[str]):
29 | sizes (Union[list[Union[int, str]], str]):
30 | """
31 |
32 | today: datetime.date
33 | user: "User"
34 | dartboards: list[str]
35 | folders: list[str]
36 | types: list[str]
37 | statuses: list[str]
38 | assignees: list["User"]
39 | tags: list[str]
40 | priorities: list[str]
41 | sizes: Union[list[Union[int, str]], str]
42 | additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
43 |
44 | def to_dict(self) -> dict[str, Any]:
45 | today = self.today.isoformat()
46 |
47 | user = self.user.to_dict()
48 |
49 | dartboards = self.dartboards
50 |
51 | folders = self.folders
52 |
53 | types = self.types
54 |
55 | statuses = self.statuses
56 |
57 | assignees = []
58 | for assignees_item_data in self.assignees:
59 | assignees_item = assignees_item_data.to_dict()
60 | assignees.append(assignees_item)
61 |
62 | tags = self.tags
63 |
64 | priorities = self.priorities
65 |
66 | sizes: Union[list[Union[int, str]], str]
67 | if isinstance(self.sizes, list):
68 | sizes = []
69 | for sizes_type_1_item_data in self.sizes:
70 | sizes_type_1_item: Union[int, str]
71 | sizes_type_1_item = sizes_type_1_item_data
72 | sizes.append(sizes_type_1_item)
73 |
74 | else:
75 | sizes = self.sizes
76 |
77 | field_dict: dict[str, Any] = {}
78 | field_dict.update(self.additional_properties)
79 | field_dict.update(
80 | {
81 | "today": today,
82 | "user": user,
83 | "dartboards": dartboards,
84 | "folders": folders,
85 | "types": types,
86 | "statuses": statuses,
87 | "assignees": assignees,
88 | "tags": tags,
89 | "priorities": priorities,
90 | "sizes": sizes,
91 | }
92 | )
93 |
94 | return field_dict
95 |
96 | @classmethod
97 | def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
98 | from ..models.user import User
99 |
100 | d = dict(src_dict)
101 | today = isoparse(d.pop("today")).date()
102 |
103 | user = User.from_dict(d.pop("user"))
104 |
105 | dartboards = cast(list[str], d.pop("dartboards"))
106 |
107 | folders = cast(list[str], d.pop("folders"))
108 |
109 | types = cast(list[str], d.pop("types"))
110 |
111 | statuses = cast(list[str], d.pop("statuses"))
112 |
113 | assignees = []
114 | _assignees = d.pop("assignees")
115 | for assignees_item_data in _assignees:
116 | assignees_item = User.from_dict(assignees_item_data)
117 |
118 | assignees.append(assignees_item)
119 |
120 | tags = cast(list[str], d.pop("tags"))
121 |
122 | priorities = cast(list[str], d.pop("priorities"))
123 |
124 | def _parse_sizes(data: object) -> Union[list[Union[int, str]], str]:
125 | try:
126 | if not isinstance(data, list):
127 | raise TypeError()
128 | sizes_type_1 = []
129 | _sizes_type_1 = data
130 | for sizes_type_1_item_data in _sizes_type_1:
131 |
132 | def _parse_sizes_type_1_item(data: object) -> Union[int, str]:
133 | return cast(Union[int, str], data)
134 |
135 | sizes_type_1_item = _parse_sizes_type_1_item(sizes_type_1_item_data)
136 |
137 | sizes_type_1.append(sizes_type_1_item)
138 |
139 | return sizes_type_1
140 | except: # noqa: E722
141 | pass
142 | return cast(Union[list[Union[int, str]], str], data)
143 |
144 | sizes = _parse_sizes(d.pop("sizes"))
145 |
146 | user_space_configuration = cls(
147 | today=today,
148 | user=user,
149 | dartboards=dartboards,
150 | folders=folders,
151 | types=types,
152 | statuses=statuses,
153 | assignees=assignees,
154 | tags=tags,
155 | priorities=priorities,
156 | sizes=sizes,
157 | )
158 |
159 | user_space_configuration.additional_properties = d
160 | return user_space_configuration
161 |
162 | @property
163 | def additional_keys(self) -> list[str]:
164 | return list(self.additional_properties.keys())
165 |
166 | def __getitem__(self, key: str) -> Any:
167 | return self.additional_properties[key]
168 |
169 | def __setitem__(self, key: str, value: Any) -> None:
170 | self.additional_properties[key] = value
171 |
172 | def __delitem__(self, key: str) -> None:
173 | del self.additional_properties[key]
174 |
175 | def __contains__(self, key: str) -> bool:
176 | return key in self.additional_properties
177 |
--------------------------------------------------------------------------------
/dart/generated/models/view.py:
--------------------------------------------------------------------------------
1 | from collections.abc import Mapping
2 | from typing import TYPE_CHECKING, Any, TypeVar
3 |
4 | from attrs import define as _attrs_define
5 | from attrs import field as _attrs_field
6 |
7 | if TYPE_CHECKING:
8 | from ..models.task import Task
9 |
10 |
11 | T = TypeVar("T", bound="View")
12 |
13 |
14 | @_attrs_define
15 | class View:
16 | """
17 | Attributes:
18 | id (str): The universal, unique ID of the view.
19 | html_url (str): The URL that can be used to open the view in the Dart web UI.
20 | title (str): The title, which is a short description of the view.
21 | description (str): The description, which is a longer description of the view.
22 | tasks (list['Task']): The list of all of the tasks in the view.
23 | """
24 |
25 | id: str
26 | html_url: str
27 | title: str
28 | description: str
29 | tasks: list["Task"]
30 | additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
31 |
32 | def to_dict(self) -> dict[str, Any]:
33 | id = self.id
34 |
35 | html_url = self.html_url
36 |
37 | title = self.title
38 |
39 | description = self.description
40 |
41 | tasks = []
42 | for tasks_item_data in self.tasks:
43 | tasks_item = tasks_item_data.to_dict()
44 | tasks.append(tasks_item)
45 |
46 | field_dict: dict[str, Any] = {}
47 | field_dict.update(self.additional_properties)
48 | field_dict.update(
49 | {
50 | "id": id,
51 | "htmlUrl": html_url,
52 | "title": title,
53 | "description": description,
54 | "tasks": tasks,
55 | }
56 | )
57 |
58 | return field_dict
59 |
60 | @classmethod
61 | def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
62 | from ..models.task import Task
63 |
64 | d = dict(src_dict)
65 | id = d.pop("id")
66 |
67 | html_url = d.pop("htmlUrl")
68 |
69 | title = d.pop("title")
70 |
71 | description = d.pop("description")
72 |
73 | tasks = []
74 | _tasks = d.pop("tasks")
75 | for tasks_item_data in _tasks:
76 | tasks_item = Task.from_dict(tasks_item_data)
77 |
78 | tasks.append(tasks_item)
79 |
80 | view = cls(
81 | id=id,
82 | html_url=html_url,
83 | title=title,
84 | description=description,
85 | tasks=tasks,
86 | )
87 |
88 | view.additional_properties = d
89 | return view
90 |
91 | @property
92 | def additional_keys(self) -> list[str]:
93 | return list(self.additional_properties.keys())
94 |
95 | def __getitem__(self, key: str) -> Any:
96 | return self.additional_properties[key]
97 |
98 | def __setitem__(self, key: str, value: Any) -> None:
99 | self.additional_properties[key] = value
100 |
101 | def __delitem__(self, key: str) -> None:
102 | del self.additional_properties[key]
103 |
104 | def __contains__(self, key: str) -> bool:
105 | return key in self.additional_properties
106 |
--------------------------------------------------------------------------------
/dart/generated/models/wrapped_comment.py:
--------------------------------------------------------------------------------
1 | from collections.abc import Mapping
2 | from typing import TYPE_CHECKING, Any, TypeVar
3 |
4 | from attrs import define as _attrs_define
5 | from attrs import field as _attrs_field
6 |
7 | if TYPE_CHECKING:
8 | from ..models.comment import Comment
9 |
10 |
11 | T = TypeVar("T", bound="WrappedComment")
12 |
13 |
14 | @_attrs_define
15 | class WrappedComment:
16 | """
17 | Attributes:
18 | item (Comment):
19 | """
20 |
21 | item: "Comment"
22 | additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
23 |
24 | def to_dict(self) -> dict[str, Any]:
25 | item = self.item.to_dict()
26 |
27 | field_dict: dict[str, Any] = {}
28 | field_dict.update(self.additional_properties)
29 | field_dict.update(
30 | {
31 | "item": item,
32 | }
33 | )
34 |
35 | return field_dict
36 |
37 | @classmethod
38 | def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
39 | from ..models.comment import Comment
40 |
41 | d = dict(src_dict)
42 | item = Comment.from_dict(d.pop("item"))
43 |
44 | wrapped_comment = cls(
45 | item=item,
46 | )
47 |
48 | wrapped_comment.additional_properties = d
49 | return wrapped_comment
50 |
51 | @property
52 | def additional_keys(self) -> list[str]:
53 | return list(self.additional_properties.keys())
54 |
55 | def __getitem__(self, key: str) -> Any:
56 | return self.additional_properties[key]
57 |
58 | def __setitem__(self, key: str, value: Any) -> None:
59 | self.additional_properties[key] = value
60 |
61 | def __delitem__(self, key: str) -> None:
62 | del self.additional_properties[key]
63 |
64 | def __contains__(self, key: str) -> bool:
65 | return key in self.additional_properties
66 |
--------------------------------------------------------------------------------
/dart/generated/models/wrapped_comment_create.py:
--------------------------------------------------------------------------------
1 | from collections.abc import Mapping
2 | from typing import TYPE_CHECKING, Any, TypeVar
3 |
4 | from attrs import define as _attrs_define
5 | from attrs import field as _attrs_field
6 |
7 | if TYPE_CHECKING:
8 | from ..models.comment_create import CommentCreate
9 |
10 |
11 | T = TypeVar("T", bound="WrappedCommentCreate")
12 |
13 |
14 | @_attrs_define
15 | class WrappedCommentCreate:
16 | """
17 | Attributes:
18 | item (CommentCreate):
19 | """
20 |
21 | item: "CommentCreate"
22 | additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
23 |
24 | def to_dict(self) -> dict[str, Any]:
25 | item = self.item.to_dict()
26 |
27 | field_dict: dict[str, Any] = {}
28 | field_dict.update(self.additional_properties)
29 | field_dict.update(
30 | {
31 | "item": item,
32 | }
33 | )
34 |
35 | return field_dict
36 |
37 | @classmethod
38 | def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
39 | from ..models.comment_create import CommentCreate
40 |
41 | d = dict(src_dict)
42 | item = CommentCreate.from_dict(d.pop("item"))
43 |
44 | wrapped_comment_create = cls(
45 | item=item,
46 | )
47 |
48 | wrapped_comment_create.additional_properties = d
49 | return wrapped_comment_create
50 |
51 | @property
52 | def additional_keys(self) -> list[str]:
53 | return list(self.additional_properties.keys())
54 |
55 | def __getitem__(self, key: str) -> Any:
56 | return self.additional_properties[key]
57 |
58 | def __setitem__(self, key: str, value: Any) -> None:
59 | self.additional_properties[key] = value
60 |
61 | def __delitem__(self, key: str) -> None:
62 | del self.additional_properties[key]
63 |
64 | def __contains__(self, key: str) -> bool:
65 | return key in self.additional_properties
66 |
--------------------------------------------------------------------------------
/dart/generated/models/wrapped_dartboard.py:
--------------------------------------------------------------------------------
1 | from collections.abc import Mapping
2 | from typing import TYPE_CHECKING, Any, TypeVar
3 |
4 | from attrs import define as _attrs_define
5 | from attrs import field as _attrs_field
6 |
7 | if TYPE_CHECKING:
8 | from ..models.dartboard import Dartboard
9 |
10 |
11 | T = TypeVar("T", bound="WrappedDartboard")
12 |
13 |
14 | @_attrs_define
15 | class WrappedDartboard:
16 | """
17 | Attributes:
18 | item (Dartboard):
19 | """
20 |
21 | item: "Dartboard"
22 | additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
23 |
24 | def to_dict(self) -> dict[str, Any]:
25 | item = self.item.to_dict()
26 |
27 | field_dict: dict[str, Any] = {}
28 | field_dict.update(self.additional_properties)
29 | field_dict.update(
30 | {
31 | "item": item,
32 | }
33 | )
34 |
35 | return field_dict
36 |
37 | @classmethod
38 | def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
39 | from ..models.dartboard import Dartboard
40 |
41 | d = dict(src_dict)
42 | item = Dartboard.from_dict(d.pop("item"))
43 |
44 | wrapped_dartboard = cls(
45 | item=item,
46 | )
47 |
48 | wrapped_dartboard.additional_properties = d
49 | return wrapped_dartboard
50 |
51 | @property
52 | def additional_keys(self) -> list[str]:
53 | return list(self.additional_properties.keys())
54 |
55 | def __getitem__(self, key: str) -> Any:
56 | return self.additional_properties[key]
57 |
58 | def __setitem__(self, key: str, value: Any) -> None:
59 | self.additional_properties[key] = value
60 |
61 | def __delitem__(self, key: str) -> None:
62 | del self.additional_properties[key]
63 |
64 | def __contains__(self, key: str) -> bool:
65 | return key in self.additional_properties
66 |
--------------------------------------------------------------------------------
/dart/generated/models/wrapped_doc.py:
--------------------------------------------------------------------------------
1 | from collections.abc import Mapping
2 | from typing import TYPE_CHECKING, Any, TypeVar
3 |
4 | from attrs import define as _attrs_define
5 | from attrs import field as _attrs_field
6 |
7 | if TYPE_CHECKING:
8 | from ..models.doc import Doc
9 |
10 |
11 | T = TypeVar("T", bound="WrappedDoc")
12 |
13 |
14 | @_attrs_define
15 | class WrappedDoc:
16 | """
17 | Attributes:
18 | item (Doc):
19 | """
20 |
21 | item: "Doc"
22 | additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
23 |
24 | def to_dict(self) -> dict[str, Any]:
25 | item = self.item.to_dict()
26 |
27 | field_dict: dict[str, Any] = {}
28 | field_dict.update(self.additional_properties)
29 | field_dict.update(
30 | {
31 | "item": item,
32 | }
33 | )
34 |
35 | return field_dict
36 |
37 | @classmethod
38 | def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
39 | from ..models.doc import Doc
40 |
41 | d = dict(src_dict)
42 | item = Doc.from_dict(d.pop("item"))
43 |
44 | wrapped_doc = cls(
45 | item=item,
46 | )
47 |
48 | wrapped_doc.additional_properties = d
49 | return wrapped_doc
50 |
51 | @property
52 | def additional_keys(self) -> list[str]:
53 | return list(self.additional_properties.keys())
54 |
55 | def __getitem__(self, key: str) -> Any:
56 | return self.additional_properties[key]
57 |
58 | def __setitem__(self, key: str, value: Any) -> None:
59 | self.additional_properties[key] = value
60 |
61 | def __delitem__(self, key: str) -> None:
62 | del self.additional_properties[key]
63 |
64 | def __contains__(self, key: str) -> bool:
65 | return key in self.additional_properties
66 |
--------------------------------------------------------------------------------
/dart/generated/models/wrapped_doc_create.py:
--------------------------------------------------------------------------------
1 | from collections.abc import Mapping
2 | from typing import TYPE_CHECKING, Any, TypeVar
3 |
4 | from attrs import define as _attrs_define
5 | from attrs import field as _attrs_field
6 |
7 | if TYPE_CHECKING:
8 | from ..models.doc_create import DocCreate
9 |
10 |
11 | T = TypeVar("T", bound="WrappedDocCreate")
12 |
13 |
14 | @_attrs_define
15 | class WrappedDocCreate:
16 | """
17 | Attributes:
18 | item (DocCreate):
19 | """
20 |
21 | item: "DocCreate"
22 | additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
23 |
24 | def to_dict(self) -> dict[str, Any]:
25 | item = self.item.to_dict()
26 |
27 | field_dict: dict[str, Any] = {}
28 | field_dict.update(self.additional_properties)
29 | field_dict.update(
30 | {
31 | "item": item,
32 | }
33 | )
34 |
35 | return field_dict
36 |
37 | @classmethod
38 | def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
39 | from ..models.doc_create import DocCreate
40 |
41 | d = dict(src_dict)
42 | item = DocCreate.from_dict(d.pop("item"))
43 |
44 | wrapped_doc_create = cls(
45 | item=item,
46 | )
47 |
48 | wrapped_doc_create.additional_properties = d
49 | return wrapped_doc_create
50 |
51 | @property
52 | def additional_keys(self) -> list[str]:
53 | return list(self.additional_properties.keys())
54 |
55 | def __getitem__(self, key: str) -> Any:
56 | return self.additional_properties[key]
57 |
58 | def __setitem__(self, key: str, value: Any) -> None:
59 | self.additional_properties[key] = value
60 |
61 | def __delitem__(self, key: str) -> None:
62 | del self.additional_properties[key]
63 |
64 | def __contains__(self, key: str) -> bool:
65 | return key in self.additional_properties
66 |
--------------------------------------------------------------------------------
/dart/generated/models/wrapped_doc_update.py:
--------------------------------------------------------------------------------
1 | from collections.abc import Mapping
2 | from typing import TYPE_CHECKING, Any, TypeVar
3 |
4 | from attrs import define as _attrs_define
5 | from attrs import field as _attrs_field
6 |
7 | if TYPE_CHECKING:
8 | from ..models.doc_update import DocUpdate
9 |
10 |
11 | T = TypeVar("T", bound="WrappedDocUpdate")
12 |
13 |
14 | @_attrs_define
15 | class WrappedDocUpdate:
16 | """
17 | Attributes:
18 | item (DocUpdate):
19 | """
20 |
21 | item: "DocUpdate"
22 | additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
23 |
24 | def to_dict(self) -> dict[str, Any]:
25 | item = self.item.to_dict()
26 |
27 | field_dict: dict[str, Any] = {}
28 | field_dict.update(self.additional_properties)
29 | field_dict.update(
30 | {
31 | "item": item,
32 | }
33 | )
34 |
35 | return field_dict
36 |
37 | @classmethod
38 | def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
39 | from ..models.doc_update import DocUpdate
40 |
41 | d = dict(src_dict)
42 | item = DocUpdate.from_dict(d.pop("item"))
43 |
44 | wrapped_doc_update = cls(
45 | item=item,
46 | )
47 |
48 | wrapped_doc_update.additional_properties = d
49 | return wrapped_doc_update
50 |
51 | @property
52 | def additional_keys(self) -> list[str]:
53 | return list(self.additional_properties.keys())
54 |
55 | def __getitem__(self, key: str) -> Any:
56 | return self.additional_properties[key]
57 |
58 | def __setitem__(self, key: str, value: Any) -> None:
59 | self.additional_properties[key] = value
60 |
61 | def __delitem__(self, key: str) -> None:
62 | del self.additional_properties[key]
63 |
64 | def __contains__(self, key: str) -> bool:
65 | return key in self.additional_properties
66 |
--------------------------------------------------------------------------------
/dart/generated/models/wrapped_folder.py:
--------------------------------------------------------------------------------
1 | from collections.abc import Mapping
2 | from typing import TYPE_CHECKING, Any, TypeVar
3 |
4 | from attrs import define as _attrs_define
5 | from attrs import field as _attrs_field
6 |
7 | if TYPE_CHECKING:
8 | from ..models.folder import Folder
9 |
10 |
11 | T = TypeVar("T", bound="WrappedFolder")
12 |
13 |
14 | @_attrs_define
15 | class WrappedFolder:
16 | """
17 | Attributes:
18 | item (Folder):
19 | """
20 |
21 | item: "Folder"
22 | additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
23 |
24 | def to_dict(self) -> dict[str, Any]:
25 | item = self.item.to_dict()
26 |
27 | field_dict: dict[str, Any] = {}
28 | field_dict.update(self.additional_properties)
29 | field_dict.update(
30 | {
31 | "item": item,
32 | }
33 | )
34 |
35 | return field_dict
36 |
37 | @classmethod
38 | def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
39 | from ..models.folder import Folder
40 |
41 | d = dict(src_dict)
42 | item = Folder.from_dict(d.pop("item"))
43 |
44 | wrapped_folder = cls(
45 | item=item,
46 | )
47 |
48 | wrapped_folder.additional_properties = d
49 | return wrapped_folder
50 |
51 | @property
52 | def additional_keys(self) -> list[str]:
53 | return list(self.additional_properties.keys())
54 |
55 | def __getitem__(self, key: str) -> Any:
56 | return self.additional_properties[key]
57 |
58 | def __setitem__(self, key: str, value: Any) -> None:
59 | self.additional_properties[key] = value
60 |
61 | def __delitem__(self, key: str) -> None:
62 | del self.additional_properties[key]
63 |
64 | def __contains__(self, key: str) -> bool:
65 | return key in self.additional_properties
66 |
--------------------------------------------------------------------------------
/dart/generated/models/wrapped_task.py:
--------------------------------------------------------------------------------
1 | from collections.abc import Mapping
2 | from typing import TYPE_CHECKING, Any, TypeVar
3 |
4 | from attrs import define as _attrs_define
5 | from attrs import field as _attrs_field
6 |
7 | if TYPE_CHECKING:
8 | from ..models.task import Task
9 |
10 |
11 | T = TypeVar("T", bound="WrappedTask")
12 |
13 |
14 | @_attrs_define
15 | class WrappedTask:
16 | """
17 | Attributes:
18 | item (Task):
19 | """
20 |
21 | item: "Task"
22 | additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
23 |
24 | def to_dict(self) -> dict[str, Any]:
25 | item = self.item.to_dict()
26 |
27 | field_dict: dict[str, Any] = {}
28 | field_dict.update(self.additional_properties)
29 | field_dict.update(
30 | {
31 | "item": item,
32 | }
33 | )
34 |
35 | return field_dict
36 |
37 | @classmethod
38 | def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
39 | from ..models.task import Task
40 |
41 | d = dict(src_dict)
42 | item = Task.from_dict(d.pop("item"))
43 |
44 | wrapped_task = cls(
45 | item=item,
46 | )
47 |
48 | wrapped_task.additional_properties = d
49 | return wrapped_task
50 |
51 | @property
52 | def additional_keys(self) -> list[str]:
53 | return list(self.additional_properties.keys())
54 |
55 | def __getitem__(self, key: str) -> Any:
56 | return self.additional_properties[key]
57 |
58 | def __setitem__(self, key: str, value: Any) -> None:
59 | self.additional_properties[key] = value
60 |
61 | def __delitem__(self, key: str) -> None:
62 | del self.additional_properties[key]
63 |
64 | def __contains__(self, key: str) -> bool:
65 | return key in self.additional_properties
66 |
--------------------------------------------------------------------------------
/dart/generated/models/wrapped_task_create.py:
--------------------------------------------------------------------------------
1 | from collections.abc import Mapping
2 | from typing import TYPE_CHECKING, Any, TypeVar
3 |
4 | from attrs import define as _attrs_define
5 | from attrs import field as _attrs_field
6 |
7 | if TYPE_CHECKING:
8 | from ..models.task_create import TaskCreate
9 |
10 |
11 | T = TypeVar("T", bound="WrappedTaskCreate")
12 |
13 |
14 | @_attrs_define
15 | class WrappedTaskCreate:
16 | """
17 | Attributes:
18 | item (TaskCreate):
19 | """
20 |
21 | item: "TaskCreate"
22 | additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
23 |
24 | def to_dict(self) -> dict[str, Any]:
25 | item = self.item.to_dict()
26 |
27 | field_dict: dict[str, Any] = {}
28 | field_dict.update(self.additional_properties)
29 | field_dict.update(
30 | {
31 | "item": item,
32 | }
33 | )
34 |
35 | return field_dict
36 |
37 | @classmethod
38 | def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
39 | from ..models.task_create import TaskCreate
40 |
41 | d = dict(src_dict)
42 | item = TaskCreate.from_dict(d.pop("item"))
43 |
44 | wrapped_task_create = cls(
45 | item=item,
46 | )
47 |
48 | wrapped_task_create.additional_properties = d
49 | return wrapped_task_create
50 |
51 | @property
52 | def additional_keys(self) -> list[str]:
53 | return list(self.additional_properties.keys())
54 |
55 | def __getitem__(self, key: str) -> Any:
56 | return self.additional_properties[key]
57 |
58 | def __setitem__(self, key: str, value: Any) -> None:
59 | self.additional_properties[key] = value
60 |
61 | def __delitem__(self, key: str) -> None:
62 | del self.additional_properties[key]
63 |
64 | def __contains__(self, key: str) -> bool:
65 | return key in self.additional_properties
66 |
--------------------------------------------------------------------------------
/dart/generated/models/wrapped_task_update.py:
--------------------------------------------------------------------------------
1 | from collections.abc import Mapping
2 | from typing import TYPE_CHECKING, Any, TypeVar
3 |
4 | from attrs import define as _attrs_define
5 | from attrs import field as _attrs_field
6 |
7 | if TYPE_CHECKING:
8 | from ..models.task_update import TaskUpdate
9 |
10 |
11 | T = TypeVar("T", bound="WrappedTaskUpdate")
12 |
13 |
14 | @_attrs_define
15 | class WrappedTaskUpdate:
16 | """
17 | Attributes:
18 | item (TaskUpdate):
19 | """
20 |
21 | item: "TaskUpdate"
22 | additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
23 |
24 | def to_dict(self) -> dict[str, Any]:
25 | item = self.item.to_dict()
26 |
27 | field_dict: dict[str, Any] = {}
28 | field_dict.update(self.additional_properties)
29 | field_dict.update(
30 | {
31 | "item": item,
32 | }
33 | )
34 |
35 | return field_dict
36 |
37 | @classmethod
38 | def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
39 | from ..models.task_update import TaskUpdate
40 |
41 | d = dict(src_dict)
42 | item = TaskUpdate.from_dict(d.pop("item"))
43 |
44 | wrapped_task_update = cls(
45 | item=item,
46 | )
47 |
48 | wrapped_task_update.additional_properties = d
49 | return wrapped_task_update
50 |
51 | @property
52 | def additional_keys(self) -> list[str]:
53 | return list(self.additional_properties.keys())
54 |
55 | def __getitem__(self, key: str) -> Any:
56 | return self.additional_properties[key]
57 |
58 | def __setitem__(self, key: str, value: Any) -> None:
59 | self.additional_properties[key] = value
60 |
61 | def __delitem__(self, key: str) -> None:
62 | del self.additional_properties[key]
63 |
64 | def __contains__(self, key: str) -> bool:
65 | return key in self.additional_properties
66 |
--------------------------------------------------------------------------------
/dart/generated/models/wrapped_view.py:
--------------------------------------------------------------------------------
1 | from collections.abc import Mapping
2 | from typing import TYPE_CHECKING, Any, TypeVar
3 |
4 | from attrs import define as _attrs_define
5 | from attrs import field as _attrs_field
6 |
7 | if TYPE_CHECKING:
8 | from ..models.view import View
9 |
10 |
11 | T = TypeVar("T", bound="WrappedView")
12 |
13 |
14 | @_attrs_define
15 | class WrappedView:
16 | """
17 | Attributes:
18 | item (View):
19 | """
20 |
21 | item: "View"
22 | additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
23 |
24 | def to_dict(self) -> dict[str, Any]:
25 | item = self.item.to_dict()
26 |
27 | field_dict: dict[str, Any] = {}
28 | field_dict.update(self.additional_properties)
29 | field_dict.update(
30 | {
31 | "item": item,
32 | }
33 | )
34 |
35 | return field_dict
36 |
37 | @classmethod
38 | def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
39 | from ..models.view import View
40 |
41 | d = dict(src_dict)
42 | item = View.from_dict(d.pop("item"))
43 |
44 | wrapped_view = cls(
45 | item=item,
46 | )
47 |
48 | wrapped_view.additional_properties = d
49 | return wrapped_view
50 |
51 | @property
52 | def additional_keys(self) -> list[str]:
53 | return list(self.additional_properties.keys())
54 |
55 | def __getitem__(self, key: str) -> Any:
56 | return self.additional_properties[key]
57 |
58 | def __setitem__(self, key: str, value: Any) -> None:
59 | self.additional_properties[key] = value
60 |
61 | def __delitem__(self, key: str) -> None:
62 | del self.additional_properties[key]
63 |
64 | def __contains__(self, key: str) -> bool:
65 | return key in self.additional_properties
66 |
--------------------------------------------------------------------------------
/dart/generated/py.typed:
--------------------------------------------------------------------------------
1 | # Marker file for PEP 561
--------------------------------------------------------------------------------
/dart/generated/types.py:
--------------------------------------------------------------------------------
1 | """Contains some shared types for properties"""
2 |
3 | from collections.abc import MutableMapping
4 | from http import HTTPStatus
5 | from typing import BinaryIO, Generic, Literal, Optional, TypeVar
6 |
7 | from attrs import define
8 |
9 |
10 | class Unset:
11 | def __bool__(self) -> Literal[False]:
12 | return False
13 |
14 |
15 | UNSET: Unset = Unset()
16 |
17 | FileJsonType = tuple[Optional[str], BinaryIO, Optional[str]]
18 |
19 |
20 | @define
21 | class File:
22 | """Contains information for file uploads"""
23 |
24 | payload: BinaryIO
25 | file_name: Optional[str] = None
26 | mime_type: Optional[str] = None
27 |
28 | def to_tuple(self) -> FileJsonType:
29 | """Return a tuple representation that httpx will accept for multipart/form-data"""
30 | return self.file_name, self.payload, self.mime_type
31 |
32 |
33 | T = TypeVar("T")
34 |
35 |
36 | @define
37 | class Response(Generic[T]):
38 | """A response from an endpoint"""
39 |
40 | status_code: HTTPStatus
41 | content: bytes
42 | headers: MutableMapping[str, str]
43 | parsed: Optional[T]
44 |
45 |
46 | __all__ = ["UNSET", "File", "FileJsonType", "Response", "Unset"]
47 |
--------------------------------------------------------------------------------
/dart/old.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 |
4 | """These are legacy components that still rely on private API, moved out of dart.py."""
5 |
6 | # Required for type hinting compatibility when using Python 3.9
7 | from __future__ import annotations
8 |
9 | from functools import wraps
10 | from typing import Any, Callable, Union
11 |
12 | import httpx
13 |
14 | from .dart import (
15 | Dart,
16 | _auth_failure_exit,
17 | _handle_request_errors,
18 | _log,
19 | _make_id,
20 | _unknown_failure_exit,
21 | )
22 | from .exception import DartException
23 |
24 | _CREATE_TRANSACTION_URL_FRAG = "/transactions/create"
25 | _LIST_DARTBOARDS_URL_FRAG = "/dartboards"
26 | _LIST_FOLDERS_URL_FRAG = "/folders"
27 | _REPLICATE_DARTBOARD_URL_FRAG_FMT = "/dartboards/replicate/{dartboard_id}"
28 | _REPLICATE_SPACE_URL_FRAG_FMT = "/spaces/replicate/{space_id}"
29 |
30 |
31 | def _get_space_url(host: str, space_id: str) -> str:
32 | return f"{host}/s/{space_id}"
33 |
34 |
35 | def _get_dartboard_url(host: str, dartboard_id: str) -> str:
36 | return f"{host}/d/{dartboard_id}"
37 |
38 |
39 | def _get_folder_url(host: str, folder_id: str) -> str:
40 | return f"{host}/f/{folder_id}"
41 |
42 |
43 | def _handle_api_errors(fn: Callable[..., httpx.Response]) -> Callable[..., httpx.Response]:
44 | @wraps(fn)
45 | def wrapper(*args, **kwargs):
46 | response = fn(*args, **kwargs)
47 | if response.status_code in {401, 403}:
48 | _auth_failure_exit()
49 | return response
50 |
51 | return wrapper
52 |
53 |
54 | def _parse_transaction_response_and_maybe_exit(response: dict, model_kind: str, model_id: str) -> Any:
55 | if (
56 | response is None
57 | or "results" not in response
58 | or not response["results"]
59 | or not response["results"][0]["success"]
60 | ):
61 | _unknown_failure_exit()
62 | models = response["results"][0]["models"][f"{model_kind}s"]
63 | model = next((e for e in models if e["duid"] == model_id), None)
64 | if model is None:
65 | _unknown_failure_exit()
66 | return model
67 |
68 |
69 | class DartOld(Dart):
70 | @_handle_api_errors
71 | @_handle_request_errors
72 | def transact(self, operations: list[dict], kind: str) -> httpx.Response:
73 | transaction = {
74 | "duid": _make_id(),
75 | "kind": kind,
76 | "operations": operations,
77 | }
78 | request_body = {
79 | "client_duid": self.get_client_id(),
80 | "items": [transaction],
81 | }
82 | return self._private_api.get_httpx_client().post(_CREATE_TRANSACTION_URL_FRAG, json=request_body)
83 |
84 | @_handle_api_errors
85 | @_handle_request_errors
86 | def get(self, url_frag, *args, **kwargs) -> httpx.Response:
87 | return self._private_api.get_httpx_client().get(url_frag, *args, **kwargs)
88 |
89 | @_handle_api_errors
90 | @_handle_request_errors
91 | def post(self, url_frag, *args, **kwargs) -> httpx.Response:
92 | return self._private_api.get_httpx_client().post(url_frag, *args, **kwargs)
93 |
94 |
95 | def replicate_space(
96 | space_id: str,
97 | *,
98 | title: Union[str, None] = None,
99 | abrev: Union[str, None] = None,
100 | color_hex: Union[str, None] = None,
101 | accessible_by_team: Union[bool, None] = None,
102 | accessor_duids: Union[list[str], None] = None,
103 | ) -> str:
104 | dart = DartOld()
105 | content = {}
106 | if title is not None:
107 | content["title"] = title
108 | if abrev is not None:
109 | content["abrev"] = abrev
110 | if color_hex is not None:
111 | content["colorHex"] = color_hex
112 | if accessible_by_team is not None:
113 | content["accessibleByTeam"] = accessible_by_team
114 | if accessor_duids is not None:
115 | content["accessorIds"] = accessor_duids
116 | response = dart.post(_REPLICATE_SPACE_URL_FRAG_FMT.format(space_id=space_id), json=content)
117 | space_id = response.json()["duid"]
118 |
119 | _log(f"Replicated space at {_get_space_url(dart.get_base_url(), space_id)}")
120 | _log("Done.")
121 | return space_id
122 |
123 |
124 | def get_dartboards(space_id: str, include_special: bool = False) -> list[dict]:
125 | dart = DartOld()
126 |
127 | response = dart.get(_LIST_DARTBOARDS_URL_FRAG, params={"space_duid": space_id})
128 | response_json = response.json()
129 | dartboards = response_json["results"] if response_json is not None else []
130 | if not include_special:
131 | dartboards = [e for e in dartboards if e["kind"] == "Custom"]
132 |
133 | _log(f"Got {len(dartboards)} dartboards")
134 | _log("Done.")
135 | return dartboards
136 |
137 |
138 | def replicate_dartboard(dartboard_id: str, *, title: Union[str, None] = None) -> str:
139 | dart = DartOld()
140 | content = {}
141 | if title is not None:
142 | content["title"] = title
143 | response = dart.post(_REPLICATE_DARTBOARD_URL_FRAG_FMT.format(dartboard_id=dartboard_id), json=content)
144 | dartboard_id = response.json()["duid"]
145 |
146 | _log(f"Replicated dartboard at {_get_dartboard_url(dart.get_base_url(), dartboard_id)}")
147 | _log("Done.")
148 | return dartboard_id
149 |
150 |
151 | def update_dartboard(dartboard_id: str, *, title: Union[str, None] = None, color_hex: Union[str, None] = None) -> dict:
152 | dart = DartOld()
153 | dartboard_update = {}
154 |
155 | if title is not None:
156 | dartboard_update["title"] = title
157 | if color_hex is not None:
158 | dartboard_update["color_hex"] = color_hex
159 |
160 | if not dartboard_update:
161 | raise DartException("At least one of 'title' or 'color_hex' must be provided to update a dartboard.")
162 |
163 | dartboard_update["duid"] = dartboard_id
164 | dartboard_update_op = {
165 | "model": "dartboard",
166 | "kind": "update",
167 | "data": dartboard_update,
168 | }
169 | response = dart.transact([dartboard_update_op], "dartboard_update")
170 | response_json = response.json()
171 | dartboard = _parse_transaction_response_and_maybe_exit(response_json, "dartboard", dartboard_id)
172 |
173 | _log(f"Updated dartboard {dartboard['title']} at {_get_dartboard_url(dart.get_base_url(), dartboard['duid'])}")
174 | _log("Done.")
175 | return dartboard
176 |
177 |
178 | def get_folders(space_id: str, *, include_special: Union[bool, None] = False) -> list[dict]:
179 | dart = DartOld()
180 |
181 | response = dart.get(_LIST_FOLDERS_URL_FRAG, params={"space_duid": space_id})
182 | response_json = response.json()
183 | folders = response_json["results"] if response_json is not None else []
184 | if not include_special:
185 | folders = [e for e in folders if e["kind"] == "Other"]
186 |
187 | _log(f"Got {len(folders)} folders")
188 | _log("Done.")
189 | return folders
190 |
191 |
192 | def update_folder(folder_id: str, *, title: Union[str, None] = None, color_hex: Union[str, None] = None) -> dict:
193 | dart = DartOld()
194 | folder_update = {}
195 |
196 | if title is not None:
197 | folder_update["title"] = title
198 | if color_hex is not None:
199 | folder_update["color_hex"] = color_hex
200 |
201 | if not folder_update:
202 | raise DartException("At least one of 'title' or 'color_hex' must be provided to update a folder.")
203 |
204 | folder_update["duid"] = folder_id
205 | folder_update_op = {
206 | "model": "folder",
207 | "kind": "update",
208 | "data": folder_update,
209 | }
210 | response = dart.transact([folder_update_op], "folder_update")
211 | response_json = response.json()
212 | folder = _parse_transaction_response_and_maybe_exit(response_json, "folder", folder_id)
213 |
214 | _log(f"Updated folder {folder['title']} at {_get_folder_url(dart.get_base_url(), folder['duid'])}")
215 | _log("Done.")
216 | return folder
217 |
--------------------------------------------------------------------------------
/dart/order_manager.py:
--------------------------------------------------------------------------------
1 | # Required for type hinting compatibility when using Python 3.9
2 | from __future__ import annotations
3 |
4 | # TODO dedupe with the other order manager
5 | from random import choices
6 |
7 | from .exception import OrderException
8 |
9 | _MIN_ORD = 1
10 | _MAX_ORD = 256
11 |
12 | _ORDER_CHARS = [chr(e) for e in range(_MIN_ORD, _MAX_ORD)]
13 |
14 |
15 | def _make_order_suffix():
16 | return "".join(choices(_ORDER_CHARS, k=4))
17 |
18 |
19 | def _get_orders_between_recursive(start: str, end: str, count: int):
20 | max_len = max(len(start), len(end)) + 1
21 | for i in range(max_len):
22 | start_ord = ord(start[i]) if i < len(start) else _MIN_ORD
23 | end_ord = ord(end[i]) if i < len(end) else _MAX_ORD
24 | diff = end_ord - start_ord
25 | if diff <= 1:
26 | continue
27 | prefix = start[:i].ljust(i, chr(_MIN_ORD))
28 | if diff > count:
29 | frac = diff / (count + 1)
30 | return [prefix + chr(start_ord + round(frac * (j + 1))) for j in range(0, count)]
31 | segs = [start[i:]] + [chr(start_ord + j + 1) for j in range(diff - 1)] + [end[i:]]
32 | tot_amount = 0
33 | amounts = []
34 | for j in range(diff):
35 | next_amount = round((count * (j + 1)) / diff) - tot_amount
36 | amounts.append(next_amount)
37 | tot_amount += next_amount
38 | res = []
39 | for j in range(diff):
40 | res += [prefix + e for e in _get_orders_between_recursive(segs[j], segs[j + 1], amounts[j])]
41 | return res
42 | raise OrderException(f"failed to get {count} values between {start} and {end}")
43 |
44 |
45 | def get_orders_between(start: str | None, end: str | None, count: int = 1):
46 | if count <= 0:
47 | return []
48 | if bool(start) and bool(end) and start >= end:
49 | print(f"invalid request for {count} values between {start} and {end}")
50 | return [start] * count
51 | return [e + _make_order_suffix() for e in _get_orders_between_recursive(start or "", end or "", count)]
52 |
--------------------------------------------------------------------------------
/dart/webhook.py:
--------------------------------------------------------------------------------
1 | import hashlib
2 | import hmac
3 | import os
4 |
5 | _WEBHOOK_SECRET = os.environ.get("DART_WEBHOOK_SECRET")
6 | _ENCODED_WEBHOOK_SECRET = _WEBHOOK_SECRET.encode() if _WEBHOOK_SECRET is not None else None
7 |
8 |
9 | def is_signature_correct(payload: bytes, signature: str) -> bool:
10 | if _ENCODED_WEBHOOK_SECRET is None:
11 | raise RuntimeError("DART_WEBHOOK_SECRET environment variable is not set")
12 | expected_signature = hmac.new(_ENCODED_WEBHOOK_SECRET, payload, hashlib.sha256).hexdigest()
13 | try:
14 | return hmac.compare_digest(expected_signature, signature)
15 | except TypeError:
16 | return False
17 |
--------------------------------------------------------------------------------
/examples/replicate_space.py:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 |
4 |
5 | from dart import (
6 | create_task,
7 | get_dartboards,
8 | get_folders,
9 | is_logged_in,
10 | replicate_space,
11 | update_dartboard,
12 | update_folder,
13 | )
14 |
15 | # The DART_TOKEN environment variable must be set to the value from
16 | # https://app.itsdart.com/?settings=account at this point
17 | is_logged_in(should_raise=True)
18 |
19 |
20 | # You can get this ID from the space's three dot menu > 'Copy ID'
21 | TEMPLATE_SPACE_ID = "J3h4WKcqRpnS"
22 | NEW_COLOR_HEX = "#000000"
23 |
24 | # Title is optional
25 | new_space_id = replicate_space(
26 | TEMPLATE_SPACE_ID,
27 | title="New space title",
28 | abrev="NST",
29 | color_hex=NEW_COLOR_HEX,
30 | accessible_by_team=True,
31 | )
32 |
33 | # Because space replication is async, you might need to add a timeout
34 | # or loop until you get the expected number of dartboards here
35 | dartboards = get_dartboards(new_space_id)
36 | main_dartboard = [e for e in dartboards if e.title == "Dartboard title to change"][0]
37 | # Update the relevant dartboard
38 | update_dartboard(main_dartboard.duid, title="New dartboard title", color_hex=NEW_COLOR_HEX)
39 |
40 | # Do the same for folders
41 | folders = get_folders(new_space_id)
42 | for folder in folders:
43 | update_folder(folder.duid, title="New folder title", color_hex=NEW_COLOR_HEX)
44 |
45 | # Create and assign tasks to the new dartboard
46 | create_task(
47 | dartboard_duid=main_dartboard.duid,
48 | title="New task",
49 | priority_int=0,
50 | )
51 |
--------------------------------------------------------------------------------
/examples/replicate_space_and_more.js:
--------------------------------------------------------------------------------
1 | const DART_TOKEN = process.env.DART_TOKEN;
2 |
3 | const DART_ROOT_URL = "https://app.itsdart.com/api/v0";
4 | const DART_REPLICATE_SPACE_URL = `${DART_ROOT_URL}/spaces/replicate`;
5 | const DART_CREATE_TRANSACTION_URL = `${DART_ROOT_URL}/transactions/create`;
6 |
7 | const DUID_CHARS = Array.from(Array(26).keys())
8 | .map((i) => String.fromCharCode(i + 65))
9 | .concat(Array.from(Array(26).keys()).map((i) => String.fromCharCode(i + 97)))
10 | .concat(Array.from(Array(10).keys()).map((i) => `${i}`))
11 | .concat(["-", "_"])
12 | .sort();
13 |
14 | const randomSample = (arr, k = 1) => Array.from(Array(k), () => arr[Math.floor(Math.random() * arr.length)]);
15 |
16 | const makeDuid = () => randomSample(DUID_CHARS, 12).join("");
17 |
18 | const clientDuid = makeDuid();
19 |
20 | const replicateSpace = async (duid, title) => {
21 | const response = await fetch(`${DART_REPLICATE_SPACE_URL}/${duid}`, {
22 | method: "POST",
23 | headers: {
24 | Authorization: `Bearer ${DART_TOKEN}`,
25 | "Content-Type": "application/json",
26 | },
27 | body: JSON.stringify({
28 | title,
29 | }),
30 | });
31 | return response.json();
32 | };
33 |
34 | const updateDartboard = async (duid, title) => {
35 | const response = await fetch(`${DART_CREATE_TRANSACTION_URL}`, {
36 | method: "POST",
37 | headers: {
38 | Authorization: `Bearer ${DART_TOKEN}`,
39 | "Content-Type": "application/json",
40 | },
41 | body: JSON.stringify({
42 | clientDuid,
43 | items: [
44 | {
45 | duid: makeDuid(),
46 | operations: [
47 | {
48 | model: "dartboard",
49 | kind: "update",
50 | data: {
51 | duid,
52 | title,
53 | },
54 | },
55 | ],
56 | kind: "dartboard_update",
57 | },
58 | ],
59 | }),
60 | });
61 | return response.json();
62 | };
63 |
64 | const createTask = async (dartboardDuid, title) => {
65 | const response = await fetch(`${DART_CREATE_TRANSACTION_URL}`, {
66 | method: "POST",
67 | headers: {
68 | Authorization: `Bearer ${DART_TOKEN}`,
69 | "Content-Type": "application/json",
70 | },
71 | body: JSON.stringify({
72 | clientDuid,
73 | items: [
74 | {
75 | duid: makeDuid(),
76 | operations: [
77 | {
78 | model: "task",
79 | kind: "create",
80 | data: {
81 | duid: makeDuid(),
82 | dartboardDuid,
83 | title,
84 | },
85 | },
86 | ],
87 | kind: "task_create",
88 | },
89 | ],
90 | }),
91 | });
92 | return response.json();
93 | };
94 |
95 | const main = async () => {
96 | const replicatedSpaceDuid = (await replicateSpace("Mp9fFrctHssQ", "New space title")).duid;
97 | const updatedDartboard = (await updateDartboard("8ytNh7Aa5weF", "New dartboard title")).results[0].models;
98 | const createdTask = (await createTask("8ytNh7Aa5weF", "New task title")).results[0].models;
99 | console.log(replicatedSpaceDuid, updatedDartboard, createdTask);
100 | };
101 |
102 | main();
103 |
--------------------------------------------------------------------------------
/examples/upload_attachment.py:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 |
4 | import mimetypes
5 | import os
6 | import random
7 | import string
8 |
9 | import requests
10 |
11 | _DART_TOKEN = os.environ.get("DART_TOKEN")
12 |
13 | _BASE_URL = "https://app.itsdart.com"
14 | _HEADERS = {
15 | "Content-Type": "application/json",
16 | "Authorization": "Bearer " + _DART_TOKEN,
17 | }
18 |
19 | _DUID_CHARS = string.ascii_lowercase + string.ascii_uppercase + string.digits
20 |
21 |
22 | def _make_duid() -> str:
23 | return "".join(random.choices(_DUID_CHARS, k=12))
24 |
25 |
26 | def _get_task_id(task_title: str) -> str:
27 | response = requests.get(
28 | f"{_BASE_URL}/api/v0/public/tasks/list",
29 | params={"title": task_title},
30 | headers=_HEADERS,
31 | timeout=10,
32 | )
33 | response.raise_for_status()
34 | return response.json()["results"][0]["id"]
35 |
36 |
37 | def _create_presigned_url_config(file_name: str, attachment_id: str) -> dict:
38 | response = requests.post(
39 | f"{_BASE_URL}/api/v0/create-presigned-url",
40 | json={
41 | "kind": "attachment",
42 | "filename": file_name,
43 | "entityDuid": attachment_id,
44 | },
45 | headers=_HEADERS,
46 | timeout=10,
47 | )
48 | response.raise_for_status()
49 | return response.json()
50 |
51 |
52 | def _make_attachment(task_id: str, attachment_id: str, file_name: str, file_type: str, file_url: str):
53 | response = requests.post(
54 | f"{_BASE_URL}/api/v0/transactions/create",
55 | json={
56 | "items": [
57 | {
58 | "kind": "task_update",
59 | "operations": [
60 | {
61 | "model": "attachment",
62 | "kind": "create",
63 | "data": {
64 | "duid": attachment_id,
65 | "order": _make_duid(),
66 | "name": file_name,
67 | "kind": file_type,
68 | "filePath": file_url,
69 | },
70 | },
71 | {
72 | "model": "task",
73 | "kind": "update_list_add",
74 | "data": {
75 | "duid": task_id,
76 | "attachmentDuids": [attachment_id],
77 | },
78 | },
79 | ],
80 | },
81 | ]
82 | },
83 | headers=_HEADERS,
84 | timeout=10,
85 | )
86 | response.raise_for_status()
87 |
88 |
89 | def _get_file(file_url: str) -> bytes:
90 | response = requests.get(file_url, timeout=10)
91 | response.raise_for_status()
92 | return response.content
93 |
94 |
95 | def _upload_file(file: bytes, presigned_url: str, signed_headers: dict):
96 | response = requests.put(presigned_url, data=file, headers=signed_headers, timeout=10)
97 | response.raise_for_status()
98 |
99 |
100 | def upload_attachment(task_title: str, file_name: str, file_url: str) -> str:
101 | file_type = mimetypes.guess_type(file_url)[0] or "application/octet-stream"
102 | task_id = _get_task_id(task_title)
103 | attachment_id = _make_duid()
104 | presigned_url_config = _create_presigned_url_config(file_name, attachment_id)
105 | _make_attachment(task_id, attachment_id, file_name, file_type, presigned_url_config["filePath"])
106 | file = _get_file(file_url)
107 | _upload_file(
108 | file,
109 | presigned_url_config["presignedUrl"],
110 | presigned_url_config["signedHeaders"],
111 | )
112 | return attachment_id
113 |
--------------------------------------------------------------------------------
/examples/watch_for_status_change.py:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 |
4 | import json
5 |
6 | from dart import is_signature_correct
7 |
8 | # Adjust these depending on the situation within Dart
9 | STANDARD_TITLE = "Approve to continue"
10 |
11 |
12 | def run_webhook(payload: bytes, headers: dict) -> bool:
13 | # Parse the event
14 | try:
15 | event = json.loads(payload)
16 | except TypeError as ex:
17 | print(f"Webhook error while parsing event: {ex}")
18 | return False
19 |
20 | # Verify the signature of the event
21 | signature: str | None = headers.get("Dart-Signature")
22 | if signature is None or not is_signature_correct(payload, signature):
23 | print("Webhook signature verification failed")
24 | return False
25 |
26 | # Ignore if it wasn't an update
27 | event_type = event["type"]
28 | if event_type != "task.updated":
29 | return True
30 |
31 | # Ignore if it isn't relevant based on our criteria
32 | data = event["data"]
33 | task = data["model"]
34 | old_task = data["oldModel"]
35 | if task["title"] != STANDARD_TITLE or task["status"] != "Approved" or old_task["status"] == "Approved":
36 | return True
37 |
38 | # At this point we know that this is a relevant event, so we can do whatever we want with it
39 | print(f"Task {task['id']} was approved")
40 |
41 | return True
42 |
--------------------------------------------------------------------------------
/examples/webhook_server.py:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 |
4 | # README: https://help.itsdart.com/articles/9024895-webhooks
5 |
6 |
7 | import json
8 |
9 | from flask import Flask, Response, jsonify, request
10 |
11 | from dart import Comment, Doc, Task, is_signature_correct
12 |
13 | app = Flask(__name__)
14 |
15 |
16 | @app.route("/", methods=["POST"])
17 | def webhook() -> Response:
18 | payload = request.data
19 |
20 | # Parse the event
21 | try:
22 | event = json.loads(payload)
23 | except TypeError as ex:
24 | print(f"Webhook error while parsing event: {ex}")
25 | return jsonify(success=False)
26 |
27 | # Verify the signature of the event
28 | signature = request.headers.get("Dart-Signature")
29 | if not is_signature_correct(payload, signature):
30 | print("Webhook signature verification failed")
31 | return jsonify(success=False)
32 |
33 | # Handle the event
34 | event_type = event["type"]
35 | match event_type:
36 | case "task.created":
37 | task = Task.from_dict(event["data"]["model"]) # The task that was created
38 | print(f"Task created:\n{task.to_dict()}")
39 | case "task.updated":
40 | data = event["data"]
41 | task = Task.from_dict(data["model"]) # The new version of the task that was updated
42 | old_task = Task.from_dict(data["oldModel"]) # The old version of the task that was updated
43 | print(f"Task updated from:\n{old_task.to_dict()}\nfrom:\n{task.to_dict()}")
44 | case "task.deleted":
45 | task = Task.from_dict(event["data"]["model"]) # The task that was deleted
46 | print(f"Task deleted:\n{task.to_dict()}")
47 | case "doc.created":
48 | doc = Doc.from_dict(event["data"]["model"]) # The doc that was created
49 | print(f"Doc created:\n{doc.to_dict()}")
50 | case "doc.updated":
51 | data = event["data"]
52 | doc = Doc.from_dict(data["model"]) # The new version of the doc that was updated
53 | old_doc = Doc.from_dict(data["oldModel"]) # The old version of the doc that was updated
54 | print(f"Doc updated from:\n{old_doc.to_dict()}\nfrom:\n{doc.to_dict()}")
55 | case "doc.deleted":
56 | doc = Doc.from_dict(event["data"]["model"]) # The doc that was deleted
57 | print(f"Doc deleted:\n{doc.to_dict()}")
58 | case "comment.created":
59 | comment = Comment.from_dict(event["data"]["model"]) # The comment that was created
60 | print(f"Comment created:\n{comment.to_dict()}")
61 | case _:
62 | # Unexpected event type
63 | print(f"Unhandled event type: {event_type}")
64 | return jsonify(success=False)
65 |
66 | return jsonify(success=True)
67 |
68 |
69 | if __name__ == "__main__":
70 | app.run(debug=True)
71 |
--------------------------------------------------------------------------------
/makefile:
--------------------------------------------------------------------------------
1 | # Generate OpenAPI client.
2 | api:
3 | admin/make-api.sh
4 | @$(MAKE) isort
5 | @$(MAKE) blacken
6 |
7 | # Run black on python files to format them.
8 | blacken:
9 | uv run black ./dart ./examples
10 |
11 | # Build a Python package and upload it to PyPI.
12 | deploy:
13 | admin/make-deploy.sh
14 |
15 | # Format imports on python files.
16 | isort:
17 | uv run isort ./dart ./examples
18 |
19 | # Update all dependencies.
20 | req-up-all:
21 | uv lock --upgrade && uv sync
22 |
--------------------------------------------------------------------------------
/pyproject.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | name = "dart-tools"
3 | version = "0.7.2"
4 | description = "The Dart CLI and Python Library"
5 | readme = "README.md"
6 | requires-python = ">=3.9"
7 | license = {file = "LICENSE"}
8 | keywords = ["dart", "cli", "projectmanagement", "taskmanagement"]
9 | authors = [
10 | { name="Dart", email="software@itsdart.com" }
11 | ]
12 | classifiers=[
13 | "Development Status :: 4 - Beta",
14 | "Environment :: Console",
15 | "Intended Audience :: Developers",
16 | "License :: OSI Approved :: MIT License",
17 | "Natural Language :: English",
18 | "Operating System :: OS Independent",
19 | "Programming Language :: Python",
20 | "Programming Language :: Python :: 3",
21 | "Programming Language :: Python :: 3 :: Only",
22 | "Programming Language :: Python :: 3.9",
23 | "Programming Language :: Python :: 3.10",
24 | "Programming Language :: Python :: 3.11",
25 | "Programming Language :: Python :: 3.12",
26 | "Programming Language :: Python :: 3.13",
27 | "Topic :: Office/Business",
28 | "Topic :: Office/Business :: Groupware",
29 | "Topic :: Office/Business :: Scheduling",
30 | "Topic :: Software Development",
31 | "Topic :: Software Development :: Libraries",
32 | "Topic :: Software Development :: Libraries :: Python Modules",
33 | ]
34 | dependencies = [
35 | "attrs>=25.3",
36 | "dateparser>=1.2",
37 | "httpx>=0.28",
38 | "pick>=2.4",
39 | "platformdirs>=4.3",
40 | ]
41 |
42 | [dependency-groups]
43 | dev = [
44 | "black==25.1.0",
45 | "flask==3.1.1",
46 | "isort==6.0.1",
47 | "openapi-python-client==0.24.3",
48 | ]
49 |
50 | [project.urls]
51 | "Homepage" = "https://www.itsdart.com/?nr=1"
52 | "Web App" = "https://app.itsdart.com/"
53 | "Help Center" = "https://help.itsdart.com/"
54 | "Bugs and Features" = "https://github.com/its-dart/dart-tools-py/issues"
55 | "Library Source" = "https://github.com/its-dart/dart-tools-py/"
56 |
57 | [project.scripts]
58 | dart = "dart:cli"
59 |
60 | [build-system]
61 | requires = ["setuptools>=43.0.0", "wheel"]
62 | build-backend = "setuptools.build_meta"
63 |
64 | [tool.black]
65 | line-length = 120
66 |
67 | [tool.isort]
68 | profile = "black"
69 | line_length = 120
70 |
71 | [tool.setuptools.packages.find]
72 | where = ["."]
73 | include = ["dart", "dart.generated*"]
74 |
--------------------------------------------------------------------------------