sinatra-dev 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sinatra_dev/__init__.py +71 -0
- sinatra_dev/_client.py +391 -0
- sinatra_dev/_errors.py +53 -0
- sinatra_dev/_generated/__init__.py +8 -0
- sinatra_dev/_generated/api/__init__.py +1 -0
- sinatra_dev/_generated/api/me/__init__.py +1 -0
- sinatra_dev/_generated/api/me/me_get.py +156 -0
- sinatra_dev/_generated/api/me/me_revoke_token.py +173 -0
- sinatra_dev/_generated/api/messages/__init__.py +1 -0
- sinatra_dev/_generated/api/messages/messages_create.py +323 -0
- sinatra_dev/_generated/api/messages/messages_list.py +332 -0
- sinatra_dev/_generated/api/tasks/__init__.py +1 -0
- sinatra_dev/_generated/api/tasks/tasks_create.py +337 -0
- sinatra_dev/_generated/api/tasks/tasks_get.py +202 -0
- sinatra_dev/_generated/api/tasks/tasks_list.py +252 -0
- sinatra_dev/_generated/api/tasks/tasks_stop.py +231 -0
- sinatra_dev/_generated/api/tickets/__init__.py +1 -0
- sinatra_dev/_generated/api/tickets/tickets_delegate.py +273 -0
- sinatra_dev/_generated/api/tickets/tickets_search.py +265 -0
- sinatra_dev/_generated/client.py +280 -0
- sinatra_dev/_generated/errors.py +16 -0
- sinatra_dev/_generated/models/__init__.py +47 -0
- sinatra_dev/_generated/models/create_message_request.py +62 -0
- sinatra_dev/_generated/models/create_message_response.py +62 -0
- sinatra_dev/_generated/models/create_task_request.py +106 -0
- sinatra_dev/_generated/models/create_task_response.py +76 -0
- sinatra_dev/_generated/models/delegate_github_ticket.py +86 -0
- sinatra_dev/_generated/models/delegate_linear_ticket.py +78 -0
- sinatra_dev/_generated/models/delegate_ticket_response.py +62 -0
- sinatra_dev/_generated/models/error.py +168 -0
- sinatra_dev/_generated/models/me.py +86 -0
- sinatra_dev/_generated/models/me_user.py +98 -0
- sinatra_dev/_generated/models/message.py +113 -0
- sinatra_dev/_generated/models/message_list.py +91 -0
- sinatra_dev/_generated/models/pull_request.py +70 -0
- sinatra_dev/_generated/models/stop_task_response.py +62 -0
- sinatra_dev/_generated/models/task.py +201 -0
- sinatra_dev/_generated/models/task_list.py +91 -0
- sinatra_dev/_generated/models/ticket.py +147 -0
- sinatra_dev/_generated/models/ticket_search_result.py +97 -0
- sinatra_dev/_generated/models/ticket_search_result_github.py +77 -0
- sinatra_dev/_generated/models/ticket_search_result_linear.py +79 -0
- sinatra_dev/_generated/models/workspace.py +78 -0
- sinatra_dev/_generated/types.py +54 -0
- sinatra_dev/_retry.py +72 -0
- sinatra_dev/py.typed +0 -0
- sinatra_dev-0.1.0.dist-info/METADATA +184 -0
- sinatra_dev-0.1.0.dist-info/RECORD +50 -0
- sinatra_dev-0.1.0.dist-info/WHEEL +4 -0
- sinatra_dev-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ... import errors
|
|
8
|
+
from ...client import AuthenticatedClient, Client
|
|
9
|
+
from ...models.error import Error
|
|
10
|
+
from ...models.task import Task
|
|
11
|
+
from ...types import Response
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
workspace_id: str,
|
|
16
|
+
task_id: str,
|
|
17
|
+
) -> dict[str, Any]:
|
|
18
|
+
|
|
19
|
+
_kwargs: dict[str, Any] = {
|
|
20
|
+
"method": "get",
|
|
21
|
+
"url": "/v1/workspaces/{workspace_id}/tasks/{task_id}".format(
|
|
22
|
+
workspace_id=quote(str(workspace_id), safe=""),
|
|
23
|
+
task_id=quote(str(task_id), safe=""),
|
|
24
|
+
),
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return _kwargs
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def _parse_response(
|
|
31
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
32
|
+
) -> Error | Task | None:
|
|
33
|
+
if response.status_code == 200:
|
|
34
|
+
response_200 = Task.from_dict(response.json())
|
|
35
|
+
|
|
36
|
+
return response_200
|
|
37
|
+
|
|
38
|
+
if response.status_code == 401:
|
|
39
|
+
response_401 = Error.from_dict(response.json())
|
|
40
|
+
|
|
41
|
+
return response_401
|
|
42
|
+
|
|
43
|
+
if response.status_code == 404:
|
|
44
|
+
response_404 = Error.from_dict(response.json())
|
|
45
|
+
|
|
46
|
+
return response_404
|
|
47
|
+
|
|
48
|
+
if response.status_code == 429:
|
|
49
|
+
response_429 = Error.from_dict(response.json())
|
|
50
|
+
|
|
51
|
+
return response_429
|
|
52
|
+
|
|
53
|
+
if response.status_code == 500:
|
|
54
|
+
response_500 = Error.from_dict(response.json())
|
|
55
|
+
|
|
56
|
+
return response_500
|
|
57
|
+
|
|
58
|
+
if client.raise_on_unexpected_status:
|
|
59
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
60
|
+
else:
|
|
61
|
+
return None
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def _build_response(
|
|
65
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
66
|
+
) -> Response[Error | Task]:
|
|
67
|
+
return Response(
|
|
68
|
+
status_code=HTTPStatus(response.status_code),
|
|
69
|
+
content=response.content,
|
|
70
|
+
headers=response.headers,
|
|
71
|
+
parsed=_parse_response(client=client, response=response),
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def sync_detailed(
|
|
76
|
+
workspace_id: str,
|
|
77
|
+
task_id: str,
|
|
78
|
+
*,
|
|
79
|
+
client: AuthenticatedClient | Client,
|
|
80
|
+
) -> Response[Error | Task]:
|
|
81
|
+
"""Get a task
|
|
82
|
+
|
|
83
|
+
Returns one task. It works for any task in the workspace, wherever it started: the API, Linear,
|
|
84
|
+
GitHub or chat.
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
workspace_id (str):
|
|
88
|
+
task_id (str):
|
|
89
|
+
|
|
90
|
+
Raises:
|
|
91
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
92
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
93
|
+
|
|
94
|
+
Returns:
|
|
95
|
+
Response[Error | Task]
|
|
96
|
+
"""
|
|
97
|
+
|
|
98
|
+
kwargs = _get_kwargs(
|
|
99
|
+
workspace_id=workspace_id,
|
|
100
|
+
task_id=task_id,
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
response = client.get_httpx_client().request(
|
|
104
|
+
**kwargs,
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
return _build_response(client=client, response=response)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def sync(
|
|
111
|
+
workspace_id: str,
|
|
112
|
+
task_id: str,
|
|
113
|
+
*,
|
|
114
|
+
client: AuthenticatedClient | Client,
|
|
115
|
+
) -> Error | Task | None:
|
|
116
|
+
"""Get a task
|
|
117
|
+
|
|
118
|
+
Returns one task. It works for any task in the workspace, wherever it started: the API, Linear,
|
|
119
|
+
GitHub or chat.
|
|
120
|
+
|
|
121
|
+
Args:
|
|
122
|
+
workspace_id (str):
|
|
123
|
+
task_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
|
+
Error | Task
|
|
131
|
+
"""
|
|
132
|
+
|
|
133
|
+
return sync_detailed(
|
|
134
|
+
workspace_id=workspace_id,
|
|
135
|
+
task_id=task_id,
|
|
136
|
+
client=client,
|
|
137
|
+
).parsed
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
async def asyncio_detailed(
|
|
141
|
+
workspace_id: str,
|
|
142
|
+
task_id: str,
|
|
143
|
+
*,
|
|
144
|
+
client: AuthenticatedClient | Client,
|
|
145
|
+
) -> Response[Error | Task]:
|
|
146
|
+
"""Get a task
|
|
147
|
+
|
|
148
|
+
Returns one task. It works for any task in the workspace, wherever it started: the API, Linear,
|
|
149
|
+
GitHub or chat.
|
|
150
|
+
|
|
151
|
+
Args:
|
|
152
|
+
workspace_id (str):
|
|
153
|
+
task_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
|
+
Response[Error | Task]
|
|
161
|
+
"""
|
|
162
|
+
|
|
163
|
+
kwargs = _get_kwargs(
|
|
164
|
+
workspace_id=workspace_id,
|
|
165
|
+
task_id=task_id,
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
169
|
+
|
|
170
|
+
return _build_response(client=client, response=response)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
async def asyncio(
|
|
174
|
+
workspace_id: str,
|
|
175
|
+
task_id: str,
|
|
176
|
+
*,
|
|
177
|
+
client: AuthenticatedClient | Client,
|
|
178
|
+
) -> Error | Task | None:
|
|
179
|
+
"""Get a task
|
|
180
|
+
|
|
181
|
+
Returns one task. It works for any task in the workspace, wherever it started: the API, Linear,
|
|
182
|
+
GitHub or chat.
|
|
183
|
+
|
|
184
|
+
Args:
|
|
185
|
+
workspace_id (str):
|
|
186
|
+
task_id (str):
|
|
187
|
+
|
|
188
|
+
Raises:
|
|
189
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
190
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
191
|
+
|
|
192
|
+
Returns:
|
|
193
|
+
Error | Task
|
|
194
|
+
"""
|
|
195
|
+
|
|
196
|
+
return (
|
|
197
|
+
await asyncio_detailed(
|
|
198
|
+
workspace_id=workspace_id,
|
|
199
|
+
task_id=task_id,
|
|
200
|
+
client=client,
|
|
201
|
+
)
|
|
202
|
+
).parsed
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ... import errors
|
|
8
|
+
from ...client import AuthenticatedClient, Client
|
|
9
|
+
from ...models.error import Error
|
|
10
|
+
from ...models.task_list import TaskList
|
|
11
|
+
from ...types import UNSET, Response, Unset
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
workspace_id: str,
|
|
16
|
+
*,
|
|
17
|
+
status: str | Unset = UNSET,
|
|
18
|
+
limit: int | Unset = 50,
|
|
19
|
+
cursor: str | Unset = UNSET,
|
|
20
|
+
) -> dict[str, Any]:
|
|
21
|
+
|
|
22
|
+
params: dict[str, Any] = {}
|
|
23
|
+
|
|
24
|
+
params["status"] = status
|
|
25
|
+
|
|
26
|
+
params["limit"] = limit
|
|
27
|
+
|
|
28
|
+
params["cursor"] = cursor
|
|
29
|
+
|
|
30
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
31
|
+
|
|
32
|
+
_kwargs: dict[str, Any] = {
|
|
33
|
+
"method": "get",
|
|
34
|
+
"url": "/v1/workspaces/{workspace_id}/tasks".format(
|
|
35
|
+
workspace_id=quote(str(workspace_id), safe=""),
|
|
36
|
+
),
|
|
37
|
+
"params": params,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return _kwargs
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _parse_response(
|
|
44
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
45
|
+
) -> Error | TaskList | None:
|
|
46
|
+
if response.status_code == 200:
|
|
47
|
+
response_200 = TaskList.from_dict(response.json())
|
|
48
|
+
|
|
49
|
+
return response_200
|
|
50
|
+
|
|
51
|
+
if response.status_code == 400:
|
|
52
|
+
response_400 = Error.from_dict(response.json())
|
|
53
|
+
|
|
54
|
+
return response_400
|
|
55
|
+
|
|
56
|
+
if response.status_code == 401:
|
|
57
|
+
response_401 = Error.from_dict(response.json())
|
|
58
|
+
|
|
59
|
+
return response_401
|
|
60
|
+
|
|
61
|
+
if response.status_code == 404:
|
|
62
|
+
response_404 = Error.from_dict(response.json())
|
|
63
|
+
|
|
64
|
+
return response_404
|
|
65
|
+
|
|
66
|
+
if response.status_code == 429:
|
|
67
|
+
response_429 = Error.from_dict(response.json())
|
|
68
|
+
|
|
69
|
+
return response_429
|
|
70
|
+
|
|
71
|
+
if response.status_code == 500:
|
|
72
|
+
response_500 = Error.from_dict(response.json())
|
|
73
|
+
|
|
74
|
+
return response_500
|
|
75
|
+
|
|
76
|
+
if client.raise_on_unexpected_status:
|
|
77
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
78
|
+
else:
|
|
79
|
+
return None
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def _build_response(
|
|
83
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
84
|
+
) -> Response[Error | TaskList]:
|
|
85
|
+
return Response(
|
|
86
|
+
status_code=HTTPStatus(response.status_code),
|
|
87
|
+
content=response.content,
|
|
88
|
+
headers=response.headers,
|
|
89
|
+
parsed=_parse_response(client=client, response=response),
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def sync_detailed(
|
|
94
|
+
workspace_id: str,
|
|
95
|
+
*,
|
|
96
|
+
client: AuthenticatedClient | Client,
|
|
97
|
+
status: str | Unset = UNSET,
|
|
98
|
+
limit: int | Unset = 50,
|
|
99
|
+
cursor: str | Unset = UNSET,
|
|
100
|
+
) -> Response[Error | TaskList]:
|
|
101
|
+
"""List tasks
|
|
102
|
+
|
|
103
|
+
Lists the workspace's tasks, from every source, most recently active first.
|
|
104
|
+
|
|
105
|
+
To get the next page, pass `nextCursor` back as `cursor`. Treat the cursor as opaque. `nextCursor`
|
|
106
|
+
is `null` on the last page.
|
|
107
|
+
|
|
108
|
+
Args:
|
|
109
|
+
workspace_id (str):
|
|
110
|
+
status (str | Unset):
|
|
111
|
+
limit (int | Unset): Default: 50.
|
|
112
|
+
cursor (str | Unset):
|
|
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
|
+
Response[Error | TaskList]
|
|
120
|
+
"""
|
|
121
|
+
|
|
122
|
+
kwargs = _get_kwargs(
|
|
123
|
+
workspace_id=workspace_id,
|
|
124
|
+
status=status,
|
|
125
|
+
limit=limit,
|
|
126
|
+
cursor=cursor,
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
response = client.get_httpx_client().request(
|
|
130
|
+
**kwargs,
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
return _build_response(client=client, response=response)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def sync(
|
|
137
|
+
workspace_id: str,
|
|
138
|
+
*,
|
|
139
|
+
client: AuthenticatedClient | Client,
|
|
140
|
+
status: str | Unset = UNSET,
|
|
141
|
+
limit: int | Unset = 50,
|
|
142
|
+
cursor: str | Unset = UNSET,
|
|
143
|
+
) -> Error | TaskList | None:
|
|
144
|
+
"""List tasks
|
|
145
|
+
|
|
146
|
+
Lists the workspace's tasks, from every source, most recently active first.
|
|
147
|
+
|
|
148
|
+
To get the next page, pass `nextCursor` back as `cursor`. Treat the cursor as opaque. `nextCursor`
|
|
149
|
+
is `null` on the last page.
|
|
150
|
+
|
|
151
|
+
Args:
|
|
152
|
+
workspace_id (str):
|
|
153
|
+
status (str | Unset):
|
|
154
|
+
limit (int | Unset): Default: 50.
|
|
155
|
+
cursor (str | Unset):
|
|
156
|
+
|
|
157
|
+
Raises:
|
|
158
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
159
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
160
|
+
|
|
161
|
+
Returns:
|
|
162
|
+
Error | TaskList
|
|
163
|
+
"""
|
|
164
|
+
|
|
165
|
+
return sync_detailed(
|
|
166
|
+
workspace_id=workspace_id,
|
|
167
|
+
client=client,
|
|
168
|
+
status=status,
|
|
169
|
+
limit=limit,
|
|
170
|
+
cursor=cursor,
|
|
171
|
+
).parsed
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
async def asyncio_detailed(
|
|
175
|
+
workspace_id: str,
|
|
176
|
+
*,
|
|
177
|
+
client: AuthenticatedClient | Client,
|
|
178
|
+
status: str | Unset = UNSET,
|
|
179
|
+
limit: int | Unset = 50,
|
|
180
|
+
cursor: str | Unset = UNSET,
|
|
181
|
+
) -> Response[Error | TaskList]:
|
|
182
|
+
"""List tasks
|
|
183
|
+
|
|
184
|
+
Lists the workspace's tasks, from every source, most recently active first.
|
|
185
|
+
|
|
186
|
+
To get the next page, pass `nextCursor` back as `cursor`. Treat the cursor as opaque. `nextCursor`
|
|
187
|
+
is `null` on the last page.
|
|
188
|
+
|
|
189
|
+
Args:
|
|
190
|
+
workspace_id (str):
|
|
191
|
+
status (str | Unset):
|
|
192
|
+
limit (int | Unset): Default: 50.
|
|
193
|
+
cursor (str | Unset):
|
|
194
|
+
|
|
195
|
+
Raises:
|
|
196
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
197
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
198
|
+
|
|
199
|
+
Returns:
|
|
200
|
+
Response[Error | TaskList]
|
|
201
|
+
"""
|
|
202
|
+
|
|
203
|
+
kwargs = _get_kwargs(
|
|
204
|
+
workspace_id=workspace_id,
|
|
205
|
+
status=status,
|
|
206
|
+
limit=limit,
|
|
207
|
+
cursor=cursor,
|
|
208
|
+
)
|
|
209
|
+
|
|
210
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
211
|
+
|
|
212
|
+
return _build_response(client=client, response=response)
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
async def asyncio(
|
|
216
|
+
workspace_id: str,
|
|
217
|
+
*,
|
|
218
|
+
client: AuthenticatedClient | Client,
|
|
219
|
+
status: str | Unset = UNSET,
|
|
220
|
+
limit: int | Unset = 50,
|
|
221
|
+
cursor: str | Unset = UNSET,
|
|
222
|
+
) -> Error | TaskList | None:
|
|
223
|
+
"""List tasks
|
|
224
|
+
|
|
225
|
+
Lists the workspace's tasks, from every source, most recently active first.
|
|
226
|
+
|
|
227
|
+
To get the next page, pass `nextCursor` back as `cursor`. Treat the cursor as opaque. `nextCursor`
|
|
228
|
+
is `null` on the last page.
|
|
229
|
+
|
|
230
|
+
Args:
|
|
231
|
+
workspace_id (str):
|
|
232
|
+
status (str | Unset):
|
|
233
|
+
limit (int | Unset): Default: 50.
|
|
234
|
+
cursor (str | Unset):
|
|
235
|
+
|
|
236
|
+
Raises:
|
|
237
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
238
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
239
|
+
|
|
240
|
+
Returns:
|
|
241
|
+
Error | TaskList
|
|
242
|
+
"""
|
|
243
|
+
|
|
244
|
+
return (
|
|
245
|
+
await asyncio_detailed(
|
|
246
|
+
workspace_id=workspace_id,
|
|
247
|
+
client=client,
|
|
248
|
+
status=status,
|
|
249
|
+
limit=limit,
|
|
250
|
+
cursor=cursor,
|
|
251
|
+
)
|
|
252
|
+
).parsed
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ... import errors
|
|
8
|
+
from ...client import AuthenticatedClient, Client
|
|
9
|
+
from ...models.error import Error
|
|
10
|
+
from ...models.stop_task_response import StopTaskResponse
|
|
11
|
+
from ...types import Response
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
workspace_id: str,
|
|
16
|
+
task_id: str,
|
|
17
|
+
) -> dict[str, Any]:
|
|
18
|
+
|
|
19
|
+
_kwargs: dict[str, Any] = {
|
|
20
|
+
"method": "post",
|
|
21
|
+
"url": "/v1/workspaces/{workspace_id}/tasks/{task_id}/stop".format(
|
|
22
|
+
workspace_id=quote(str(workspace_id), safe=""),
|
|
23
|
+
task_id=quote(str(task_id), safe=""),
|
|
24
|
+
),
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return _kwargs
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def _parse_response(
|
|
31
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
32
|
+
) -> Error | StopTaskResponse | None:
|
|
33
|
+
if response.status_code == 202:
|
|
34
|
+
response_202 = StopTaskResponse.from_dict(response.json())
|
|
35
|
+
|
|
36
|
+
return response_202
|
|
37
|
+
|
|
38
|
+
if response.status_code == 400:
|
|
39
|
+
response_400 = Error.from_dict(response.json())
|
|
40
|
+
|
|
41
|
+
return response_400
|
|
42
|
+
|
|
43
|
+
if response.status_code == 401:
|
|
44
|
+
response_401 = Error.from_dict(response.json())
|
|
45
|
+
|
|
46
|
+
return response_401
|
|
47
|
+
|
|
48
|
+
if response.status_code == 404:
|
|
49
|
+
response_404 = Error.from_dict(response.json())
|
|
50
|
+
|
|
51
|
+
return response_404
|
|
52
|
+
|
|
53
|
+
if response.status_code == 409:
|
|
54
|
+
response_409 = Error.from_dict(response.json())
|
|
55
|
+
|
|
56
|
+
return response_409
|
|
57
|
+
|
|
58
|
+
if response.status_code == 413:
|
|
59
|
+
response_413 = Error.from_dict(response.json())
|
|
60
|
+
|
|
61
|
+
return response_413
|
|
62
|
+
|
|
63
|
+
if response.status_code == 415:
|
|
64
|
+
response_415 = Error.from_dict(response.json())
|
|
65
|
+
|
|
66
|
+
return response_415
|
|
67
|
+
|
|
68
|
+
if response.status_code == 429:
|
|
69
|
+
response_429 = Error.from_dict(response.json())
|
|
70
|
+
|
|
71
|
+
return response_429
|
|
72
|
+
|
|
73
|
+
if response.status_code == 500:
|
|
74
|
+
response_500 = Error.from_dict(response.json())
|
|
75
|
+
|
|
76
|
+
return response_500
|
|
77
|
+
|
|
78
|
+
if response.status_code == 503:
|
|
79
|
+
response_503 = Error.from_dict(response.json())
|
|
80
|
+
|
|
81
|
+
return response_503
|
|
82
|
+
|
|
83
|
+
if client.raise_on_unexpected_status:
|
|
84
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
85
|
+
else:
|
|
86
|
+
return None
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def _build_response(
|
|
90
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
91
|
+
) -> Response[Error | StopTaskResponse]:
|
|
92
|
+
return Response(
|
|
93
|
+
status_code=HTTPStatus(response.status_code),
|
|
94
|
+
content=response.content,
|
|
95
|
+
headers=response.headers,
|
|
96
|
+
parsed=_parse_response(client=client, response=response),
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def sync_detailed(
|
|
101
|
+
workspace_id: str,
|
|
102
|
+
task_id: str,
|
|
103
|
+
*,
|
|
104
|
+
client: AuthenticatedClient | Client,
|
|
105
|
+
) -> Response[Error | StopTaskResponse]:
|
|
106
|
+
"""Stop a task
|
|
107
|
+
|
|
108
|
+
Stops the task's running turn and returns `202` with `{"accepted": true}`. It works on any task in
|
|
109
|
+
the workspace, whatever its source, and any member can stop one. A completed or cancelled task, or
|
|
110
|
+
one whose session has already ended, is `409 not_running`.
|
|
111
|
+
|
|
112
|
+
Args:
|
|
113
|
+
workspace_id (str):
|
|
114
|
+
task_id (str):
|
|
115
|
+
|
|
116
|
+
Raises:
|
|
117
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
118
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
119
|
+
|
|
120
|
+
Returns:
|
|
121
|
+
Response[Error | StopTaskResponse]
|
|
122
|
+
"""
|
|
123
|
+
|
|
124
|
+
kwargs = _get_kwargs(
|
|
125
|
+
workspace_id=workspace_id,
|
|
126
|
+
task_id=task_id,
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
response = client.get_httpx_client().request(
|
|
130
|
+
**kwargs,
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
return _build_response(client=client, response=response)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def sync(
|
|
137
|
+
workspace_id: str,
|
|
138
|
+
task_id: str,
|
|
139
|
+
*,
|
|
140
|
+
client: AuthenticatedClient | Client,
|
|
141
|
+
) -> Error | StopTaskResponse | None:
|
|
142
|
+
"""Stop a task
|
|
143
|
+
|
|
144
|
+
Stops the task's running turn and returns `202` with `{"accepted": true}`. It works on any task in
|
|
145
|
+
the workspace, whatever its source, and any member can stop one. A completed or cancelled task, or
|
|
146
|
+
one whose session has already ended, is `409 not_running`.
|
|
147
|
+
|
|
148
|
+
Args:
|
|
149
|
+
workspace_id (str):
|
|
150
|
+
task_id (str):
|
|
151
|
+
|
|
152
|
+
Raises:
|
|
153
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
154
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
155
|
+
|
|
156
|
+
Returns:
|
|
157
|
+
Error | StopTaskResponse
|
|
158
|
+
"""
|
|
159
|
+
|
|
160
|
+
return sync_detailed(
|
|
161
|
+
workspace_id=workspace_id,
|
|
162
|
+
task_id=task_id,
|
|
163
|
+
client=client,
|
|
164
|
+
).parsed
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
async def asyncio_detailed(
|
|
168
|
+
workspace_id: str,
|
|
169
|
+
task_id: str,
|
|
170
|
+
*,
|
|
171
|
+
client: AuthenticatedClient | Client,
|
|
172
|
+
) -> Response[Error | StopTaskResponse]:
|
|
173
|
+
"""Stop a task
|
|
174
|
+
|
|
175
|
+
Stops the task's running turn and returns `202` with `{"accepted": true}`. It works on any task in
|
|
176
|
+
the workspace, whatever its source, and any member can stop one. A completed or cancelled task, or
|
|
177
|
+
one whose session has already ended, is `409 not_running`.
|
|
178
|
+
|
|
179
|
+
Args:
|
|
180
|
+
workspace_id (str):
|
|
181
|
+
task_id (str):
|
|
182
|
+
|
|
183
|
+
Raises:
|
|
184
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
185
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
186
|
+
|
|
187
|
+
Returns:
|
|
188
|
+
Response[Error | StopTaskResponse]
|
|
189
|
+
"""
|
|
190
|
+
|
|
191
|
+
kwargs = _get_kwargs(
|
|
192
|
+
workspace_id=workspace_id,
|
|
193
|
+
task_id=task_id,
|
|
194
|
+
)
|
|
195
|
+
|
|
196
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
197
|
+
|
|
198
|
+
return _build_response(client=client, response=response)
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
async def asyncio(
|
|
202
|
+
workspace_id: str,
|
|
203
|
+
task_id: str,
|
|
204
|
+
*,
|
|
205
|
+
client: AuthenticatedClient | Client,
|
|
206
|
+
) -> Error | StopTaskResponse | None:
|
|
207
|
+
"""Stop a task
|
|
208
|
+
|
|
209
|
+
Stops the task's running turn and returns `202` with `{"accepted": true}`. It works on any task in
|
|
210
|
+
the workspace, whatever its source, and any member can stop one. A completed or cancelled task, or
|
|
211
|
+
one whose session has already ended, is `409 not_running`.
|
|
212
|
+
|
|
213
|
+
Args:
|
|
214
|
+
workspace_id (str):
|
|
215
|
+
task_id (str):
|
|
216
|
+
|
|
217
|
+
Raises:
|
|
218
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
219
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
220
|
+
|
|
221
|
+
Returns:
|
|
222
|
+
Error | StopTaskResponse
|
|
223
|
+
"""
|
|
224
|
+
|
|
225
|
+
return (
|
|
226
|
+
await asyncio_detailed(
|
|
227
|
+
workspace_id=workspace_id,
|
|
228
|
+
task_id=task_id,
|
|
229
|
+
client=client,
|
|
230
|
+
)
|
|
231
|
+
).parsed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|