skillforge-client 0.3.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.
- skillforge_client/__init__.py +8 -0
- skillforge_client/api/__init__.py +1 -0
- skillforge_client/api/auth/__init__.py +1 -0
- skillforge_client/api/auth/create_application_client_endpoint_api_v1_auth_clients_post.py +166 -0
- skillforge_client/api/auth/create_application_client_secret_endpoint_api_v1_auth_clients_client_id_secrets_post.py +182 -0
- skillforge_client/api/auth/create_token_api_v1_auth_token_post.py +165 -0
- skillforge_client/api/auth/grant_application_client_scopes_endpoint_api_v1_auth_clients_client_id_scopes_post.py +182 -0
- skillforge_client/api/auth/read_application_client_api_v1_auth_clients_client_id_get.py +161 -0
- skillforge_client/api/auth/read_application_clients_api_v1_auth_clients_get.py +133 -0
- skillforge_client/api/auth/revoke_application_client_scope_endpoint_api_v1_auth_clients_client_id_scopes_scope_key_delete.py +173 -0
- skillforge_client/api/auth/revoke_application_client_secret_endpoint_api_v1_auth_clients_client_id_secrets_secret_id_delete.py +174 -0
- skillforge_client/api/auth/update_application_client_endpoint_api_v1_auth_clients_client_id_patch.py +182 -0
- skillforge_client/api/bot/__init__.py +1 -0
- skillforge_client/api/bot/add_user_to_group_endpoint_api_v1_bot_users_discord_id_groups_group_key_put.py +199 -0
- skillforge_client/api/bot/cancel_operation_endpoint_api_v1_bot_operations_operation_id_cancel_post.py +203 -0
- skillforge_client/api/bot/check_authorization_endpoint_api_v1_bot_authz_check_post.py +206 -0
- skillforge_client/api/bot/claim_jobs_endpoint_api_v1_bot_jobs_claim_post.py +210 -0
- skillforge_client/api/bot/commit_student_activation_endpoint_api_v1_bot_students_activations_operation_id_commit_post.py +204 -0
- skillforge_client/api/bot/commit_student_deactivation_endpoint_api_v1_bot_students_guild_id_student_discord_id_deactivate_operation_id_commit_post.py +211 -0
- skillforge_client/api/bot/commit_student_pop_endpoint_api_v1_bot_students_guild_id_student_discord_id_pop_operation_id_commit_post.py +211 -0
- skillforge_client/api/bot/commit_student_stash_endpoint_api_v1_bot_students_guild_id_student_discord_id_stash_operation_id_commit_post.py +211 -0
- skillforge_client/api/bot/commit_tutor_activation_endpoint_api_v1_bot_tutors_activations_operation_id_commit_post.py +204 -0
- skillforge_client/api/bot/commit_tutor_deactivation_endpoint_api_v1_bot_tutors_guild_id_tutor_discord_id_deactivate_operation_id_commit_post.py +211 -0
- skillforge_client/api/bot/complete_job_endpoint_api_v1_bot_jobs_job_id_complete_post.py +183 -0
- skillforge_client/api/bot/deactivate_discord_account_endpoint_api_v1_bot_users_discord_id_account_delete.py +197 -0
- skillforge_client/api/bot/delete_command_env_endpoint_api_v1_bot_command_envs_guild_id_channel_id_kind_delete.py +204 -0
- skillforge_client/api/bot/fail_job_endpoint_api_v1_bot_jobs_job_id_fail_post.py +228 -0
- skillforge_client/api/bot/job_queue_summary_endpoint_api_v1_bot_jobs_summary_get.py +202 -0
- skillforge_client/api/bot/link_discord_account_endpoint_api_v1_bot_users_discord_id_account_put.py +227 -0
- skillforge_client/api/bot/list_jobs_endpoint_api_v1_bot_jobs_get.py +243 -0
- skillforge_client/api/bot/list_operations_endpoint_api_v1_bot_operations_get.py +302 -0
- skillforge_client/api/bot/prepare_student_activation_endpoint_api_v1_bot_students_activations_prepare_post.py +181 -0
- skillforge_client/api/bot/prepare_student_deactivation_endpoint_api_v1_bot_students_guild_id_student_discord_id_deactivate_prepare_post.py +190 -0
- skillforge_client/api/bot/prepare_student_pop_endpoint_api_v1_bot_students_guild_id_student_discord_id_pop_prepare_post.py +190 -0
- skillforge_client/api/bot/prepare_student_stash_endpoint_api_v1_bot_students_guild_id_student_discord_id_stash_prepare_post.py +190 -0
- skillforge_client/api/bot/prepare_tutor_activation_endpoint_api_v1_bot_tutors_activations_prepare_post.py +181 -0
- skillforge_client/api/bot/prepare_tutor_deactivation_endpoint_api_v1_bot_tutors_guild_id_tutor_discord_id_deactivate_prepare_post.py +190 -0
- skillforge_client/api/bot/read_job_api_v1_bot_jobs_job_id_get.py +186 -0
- skillforge_client/api/bot/read_operation_api_v1_bot_operations_operation_id_get.py +186 -0
- skillforge_client/api/bot/read_principal_api_v1_bot_runtime_principals_discord_id_get.py +177 -0
- skillforge_client/api/bot/read_principals_batch_api_v1_bot_runtime_principals_batch_post.py +189 -0
- skillforge_client/api/bot/read_student_context_api_v1_bot_runtime_students_guild_id_discord_id_get.py +191 -0
- skillforge_client/api/bot/read_student_contexts_batch_api_v1_bot_runtime_students_guild_id_batch_post.py +205 -0
- skillforge_client/api/bot/read_tutor_context_api_v1_bot_runtime_tutors_guild_id_discord_id_get.py +191 -0
- skillforge_client/api/bot/read_tutor_contexts_batch_api_v1_bot_runtime_tutors_guild_id_batch_post.py +205 -0
- skillforge_client/api/bot/remove_user_from_group_endpoint_api_v1_bot_users_discord_id_groups_group_key_delete.py +197 -0
- skillforge_client/api/bot/resolve_command_env_endpoint_api_v1_bot_runtime_command_envs_resolve_get.py +234 -0
- skillforge_client/api/bot/upsert_command_env_endpoint_api_v1_bot_command_envs_put.py +181 -0
- skillforge_client/api/bot/upsert_discord_user_endpoint_api_v1_bot_users_discord_id_put.py +213 -0
- skillforge_client/api/default/__init__.py +1 -0
- skillforge_client/api/default/root_get.py +81 -0
- skillforge_client/api/system/__init__.py +1 -0
- skillforge_client/api/system/dependencies_health_check_health_dependencies_get.py +136 -0
- skillforge_client/api/system/dependency_health_check_health_dependencies_dependency_name_get.py +170 -0
- skillforge_client/api/system/liveness_check_health_live_get.py +132 -0
- skillforge_client/api/system/system_health_check_health_get.py +136 -0
- skillforge_client/api/system/worker_health_check_health_workers_worker_name_get.py +170 -0
- skillforge_client/api/system/workers_health_check_health_workers_get.py +136 -0
- skillforge_client/client.py +268 -0
- skillforge_client/errors.py +16 -0
- skillforge_client/models/__init__.py +167 -0
- skillforge_client/models/access_token_response.py +85 -0
- skillforge_client/models/application_client_create_request.py +91 -0
- skillforge_client/models/application_client_response.py +149 -0
- skillforge_client/models/application_client_scope_grant_request.py +61 -0
- skillforge_client/models/application_client_secret_create_request.py +104 -0
- skillforge_client/models/application_client_secret_response.py +160 -0
- skillforge_client/models/application_client_status.py +9 -0
- skillforge_client/models/application_client_update_request.py +124 -0
- skillforge_client/models/authorization_check_request.py +78 -0
- skillforge_client/models/authorization_check_response.py +61 -0
- skillforge_client/models/body_create_token_api_v1_auth_token_post.py +123 -0
- skillforge_client/models/bot_job.py +119 -0
- skillforge_client/models/bot_job_payload.py +47 -0
- skillforge_client/models/bot_principal.py +148 -0
- skillforge_client/models/command_env_channel_response.py +100 -0
- skillforge_client/models/command_env_kind.py +9 -0
- skillforge_client/models/command_env_upsert_request.py +100 -0
- skillforge_client/models/contact_info_profile.py +92 -0
- skillforge_client/models/contact_info_type.py +9 -0
- skillforge_client/models/created_client_secret_response.py +75 -0
- skillforge_client/models/dependencies_health_check_response.py +77 -0
- skillforge_client/models/dependencies_health_check_response_checks.py +56 -0
- skillforge_client/models/dependency_health_check_response.py +72 -0
- skillforge_client/models/dependency_name.py +8 -0
- skillforge_client/models/discord_account_link_request.py +82 -0
- skillforge_client/models/discord_account_link_response.py +86 -0
- skillforge_client/models/discord_account_profile.py +77 -0
- skillforge_client/models/discord_id_batch_request.py +62 -0
- skillforge_client/models/discord_user_response.py +87 -0
- skillforge_client/models/discord_user_upsert_request.py +81 -0
- skillforge_client/models/error_response.py +61 -0
- skillforge_client/models/external_accounts_profile.py +124 -0
- skillforge_client/models/group_membership_response.py +69 -0
- skillforge_client/models/health_check_response.py +63 -0
- skillforge_client/models/health_status.py +10 -0
- skillforge_client/models/http_validation_error.py +79 -0
- skillforge_client/models/job_claim_request.py +113 -0
- skillforge_client/models/job_detail.py +239 -0
- skillforge_client/models/job_detail_payload.py +47 -0
- skillforge_client/models/job_fail_request.py +82 -0
- skillforge_client/models/job_kind_counts.py +92 -0
- skillforge_client/models/job_list_item.py +225 -0
- skillforge_client/models/job_page.py +100 -0
- skillforge_client/models/job_queue_summary.py +106 -0
- skillforge_client/models/job_response.py +187 -0
- skillforge_client/models/job_status.py +11 -0
- skillforge_client/models/job_status_counts.py +86 -0
- skillforge_client/models/member_role.py +10 -0
- skillforge_client/models/microsoft_account_profile.py +61 -0
- skillforge_client/models/operation_cancel_response.py +108 -0
- skillforge_client/models/operation_kind.py +13 -0
- skillforge_client/models/operation_page.py +100 -0
- skillforge_client/models/operation_response.py +257 -0
- skillforge_client/models/operation_response_plan.py +47 -0
- skillforge_client/models/operation_status.py +12 -0
- skillforge_client/models/operation_summary.py +243 -0
- skillforge_client/models/operational_profile.py +178 -0
- skillforge_client/models/party_relation_type.py +10 -0
- skillforge_client/models/person_profile.py +69 -0
- skillforge_client/models/principal_batch.py +84 -0
- skillforge_client/models/relation_profile.py +81 -0
- skillforge_client/models/relation_profile_direction.py +9 -0
- skillforge_client/models/student_activation_commit_request.py +61 -0
- skillforge_client/models/student_activation_prepare_request.py +77 -0
- skillforge_client/models/student_channel_state.py +9 -0
- skillforge_client/models/student_context.py +140 -0
- skillforge_client/models/student_context_batch.py +83 -0
- skillforge_client/models/system_health_check_response.py +87 -0
- skillforge_client/models/transition_commit_response.py +108 -0
- skillforge_client/models/transition_prepare_response.py +95 -0
- skillforge_client/models/transition_prepare_response_plan.py +47 -0
- skillforge_client/models/tutor_activation_commit_request.py +69 -0
- skillforge_client/models/tutor_activation_prepare_request.py +69 -0
- skillforge_client/models/tutor_context.py +99 -0
- skillforge_client/models/tutor_context_batch.py +83 -0
- skillforge_client/models/validation_error.py +123 -0
- skillforge_client/models/validation_error_context.py +47 -0
- skillforge_client/models/worker_health_check_response.py +72 -0
- skillforge_client/models/worker_name.py +8 -0
- skillforge_client/models/workers_health_check_response.py +77 -0
- skillforge_client/models/workers_health_check_response_checks.py +56 -0
- skillforge_client/py.typed +1 -0
- skillforge_client/types.py +54 -0
- skillforge_client-0.3.0.dist-info/METADATA +83 -0
- skillforge_client-0.3.0.dist-info/RECORD +147 -0
- skillforge_client-0.3.0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,197 @@
|
|
|
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.discord_account_link_response import DiscordAccountLinkResponse
|
|
10
|
+
from ...models.error_response import ErrorResponse
|
|
11
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
12
|
+
from ...types import Response
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _get_kwargs(
|
|
16
|
+
discord_id: int,
|
|
17
|
+
) -> dict[str, Any]:
|
|
18
|
+
|
|
19
|
+
_kwargs: dict[str, Any] = {
|
|
20
|
+
"method": "delete",
|
|
21
|
+
"url": "/api/v1/bot/users/{discord_id}/account".format(
|
|
22
|
+
discord_id=quote(str(discord_id), safe=""),
|
|
23
|
+
),
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return _kwargs
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _parse_response(
|
|
30
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
31
|
+
) -> DiscordAccountLinkResponse | ErrorResponse | HTTPValidationError | None:
|
|
32
|
+
if response.status_code == 200:
|
|
33
|
+
response_200 = DiscordAccountLinkResponse.from_dict(response.json())
|
|
34
|
+
|
|
35
|
+
return response_200
|
|
36
|
+
|
|
37
|
+
if response.status_code == 401:
|
|
38
|
+
response_401 = ErrorResponse.from_dict(response.json())
|
|
39
|
+
|
|
40
|
+
return response_401
|
|
41
|
+
|
|
42
|
+
if response.status_code == 403:
|
|
43
|
+
response_403 = ErrorResponse.from_dict(response.json())
|
|
44
|
+
|
|
45
|
+
return response_403
|
|
46
|
+
|
|
47
|
+
if response.status_code == 404:
|
|
48
|
+
response_404 = ErrorResponse.from_dict(response.json())
|
|
49
|
+
|
|
50
|
+
return response_404
|
|
51
|
+
|
|
52
|
+
if response.status_code == 422:
|
|
53
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
54
|
+
|
|
55
|
+
return response_422
|
|
56
|
+
|
|
57
|
+
if client.raise_on_unexpected_status:
|
|
58
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
59
|
+
else:
|
|
60
|
+
return None
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def _build_response(
|
|
64
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
65
|
+
) -> Response[DiscordAccountLinkResponse | ErrorResponse | HTTPValidationError]:
|
|
66
|
+
return Response(
|
|
67
|
+
status_code=HTTPStatus(response.status_code),
|
|
68
|
+
content=response.content,
|
|
69
|
+
headers=response.headers,
|
|
70
|
+
parsed=_parse_response(client=client, response=response),
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def sync_detailed(
|
|
75
|
+
discord_id: int,
|
|
76
|
+
*,
|
|
77
|
+
client: AuthenticatedClient,
|
|
78
|
+
) -> Response[DiscordAccountLinkResponse | ErrorResponse | HTTPValidationError]:
|
|
79
|
+
"""Deactivate Discord Account Endpoint
|
|
80
|
+
|
|
81
|
+
Deactivate (unlink) a Discord account without deleting it.
|
|
82
|
+
|
|
83
|
+
Sets `active` to false and clears `is_primary`, freeing the party's primary slot while keeping
|
|
84
|
+
the row for history. Re-linking via the `PUT` endpoint reactivates it.
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
discord_id (int):
|
|
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[DiscordAccountLinkResponse | ErrorResponse | HTTPValidationError]
|
|
95
|
+
"""
|
|
96
|
+
|
|
97
|
+
kwargs = _get_kwargs(
|
|
98
|
+
discord_id=discord_id,
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
response = client.get_httpx_client().request(
|
|
102
|
+
**kwargs,
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
return _build_response(client=client, response=response)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def sync(
|
|
109
|
+
discord_id: int,
|
|
110
|
+
*,
|
|
111
|
+
client: AuthenticatedClient,
|
|
112
|
+
) -> DiscordAccountLinkResponse | ErrorResponse | HTTPValidationError | None:
|
|
113
|
+
"""Deactivate Discord Account Endpoint
|
|
114
|
+
|
|
115
|
+
Deactivate (unlink) a Discord account without deleting it.
|
|
116
|
+
|
|
117
|
+
Sets `active` to false and clears `is_primary`, freeing the party's primary slot while keeping
|
|
118
|
+
the row for history. Re-linking via the `PUT` endpoint reactivates it.
|
|
119
|
+
|
|
120
|
+
Args:
|
|
121
|
+
discord_id (int):
|
|
122
|
+
|
|
123
|
+
Raises:
|
|
124
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
125
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
126
|
+
|
|
127
|
+
Returns:
|
|
128
|
+
DiscordAccountLinkResponse | ErrorResponse | HTTPValidationError
|
|
129
|
+
"""
|
|
130
|
+
|
|
131
|
+
return sync_detailed(
|
|
132
|
+
discord_id=discord_id,
|
|
133
|
+
client=client,
|
|
134
|
+
).parsed
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
async def asyncio_detailed(
|
|
138
|
+
discord_id: int,
|
|
139
|
+
*,
|
|
140
|
+
client: AuthenticatedClient,
|
|
141
|
+
) -> Response[DiscordAccountLinkResponse | ErrorResponse | HTTPValidationError]:
|
|
142
|
+
"""Deactivate Discord Account Endpoint
|
|
143
|
+
|
|
144
|
+
Deactivate (unlink) a Discord account without deleting it.
|
|
145
|
+
|
|
146
|
+
Sets `active` to false and clears `is_primary`, freeing the party's primary slot while keeping
|
|
147
|
+
the row for history. Re-linking via the `PUT` endpoint reactivates it.
|
|
148
|
+
|
|
149
|
+
Args:
|
|
150
|
+
discord_id (int):
|
|
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
|
+
Response[DiscordAccountLinkResponse | ErrorResponse | HTTPValidationError]
|
|
158
|
+
"""
|
|
159
|
+
|
|
160
|
+
kwargs = _get_kwargs(
|
|
161
|
+
discord_id=discord_id,
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
165
|
+
|
|
166
|
+
return _build_response(client=client, response=response)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
async def asyncio(
|
|
170
|
+
discord_id: int,
|
|
171
|
+
*,
|
|
172
|
+
client: AuthenticatedClient,
|
|
173
|
+
) -> DiscordAccountLinkResponse | ErrorResponse | HTTPValidationError | None:
|
|
174
|
+
"""Deactivate Discord Account Endpoint
|
|
175
|
+
|
|
176
|
+
Deactivate (unlink) a Discord account without deleting it.
|
|
177
|
+
|
|
178
|
+
Sets `active` to false and clears `is_primary`, freeing the party's primary slot while keeping
|
|
179
|
+
the row for history. Re-linking via the `PUT` endpoint reactivates it.
|
|
180
|
+
|
|
181
|
+
Args:
|
|
182
|
+
discord_id (int):
|
|
183
|
+
|
|
184
|
+
Raises:
|
|
185
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
186
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
187
|
+
|
|
188
|
+
Returns:
|
|
189
|
+
DiscordAccountLinkResponse | ErrorResponse | HTTPValidationError
|
|
190
|
+
"""
|
|
191
|
+
|
|
192
|
+
return (
|
|
193
|
+
await asyncio_detailed(
|
|
194
|
+
discord_id=discord_id,
|
|
195
|
+
client=client,
|
|
196
|
+
)
|
|
197
|
+
).parsed
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, cast
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ... import errors
|
|
8
|
+
from ...client import AuthenticatedClient, Client
|
|
9
|
+
from ...models.command_env_kind import CommandEnvKind
|
|
10
|
+
from ...models.error_response import ErrorResponse
|
|
11
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
12
|
+
from ...types import Response
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _get_kwargs(
|
|
16
|
+
guild_id: int,
|
|
17
|
+
channel_id: int,
|
|
18
|
+
kind: CommandEnvKind,
|
|
19
|
+
) -> dict[str, Any]:
|
|
20
|
+
|
|
21
|
+
_kwargs: dict[str, Any] = {
|
|
22
|
+
"method": "delete",
|
|
23
|
+
"url": "/api/v1/bot/command-envs/{guild_id}/{channel_id}/{kind}".format(
|
|
24
|
+
guild_id=quote(str(guild_id), safe=""),
|
|
25
|
+
channel_id=quote(str(channel_id), safe=""),
|
|
26
|
+
kind=quote(str(kind), safe=""),
|
|
27
|
+
),
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return _kwargs
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _parse_response(
|
|
34
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
35
|
+
) -> Any | ErrorResponse | HTTPValidationError | None:
|
|
36
|
+
if response.status_code == 204:
|
|
37
|
+
response_204 = cast(Any, None)
|
|
38
|
+
return response_204
|
|
39
|
+
|
|
40
|
+
if response.status_code == 401:
|
|
41
|
+
response_401 = ErrorResponse.from_dict(response.json())
|
|
42
|
+
|
|
43
|
+
return response_401
|
|
44
|
+
|
|
45
|
+
if response.status_code == 403:
|
|
46
|
+
response_403 = ErrorResponse.from_dict(response.json())
|
|
47
|
+
|
|
48
|
+
return response_403
|
|
49
|
+
|
|
50
|
+
if response.status_code == 404:
|
|
51
|
+
response_404 = ErrorResponse.from_dict(response.json())
|
|
52
|
+
|
|
53
|
+
return response_404
|
|
54
|
+
|
|
55
|
+
if response.status_code == 422:
|
|
56
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
57
|
+
|
|
58
|
+
return response_422
|
|
59
|
+
|
|
60
|
+
if client.raise_on_unexpected_status:
|
|
61
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
62
|
+
else:
|
|
63
|
+
return None
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def _build_response(
|
|
67
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
68
|
+
) -> Response[Any | ErrorResponse | HTTPValidationError]:
|
|
69
|
+
return Response(
|
|
70
|
+
status_code=HTTPStatus(response.status_code),
|
|
71
|
+
content=response.content,
|
|
72
|
+
headers=response.headers,
|
|
73
|
+
parsed=_parse_response(client=client, response=response),
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def sync_detailed(
|
|
78
|
+
guild_id: int,
|
|
79
|
+
channel_id: int,
|
|
80
|
+
kind: CommandEnvKind,
|
|
81
|
+
*,
|
|
82
|
+
client: AuthenticatedClient,
|
|
83
|
+
) -> Response[Any | ErrorResponse | HTTPValidationError]:
|
|
84
|
+
"""Delete Command Env Endpoint
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
guild_id (int):
|
|
88
|
+
channel_id (int):
|
|
89
|
+
kind (CommandEnvKind):
|
|
90
|
+
|
|
91
|
+
Raises:
|
|
92
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
93
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
94
|
+
|
|
95
|
+
Returns:
|
|
96
|
+
Response[Any | ErrorResponse | HTTPValidationError]
|
|
97
|
+
"""
|
|
98
|
+
|
|
99
|
+
kwargs = _get_kwargs(
|
|
100
|
+
guild_id=guild_id,
|
|
101
|
+
channel_id=channel_id,
|
|
102
|
+
kind=kind,
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
response = client.get_httpx_client().request(
|
|
106
|
+
**kwargs,
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
return _build_response(client=client, response=response)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def sync(
|
|
113
|
+
guild_id: int,
|
|
114
|
+
channel_id: int,
|
|
115
|
+
kind: CommandEnvKind,
|
|
116
|
+
*,
|
|
117
|
+
client: AuthenticatedClient,
|
|
118
|
+
) -> Any | ErrorResponse | HTTPValidationError | None:
|
|
119
|
+
"""Delete Command Env Endpoint
|
|
120
|
+
|
|
121
|
+
Args:
|
|
122
|
+
guild_id (int):
|
|
123
|
+
channel_id (int):
|
|
124
|
+
kind (CommandEnvKind):
|
|
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
|
+
Any | ErrorResponse | HTTPValidationError
|
|
132
|
+
"""
|
|
133
|
+
|
|
134
|
+
return sync_detailed(
|
|
135
|
+
guild_id=guild_id,
|
|
136
|
+
channel_id=channel_id,
|
|
137
|
+
kind=kind,
|
|
138
|
+
client=client,
|
|
139
|
+
).parsed
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
async def asyncio_detailed(
|
|
143
|
+
guild_id: int,
|
|
144
|
+
channel_id: int,
|
|
145
|
+
kind: CommandEnvKind,
|
|
146
|
+
*,
|
|
147
|
+
client: AuthenticatedClient,
|
|
148
|
+
) -> Response[Any | ErrorResponse | HTTPValidationError]:
|
|
149
|
+
"""Delete Command Env Endpoint
|
|
150
|
+
|
|
151
|
+
Args:
|
|
152
|
+
guild_id (int):
|
|
153
|
+
channel_id (int):
|
|
154
|
+
kind (CommandEnvKind):
|
|
155
|
+
|
|
156
|
+
Raises:
|
|
157
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
158
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
159
|
+
|
|
160
|
+
Returns:
|
|
161
|
+
Response[Any | ErrorResponse | HTTPValidationError]
|
|
162
|
+
"""
|
|
163
|
+
|
|
164
|
+
kwargs = _get_kwargs(
|
|
165
|
+
guild_id=guild_id,
|
|
166
|
+
channel_id=channel_id,
|
|
167
|
+
kind=kind,
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
171
|
+
|
|
172
|
+
return _build_response(client=client, response=response)
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
async def asyncio(
|
|
176
|
+
guild_id: int,
|
|
177
|
+
channel_id: int,
|
|
178
|
+
kind: CommandEnvKind,
|
|
179
|
+
*,
|
|
180
|
+
client: AuthenticatedClient,
|
|
181
|
+
) -> Any | ErrorResponse | HTTPValidationError | None:
|
|
182
|
+
"""Delete Command Env Endpoint
|
|
183
|
+
|
|
184
|
+
Args:
|
|
185
|
+
guild_id (int):
|
|
186
|
+
channel_id (int):
|
|
187
|
+
kind (CommandEnvKind):
|
|
188
|
+
|
|
189
|
+
Raises:
|
|
190
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
191
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
192
|
+
|
|
193
|
+
Returns:
|
|
194
|
+
Any | ErrorResponse | HTTPValidationError
|
|
195
|
+
"""
|
|
196
|
+
|
|
197
|
+
return (
|
|
198
|
+
await asyncio_detailed(
|
|
199
|
+
guild_id=guild_id,
|
|
200
|
+
channel_id=channel_id,
|
|
201
|
+
kind=kind,
|
|
202
|
+
client=client,
|
|
203
|
+
)
|
|
204
|
+
).parsed
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
from uuid import UUID
|
|
5
|
+
|
|
6
|
+
import httpx
|
|
7
|
+
|
|
8
|
+
from ... import errors
|
|
9
|
+
from ...client import AuthenticatedClient, Client
|
|
10
|
+
from ...models.error_response import ErrorResponse
|
|
11
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
12
|
+
from ...models.job_fail_request import JobFailRequest
|
|
13
|
+
from ...models.job_response import JobResponse
|
|
14
|
+
from ...types import Response
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _get_kwargs(
|
|
18
|
+
job_id: UUID,
|
|
19
|
+
*,
|
|
20
|
+
body: JobFailRequest,
|
|
21
|
+
) -> dict[str, Any]:
|
|
22
|
+
headers: dict[str, Any] = {}
|
|
23
|
+
|
|
24
|
+
_kwargs: dict[str, Any] = {
|
|
25
|
+
"method": "post",
|
|
26
|
+
"url": "/api/v1/bot/jobs/{job_id}/fail".format(
|
|
27
|
+
job_id=quote(str(job_id), safe=""),
|
|
28
|
+
),
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
_kwargs["json"] = body.to_dict()
|
|
32
|
+
|
|
33
|
+
headers["Content-Type"] = "application/json"
|
|
34
|
+
|
|
35
|
+
_kwargs["headers"] = headers
|
|
36
|
+
return _kwargs
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def _parse_response(
|
|
40
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
41
|
+
) -> ErrorResponse | HTTPValidationError | JobResponse | None:
|
|
42
|
+
if response.status_code == 200:
|
|
43
|
+
response_200 = JobResponse.from_dict(response.json())
|
|
44
|
+
|
|
45
|
+
return response_200
|
|
46
|
+
|
|
47
|
+
if response.status_code == 401:
|
|
48
|
+
response_401 = ErrorResponse.from_dict(response.json())
|
|
49
|
+
|
|
50
|
+
return response_401
|
|
51
|
+
|
|
52
|
+
if response.status_code == 403:
|
|
53
|
+
response_403 = ErrorResponse.from_dict(response.json())
|
|
54
|
+
|
|
55
|
+
return response_403
|
|
56
|
+
|
|
57
|
+
if response.status_code == 404:
|
|
58
|
+
response_404 = ErrorResponse.from_dict(response.json())
|
|
59
|
+
|
|
60
|
+
return response_404
|
|
61
|
+
|
|
62
|
+
if response.status_code == 409:
|
|
63
|
+
response_409 = ErrorResponse.from_dict(response.json())
|
|
64
|
+
|
|
65
|
+
return response_409
|
|
66
|
+
|
|
67
|
+
if response.status_code == 422:
|
|
68
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
69
|
+
|
|
70
|
+
return response_422
|
|
71
|
+
|
|
72
|
+
if client.raise_on_unexpected_status:
|
|
73
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
74
|
+
else:
|
|
75
|
+
return None
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def _build_response(
|
|
79
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
80
|
+
) -> Response[ErrorResponse | HTTPValidationError | JobResponse]:
|
|
81
|
+
return Response(
|
|
82
|
+
status_code=HTTPStatus(response.status_code),
|
|
83
|
+
content=response.content,
|
|
84
|
+
headers=response.headers,
|
|
85
|
+
parsed=_parse_response(client=client, response=response),
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def sync_detailed(
|
|
90
|
+
job_id: UUID,
|
|
91
|
+
*,
|
|
92
|
+
client: AuthenticatedClient,
|
|
93
|
+
body: JobFailRequest,
|
|
94
|
+
) -> Response[ErrorResponse | HTTPValidationError | JobResponse]:
|
|
95
|
+
"""Fail Job Endpoint
|
|
96
|
+
|
|
97
|
+
Report a claimed job as failed.
|
|
98
|
+
|
|
99
|
+
With `retry` set and attempts remaining, the job is requeued with backoff; otherwise it is
|
|
100
|
+
dead-lettered to `failed`. A worker that crashes without reporting reaches the same outcome
|
|
101
|
+
automatically once its lease expires (see the at-least-once contract on `claim`).
|
|
102
|
+
|
|
103
|
+
Args:
|
|
104
|
+
job_id (UUID):
|
|
105
|
+
body (JobFailRequest):
|
|
106
|
+
|
|
107
|
+
Raises:
|
|
108
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
109
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
110
|
+
|
|
111
|
+
Returns:
|
|
112
|
+
Response[ErrorResponse | HTTPValidationError | JobResponse]
|
|
113
|
+
"""
|
|
114
|
+
|
|
115
|
+
kwargs = _get_kwargs(
|
|
116
|
+
job_id=job_id,
|
|
117
|
+
body=body,
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
response = client.get_httpx_client().request(
|
|
121
|
+
**kwargs,
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
return _build_response(client=client, response=response)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def sync(
|
|
128
|
+
job_id: UUID,
|
|
129
|
+
*,
|
|
130
|
+
client: AuthenticatedClient,
|
|
131
|
+
body: JobFailRequest,
|
|
132
|
+
) -> ErrorResponse | HTTPValidationError | JobResponse | None:
|
|
133
|
+
"""Fail Job Endpoint
|
|
134
|
+
|
|
135
|
+
Report a claimed job as failed.
|
|
136
|
+
|
|
137
|
+
With `retry` set and attempts remaining, the job is requeued with backoff; otherwise it is
|
|
138
|
+
dead-lettered to `failed`. A worker that crashes without reporting reaches the same outcome
|
|
139
|
+
automatically once its lease expires (see the at-least-once contract on `claim`).
|
|
140
|
+
|
|
141
|
+
Args:
|
|
142
|
+
job_id (UUID):
|
|
143
|
+
body (JobFailRequest):
|
|
144
|
+
|
|
145
|
+
Raises:
|
|
146
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
147
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
148
|
+
|
|
149
|
+
Returns:
|
|
150
|
+
ErrorResponse | HTTPValidationError | JobResponse
|
|
151
|
+
"""
|
|
152
|
+
|
|
153
|
+
return sync_detailed(
|
|
154
|
+
job_id=job_id,
|
|
155
|
+
client=client,
|
|
156
|
+
body=body,
|
|
157
|
+
).parsed
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
async def asyncio_detailed(
|
|
161
|
+
job_id: UUID,
|
|
162
|
+
*,
|
|
163
|
+
client: AuthenticatedClient,
|
|
164
|
+
body: JobFailRequest,
|
|
165
|
+
) -> Response[ErrorResponse | HTTPValidationError | JobResponse]:
|
|
166
|
+
"""Fail Job Endpoint
|
|
167
|
+
|
|
168
|
+
Report a claimed job as failed.
|
|
169
|
+
|
|
170
|
+
With `retry` set and attempts remaining, the job is requeued with backoff; otherwise it is
|
|
171
|
+
dead-lettered to `failed`. A worker that crashes without reporting reaches the same outcome
|
|
172
|
+
automatically once its lease expires (see the at-least-once contract on `claim`).
|
|
173
|
+
|
|
174
|
+
Args:
|
|
175
|
+
job_id (UUID):
|
|
176
|
+
body (JobFailRequest):
|
|
177
|
+
|
|
178
|
+
Raises:
|
|
179
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
180
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
181
|
+
|
|
182
|
+
Returns:
|
|
183
|
+
Response[ErrorResponse | HTTPValidationError | JobResponse]
|
|
184
|
+
"""
|
|
185
|
+
|
|
186
|
+
kwargs = _get_kwargs(
|
|
187
|
+
job_id=job_id,
|
|
188
|
+
body=body,
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
192
|
+
|
|
193
|
+
return _build_response(client=client, response=response)
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
async def asyncio(
|
|
197
|
+
job_id: UUID,
|
|
198
|
+
*,
|
|
199
|
+
client: AuthenticatedClient,
|
|
200
|
+
body: JobFailRequest,
|
|
201
|
+
) -> ErrorResponse | HTTPValidationError | JobResponse | None:
|
|
202
|
+
"""Fail Job Endpoint
|
|
203
|
+
|
|
204
|
+
Report a claimed job as failed.
|
|
205
|
+
|
|
206
|
+
With `retry` set and attempts remaining, the job is requeued with backoff; otherwise it is
|
|
207
|
+
dead-lettered to `failed`. A worker that crashes without reporting reaches the same outcome
|
|
208
|
+
automatically once its lease expires (see the at-least-once contract on `claim`).
|
|
209
|
+
|
|
210
|
+
Args:
|
|
211
|
+
job_id (UUID):
|
|
212
|
+
body (JobFailRequest):
|
|
213
|
+
|
|
214
|
+
Raises:
|
|
215
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
216
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
217
|
+
|
|
218
|
+
Returns:
|
|
219
|
+
ErrorResponse | HTTPValidationError | JobResponse
|
|
220
|
+
"""
|
|
221
|
+
|
|
222
|
+
return (
|
|
223
|
+
await asyncio_detailed(
|
|
224
|
+
job_id=job_id,
|
|
225
|
+
client=client,
|
|
226
|
+
body=body,
|
|
227
|
+
)
|
|
228
|
+
).parsed
|