hackagent 0.3.1__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.
- hackagent/__init__.py +12 -0
- hackagent/agent.py +214 -0
- hackagent/api/__init__.py +1 -0
- hackagent/api/agent/__init__.py +1 -0
- hackagent/api/agent/agent_create.py +347 -0
- hackagent/api/agent/agent_destroy.py +140 -0
- hackagent/api/agent/agent_list.py +242 -0
- hackagent/api/agent/agent_partial_update.py +361 -0
- hackagent/api/agent/agent_retrieve.py +235 -0
- hackagent/api/agent/agent_update.py +361 -0
- hackagent/api/apilogs/__init__.py +1 -0
- hackagent/api/apilogs/apilogs_list.py +170 -0
- hackagent/api/apilogs/apilogs_retrieve.py +162 -0
- hackagent/api/attack/__init__.py +1 -0
- hackagent/api/attack/attack_create.py +275 -0
- hackagent/api/attack/attack_destroy.py +146 -0
- hackagent/api/attack/attack_list.py +254 -0
- hackagent/api/attack/attack_partial_update.py +289 -0
- hackagent/api/attack/attack_retrieve.py +247 -0
- hackagent/api/attack/attack_update.py +289 -0
- hackagent/api/checkout/__init__.py +1 -0
- hackagent/api/checkout/checkout_create.py +225 -0
- hackagent/api/generate/__init__.py +1 -0
- hackagent/api/generate/generate_create.py +253 -0
- hackagent/api/judge/__init__.py +1 -0
- hackagent/api/judge/judge_create.py +253 -0
- hackagent/api/key/__init__.py +1 -0
- hackagent/api/key/key_create.py +179 -0
- hackagent/api/key/key_destroy.py +103 -0
- hackagent/api/key/key_list.py +170 -0
- hackagent/api/key/key_retrieve.py +162 -0
- hackagent/api/organization/__init__.py +1 -0
- hackagent/api/organization/organization_create.py +208 -0
- hackagent/api/organization/organization_destroy.py +104 -0
- hackagent/api/organization/organization_list.py +170 -0
- hackagent/api/organization/organization_me_retrieve.py +126 -0
- hackagent/api/organization/organization_partial_update.py +222 -0
- hackagent/api/organization/organization_retrieve.py +163 -0
- hackagent/api/organization/organization_update.py +222 -0
- hackagent/api/prompt/__init__.py +1 -0
- hackagent/api/prompt/prompt_create.py +171 -0
- hackagent/api/prompt/prompt_destroy.py +104 -0
- hackagent/api/prompt/prompt_list.py +185 -0
- hackagent/api/prompt/prompt_partial_update.py +185 -0
- hackagent/api/prompt/prompt_retrieve.py +163 -0
- hackagent/api/prompt/prompt_update.py +185 -0
- hackagent/api/result/__init__.py +1 -0
- hackagent/api/result/result_create.py +175 -0
- hackagent/api/result/result_destroy.py +106 -0
- hackagent/api/result/result_list.py +249 -0
- hackagent/api/result/result_partial_update.py +193 -0
- hackagent/api/result/result_retrieve.py +167 -0
- hackagent/api/result/result_trace_create.py +177 -0
- hackagent/api/result/result_update.py +189 -0
- hackagent/api/run/__init__.py +1 -0
- hackagent/api/run/run_create.py +187 -0
- hackagent/api/run/run_destroy.py +112 -0
- hackagent/api/run/run_list.py +291 -0
- hackagent/api/run/run_partial_update.py +201 -0
- hackagent/api/run/run_result_create.py +177 -0
- hackagent/api/run/run_retrieve.py +179 -0
- hackagent/api/run/run_run_tests_create.py +187 -0
- hackagent/api/run/run_update.py +201 -0
- hackagent/api/user/__init__.py +1 -0
- hackagent/api/user/user_create.py +212 -0
- hackagent/api/user/user_destroy.py +106 -0
- hackagent/api/user/user_list.py +174 -0
- hackagent/api/user/user_me_retrieve.py +126 -0
- hackagent/api/user/user_me_update.py +196 -0
- hackagent/api/user/user_partial_update.py +226 -0
- hackagent/api/user/user_retrieve.py +167 -0
- hackagent/api/user/user_update.py +226 -0
- hackagent/attacks/AdvPrefix/__init__.py +41 -0
- hackagent/attacks/AdvPrefix/completions.py +416 -0
- hackagent/attacks/AdvPrefix/config.py +259 -0
- hackagent/attacks/AdvPrefix/evaluation.py +745 -0
- hackagent/attacks/AdvPrefix/evaluators.py +564 -0
- hackagent/attacks/AdvPrefix/generate.py +711 -0
- hackagent/attacks/AdvPrefix/utils.py +307 -0
- hackagent/attacks/__init__.py +35 -0
- hackagent/attacks/advprefix.py +507 -0
- hackagent/attacks/base.py +106 -0
- hackagent/attacks/strategies.py +906 -0
- hackagent/cli/__init__.py +19 -0
- hackagent/cli/commands/__init__.py +20 -0
- hackagent/cli/commands/agent.py +100 -0
- hackagent/cli/commands/attack.py +417 -0
- hackagent/cli/commands/config.py +301 -0
- hackagent/cli/commands/results.py +327 -0
- hackagent/cli/config.py +249 -0
- hackagent/cli/main.py +515 -0
- hackagent/cli/tui/__init__.py +31 -0
- hackagent/cli/tui/actions_logger.py +200 -0
- hackagent/cli/tui/app.py +288 -0
- hackagent/cli/tui/base.py +137 -0
- hackagent/cli/tui/logger.py +318 -0
- hackagent/cli/tui/views/__init__.py +33 -0
- hackagent/cli/tui/views/agents.py +488 -0
- hackagent/cli/tui/views/attacks.py +624 -0
- hackagent/cli/tui/views/config.py +244 -0
- hackagent/cli/tui/views/dashboard.py +307 -0
- hackagent/cli/tui/views/results.py +1210 -0
- hackagent/cli/tui/widgets/__init__.py +24 -0
- hackagent/cli/tui/widgets/actions.py +346 -0
- hackagent/cli/tui/widgets/logs.py +435 -0
- hackagent/cli/utils.py +276 -0
- hackagent/client.py +286 -0
- hackagent/errors.py +37 -0
- hackagent/logger.py +83 -0
- hackagent/models/__init__.py +109 -0
- hackagent/models/agent.py +223 -0
- hackagent/models/agent_request.py +129 -0
- hackagent/models/api_token_log.py +184 -0
- hackagent/models/attack.py +154 -0
- hackagent/models/attack_request.py +82 -0
- hackagent/models/checkout_session_request_request.py +76 -0
- hackagent/models/checkout_session_response.py +59 -0
- hackagent/models/choice.py +81 -0
- hackagent/models/choice_message.py +67 -0
- hackagent/models/evaluation_status_enum.py +14 -0
- hackagent/models/generate_error_response.py +59 -0
- hackagent/models/generate_request_request.py +212 -0
- hackagent/models/generate_success_response.py +115 -0
- hackagent/models/generic_error_response.py +70 -0
- hackagent/models/message_request.py +67 -0
- hackagent/models/organization.py +102 -0
- hackagent/models/organization_minimal.py +68 -0
- hackagent/models/organization_request.py +71 -0
- hackagent/models/paginated_agent_list.py +123 -0
- hackagent/models/paginated_api_token_log_list.py +123 -0
- hackagent/models/paginated_attack_list.py +123 -0
- hackagent/models/paginated_organization_list.py +123 -0
- hackagent/models/paginated_prompt_list.py +123 -0
- hackagent/models/paginated_result_list.py +123 -0
- hackagent/models/paginated_run_list.py +123 -0
- hackagent/models/paginated_user_api_key_list.py +123 -0
- hackagent/models/paginated_user_profile_list.py +123 -0
- hackagent/models/patched_agent_request.py +128 -0
- hackagent/models/patched_attack_request.py +92 -0
- hackagent/models/patched_organization_request.py +71 -0
- hackagent/models/patched_prompt_request.py +125 -0
- hackagent/models/patched_result_request.py +237 -0
- hackagent/models/patched_run_request.py +138 -0
- hackagent/models/patched_user_profile_request.py +99 -0
- hackagent/models/prompt.py +220 -0
- hackagent/models/prompt_request.py +126 -0
- hackagent/models/result.py +294 -0
- hackagent/models/result_list_evaluation_status.py +14 -0
- hackagent/models/result_request.py +232 -0
- hackagent/models/run.py +233 -0
- hackagent/models/run_list_status.py +12 -0
- hackagent/models/run_request.py +133 -0
- hackagent/models/status_enum.py +12 -0
- hackagent/models/step_type_enum.py +14 -0
- hackagent/models/trace.py +121 -0
- hackagent/models/trace_request.py +94 -0
- hackagent/models/usage.py +75 -0
- hackagent/models/user_api_key.py +201 -0
- hackagent/models/user_api_key_request.py +73 -0
- hackagent/models/user_profile.py +135 -0
- hackagent/models/user_profile_minimal.py +76 -0
- hackagent/models/user_profile_request.py +99 -0
- hackagent/router/__init__.py +25 -0
- hackagent/router/adapters/__init__.py +20 -0
- hackagent/router/adapters/base.py +63 -0
- hackagent/router/adapters/google_adk.py +671 -0
- hackagent/router/adapters/litellm_adapter.py +524 -0
- hackagent/router/adapters/openai_adapter.py +426 -0
- hackagent/router/router.py +969 -0
- hackagent/router/types.py +54 -0
- hackagent/tracking/__init__.py +42 -0
- hackagent/tracking/context.py +163 -0
- hackagent/tracking/decorators.py +299 -0
- hackagent/tracking/tracker.py +441 -0
- hackagent/types.py +54 -0
- hackagent/utils.py +194 -0
- hackagent/vulnerabilities/__init__.py +13 -0
- hackagent/vulnerabilities/prompts.py +81 -0
- hackagent-0.3.1.dist-info/METADATA +122 -0
- hackagent-0.3.1.dist-info/RECORD +183 -0
- hackagent-0.3.1.dist-info/WHEEL +4 -0
- hackagent-0.3.1.dist-info/entry_points.txt +2 -0
- hackagent-0.3.1.dist-info/licenses/LICENSE +202 -0
|
@@ -0,0 +1,115 @@
|
|
|
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.choice import Choice
|
|
9
|
+
from ..models.usage import Usage
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
T = TypeVar("T", bound="GenerateSuccessResponse")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@_attrs_define
|
|
16
|
+
class GenerateSuccessResponse:
|
|
17
|
+
"""
|
|
18
|
+
Attributes:
|
|
19
|
+
id (str): Unique identifier for the completion
|
|
20
|
+
object_ (str): Object type (chat.completion)
|
|
21
|
+
created (int): Unix timestamp of creation
|
|
22
|
+
model (str): Model used for generation
|
|
23
|
+
choices (list['Choice']): Array of completion choices
|
|
24
|
+
usage (Usage):
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
id: str
|
|
28
|
+
object_: str
|
|
29
|
+
created: int
|
|
30
|
+
model: str
|
|
31
|
+
choices: list["Choice"]
|
|
32
|
+
usage: "Usage"
|
|
33
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
34
|
+
|
|
35
|
+
def to_dict(self) -> dict[str, Any]:
|
|
36
|
+
id = self.id
|
|
37
|
+
|
|
38
|
+
object_ = self.object_
|
|
39
|
+
|
|
40
|
+
created = self.created
|
|
41
|
+
|
|
42
|
+
model = self.model
|
|
43
|
+
|
|
44
|
+
choices = []
|
|
45
|
+
for choices_item_data in self.choices:
|
|
46
|
+
choices_item = choices_item_data.to_dict()
|
|
47
|
+
choices.append(choices_item)
|
|
48
|
+
|
|
49
|
+
usage = self.usage.to_dict()
|
|
50
|
+
|
|
51
|
+
field_dict: dict[str, Any] = {}
|
|
52
|
+
field_dict.update(self.additional_properties)
|
|
53
|
+
field_dict.update(
|
|
54
|
+
{
|
|
55
|
+
"id": id,
|
|
56
|
+
"object": object_,
|
|
57
|
+
"created": created,
|
|
58
|
+
"model": model,
|
|
59
|
+
"choices": choices,
|
|
60
|
+
"usage": usage,
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
return field_dict
|
|
65
|
+
|
|
66
|
+
@classmethod
|
|
67
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
68
|
+
from ..models.choice import Choice
|
|
69
|
+
from ..models.usage import Usage
|
|
70
|
+
|
|
71
|
+
d = dict(src_dict)
|
|
72
|
+
id = d.pop("id")
|
|
73
|
+
|
|
74
|
+
object_ = d.pop("object")
|
|
75
|
+
|
|
76
|
+
created = d.pop("created")
|
|
77
|
+
|
|
78
|
+
model = d.pop("model")
|
|
79
|
+
|
|
80
|
+
choices = []
|
|
81
|
+
_choices = d.pop("choices")
|
|
82
|
+
for choices_item_data in _choices:
|
|
83
|
+
choices_item = Choice.from_dict(choices_item_data)
|
|
84
|
+
|
|
85
|
+
choices.append(choices_item)
|
|
86
|
+
|
|
87
|
+
usage = Usage.from_dict(d.pop("usage"))
|
|
88
|
+
|
|
89
|
+
generate_success_response = cls(
|
|
90
|
+
id=id,
|
|
91
|
+
object_=object_,
|
|
92
|
+
created=created,
|
|
93
|
+
model=model,
|
|
94
|
+
choices=choices,
|
|
95
|
+
usage=usage,
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
generate_success_response.additional_properties = d
|
|
99
|
+
return generate_success_response
|
|
100
|
+
|
|
101
|
+
@property
|
|
102
|
+
def additional_keys(self) -> list[str]:
|
|
103
|
+
return list(self.additional_properties.keys())
|
|
104
|
+
|
|
105
|
+
def __getitem__(self, key: str) -> Any:
|
|
106
|
+
return self.additional_properties[key]
|
|
107
|
+
|
|
108
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
109
|
+
self.additional_properties[key] = value
|
|
110
|
+
|
|
111
|
+
def __delitem__(self, key: str) -> None:
|
|
112
|
+
del self.additional_properties[key]
|
|
113
|
+
|
|
114
|
+
def __contains__(self, key: str) -> bool:
|
|
115
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,70 @@
|
|
|
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="GenericErrorResponse")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@_attrs_define
|
|
13
|
+
class GenericErrorResponse:
|
|
14
|
+
"""
|
|
15
|
+
Attributes:
|
|
16
|
+
error (str):
|
|
17
|
+
details (Union[Unset, str]):
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
error: str
|
|
21
|
+
details: Union[Unset, str] = UNSET
|
|
22
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
23
|
+
|
|
24
|
+
def to_dict(self) -> dict[str, Any]:
|
|
25
|
+
error = self.error
|
|
26
|
+
|
|
27
|
+
details = self.details
|
|
28
|
+
|
|
29
|
+
field_dict: dict[str, Any] = {}
|
|
30
|
+
field_dict.update(self.additional_properties)
|
|
31
|
+
field_dict.update(
|
|
32
|
+
{
|
|
33
|
+
"error": error,
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
if details is not UNSET:
|
|
37
|
+
field_dict["details"] = details
|
|
38
|
+
|
|
39
|
+
return field_dict
|
|
40
|
+
|
|
41
|
+
@classmethod
|
|
42
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
43
|
+
d = dict(src_dict)
|
|
44
|
+
error = d.pop("error")
|
|
45
|
+
|
|
46
|
+
details = d.pop("details", UNSET)
|
|
47
|
+
|
|
48
|
+
generic_error_response = cls(
|
|
49
|
+
error=error,
|
|
50
|
+
details=details,
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
generic_error_response.additional_properties = d
|
|
54
|
+
return generic_error_response
|
|
55
|
+
|
|
56
|
+
@property
|
|
57
|
+
def additional_keys(self) -> list[str]:
|
|
58
|
+
return list(self.additional_properties.keys())
|
|
59
|
+
|
|
60
|
+
def __getitem__(self, key: str) -> Any:
|
|
61
|
+
return self.additional_properties[key]
|
|
62
|
+
|
|
63
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
64
|
+
self.additional_properties[key] = value
|
|
65
|
+
|
|
66
|
+
def __delitem__(self, key: str) -> None:
|
|
67
|
+
del self.additional_properties[key]
|
|
68
|
+
|
|
69
|
+
def __contains__(self, key: str) -> bool:
|
|
70
|
+
return key in self.additional_properties
|
|
@@ -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="MessageRequest")
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@_attrs_define
|
|
11
|
+
class MessageRequest:
|
|
12
|
+
"""
|
|
13
|
+
Attributes:
|
|
14
|
+
role (str): Role of the message sender (system, user, assistant)
|
|
15
|
+
content (str): Content of the message
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
role: str
|
|
19
|
+
content: str
|
|
20
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
21
|
+
|
|
22
|
+
def to_dict(self) -> dict[str, Any]:
|
|
23
|
+
role = self.role
|
|
24
|
+
|
|
25
|
+
content = self.content
|
|
26
|
+
|
|
27
|
+
field_dict: dict[str, Any] = {}
|
|
28
|
+
field_dict.update(self.additional_properties)
|
|
29
|
+
field_dict.update(
|
|
30
|
+
{
|
|
31
|
+
"role": role,
|
|
32
|
+
"content": content,
|
|
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
|
+
role = d.pop("role")
|
|
42
|
+
|
|
43
|
+
content = d.pop("content")
|
|
44
|
+
|
|
45
|
+
message_request = cls(
|
|
46
|
+
role=role,
|
|
47
|
+
content=content,
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
message_request.additional_properties = d
|
|
51
|
+
return message_request
|
|
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
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import datetime
|
|
2
|
+
from collections.abc import Mapping
|
|
3
|
+
from typing import Any, TypeVar
|
|
4
|
+
from uuid import UUID
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
from attrs import field as _attrs_field
|
|
8
|
+
from dateutil.parser import isoparse
|
|
9
|
+
|
|
10
|
+
T = TypeVar("T", bound="Organization")
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@_attrs_define
|
|
14
|
+
class Organization:
|
|
15
|
+
"""
|
|
16
|
+
Attributes:
|
|
17
|
+
id (UUID):
|
|
18
|
+
name (str):
|
|
19
|
+
created_at (datetime.datetime):
|
|
20
|
+
updated_at (datetime.datetime):
|
|
21
|
+
credits_ (str): Available API credit balance in USD for the organization.
|
|
22
|
+
credits_last_updated (datetime.datetime): Timestamp of the last credit balance update.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
id: UUID
|
|
26
|
+
name: str
|
|
27
|
+
created_at: datetime.datetime
|
|
28
|
+
updated_at: datetime.datetime
|
|
29
|
+
credits_: str
|
|
30
|
+
credits_last_updated: datetime.datetime
|
|
31
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
32
|
+
|
|
33
|
+
def to_dict(self) -> dict[str, Any]:
|
|
34
|
+
id = str(self.id)
|
|
35
|
+
|
|
36
|
+
name = self.name
|
|
37
|
+
|
|
38
|
+
created_at = self.created_at.isoformat()
|
|
39
|
+
|
|
40
|
+
updated_at = self.updated_at.isoformat()
|
|
41
|
+
|
|
42
|
+
credits_ = self.credits_
|
|
43
|
+
|
|
44
|
+
credits_last_updated = self.credits_last_updated.isoformat()
|
|
45
|
+
|
|
46
|
+
field_dict: dict[str, Any] = {}
|
|
47
|
+
field_dict.update(self.additional_properties)
|
|
48
|
+
field_dict.update(
|
|
49
|
+
{
|
|
50
|
+
"id": id,
|
|
51
|
+
"name": name,
|
|
52
|
+
"created_at": created_at,
|
|
53
|
+
"updated_at": updated_at,
|
|
54
|
+
"credits": credits_,
|
|
55
|
+
"credits_last_updated": credits_last_updated,
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
return field_dict
|
|
60
|
+
|
|
61
|
+
@classmethod
|
|
62
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
63
|
+
d = dict(src_dict)
|
|
64
|
+
id = UUID(d.pop("id"))
|
|
65
|
+
|
|
66
|
+
name = d.pop("name")
|
|
67
|
+
|
|
68
|
+
created_at = isoparse(d.pop("created_at"))
|
|
69
|
+
|
|
70
|
+
updated_at = isoparse(d.pop("updated_at"))
|
|
71
|
+
|
|
72
|
+
credits_ = d.pop("credits")
|
|
73
|
+
|
|
74
|
+
credits_last_updated = isoparse(d.pop("credits_last_updated"))
|
|
75
|
+
|
|
76
|
+
organization = cls(
|
|
77
|
+
id=id,
|
|
78
|
+
name=name,
|
|
79
|
+
created_at=created_at,
|
|
80
|
+
updated_at=updated_at,
|
|
81
|
+
credits_=credits_,
|
|
82
|
+
credits_last_updated=credits_last_updated,
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
organization.additional_properties = d
|
|
86
|
+
return organization
|
|
87
|
+
|
|
88
|
+
@property
|
|
89
|
+
def additional_keys(self) -> list[str]:
|
|
90
|
+
return list(self.additional_properties.keys())
|
|
91
|
+
|
|
92
|
+
def __getitem__(self, key: str) -> Any:
|
|
93
|
+
return self.additional_properties[key]
|
|
94
|
+
|
|
95
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
96
|
+
self.additional_properties[key] = value
|
|
97
|
+
|
|
98
|
+
def __delitem__(self, key: str) -> None:
|
|
99
|
+
del self.additional_properties[key]
|
|
100
|
+
|
|
101
|
+
def __contains__(self, key: str) -> bool:
|
|
102
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
from collections.abc import Mapping
|
|
2
|
+
from typing import Any, TypeVar
|
|
3
|
+
from uuid import UUID
|
|
4
|
+
|
|
5
|
+
from attrs import define as _attrs_define
|
|
6
|
+
from attrs import field as _attrs_field
|
|
7
|
+
|
|
8
|
+
T = TypeVar("T", bound="OrganizationMinimal")
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@_attrs_define
|
|
12
|
+
class OrganizationMinimal:
|
|
13
|
+
"""
|
|
14
|
+
Attributes:
|
|
15
|
+
id (UUID):
|
|
16
|
+
name (str):
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
id: UUID
|
|
20
|
+
name: str
|
|
21
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
22
|
+
|
|
23
|
+
def to_dict(self) -> dict[str, Any]:
|
|
24
|
+
id = str(self.id)
|
|
25
|
+
|
|
26
|
+
name = self.name
|
|
27
|
+
|
|
28
|
+
field_dict: dict[str, Any] = {}
|
|
29
|
+
field_dict.update(self.additional_properties)
|
|
30
|
+
field_dict.update(
|
|
31
|
+
{
|
|
32
|
+
"id": id,
|
|
33
|
+
"name": name,
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
return field_dict
|
|
38
|
+
|
|
39
|
+
@classmethod
|
|
40
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
41
|
+
d = dict(src_dict)
|
|
42
|
+
id = UUID(d.pop("id"))
|
|
43
|
+
|
|
44
|
+
name = d.pop("name")
|
|
45
|
+
|
|
46
|
+
organization_minimal = cls(
|
|
47
|
+
id=id,
|
|
48
|
+
name=name,
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
organization_minimal.additional_properties = d
|
|
52
|
+
return organization_minimal
|
|
53
|
+
|
|
54
|
+
@property
|
|
55
|
+
def additional_keys(self) -> list[str]:
|
|
56
|
+
return list(self.additional_properties.keys())
|
|
57
|
+
|
|
58
|
+
def __getitem__(self, key: str) -> Any:
|
|
59
|
+
return self.additional_properties[key]
|
|
60
|
+
|
|
61
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
62
|
+
self.additional_properties[key] = value
|
|
63
|
+
|
|
64
|
+
def __delitem__(self, key: str) -> None:
|
|
65
|
+
del self.additional_properties[key]
|
|
66
|
+
|
|
67
|
+
def __contains__(self, key: str) -> bool:
|
|
68
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,71 @@
|
|
|
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
|
+
from .. import types
|
|
8
|
+
|
|
9
|
+
T = TypeVar("T", bound="OrganizationRequest")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@_attrs_define
|
|
13
|
+
class OrganizationRequest:
|
|
14
|
+
"""
|
|
15
|
+
Attributes:
|
|
16
|
+
name (str):
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
name: 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
|
+
field_dict: dict[str, Any] = {}
|
|
26
|
+
field_dict.update(self.additional_properties)
|
|
27
|
+
field_dict.update(
|
|
28
|
+
{
|
|
29
|
+
"name": name,
|
|
30
|
+
}
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
return field_dict
|
|
34
|
+
|
|
35
|
+
def to_multipart(self) -> types.RequestFiles:
|
|
36
|
+
files: types.RequestFiles = []
|
|
37
|
+
|
|
38
|
+
files.append(("name", (None, str(self.name).encode(), "text/plain")))
|
|
39
|
+
|
|
40
|
+
for prop_name, prop in self.additional_properties.items():
|
|
41
|
+
files.append((prop_name, (None, str(prop).encode(), "text/plain")))
|
|
42
|
+
|
|
43
|
+
return files
|
|
44
|
+
|
|
45
|
+
@classmethod
|
|
46
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
47
|
+
d = dict(src_dict)
|
|
48
|
+
name = d.pop("name")
|
|
49
|
+
|
|
50
|
+
organization_request = cls(
|
|
51
|
+
name=name,
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
organization_request.additional_properties = d
|
|
55
|
+
return organization_request
|
|
56
|
+
|
|
57
|
+
@property
|
|
58
|
+
def additional_keys(self) -> list[str]:
|
|
59
|
+
return list(self.additional_properties.keys())
|
|
60
|
+
|
|
61
|
+
def __getitem__(self, key: str) -> Any:
|
|
62
|
+
return self.additional_properties[key]
|
|
63
|
+
|
|
64
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
65
|
+
self.additional_properties[key] = value
|
|
66
|
+
|
|
67
|
+
def __delitem__(self, key: str) -> None:
|
|
68
|
+
del self.additional_properties[key]
|
|
69
|
+
|
|
70
|
+
def __contains__(self, key: str) -> bool:
|
|
71
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,123 @@
|
|
|
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.agent import Agent
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
T = TypeVar("T", bound="PaginatedAgentList")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@_attrs_define
|
|
17
|
+
class PaginatedAgentList:
|
|
18
|
+
"""
|
|
19
|
+
Attributes:
|
|
20
|
+
count (int): Example: 123.
|
|
21
|
+
results (list['Agent']):
|
|
22
|
+
next_ (Union[None, Unset, str]): Example: http://api.example.org/accounts/?page=4.
|
|
23
|
+
previous (Union[None, Unset, str]): Example: http://api.example.org/accounts/?page=2.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
count: int
|
|
27
|
+
results: list["Agent"]
|
|
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.agent import Agent
|
|
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 = Agent.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_agent_list = cls(
|
|
100
|
+
count=count,
|
|
101
|
+
results=results,
|
|
102
|
+
next_=next_,
|
|
103
|
+
previous=previous,
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
paginated_agent_list.additional_properties = d
|
|
107
|
+
return paginated_agent_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
|