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,103 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Optional, Union
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...types import Response
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def _get_kwargs(
|
|
12
|
+
prefix: str,
|
|
13
|
+
) -> dict[str, Any]:
|
|
14
|
+
_kwargs: dict[str, Any] = {
|
|
15
|
+
"method": "delete",
|
|
16
|
+
"url": f"/key/{prefix}",
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return _kwargs
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _parse_response(
|
|
23
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
24
|
+
) -> Optional[Any]:
|
|
25
|
+
if response.status_code == 204:
|
|
26
|
+
return None
|
|
27
|
+
if client.raise_on_unexpected_status:
|
|
28
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
29
|
+
else:
|
|
30
|
+
return None
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _build_response(
|
|
34
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
35
|
+
) -> Response[Any]:
|
|
36
|
+
return Response(
|
|
37
|
+
status_code=HTTPStatus(response.status_code),
|
|
38
|
+
content=response.content,
|
|
39
|
+
headers=response.headers,
|
|
40
|
+
parsed=_parse_response(client=client, response=response),
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def sync_detailed(
|
|
45
|
+
prefix: str,
|
|
46
|
+
*,
|
|
47
|
+
client: AuthenticatedClient,
|
|
48
|
+
) -> Response[Any]:
|
|
49
|
+
"""ViewSet for managing User API Keys.
|
|
50
|
+
|
|
51
|
+
Web-only endpoint - requires Auth0 authentication.
|
|
52
|
+
API keys cannot manage other API keys for security reasons.
|
|
53
|
+
|
|
54
|
+
Args:
|
|
55
|
+
prefix (str):
|
|
56
|
+
|
|
57
|
+
Raises:
|
|
58
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
59
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
60
|
+
|
|
61
|
+
Returns:
|
|
62
|
+
Response[Any]
|
|
63
|
+
"""
|
|
64
|
+
|
|
65
|
+
kwargs = _get_kwargs(
|
|
66
|
+
prefix=prefix,
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
response = client.get_httpx_client().request(
|
|
70
|
+
**kwargs,
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
return _build_response(client=client, response=response)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
async def asyncio_detailed(
|
|
77
|
+
prefix: str,
|
|
78
|
+
*,
|
|
79
|
+
client: AuthenticatedClient,
|
|
80
|
+
) -> Response[Any]:
|
|
81
|
+
"""ViewSet for managing User API Keys.
|
|
82
|
+
|
|
83
|
+
Web-only endpoint - requires Auth0 authentication.
|
|
84
|
+
API keys cannot manage other API keys for security reasons.
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
prefix (str):
|
|
88
|
+
|
|
89
|
+
Raises:
|
|
90
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
91
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
92
|
+
|
|
93
|
+
Returns:
|
|
94
|
+
Response[Any]
|
|
95
|
+
"""
|
|
96
|
+
|
|
97
|
+
kwargs = _get_kwargs(
|
|
98
|
+
prefix=prefix,
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
102
|
+
|
|
103
|
+
return _build_response(client=client, response=response)
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Optional, Union
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.paginated_user_api_key_list import PaginatedUserAPIKeyList
|
|
9
|
+
from ...types import UNSET, Response, Unset
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _get_kwargs(
|
|
13
|
+
*,
|
|
14
|
+
page: Union[Unset, int] = UNSET,
|
|
15
|
+
) -> dict[str, Any]:
|
|
16
|
+
params: dict[str, Any] = {}
|
|
17
|
+
|
|
18
|
+
params["page"] = page
|
|
19
|
+
|
|
20
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
21
|
+
|
|
22
|
+
_kwargs: dict[str, Any] = {
|
|
23
|
+
"method": "get",
|
|
24
|
+
"url": "/key",
|
|
25
|
+
"params": params,
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return _kwargs
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _parse_response(
|
|
32
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
33
|
+
) -> Optional[PaginatedUserAPIKeyList]:
|
|
34
|
+
if response.status_code == 200:
|
|
35
|
+
response_200 = PaginatedUserAPIKeyList.from_dict(response.json())
|
|
36
|
+
|
|
37
|
+
return response_200
|
|
38
|
+
if client.raise_on_unexpected_status:
|
|
39
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
40
|
+
else:
|
|
41
|
+
return None
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _build_response(
|
|
45
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
46
|
+
) -> Response[PaginatedUserAPIKeyList]:
|
|
47
|
+
return Response(
|
|
48
|
+
status_code=HTTPStatus(response.status_code),
|
|
49
|
+
content=response.content,
|
|
50
|
+
headers=response.headers,
|
|
51
|
+
parsed=_parse_response(client=client, response=response),
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def sync_detailed(
|
|
56
|
+
*,
|
|
57
|
+
client: AuthenticatedClient,
|
|
58
|
+
page: Union[Unset, int] = UNSET,
|
|
59
|
+
) -> Response[PaginatedUserAPIKeyList]:
|
|
60
|
+
"""ViewSet for managing User API Keys.
|
|
61
|
+
|
|
62
|
+
Web-only endpoint - requires Auth0 authentication.
|
|
63
|
+
API keys cannot manage other API keys for security reasons.
|
|
64
|
+
|
|
65
|
+
Args:
|
|
66
|
+
page (Union[Unset, int]):
|
|
67
|
+
|
|
68
|
+
Raises:
|
|
69
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
70
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
71
|
+
|
|
72
|
+
Returns:
|
|
73
|
+
Response[PaginatedUserAPIKeyList]
|
|
74
|
+
"""
|
|
75
|
+
|
|
76
|
+
kwargs = _get_kwargs(
|
|
77
|
+
page=page,
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
response = client.get_httpx_client().request(
|
|
81
|
+
**kwargs,
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
return _build_response(client=client, response=response)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def sync(
|
|
88
|
+
*,
|
|
89
|
+
client: AuthenticatedClient,
|
|
90
|
+
page: Union[Unset, int] = UNSET,
|
|
91
|
+
) -> Optional[PaginatedUserAPIKeyList]:
|
|
92
|
+
"""ViewSet for managing User API Keys.
|
|
93
|
+
|
|
94
|
+
Web-only endpoint - requires Auth0 authentication.
|
|
95
|
+
API keys cannot manage other API keys for security reasons.
|
|
96
|
+
|
|
97
|
+
Args:
|
|
98
|
+
page (Union[Unset, int]):
|
|
99
|
+
|
|
100
|
+
Raises:
|
|
101
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
102
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
103
|
+
|
|
104
|
+
Returns:
|
|
105
|
+
PaginatedUserAPIKeyList
|
|
106
|
+
"""
|
|
107
|
+
|
|
108
|
+
return sync_detailed(
|
|
109
|
+
client=client,
|
|
110
|
+
page=page,
|
|
111
|
+
).parsed
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
async def asyncio_detailed(
|
|
115
|
+
*,
|
|
116
|
+
client: AuthenticatedClient,
|
|
117
|
+
page: Union[Unset, int] = UNSET,
|
|
118
|
+
) -> Response[PaginatedUserAPIKeyList]:
|
|
119
|
+
"""ViewSet for managing User API Keys.
|
|
120
|
+
|
|
121
|
+
Web-only endpoint - requires Auth0 authentication.
|
|
122
|
+
API keys cannot manage other API keys for security reasons.
|
|
123
|
+
|
|
124
|
+
Args:
|
|
125
|
+
page (Union[Unset, int]):
|
|
126
|
+
|
|
127
|
+
Raises:
|
|
128
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
129
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
130
|
+
|
|
131
|
+
Returns:
|
|
132
|
+
Response[PaginatedUserAPIKeyList]
|
|
133
|
+
"""
|
|
134
|
+
|
|
135
|
+
kwargs = _get_kwargs(
|
|
136
|
+
page=page,
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
140
|
+
|
|
141
|
+
return _build_response(client=client, response=response)
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
async def asyncio(
|
|
145
|
+
*,
|
|
146
|
+
client: AuthenticatedClient,
|
|
147
|
+
page: Union[Unset, int] = UNSET,
|
|
148
|
+
) -> Optional[PaginatedUserAPIKeyList]:
|
|
149
|
+
"""ViewSet for managing User API Keys.
|
|
150
|
+
|
|
151
|
+
Web-only endpoint - requires Auth0 authentication.
|
|
152
|
+
API keys cannot manage other API keys for security reasons.
|
|
153
|
+
|
|
154
|
+
Args:
|
|
155
|
+
page (Union[Unset, int]):
|
|
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
|
+
PaginatedUserAPIKeyList
|
|
163
|
+
"""
|
|
164
|
+
|
|
165
|
+
return (
|
|
166
|
+
await asyncio_detailed(
|
|
167
|
+
client=client,
|
|
168
|
+
page=page,
|
|
169
|
+
)
|
|
170
|
+
).parsed
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Optional, Union
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.user_api_key import UserAPIKey
|
|
9
|
+
from ...types import Response
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _get_kwargs(
|
|
13
|
+
prefix: str,
|
|
14
|
+
) -> dict[str, Any]:
|
|
15
|
+
_kwargs: dict[str, Any] = {
|
|
16
|
+
"method": "get",
|
|
17
|
+
"url": f"/key/{prefix}",
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return _kwargs
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _parse_response(
|
|
24
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
25
|
+
) -> Optional[UserAPIKey]:
|
|
26
|
+
if response.status_code == 200:
|
|
27
|
+
response_200 = UserAPIKey.from_dict(response.json())
|
|
28
|
+
|
|
29
|
+
return response_200
|
|
30
|
+
if client.raise_on_unexpected_status:
|
|
31
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
32
|
+
else:
|
|
33
|
+
return None
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _build_response(
|
|
37
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
38
|
+
) -> Response[UserAPIKey]:
|
|
39
|
+
return Response(
|
|
40
|
+
status_code=HTTPStatus(response.status_code),
|
|
41
|
+
content=response.content,
|
|
42
|
+
headers=response.headers,
|
|
43
|
+
parsed=_parse_response(client=client, response=response),
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def sync_detailed(
|
|
48
|
+
prefix: str,
|
|
49
|
+
*,
|
|
50
|
+
client: AuthenticatedClient,
|
|
51
|
+
) -> Response[UserAPIKey]:
|
|
52
|
+
"""ViewSet for managing User API Keys.
|
|
53
|
+
|
|
54
|
+
Web-only endpoint - requires Auth0 authentication.
|
|
55
|
+
API keys cannot manage other API keys for security reasons.
|
|
56
|
+
|
|
57
|
+
Args:
|
|
58
|
+
prefix (str):
|
|
59
|
+
|
|
60
|
+
Raises:
|
|
61
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
62
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
63
|
+
|
|
64
|
+
Returns:
|
|
65
|
+
Response[UserAPIKey]
|
|
66
|
+
"""
|
|
67
|
+
|
|
68
|
+
kwargs = _get_kwargs(
|
|
69
|
+
prefix=prefix,
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
response = client.get_httpx_client().request(
|
|
73
|
+
**kwargs,
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
return _build_response(client=client, response=response)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def sync(
|
|
80
|
+
prefix: str,
|
|
81
|
+
*,
|
|
82
|
+
client: AuthenticatedClient,
|
|
83
|
+
) -> Optional[UserAPIKey]:
|
|
84
|
+
"""ViewSet for managing User API Keys.
|
|
85
|
+
|
|
86
|
+
Web-only endpoint - requires Auth0 authentication.
|
|
87
|
+
API keys cannot manage other API keys for security reasons.
|
|
88
|
+
|
|
89
|
+
Args:
|
|
90
|
+
prefix (str):
|
|
91
|
+
|
|
92
|
+
Raises:
|
|
93
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
94
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
95
|
+
|
|
96
|
+
Returns:
|
|
97
|
+
UserAPIKey
|
|
98
|
+
"""
|
|
99
|
+
|
|
100
|
+
return sync_detailed(
|
|
101
|
+
prefix=prefix,
|
|
102
|
+
client=client,
|
|
103
|
+
).parsed
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
async def asyncio_detailed(
|
|
107
|
+
prefix: str,
|
|
108
|
+
*,
|
|
109
|
+
client: AuthenticatedClient,
|
|
110
|
+
) -> Response[UserAPIKey]:
|
|
111
|
+
"""ViewSet for managing User API Keys.
|
|
112
|
+
|
|
113
|
+
Web-only endpoint - requires Auth0 authentication.
|
|
114
|
+
API keys cannot manage other API keys for security reasons.
|
|
115
|
+
|
|
116
|
+
Args:
|
|
117
|
+
prefix (str):
|
|
118
|
+
|
|
119
|
+
Raises:
|
|
120
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
121
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
122
|
+
|
|
123
|
+
Returns:
|
|
124
|
+
Response[UserAPIKey]
|
|
125
|
+
"""
|
|
126
|
+
|
|
127
|
+
kwargs = _get_kwargs(
|
|
128
|
+
prefix=prefix,
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
132
|
+
|
|
133
|
+
return _build_response(client=client, response=response)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
async def asyncio(
|
|
137
|
+
prefix: str,
|
|
138
|
+
*,
|
|
139
|
+
client: AuthenticatedClient,
|
|
140
|
+
) -> Optional[UserAPIKey]:
|
|
141
|
+
"""ViewSet for managing User API Keys.
|
|
142
|
+
|
|
143
|
+
Web-only endpoint - requires Auth0 authentication.
|
|
144
|
+
API keys cannot manage other API keys for security reasons.
|
|
145
|
+
|
|
146
|
+
Args:
|
|
147
|
+
prefix (str):
|
|
148
|
+
|
|
149
|
+
Raises:
|
|
150
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
151
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
152
|
+
|
|
153
|
+
Returns:
|
|
154
|
+
UserAPIKey
|
|
155
|
+
"""
|
|
156
|
+
|
|
157
|
+
return (
|
|
158
|
+
await asyncio_detailed(
|
|
159
|
+
prefix=prefix,
|
|
160
|
+
client=client,
|
|
161
|
+
)
|
|
162
|
+
).parsed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Optional, Union
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.organization import Organization
|
|
9
|
+
from ...models.organization_request import OrganizationRequest
|
|
10
|
+
from ...types import Response
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _get_kwargs(
|
|
14
|
+
*,
|
|
15
|
+
body: Union[
|
|
16
|
+
OrganizationRequest,
|
|
17
|
+
OrganizationRequest,
|
|
18
|
+
OrganizationRequest,
|
|
19
|
+
],
|
|
20
|
+
) -> dict[str, Any]:
|
|
21
|
+
headers: dict[str, Any] = {}
|
|
22
|
+
|
|
23
|
+
_kwargs: dict[str, Any] = {
|
|
24
|
+
"method": "post",
|
|
25
|
+
"url": "/organization",
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if isinstance(body, OrganizationRequest):
|
|
29
|
+
_kwargs["json"] = body.to_dict()
|
|
30
|
+
|
|
31
|
+
headers["Content-Type"] = "application/json"
|
|
32
|
+
if isinstance(body, OrganizationRequest):
|
|
33
|
+
_kwargs["data"] = body.to_dict()
|
|
34
|
+
|
|
35
|
+
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
|
36
|
+
if isinstance(body, OrganizationRequest):
|
|
37
|
+
_kwargs["files"] = body.to_multipart()
|
|
38
|
+
|
|
39
|
+
headers["Content-Type"] = "multipart/form-data"
|
|
40
|
+
|
|
41
|
+
_kwargs["headers"] = headers
|
|
42
|
+
return _kwargs
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _parse_response(
|
|
46
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
47
|
+
) -> Optional[Organization]:
|
|
48
|
+
if response.status_code == 201:
|
|
49
|
+
response_201 = Organization.from_dict(response.json())
|
|
50
|
+
|
|
51
|
+
return response_201
|
|
52
|
+
if client.raise_on_unexpected_status:
|
|
53
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
54
|
+
else:
|
|
55
|
+
return None
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def _build_response(
|
|
59
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
60
|
+
) -> Response[Organization]:
|
|
61
|
+
return Response(
|
|
62
|
+
status_code=HTTPStatus(response.status_code),
|
|
63
|
+
content=response.content,
|
|
64
|
+
headers=response.headers,
|
|
65
|
+
parsed=_parse_response(client=client, response=response),
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def sync_detailed(
|
|
70
|
+
*,
|
|
71
|
+
client: AuthenticatedClient,
|
|
72
|
+
body: Union[
|
|
73
|
+
OrganizationRequest,
|
|
74
|
+
OrganizationRequest,
|
|
75
|
+
OrganizationRequest,
|
|
76
|
+
],
|
|
77
|
+
) -> Response[Organization]:
|
|
78
|
+
"""Provides access to Organization details for the authenticated user.
|
|
79
|
+
|
|
80
|
+
Web-only endpoint - requires Auth0 authentication.
|
|
81
|
+
Organization management and billing operations require browser context.
|
|
82
|
+
|
|
83
|
+
Args:
|
|
84
|
+
body (OrganizationRequest):
|
|
85
|
+
body (OrganizationRequest):
|
|
86
|
+
body (OrganizationRequest):
|
|
87
|
+
|
|
88
|
+
Raises:
|
|
89
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
90
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
91
|
+
|
|
92
|
+
Returns:
|
|
93
|
+
Response[Organization]
|
|
94
|
+
"""
|
|
95
|
+
|
|
96
|
+
kwargs = _get_kwargs(
|
|
97
|
+
body=body,
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
response = client.get_httpx_client().request(
|
|
101
|
+
**kwargs,
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
return _build_response(client=client, response=response)
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def sync(
|
|
108
|
+
*,
|
|
109
|
+
client: AuthenticatedClient,
|
|
110
|
+
body: Union[
|
|
111
|
+
OrganizationRequest,
|
|
112
|
+
OrganizationRequest,
|
|
113
|
+
OrganizationRequest,
|
|
114
|
+
],
|
|
115
|
+
) -> Optional[Organization]:
|
|
116
|
+
"""Provides access to Organization details for the authenticated user.
|
|
117
|
+
|
|
118
|
+
Web-only endpoint - requires Auth0 authentication.
|
|
119
|
+
Organization management and billing operations require browser context.
|
|
120
|
+
|
|
121
|
+
Args:
|
|
122
|
+
body (OrganizationRequest):
|
|
123
|
+
body (OrganizationRequest):
|
|
124
|
+
body (OrganizationRequest):
|
|
125
|
+
|
|
126
|
+
Raises:
|
|
127
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
128
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
129
|
+
|
|
130
|
+
Returns:
|
|
131
|
+
Organization
|
|
132
|
+
"""
|
|
133
|
+
|
|
134
|
+
return sync_detailed(
|
|
135
|
+
client=client,
|
|
136
|
+
body=body,
|
|
137
|
+
).parsed
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
async def asyncio_detailed(
|
|
141
|
+
*,
|
|
142
|
+
client: AuthenticatedClient,
|
|
143
|
+
body: Union[
|
|
144
|
+
OrganizationRequest,
|
|
145
|
+
OrganizationRequest,
|
|
146
|
+
OrganizationRequest,
|
|
147
|
+
],
|
|
148
|
+
) -> Response[Organization]:
|
|
149
|
+
"""Provides access to Organization details for the authenticated user.
|
|
150
|
+
|
|
151
|
+
Web-only endpoint - requires Auth0 authentication.
|
|
152
|
+
Organization management and billing operations require browser context.
|
|
153
|
+
|
|
154
|
+
Args:
|
|
155
|
+
body (OrganizationRequest):
|
|
156
|
+
body (OrganizationRequest):
|
|
157
|
+
body (OrganizationRequest):
|
|
158
|
+
|
|
159
|
+
Raises:
|
|
160
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
161
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
162
|
+
|
|
163
|
+
Returns:
|
|
164
|
+
Response[Organization]
|
|
165
|
+
"""
|
|
166
|
+
|
|
167
|
+
kwargs = _get_kwargs(
|
|
168
|
+
body=body,
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
172
|
+
|
|
173
|
+
return _build_response(client=client, response=response)
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
async def asyncio(
|
|
177
|
+
*,
|
|
178
|
+
client: AuthenticatedClient,
|
|
179
|
+
body: Union[
|
|
180
|
+
OrganizationRequest,
|
|
181
|
+
OrganizationRequest,
|
|
182
|
+
OrganizationRequest,
|
|
183
|
+
],
|
|
184
|
+
) -> Optional[Organization]:
|
|
185
|
+
"""Provides access to Organization details for the authenticated user.
|
|
186
|
+
|
|
187
|
+
Web-only endpoint - requires Auth0 authentication.
|
|
188
|
+
Organization management and billing operations require browser context.
|
|
189
|
+
|
|
190
|
+
Args:
|
|
191
|
+
body (OrganizationRequest):
|
|
192
|
+
body (OrganizationRequest):
|
|
193
|
+
body (OrganizationRequest):
|
|
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
|
+
Organization
|
|
201
|
+
"""
|
|
202
|
+
|
|
203
|
+
return (
|
|
204
|
+
await asyncio_detailed(
|
|
205
|
+
client=client,
|
|
206
|
+
body=body,
|
|
207
|
+
)
|
|
208
|
+
).parsed
|