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,86 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import (
|
|
5
|
+
Any,
|
|
6
|
+
Literal,
|
|
7
|
+
Self,
|
|
8
|
+
TypeVar,
|
|
9
|
+
cast,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
from attrs import define as _attrs_define
|
|
13
|
+
from attrs import field as _attrs_field
|
|
14
|
+
|
|
15
|
+
T = TypeVar("T", bound="DelegateGithubTicket")
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@_attrs_define
|
|
19
|
+
class DelegateGithubTicket:
|
|
20
|
+
"""A GitHub issue to delegate, by its repository and number.
|
|
21
|
+
|
|
22
|
+
Attributes:
|
|
23
|
+
source (Literal['github']): `github` to delegate a GitHub issue.
|
|
24
|
+
repo (str): `owner/name` of a repository enabled in the workspace.
|
|
25
|
+
number (int): The issue's number in that repository.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
source: Literal["github"]
|
|
29
|
+
repo: str
|
|
30
|
+
number: int
|
|
31
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
32
|
+
|
|
33
|
+
def to_dict(self) -> dict[str, Any]:
|
|
34
|
+
source = self.source
|
|
35
|
+
|
|
36
|
+
repo = self.repo
|
|
37
|
+
|
|
38
|
+
number = self.number
|
|
39
|
+
|
|
40
|
+
field_dict: dict[str, Any] = {}
|
|
41
|
+
field_dict.update(self.additional_properties)
|
|
42
|
+
field_dict.update(
|
|
43
|
+
{
|
|
44
|
+
"source": source,
|
|
45
|
+
"repo": repo,
|
|
46
|
+
"number": number,
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
return field_dict
|
|
51
|
+
|
|
52
|
+
@classmethod
|
|
53
|
+
def from_dict(cls, src_dict: Mapping[str, Any]) -> Self:
|
|
54
|
+
d = dict(src_dict)
|
|
55
|
+
source = cast(Literal["github"], d.pop("source"))
|
|
56
|
+
if source != "github":
|
|
57
|
+
raise ValueError(f"source must match const 'github', got '{source}'")
|
|
58
|
+
|
|
59
|
+
repo = d.pop("repo")
|
|
60
|
+
|
|
61
|
+
number = d.pop("number")
|
|
62
|
+
|
|
63
|
+
delegate_github_ticket = cls(
|
|
64
|
+
source=source,
|
|
65
|
+
repo=repo,
|
|
66
|
+
number=number,
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
delegate_github_ticket.additional_properties = d
|
|
70
|
+
return delegate_github_ticket
|
|
71
|
+
|
|
72
|
+
@property
|
|
73
|
+
def additional_keys(self) -> list[str]:
|
|
74
|
+
return list(self.additional_properties.keys())
|
|
75
|
+
|
|
76
|
+
def __getitem__(self, key: str) -> Any:
|
|
77
|
+
return self.additional_properties[key]
|
|
78
|
+
|
|
79
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
80
|
+
self.additional_properties[key] = value
|
|
81
|
+
|
|
82
|
+
def __delitem__(self, key: str) -> None:
|
|
83
|
+
del self.additional_properties[key]
|
|
84
|
+
|
|
85
|
+
def __contains__(self, key: str) -> bool:
|
|
86
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import (
|
|
5
|
+
Any,
|
|
6
|
+
Literal,
|
|
7
|
+
Self,
|
|
8
|
+
TypeVar,
|
|
9
|
+
cast,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
from attrs import define as _attrs_define
|
|
13
|
+
from attrs import field as _attrs_field
|
|
14
|
+
|
|
15
|
+
T = TypeVar("T", bound="DelegateLinearTicket")
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@_attrs_define
|
|
19
|
+
class DelegateLinearTicket:
|
|
20
|
+
"""A Linear issue to delegate, by its identifier or id.
|
|
21
|
+
|
|
22
|
+
Attributes:
|
|
23
|
+
source (Literal['linear']): `linear` to delegate a Linear issue.
|
|
24
|
+
id (str): The issue's identifier, such as `ENG-123`, or its id.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
source: Literal["linear"]
|
|
28
|
+
id: str
|
|
29
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
30
|
+
|
|
31
|
+
def to_dict(self) -> dict[str, Any]:
|
|
32
|
+
source = self.source
|
|
33
|
+
|
|
34
|
+
id = self.id
|
|
35
|
+
|
|
36
|
+
field_dict: dict[str, Any] = {}
|
|
37
|
+
field_dict.update(self.additional_properties)
|
|
38
|
+
field_dict.update(
|
|
39
|
+
{
|
|
40
|
+
"source": source,
|
|
41
|
+
"id": id,
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
return field_dict
|
|
46
|
+
|
|
47
|
+
@classmethod
|
|
48
|
+
def from_dict(cls, src_dict: Mapping[str, Any]) -> Self:
|
|
49
|
+
d = dict(src_dict)
|
|
50
|
+
source = cast(Literal["linear"], d.pop("source"))
|
|
51
|
+
if source != "linear":
|
|
52
|
+
raise ValueError(f"source must match const 'linear', got '{source}'")
|
|
53
|
+
|
|
54
|
+
id = d.pop("id")
|
|
55
|
+
|
|
56
|
+
delegate_linear_ticket = cls(
|
|
57
|
+
source=source,
|
|
58
|
+
id=id,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
delegate_linear_ticket.additional_properties = d
|
|
62
|
+
return delegate_linear_ticket
|
|
63
|
+
|
|
64
|
+
@property
|
|
65
|
+
def additional_keys(self) -> list[str]:
|
|
66
|
+
return list(self.additional_properties.keys())
|
|
67
|
+
|
|
68
|
+
def __getitem__(self, key: str) -> Any:
|
|
69
|
+
return self.additional_properties[key]
|
|
70
|
+
|
|
71
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
72
|
+
self.additional_properties[key] = value
|
|
73
|
+
|
|
74
|
+
def __delitem__(self, key: str) -> None:
|
|
75
|
+
del self.additional_properties[key]
|
|
76
|
+
|
|
77
|
+
def __contains__(self, key: str) -> bool:
|
|
78
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import Any, Self, TypeVar
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
from attrs import field as _attrs_field
|
|
8
|
+
|
|
9
|
+
T = TypeVar("T", bound="DelegateTicketResponse")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@_attrs_define
|
|
13
|
+
class DelegateTicketResponse:
|
|
14
|
+
"""The issue was delegated.
|
|
15
|
+
|
|
16
|
+
Attributes:
|
|
17
|
+
ok (bool): Always `true`: the issue was handed to Sinatra.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
ok: bool
|
|
21
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
22
|
+
|
|
23
|
+
def to_dict(self) -> dict[str, Any]:
|
|
24
|
+
ok = self.ok
|
|
25
|
+
|
|
26
|
+
field_dict: dict[str, Any] = {}
|
|
27
|
+
field_dict.update(self.additional_properties)
|
|
28
|
+
field_dict.update(
|
|
29
|
+
{
|
|
30
|
+
"ok": ok,
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
return field_dict
|
|
35
|
+
|
|
36
|
+
@classmethod
|
|
37
|
+
def from_dict(cls, src_dict: Mapping[str, Any]) -> Self:
|
|
38
|
+
d = dict(src_dict)
|
|
39
|
+
ok = d.pop("ok")
|
|
40
|
+
|
|
41
|
+
delegate_ticket_response = cls(
|
|
42
|
+
ok=ok,
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
delegate_ticket_response.additional_properties = d
|
|
46
|
+
return delegate_ticket_response
|
|
47
|
+
|
|
48
|
+
@property
|
|
49
|
+
def additional_keys(self) -> list[str]:
|
|
50
|
+
return list(self.additional_properties.keys())
|
|
51
|
+
|
|
52
|
+
def __getitem__(self, key: str) -> Any:
|
|
53
|
+
return self.additional_properties[key]
|
|
54
|
+
|
|
55
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
56
|
+
self.additional_properties[key] = value
|
|
57
|
+
|
|
58
|
+
def __delitem__(self, key: str) -> None:
|
|
59
|
+
del self.additional_properties[key]
|
|
60
|
+
|
|
61
|
+
def __contains__(self, key: str) -> bool:
|
|
62
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import Any, Self, TypeVar
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
from attrs import field as _attrs_field
|
|
8
|
+
|
|
9
|
+
from ..types import UNSET, Unset
|
|
10
|
+
|
|
11
|
+
T = TypeVar("T", bound="Error")
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@_attrs_define
|
|
15
|
+
class Error:
|
|
16
|
+
"""The body of every error response.
|
|
17
|
+
|
|
18
|
+
Attributes:
|
|
19
|
+
error (str): A machine-readable code, such as `invalid_prompt`. Branch on this, not on `reason`. New codes can
|
|
20
|
+
appear. Known codes: `assigned_to_other`, `bad_request`, `capacity_full`, `github_identity_required`,
|
|
21
|
+
`github_not_connected`, `github_rate_limited`, `idempotency_conflict`, `internal_error`, `invalid_body`,
|
|
22
|
+
`invalid_cursor`, `invalid_idempotency_key`, `invalid_limit`, `invalid_prompt`, `invalid_repo`,
|
|
23
|
+
`invalid_status`, `invalid_title`, `invalid_token`, `issue_closed`, `issue_not_found`,
|
|
24
|
+
`linear_app_user_missing`, `linear_identity_unlinked`, `linear_not_connected`, `linear_reconnect_required`,
|
|
25
|
+
`not_an_api_task`, `not_an_issue`, `not_found`, `not_running`, `payment_required`, `repo_disabled`,
|
|
26
|
+
`unavailable`.
|
|
27
|
+
reason (str | Unset): A sentence saying what went wrong and, where it helps, what to do. Written to show to a
|
|
28
|
+
person.
|
|
29
|
+
request_id (str | Unset): The request's id. Present on some errors, not all; the `x-request-id` response header
|
|
30
|
+
always carries it. Share it with support.
|
|
31
|
+
refusal (str | Unset): Why a start was refused, on `payment_required` and `github_not_connected`. For
|
|
32
|
+
`payment_required`: `own_credentials_required` or `subscription_inactive`. For `github_not_connected`: `missing`
|
|
33
|
+
or `suspended`.
|
|
34
|
+
billing_url (str | Unset): The settings section that fixes the refusal: your model credentials or billing, on
|
|
35
|
+
`payment_required`; billing, when starting a task, on `capacity_full`.
|
|
36
|
+
settings_url (str | Unset): The settings page that fixes the refusal, on `github_not_connected`.
|
|
37
|
+
plan (str | Unset): The workspace's plan, on `capacity_full` when starting a task.
|
|
38
|
+
running (int | Unset): How many tasks the plan runs at a time, on `capacity_full` when starting a task.
|
|
39
|
+
queued (int | Unset): How many tasks the plan queues, on `capacity_full` when starting a task.
|
|
40
|
+
task_id (str | Unset): On `unavailable` after a start: the task that was made. Retry with the same key, or send
|
|
41
|
+
a message on it.
|
|
42
|
+
message_id (str | Unset): On `unavailable`: the message that was saved but not sent yet. Retry with it as the
|
|
43
|
+
`Idempotency-Key`.
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
error: str
|
|
47
|
+
reason: str | Unset = UNSET
|
|
48
|
+
request_id: str | Unset = UNSET
|
|
49
|
+
refusal: str | Unset = UNSET
|
|
50
|
+
billing_url: str | Unset = UNSET
|
|
51
|
+
settings_url: str | Unset = UNSET
|
|
52
|
+
plan: str | Unset = UNSET
|
|
53
|
+
running: int | Unset = UNSET
|
|
54
|
+
queued: int | Unset = UNSET
|
|
55
|
+
task_id: str | Unset = UNSET
|
|
56
|
+
message_id: str | Unset = UNSET
|
|
57
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
58
|
+
|
|
59
|
+
def to_dict(self) -> dict[str, Any]:
|
|
60
|
+
error = self.error
|
|
61
|
+
|
|
62
|
+
reason = self.reason
|
|
63
|
+
|
|
64
|
+
request_id = self.request_id
|
|
65
|
+
|
|
66
|
+
refusal = self.refusal
|
|
67
|
+
|
|
68
|
+
billing_url = self.billing_url
|
|
69
|
+
|
|
70
|
+
settings_url = self.settings_url
|
|
71
|
+
|
|
72
|
+
plan = self.plan
|
|
73
|
+
|
|
74
|
+
running = self.running
|
|
75
|
+
|
|
76
|
+
queued = self.queued
|
|
77
|
+
|
|
78
|
+
task_id = self.task_id
|
|
79
|
+
|
|
80
|
+
message_id = self.message_id
|
|
81
|
+
|
|
82
|
+
field_dict: dict[str, Any] = {}
|
|
83
|
+
field_dict.update(self.additional_properties)
|
|
84
|
+
field_dict.update(
|
|
85
|
+
{
|
|
86
|
+
"error": error,
|
|
87
|
+
}
|
|
88
|
+
)
|
|
89
|
+
if reason is not UNSET:
|
|
90
|
+
field_dict["reason"] = reason
|
|
91
|
+
if request_id is not UNSET:
|
|
92
|
+
field_dict["requestId"] = request_id
|
|
93
|
+
if refusal is not UNSET:
|
|
94
|
+
field_dict["refusal"] = refusal
|
|
95
|
+
if billing_url is not UNSET:
|
|
96
|
+
field_dict["billingUrl"] = billing_url
|
|
97
|
+
if settings_url is not UNSET:
|
|
98
|
+
field_dict["settingsUrl"] = settings_url
|
|
99
|
+
if plan is not UNSET:
|
|
100
|
+
field_dict["plan"] = plan
|
|
101
|
+
if running is not UNSET:
|
|
102
|
+
field_dict["running"] = running
|
|
103
|
+
if queued is not UNSET:
|
|
104
|
+
field_dict["queued"] = queued
|
|
105
|
+
if task_id is not UNSET:
|
|
106
|
+
field_dict["taskId"] = task_id
|
|
107
|
+
if message_id is not UNSET:
|
|
108
|
+
field_dict["messageId"] = message_id
|
|
109
|
+
|
|
110
|
+
return field_dict
|
|
111
|
+
|
|
112
|
+
@classmethod
|
|
113
|
+
def from_dict(cls, src_dict: Mapping[str, Any]) -> Self:
|
|
114
|
+
d = dict(src_dict)
|
|
115
|
+
error = d.pop("error")
|
|
116
|
+
|
|
117
|
+
reason = d.pop("reason", UNSET)
|
|
118
|
+
|
|
119
|
+
request_id = d.pop("requestId", UNSET)
|
|
120
|
+
|
|
121
|
+
refusal = d.pop("refusal", UNSET)
|
|
122
|
+
|
|
123
|
+
billing_url = d.pop("billingUrl", UNSET)
|
|
124
|
+
|
|
125
|
+
settings_url = d.pop("settingsUrl", UNSET)
|
|
126
|
+
|
|
127
|
+
plan = d.pop("plan", UNSET)
|
|
128
|
+
|
|
129
|
+
running = d.pop("running", UNSET)
|
|
130
|
+
|
|
131
|
+
queued = d.pop("queued", UNSET)
|
|
132
|
+
|
|
133
|
+
task_id = d.pop("taskId", UNSET)
|
|
134
|
+
|
|
135
|
+
message_id = d.pop("messageId", UNSET)
|
|
136
|
+
|
|
137
|
+
error = cls(
|
|
138
|
+
error=error,
|
|
139
|
+
reason=reason,
|
|
140
|
+
request_id=request_id,
|
|
141
|
+
refusal=refusal,
|
|
142
|
+
billing_url=billing_url,
|
|
143
|
+
settings_url=settings_url,
|
|
144
|
+
plan=plan,
|
|
145
|
+
running=running,
|
|
146
|
+
queued=queued,
|
|
147
|
+
task_id=task_id,
|
|
148
|
+
message_id=message_id,
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
error.additional_properties = d
|
|
152
|
+
return error
|
|
153
|
+
|
|
154
|
+
@property
|
|
155
|
+
def additional_keys(self) -> list[str]:
|
|
156
|
+
return list(self.additional_properties.keys())
|
|
157
|
+
|
|
158
|
+
def __getitem__(self, key: str) -> Any:
|
|
159
|
+
return self.additional_properties[key]
|
|
160
|
+
|
|
161
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
162
|
+
self.additional_properties[key] = value
|
|
163
|
+
|
|
164
|
+
def __delitem__(self, key: str) -> None:
|
|
165
|
+
del self.additional_properties[key]
|
|
166
|
+
|
|
167
|
+
def __contains__(self, key: str) -> bool:
|
|
168
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import TYPE_CHECKING, Any, Self, TypeVar
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
from attrs import field as _attrs_field
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from ..models.me_user import MeUser
|
|
11
|
+
from ..models.workspace import Workspace
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
T = TypeVar("T", bound="Me")
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@_attrs_define
|
|
18
|
+
class Me:
|
|
19
|
+
"""The token's user and workspaces.
|
|
20
|
+
|
|
21
|
+
Attributes:
|
|
22
|
+
user (MeUser): The user the token acts as.
|
|
23
|
+
workspaces (list[Workspace]): The workspaces the user belongs to, ordered by name.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
user: MeUser
|
|
27
|
+
workspaces: list[Workspace]
|
|
28
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
29
|
+
|
|
30
|
+
def to_dict(self) -> dict[str, Any]:
|
|
31
|
+
user = self.user.to_dict()
|
|
32
|
+
|
|
33
|
+
workspaces = []
|
|
34
|
+
for workspaces_item_data in self.workspaces:
|
|
35
|
+
workspaces_item = workspaces_item_data.to_dict()
|
|
36
|
+
workspaces.append(workspaces_item)
|
|
37
|
+
|
|
38
|
+
field_dict: dict[str, Any] = {}
|
|
39
|
+
field_dict.update(self.additional_properties)
|
|
40
|
+
field_dict.update(
|
|
41
|
+
{
|
|
42
|
+
"user": user,
|
|
43
|
+
"workspaces": workspaces,
|
|
44
|
+
}
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
return field_dict
|
|
48
|
+
|
|
49
|
+
@classmethod
|
|
50
|
+
def from_dict(cls, src_dict: Mapping[str, Any]) -> Self:
|
|
51
|
+
from ..models.me_user import MeUser
|
|
52
|
+
from ..models.workspace import Workspace
|
|
53
|
+
|
|
54
|
+
d = dict(src_dict)
|
|
55
|
+
user = MeUser.from_dict(d.pop("user"))
|
|
56
|
+
|
|
57
|
+
workspaces = []
|
|
58
|
+
_workspaces = d.pop("workspaces")
|
|
59
|
+
for workspaces_item_data in _workspaces:
|
|
60
|
+
workspaces_item = Workspace.from_dict(workspaces_item_data)
|
|
61
|
+
|
|
62
|
+
workspaces.append(workspaces_item)
|
|
63
|
+
|
|
64
|
+
me = cls(
|
|
65
|
+
user=user,
|
|
66
|
+
workspaces=workspaces,
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
me.additional_properties = d
|
|
70
|
+
return me
|
|
71
|
+
|
|
72
|
+
@property
|
|
73
|
+
def additional_keys(self) -> list[str]:
|
|
74
|
+
return list(self.additional_properties.keys())
|
|
75
|
+
|
|
76
|
+
def __getitem__(self, key: str) -> Any:
|
|
77
|
+
return self.additional_properties[key]
|
|
78
|
+
|
|
79
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
80
|
+
self.additional_properties[key] = value
|
|
81
|
+
|
|
82
|
+
def __delitem__(self, key: str) -> None:
|
|
83
|
+
del self.additional_properties[key]
|
|
84
|
+
|
|
85
|
+
def __contains__(self, key: str) -> bool:
|
|
86
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import Any, Self, TypeVar, cast
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
from attrs import field as _attrs_field
|
|
8
|
+
|
|
9
|
+
T = TypeVar("T", bound="MeUser")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@_attrs_define
|
|
13
|
+
class MeUser:
|
|
14
|
+
"""The user the token acts as.
|
|
15
|
+
|
|
16
|
+
Attributes:
|
|
17
|
+
id (str): The user's id.
|
|
18
|
+
github_login (None | str): The user's GitHub login. `null` for a user without GitHub.
|
|
19
|
+
name (None | str): The user's name, if they have one.
|
|
20
|
+
email (str): The user's email address: the one they sign in with by email, or their primary GitHub email.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
id: str
|
|
24
|
+
github_login: None | str
|
|
25
|
+
name: None | str
|
|
26
|
+
email: str
|
|
27
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
28
|
+
|
|
29
|
+
def to_dict(self) -> dict[str, Any]:
|
|
30
|
+
id = self.id
|
|
31
|
+
|
|
32
|
+
github_login: None | str
|
|
33
|
+
github_login = self.github_login
|
|
34
|
+
|
|
35
|
+
name: None | str
|
|
36
|
+
name = self.name
|
|
37
|
+
|
|
38
|
+
email = self.email
|
|
39
|
+
|
|
40
|
+
field_dict: dict[str, Any] = {}
|
|
41
|
+
field_dict.update(self.additional_properties)
|
|
42
|
+
field_dict.update(
|
|
43
|
+
{
|
|
44
|
+
"id": id,
|
|
45
|
+
"githubLogin": github_login,
|
|
46
|
+
"name": name,
|
|
47
|
+
"email": email,
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
return field_dict
|
|
52
|
+
|
|
53
|
+
@classmethod
|
|
54
|
+
def from_dict(cls, src_dict: Mapping[str, Any]) -> Self:
|
|
55
|
+
d = dict(src_dict)
|
|
56
|
+
id = d.pop("id")
|
|
57
|
+
|
|
58
|
+
def _parse_github_login(data: object) -> None | str:
|
|
59
|
+
if data is None:
|
|
60
|
+
return data
|
|
61
|
+
return cast(None | str, data)
|
|
62
|
+
|
|
63
|
+
github_login = _parse_github_login(d.pop("githubLogin"))
|
|
64
|
+
|
|
65
|
+
def _parse_name(data: object) -> None | str:
|
|
66
|
+
if data is None:
|
|
67
|
+
return data
|
|
68
|
+
return cast(None | str, data)
|
|
69
|
+
|
|
70
|
+
name = _parse_name(d.pop("name"))
|
|
71
|
+
|
|
72
|
+
email = d.pop("email")
|
|
73
|
+
|
|
74
|
+
me_user = cls(
|
|
75
|
+
id=id,
|
|
76
|
+
github_login=github_login,
|
|
77
|
+
name=name,
|
|
78
|
+
email=email,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
me_user.additional_properties = d
|
|
82
|
+
return me_user
|
|
83
|
+
|
|
84
|
+
@property
|
|
85
|
+
def additional_keys(self) -> list[str]:
|
|
86
|
+
return list(self.additional_properties.keys())
|
|
87
|
+
|
|
88
|
+
def __getitem__(self, key: str) -> Any:
|
|
89
|
+
return self.additional_properties[key]
|
|
90
|
+
|
|
91
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
92
|
+
self.additional_properties[key] = value
|
|
93
|
+
|
|
94
|
+
def __delitem__(self, key: str) -> None:
|
|
95
|
+
del self.additional_properties[key]
|
|
96
|
+
|
|
97
|
+
def __contains__(self, key: str) -> bool:
|
|
98
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import datetime
|
|
4
|
+
from collections.abc import Mapping
|
|
5
|
+
from typing import Any, Self, TypeVar, cast
|
|
6
|
+
|
|
7
|
+
from attrs import define as _attrs_define
|
|
8
|
+
from attrs import field as _attrs_field
|
|
9
|
+
|
|
10
|
+
T = TypeVar("T", bound="Message")
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@_attrs_define
|
|
14
|
+
class Message:
|
|
15
|
+
"""An entry in a task's conversation.
|
|
16
|
+
|
|
17
|
+
Attributes:
|
|
18
|
+
id (str): The entry's id. Pass the last one you read as `after` to get only later entries.
|
|
19
|
+
message_id (None | str): For a message a person sent: the id it was sent with, which is its idempotency key or a
|
|
20
|
+
generated id. `null` on every other entry.
|
|
21
|
+
role (str): Who wrote it: `user` for a person, `agent` for the agent, `platform` for Sinatra itself. New roles
|
|
22
|
+
can appear.
|
|
23
|
+
kind (str): What it is: `message` (a person's message), `response` (the agent's answer for a turn, or a notice
|
|
24
|
+
from Sinatra such as a stop or files the agent produced), `clarify` (a question the agent needs answered to
|
|
25
|
+
continue) or `error` (a refusal or failure from Sinatra). New kinds can appear.
|
|
26
|
+
body (str): The text.
|
|
27
|
+
created_at (datetime.datetime): When it was written.
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
id: str
|
|
31
|
+
message_id: None | str
|
|
32
|
+
role: str
|
|
33
|
+
kind: str
|
|
34
|
+
body: str
|
|
35
|
+
created_at: datetime.datetime
|
|
36
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
37
|
+
|
|
38
|
+
def to_dict(self) -> dict[str, Any]:
|
|
39
|
+
id = self.id
|
|
40
|
+
|
|
41
|
+
message_id: None | str
|
|
42
|
+
message_id = self.message_id
|
|
43
|
+
|
|
44
|
+
role = self.role
|
|
45
|
+
|
|
46
|
+
kind = self.kind
|
|
47
|
+
|
|
48
|
+
body = self.body
|
|
49
|
+
|
|
50
|
+
created_at = self.created_at.isoformat()
|
|
51
|
+
|
|
52
|
+
field_dict: dict[str, Any] = {}
|
|
53
|
+
field_dict.update(self.additional_properties)
|
|
54
|
+
field_dict.update(
|
|
55
|
+
{
|
|
56
|
+
"id": id,
|
|
57
|
+
"messageId": message_id,
|
|
58
|
+
"role": role,
|
|
59
|
+
"kind": kind,
|
|
60
|
+
"body": body,
|
|
61
|
+
"createdAt": created_at,
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
return field_dict
|
|
66
|
+
|
|
67
|
+
@classmethod
|
|
68
|
+
def from_dict(cls, src_dict: Mapping[str, Any]) -> Self:
|
|
69
|
+
d = dict(src_dict)
|
|
70
|
+
id = d.pop("id")
|
|
71
|
+
|
|
72
|
+
def _parse_message_id(data: object) -> None | str:
|
|
73
|
+
if data is None:
|
|
74
|
+
return data
|
|
75
|
+
return cast(None | str, data)
|
|
76
|
+
|
|
77
|
+
message_id = _parse_message_id(d.pop("messageId"))
|
|
78
|
+
|
|
79
|
+
role = d.pop("role")
|
|
80
|
+
|
|
81
|
+
kind = d.pop("kind")
|
|
82
|
+
|
|
83
|
+
body = d.pop("body")
|
|
84
|
+
|
|
85
|
+
created_at = datetime.datetime.fromisoformat(d.pop("createdAt"))
|
|
86
|
+
|
|
87
|
+
message = cls(
|
|
88
|
+
id=id,
|
|
89
|
+
message_id=message_id,
|
|
90
|
+
role=role,
|
|
91
|
+
kind=kind,
|
|
92
|
+
body=body,
|
|
93
|
+
created_at=created_at,
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
message.additional_properties = d
|
|
97
|
+
return message
|
|
98
|
+
|
|
99
|
+
@property
|
|
100
|
+
def additional_keys(self) -> list[str]:
|
|
101
|
+
return list(self.additional_properties.keys())
|
|
102
|
+
|
|
103
|
+
def __getitem__(self, key: str) -> Any:
|
|
104
|
+
return self.additional_properties[key]
|
|
105
|
+
|
|
106
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
107
|
+
self.additional_properties[key] = value
|
|
108
|
+
|
|
109
|
+
def __delitem__(self, key: str) -> None:
|
|
110
|
+
del self.additional_properties[key]
|
|
111
|
+
|
|
112
|
+
def __contains__(self, key: str) -> bool:
|
|
113
|
+
return key in self.additional_properties
|