dart-tools 0.8.3__py3-none-any.whl → 0.8.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
1
  """Contains methods for accessing the API"""
2
2
 
3
+ from .attachment import add_task_attachment_from_url
3
4
  from .comment import add_task_comment, list_comments
4
5
  from .config import get_config
5
6
  from .dartboard import get_dartboard
@@ -0,0 +1 @@
1
+ """Contains endpoint functions for accessing the API"""
@@ -0,0 +1,190 @@
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.attachment import Attachment
9
+ from ...models.attachment_create_from_url import AttachmentCreateFromUrl
10
+ from ...types import Response
11
+
12
+
13
+ def _get_kwargs(
14
+ id: str,
15
+ *,
16
+ body: AttachmentCreateFromUrl,
17
+ ) -> dict[str, Any]:
18
+ headers: dict[str, Any] = {}
19
+
20
+ _kwargs: dict[str, Any] = {
21
+ "method": "post",
22
+ "url": "/tasks/{id}/attachments/from-url".format(
23
+ id=id,
24
+ ),
25
+ }
26
+
27
+ _body = body.to_dict()
28
+
29
+ _kwargs["json"] = _body
30
+ headers["Content-Type"] = "application/json"
31
+
32
+ _kwargs["headers"] = headers
33
+ return _kwargs
34
+
35
+
36
+ def _parse_response(
37
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
38
+ ) -> Optional[Union[Any, Attachment]]:
39
+ if response.status_code == 200:
40
+ response_200 = Attachment.from_dict(response.json())
41
+
42
+ return response_200
43
+ if response.status_code == 400:
44
+ response_400 = cast(Any, None)
45
+ return response_400
46
+ if client.raise_on_unexpected_status:
47
+ raise errors.UnexpectedStatus(response.status_code, response.content)
48
+ else:
49
+ return None
50
+
51
+
52
+ def _build_response(
53
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
54
+ ) -> Response[Union[Any, Attachment]]:
55
+ return Response(
56
+ status_code=HTTPStatus(response.status_code),
57
+ content=response.content,
58
+ headers=response.headers,
59
+ parsed=_parse_response(client=client, response=response),
60
+ )
61
+
62
+
63
+ def sync_detailed(
64
+ id: str,
65
+ *,
66
+ client: Union[AuthenticatedClient, Client],
67
+ body: AttachmentCreateFromUrl,
68
+ ) -> Response[Union[Any, Attachment]]:
69
+ """Attach a file from a provided URL to a task
70
+
71
+ Attach a file from a provided URL to a task. The file will be downloaded and attached
72
+ asynchronously. This operation may take a few moments to complete.
73
+
74
+ Args:
75
+ id (str):
76
+ body (AttachmentCreateFromUrl):
77
+
78
+ Raises:
79
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
80
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
81
+
82
+ Returns:
83
+ Response[Union[Any, Attachment]]
84
+ """
85
+
86
+ kwargs = _get_kwargs(
87
+ id=id,
88
+ body=body,
89
+ )
90
+
91
+ response = client.get_httpx_client().request(
92
+ **kwargs,
93
+ )
94
+
95
+ return _build_response(client=client, response=response)
96
+
97
+
98
+ def sync(
99
+ id: str,
100
+ *,
101
+ client: Union[AuthenticatedClient, Client],
102
+ body: AttachmentCreateFromUrl,
103
+ ) -> Optional[Union[Any, Attachment]]:
104
+ """Attach a file from a provided URL to a task
105
+
106
+ Attach a file from a provided URL to a task. The file will be downloaded and attached
107
+ asynchronously. This operation may take a few moments to complete.
108
+
109
+ Args:
110
+ id (str):
111
+ body (AttachmentCreateFromUrl):
112
+
113
+ Raises:
114
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
115
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
116
+
117
+ Returns:
118
+ Union[Any, Attachment]
119
+ """
120
+
121
+ return sync_detailed(
122
+ id=id,
123
+ client=client,
124
+ body=body,
125
+ ).parsed
126
+
127
+
128
+ async def asyncio_detailed(
129
+ id: str,
130
+ *,
131
+ client: Union[AuthenticatedClient, Client],
132
+ body: AttachmentCreateFromUrl,
133
+ ) -> Response[Union[Any, Attachment]]:
134
+ """Attach a file from a provided URL to a task
135
+
136
+ Attach a file from a provided URL to a task. The file will be downloaded and attached
137
+ asynchronously. This operation may take a few moments to complete.
138
+
139
+ Args:
140
+ id (str):
141
+ body (AttachmentCreateFromUrl):
142
+
143
+ Raises:
144
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
145
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
146
+
147
+ Returns:
148
+ Response[Union[Any, Attachment]]
149
+ """
150
+
151
+ kwargs = _get_kwargs(
152
+ id=id,
153
+ body=body,
154
+ )
155
+
156
+ response = await client.get_async_httpx_client().request(**kwargs)
157
+
158
+ return _build_response(client=client, response=response)
159
+
160
+
161
+ async def asyncio(
162
+ id: str,
163
+ *,
164
+ client: Union[AuthenticatedClient, Client],
165
+ body: AttachmentCreateFromUrl,
166
+ ) -> Optional[Union[Any, Attachment]]:
167
+ """Attach a file from a provided URL to a task
168
+
169
+ Attach a file from a provided URL to a task. The file will be downloaded and attached
170
+ asynchronously. This operation may take a few moments to complete.
171
+
172
+ Args:
173
+ id (str):
174
+ body (AttachmentCreateFromUrl):
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
+ Union[Any, Attachment]
182
+ """
183
+
184
+ return (
185
+ await asyncio_detailed(
186
+ id=id,
187
+ client=client,
188
+ body=body,
189
+ )
190
+ ).parsed
@@ -1,6 +1,7 @@
1
1
  """Contains all the data models used in inputs/outputs"""
2
2
 
3
3
  from .attachment import Attachment
4
+ from .attachment_create_from_url import AttachmentCreateFromUrl
4
5
  from .comment import Comment
5
6
  from .comment_create import CommentCreate
6
7
  from .concise_doc import ConciseDoc
@@ -72,6 +73,7 @@ from .wrapped_view import WrappedView
72
73
 
73
74
  __all__ = (
74
75
  "Attachment",
76
+ "AttachmentCreateFromUrl",
75
77
  "Comment",
76
78
  "CommentCreate",
77
79
  "ConciseDoc",
@@ -0,0 +1,67 @@
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="AttachmentCreateFromUrl")
8
+
9
+
10
+ @_attrs_define
11
+ class AttachmentCreateFromUrl:
12
+ """
13
+ Attributes:
14
+ name (str): The name of the file to upload.
15
+ url (str): The URL of the file to upload.
16
+ """
17
+
18
+ name: str
19
+ url: 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
+ url = self.url
26
+
27
+ field_dict: dict[str, Any] = {}
28
+ field_dict.update(self.additional_properties)
29
+ field_dict.update(
30
+ {
31
+ "name": name,
32
+ "url": url,
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
+ url = d.pop("url")
44
+
45
+ attachment_create_from_url = cls(
46
+ name=name,
47
+ url=url,
48
+ )
49
+
50
+ attachment_create_from_url.additional_properties = d
51
+ return attachment_create_from_url
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dart-tools
3
- Version: 0.8.3
3
+ Version: 0.8.4
4
4
  Summary: The Dart CLI and Python Library
5
5
  Author-email: Dart <software@dartai.com>
6
6
  License: MIT License
@@ -8,7 +8,9 @@ dart/generated/__init__.py,sha256=8fO-FKZzuZzOUUaqtlgw7k08MUwNLf8Ll-cAt7BgmAU,15
8
8
  dart/generated/client.py,sha256=o_mdLqyBCQstu5tS1WZFwqIEbGwkvWQ7eQjuCJw_5VY,12419
9
9
  dart/generated/errors.py,sha256=gO8GBmKqmSNgAg-E5oT-oOyxztvp7V_6XG7OUTT15q0,546
10
10
  dart/generated/types.py,sha256=E1hhDh_zXfsSQ0NCt9-uw90_Mr5iIlsdfnfvxv5HarU,1005
11
- dart/generated/api/__init__.py,sha256=LO0cobPN91pMRQKEkKg-tMqXJ4hqpwt0aIrsccOGQ4o,477
11
+ dart/generated/api/__init__.py,sha256=WcIqezh1fvbi1zreb0N60EF59CDf3HYL61VdVQ8x6Fo,530
12
+ dart/generated/api/attachment/__init__.py,sha256=5vd9uJWAjRqa9xzxzYkLD1yoZ12Ld_bAaNB5WX4fbE8,56
13
+ dart/generated/api/attachment/add_task_attachment_from_url.py,sha256=WdaSorFXIhYH9uzCYuVbvz4G3gDZyMxOvKXO5oHjUFY,5171
12
14
  dart/generated/api/comment/__init__.py,sha256=5vd9uJWAjRqa9xzxzYkLD1yoZ12Ld_bAaNB5WX4fbE8,56
13
15
  dart/generated/api/comment/add_task_comment.py,sha256=G9kpQ60IrMC4cxXP--wsPvVtYPMmByy-t55wV4WkvbI,4757
14
16
  dart/generated/api/comment/list_comments.py,sha256=HVa9704Guk0lNFvCOS8A94RfJNe0HJsRNSy2HcJiy60,11926
@@ -36,8 +38,9 @@ dart/generated/api/task/list_tasks.py,sha256=6jrxUVQvFBQTbwdSSqZwXl6147Qpk-MHW_q
36
38
  dart/generated/api/task/update_task.py,sha256=5f8wbMwQqRHya7D-iMFOcSL2VF1-flBUIIOYRJ1PjOA,5183
37
39
  dart/generated/api/view/__init__.py,sha256=5vd9uJWAjRqa9xzxzYkLD1yoZ12Ld_bAaNB5WX4fbE8,56
38
40
  dart/generated/api/view/get_view.py,sha256=11OjxQnER-ct9gYC0ckA_JOPwKe5BYoYWHvcyGMkr8E,4370
39
- dart/generated/models/__init__.py,sha256=OSpqpdKhhB1Oh_aVJlQWCnWIURDlsYmW2JugP_shE3M,4522
41
+ dart/generated/models/__init__.py,sha256=-r-572jX92bs29ZEcjGRmkWt57cYpvhu_GNOevIg5Pk,4617
40
42
  dart/generated/models/attachment.py,sha256=snnuBPthcyqUEZ1dyR2Hgs082OhqW0q8AkwNneswu80,1625
43
+ dart/generated/models/attachment_create_from_url.py,sha256=b2HizDIwLCuWOVLXzfvo2ztWdgQ6VLFcvdhavn87--k,1699
41
44
  dart/generated/models/comment.py,sha256=kLh7iDCW9uTq4kHxi_MSys4uTBpaZj2k5lIKUTkpSUY,2735
42
45
  dart/generated/models/comment_create.py,sha256=GVC_LWi0_afdJkN0-qZsYFt9RCmU2DjRmKOwTsmAWTo,2138
43
46
  dart/generated/models/concise_doc.py,sha256=xrJIJr4rm_iG0DlmpemBtzDaOxroHC2NgsG-V9CNsX8,2200
@@ -86,9 +89,9 @@ dart/generated/models/wrapped_task.py,sha256=TRlVMxIGhDwSaJlXdMH6q7Vx2hpz7EdiGns
86
89
  dart/generated/models/wrapped_task_create.py,sha256=Oxdot2EwfEuC3l4uo0fAvmyjRNVkXALmWCvfgHI7BcI,1654
87
90
  dart/generated/models/wrapped_task_update.py,sha256=_erGSSR_k6ahF_RFjgLKdyitx5TDQiFw_Ml77zHQdJM,1654
88
91
  dart/generated/models/wrapped_view.py,sha256=zflJxA4UnITM8w-0EObw4AF54yS-c_e5UL6vaikXyG8,1577
89
- dart_tools-0.8.3.dist-info/licenses/LICENSE,sha256=aD_0TnuylEaAHWNURgifNek_ODn5Pg36o9gFdspgHtg,1061
90
- dart_tools-0.8.3.dist-info/METADATA,sha256=xewtf-htj5FgnRJBYoM3c0ok6pSC3irrxmWFiHw1AoI,8996
91
- dart_tools-0.8.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
92
- dart_tools-0.8.3.dist-info/entry_points.txt,sha256=KOVAnDWJbSKn9HoXWQ7x6NfACYzSMGHBBaBxonHEv6w,34
93
- dart_tools-0.8.3.dist-info/top_level.txt,sha256=ZwUQ6QjCyi1i32BJOAkbOA7UfgitLmIwToJGJwZXPrg,5
94
- dart_tools-0.8.3.dist-info/RECORD,,
92
+ dart_tools-0.8.4.dist-info/licenses/LICENSE,sha256=aD_0TnuylEaAHWNURgifNek_ODn5Pg36o9gFdspgHtg,1061
93
+ dart_tools-0.8.4.dist-info/METADATA,sha256=N1eOsd3-9WX1HFYgPPDw9pH8ygfH-tHDrs8ytE_kHkg,8996
94
+ dart_tools-0.8.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
95
+ dart_tools-0.8.4.dist-info/entry_points.txt,sha256=KOVAnDWJbSKn9HoXWQ7x6NfACYzSMGHBBaBxonHEv6w,34
96
+ dart_tools-0.8.4.dist-info/top_level.txt,sha256=ZwUQ6QjCyi1i32BJOAkbOA7UfgitLmIwToJGJwZXPrg,5
97
+ dart_tools-0.8.4.dist-info/RECORD,,