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,302 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.error_response import ErrorResponse
|
|
9
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
10
|
+
from ...models.operation_kind import OperationKind
|
|
11
|
+
from ...models.operation_page import OperationPage
|
|
12
|
+
from ...models.operation_status import OperationStatus
|
|
13
|
+
from ...types import UNSET, Response, Unset
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _get_kwargs(
|
|
17
|
+
*,
|
|
18
|
+
guild_id: int | None | Unset = UNSET,
|
|
19
|
+
subject_discord_id: int | None | Unset = UNSET,
|
|
20
|
+
status: None | OperationStatus | Unset = UNSET,
|
|
21
|
+
kind: None | OperationKind | Unset = UNSET,
|
|
22
|
+
limit: int | Unset = 50,
|
|
23
|
+
offset: int | Unset = 0,
|
|
24
|
+
) -> dict[str, Any]:
|
|
25
|
+
|
|
26
|
+
params: dict[str, Any] = {}
|
|
27
|
+
|
|
28
|
+
json_guild_id: int | None | Unset
|
|
29
|
+
if isinstance(guild_id, Unset):
|
|
30
|
+
json_guild_id = UNSET
|
|
31
|
+
else:
|
|
32
|
+
json_guild_id = guild_id
|
|
33
|
+
params["guild_id"] = json_guild_id
|
|
34
|
+
|
|
35
|
+
json_subject_discord_id: int | None | Unset
|
|
36
|
+
if isinstance(subject_discord_id, Unset):
|
|
37
|
+
json_subject_discord_id = UNSET
|
|
38
|
+
else:
|
|
39
|
+
json_subject_discord_id = subject_discord_id
|
|
40
|
+
params["subject_discord_id"] = json_subject_discord_id
|
|
41
|
+
|
|
42
|
+
json_status: None | str | Unset
|
|
43
|
+
if isinstance(status, Unset):
|
|
44
|
+
json_status = UNSET
|
|
45
|
+
elif isinstance(status, OperationStatus):
|
|
46
|
+
json_status = status.value
|
|
47
|
+
else:
|
|
48
|
+
json_status = status
|
|
49
|
+
params["status"] = json_status
|
|
50
|
+
|
|
51
|
+
json_kind: None | str | Unset
|
|
52
|
+
if isinstance(kind, Unset):
|
|
53
|
+
json_kind = UNSET
|
|
54
|
+
elif isinstance(kind, OperationKind):
|
|
55
|
+
json_kind = kind.value
|
|
56
|
+
else:
|
|
57
|
+
json_kind = kind
|
|
58
|
+
params["kind"] = json_kind
|
|
59
|
+
|
|
60
|
+
params["limit"] = limit
|
|
61
|
+
|
|
62
|
+
params["offset"] = offset
|
|
63
|
+
|
|
64
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
65
|
+
|
|
66
|
+
_kwargs: dict[str, Any] = {
|
|
67
|
+
"method": "get",
|
|
68
|
+
"url": "/api/v1/bot/operations",
|
|
69
|
+
"params": params,
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return _kwargs
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def _parse_response(
|
|
76
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
77
|
+
) -> ErrorResponse | HTTPValidationError | OperationPage | None:
|
|
78
|
+
if response.status_code == 200:
|
|
79
|
+
response_200 = OperationPage.from_dict(response.json())
|
|
80
|
+
|
|
81
|
+
return response_200
|
|
82
|
+
|
|
83
|
+
if response.status_code == 401:
|
|
84
|
+
response_401 = ErrorResponse.from_dict(response.json())
|
|
85
|
+
|
|
86
|
+
return response_401
|
|
87
|
+
|
|
88
|
+
if response.status_code == 403:
|
|
89
|
+
response_403 = ErrorResponse.from_dict(response.json())
|
|
90
|
+
|
|
91
|
+
return response_403
|
|
92
|
+
|
|
93
|
+
if response.status_code == 422:
|
|
94
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
95
|
+
|
|
96
|
+
return response_422
|
|
97
|
+
|
|
98
|
+
if client.raise_on_unexpected_status:
|
|
99
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
100
|
+
else:
|
|
101
|
+
return None
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def _build_response(
|
|
105
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
106
|
+
) -> Response[ErrorResponse | HTTPValidationError | OperationPage]:
|
|
107
|
+
return Response(
|
|
108
|
+
status_code=HTTPStatus(response.status_code),
|
|
109
|
+
content=response.content,
|
|
110
|
+
headers=response.headers,
|
|
111
|
+
parsed=_parse_response(client=client, response=response),
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def sync_detailed(
|
|
116
|
+
*,
|
|
117
|
+
client: AuthenticatedClient,
|
|
118
|
+
guild_id: int | None | Unset = UNSET,
|
|
119
|
+
subject_discord_id: int | None | Unset = UNSET,
|
|
120
|
+
status: None | OperationStatus | Unset = UNSET,
|
|
121
|
+
kind: None | OperationKind | Unset = UNSET,
|
|
122
|
+
limit: int | Unset = 50,
|
|
123
|
+
offset: int | Unset = 0,
|
|
124
|
+
) -> Response[ErrorResponse | HTTPValidationError | OperationPage]:
|
|
125
|
+
"""List Operations Endpoint
|
|
126
|
+
|
|
127
|
+
List operations by subject / status / kind, newest first, for post-restart reconciliation.
|
|
128
|
+
|
|
129
|
+
All filters are optional and AND-combined; the subject is the pair
|
|
130
|
+
(`guild_id`, `subject_discord_id`). List items omit the `plan` -- read a single operation by id
|
|
131
|
+
for its full plan.
|
|
132
|
+
|
|
133
|
+
Args:
|
|
134
|
+
guild_id (int | None | Unset):
|
|
135
|
+
subject_discord_id (int | None | Unset):
|
|
136
|
+
status (None | OperationStatus | Unset):
|
|
137
|
+
kind (None | OperationKind | Unset):
|
|
138
|
+
limit (int | Unset): Default: 50.
|
|
139
|
+
offset (int | Unset): Default: 0.
|
|
140
|
+
|
|
141
|
+
Raises:
|
|
142
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
143
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
144
|
+
|
|
145
|
+
Returns:
|
|
146
|
+
Response[ErrorResponse | HTTPValidationError | OperationPage]
|
|
147
|
+
"""
|
|
148
|
+
|
|
149
|
+
kwargs = _get_kwargs(
|
|
150
|
+
guild_id=guild_id,
|
|
151
|
+
subject_discord_id=subject_discord_id,
|
|
152
|
+
status=status,
|
|
153
|
+
kind=kind,
|
|
154
|
+
limit=limit,
|
|
155
|
+
offset=offset,
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
response = client.get_httpx_client().request(
|
|
159
|
+
**kwargs,
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
return _build_response(client=client, response=response)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
def sync(
|
|
166
|
+
*,
|
|
167
|
+
client: AuthenticatedClient,
|
|
168
|
+
guild_id: int | None | Unset = UNSET,
|
|
169
|
+
subject_discord_id: int | None | Unset = UNSET,
|
|
170
|
+
status: None | OperationStatus | Unset = UNSET,
|
|
171
|
+
kind: None | OperationKind | Unset = UNSET,
|
|
172
|
+
limit: int | Unset = 50,
|
|
173
|
+
offset: int | Unset = 0,
|
|
174
|
+
) -> ErrorResponse | HTTPValidationError | OperationPage | None:
|
|
175
|
+
"""List Operations Endpoint
|
|
176
|
+
|
|
177
|
+
List operations by subject / status / kind, newest first, for post-restart reconciliation.
|
|
178
|
+
|
|
179
|
+
All filters are optional and AND-combined; the subject is the pair
|
|
180
|
+
(`guild_id`, `subject_discord_id`). List items omit the `plan` -- read a single operation by id
|
|
181
|
+
for its full plan.
|
|
182
|
+
|
|
183
|
+
Args:
|
|
184
|
+
guild_id (int | None | Unset):
|
|
185
|
+
subject_discord_id (int | None | Unset):
|
|
186
|
+
status (None | OperationStatus | Unset):
|
|
187
|
+
kind (None | OperationKind | Unset):
|
|
188
|
+
limit (int | Unset): Default: 50.
|
|
189
|
+
offset (int | Unset): Default: 0.
|
|
190
|
+
|
|
191
|
+
Raises:
|
|
192
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
193
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
194
|
+
|
|
195
|
+
Returns:
|
|
196
|
+
ErrorResponse | HTTPValidationError | OperationPage
|
|
197
|
+
"""
|
|
198
|
+
|
|
199
|
+
return sync_detailed(
|
|
200
|
+
client=client,
|
|
201
|
+
guild_id=guild_id,
|
|
202
|
+
subject_discord_id=subject_discord_id,
|
|
203
|
+
status=status,
|
|
204
|
+
kind=kind,
|
|
205
|
+
limit=limit,
|
|
206
|
+
offset=offset,
|
|
207
|
+
).parsed
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
async def asyncio_detailed(
|
|
211
|
+
*,
|
|
212
|
+
client: AuthenticatedClient,
|
|
213
|
+
guild_id: int | None | Unset = UNSET,
|
|
214
|
+
subject_discord_id: int | None | Unset = UNSET,
|
|
215
|
+
status: None | OperationStatus | Unset = UNSET,
|
|
216
|
+
kind: None | OperationKind | Unset = UNSET,
|
|
217
|
+
limit: int | Unset = 50,
|
|
218
|
+
offset: int | Unset = 0,
|
|
219
|
+
) -> Response[ErrorResponse | HTTPValidationError | OperationPage]:
|
|
220
|
+
"""List Operations Endpoint
|
|
221
|
+
|
|
222
|
+
List operations by subject / status / kind, newest first, for post-restart reconciliation.
|
|
223
|
+
|
|
224
|
+
All filters are optional and AND-combined; the subject is the pair
|
|
225
|
+
(`guild_id`, `subject_discord_id`). List items omit the `plan` -- read a single operation by id
|
|
226
|
+
for its full plan.
|
|
227
|
+
|
|
228
|
+
Args:
|
|
229
|
+
guild_id (int | None | Unset):
|
|
230
|
+
subject_discord_id (int | None | Unset):
|
|
231
|
+
status (None | OperationStatus | Unset):
|
|
232
|
+
kind (None | OperationKind | Unset):
|
|
233
|
+
limit (int | Unset): Default: 50.
|
|
234
|
+
offset (int | Unset): Default: 0.
|
|
235
|
+
|
|
236
|
+
Raises:
|
|
237
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
238
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
239
|
+
|
|
240
|
+
Returns:
|
|
241
|
+
Response[ErrorResponse | HTTPValidationError | OperationPage]
|
|
242
|
+
"""
|
|
243
|
+
|
|
244
|
+
kwargs = _get_kwargs(
|
|
245
|
+
guild_id=guild_id,
|
|
246
|
+
subject_discord_id=subject_discord_id,
|
|
247
|
+
status=status,
|
|
248
|
+
kind=kind,
|
|
249
|
+
limit=limit,
|
|
250
|
+
offset=offset,
|
|
251
|
+
)
|
|
252
|
+
|
|
253
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
254
|
+
|
|
255
|
+
return _build_response(client=client, response=response)
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
async def asyncio(
|
|
259
|
+
*,
|
|
260
|
+
client: AuthenticatedClient,
|
|
261
|
+
guild_id: int | None | Unset = UNSET,
|
|
262
|
+
subject_discord_id: int | None | Unset = UNSET,
|
|
263
|
+
status: None | OperationStatus | Unset = UNSET,
|
|
264
|
+
kind: None | OperationKind | Unset = UNSET,
|
|
265
|
+
limit: int | Unset = 50,
|
|
266
|
+
offset: int | Unset = 0,
|
|
267
|
+
) -> ErrorResponse | HTTPValidationError | OperationPage | None:
|
|
268
|
+
"""List Operations Endpoint
|
|
269
|
+
|
|
270
|
+
List operations by subject / status / kind, newest first, for post-restart reconciliation.
|
|
271
|
+
|
|
272
|
+
All filters are optional and AND-combined; the subject is the pair
|
|
273
|
+
(`guild_id`, `subject_discord_id`). List items omit the `plan` -- read a single operation by id
|
|
274
|
+
for its full plan.
|
|
275
|
+
|
|
276
|
+
Args:
|
|
277
|
+
guild_id (int | None | Unset):
|
|
278
|
+
subject_discord_id (int | None | Unset):
|
|
279
|
+
status (None | OperationStatus | Unset):
|
|
280
|
+
kind (None | OperationKind | Unset):
|
|
281
|
+
limit (int | Unset): Default: 50.
|
|
282
|
+
offset (int | Unset): Default: 0.
|
|
283
|
+
|
|
284
|
+
Raises:
|
|
285
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
286
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
287
|
+
|
|
288
|
+
Returns:
|
|
289
|
+
ErrorResponse | HTTPValidationError | OperationPage
|
|
290
|
+
"""
|
|
291
|
+
|
|
292
|
+
return (
|
|
293
|
+
await asyncio_detailed(
|
|
294
|
+
client=client,
|
|
295
|
+
guild_id=guild_id,
|
|
296
|
+
subject_discord_id=subject_discord_id,
|
|
297
|
+
status=status,
|
|
298
|
+
kind=kind,
|
|
299
|
+
limit=limit,
|
|
300
|
+
offset=offset,
|
|
301
|
+
)
|
|
302
|
+
).parsed
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.error_response import ErrorResponse
|
|
9
|
+
from ...models.student_activation_prepare_request import StudentActivationPrepareRequest
|
|
10
|
+
from ...models.transition_prepare_response import TransitionPrepareResponse
|
|
11
|
+
from ...types import Response
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
*,
|
|
16
|
+
body: StudentActivationPrepareRequest,
|
|
17
|
+
) -> dict[str, Any]:
|
|
18
|
+
headers: dict[str, Any] = {}
|
|
19
|
+
|
|
20
|
+
_kwargs: dict[str, Any] = {
|
|
21
|
+
"method": "post",
|
|
22
|
+
"url": "/api/v1/bot/students/activations/prepare",
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
_kwargs["json"] = body.to_dict()
|
|
26
|
+
|
|
27
|
+
headers["Content-Type"] = "application/json"
|
|
28
|
+
|
|
29
|
+
_kwargs["headers"] = headers
|
|
30
|
+
return _kwargs
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _parse_response(
|
|
34
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
35
|
+
) -> ErrorResponse | TransitionPrepareResponse | None:
|
|
36
|
+
if response.status_code == 200:
|
|
37
|
+
response_200 = TransitionPrepareResponse.from_dict(response.json())
|
|
38
|
+
|
|
39
|
+
return response_200
|
|
40
|
+
|
|
41
|
+
if response.status_code == 401:
|
|
42
|
+
response_401 = ErrorResponse.from_dict(response.json())
|
|
43
|
+
|
|
44
|
+
return response_401
|
|
45
|
+
|
|
46
|
+
if response.status_code == 403:
|
|
47
|
+
response_403 = ErrorResponse.from_dict(response.json())
|
|
48
|
+
|
|
49
|
+
return response_403
|
|
50
|
+
|
|
51
|
+
if response.status_code == 409:
|
|
52
|
+
response_409 = ErrorResponse.from_dict(response.json())
|
|
53
|
+
|
|
54
|
+
return response_409
|
|
55
|
+
|
|
56
|
+
if response.status_code == 422:
|
|
57
|
+
response_422 = ErrorResponse.from_dict(response.json())
|
|
58
|
+
|
|
59
|
+
return response_422
|
|
60
|
+
|
|
61
|
+
if client.raise_on_unexpected_status:
|
|
62
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
63
|
+
else:
|
|
64
|
+
return None
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def _build_response(
|
|
68
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
69
|
+
) -> Response[ErrorResponse | TransitionPrepareResponse]:
|
|
70
|
+
return Response(
|
|
71
|
+
status_code=HTTPStatus(response.status_code),
|
|
72
|
+
content=response.content,
|
|
73
|
+
headers=response.headers,
|
|
74
|
+
parsed=_parse_response(client=client, response=response),
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def sync_detailed(
|
|
79
|
+
*,
|
|
80
|
+
client: AuthenticatedClient,
|
|
81
|
+
body: StudentActivationPrepareRequest,
|
|
82
|
+
) -> Response[ErrorResponse | TransitionPrepareResponse]:
|
|
83
|
+
"""Prepare Student Activation Endpoint
|
|
84
|
+
|
|
85
|
+
Args:
|
|
86
|
+
body (StudentActivationPrepareRequest):
|
|
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[ErrorResponse | TransitionPrepareResponse]
|
|
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: StudentActivationPrepareRequest,
|
|
111
|
+
) -> ErrorResponse | TransitionPrepareResponse | None:
|
|
112
|
+
"""Prepare Student Activation Endpoint
|
|
113
|
+
|
|
114
|
+
Args:
|
|
115
|
+
body (StudentActivationPrepareRequest):
|
|
116
|
+
|
|
117
|
+
Raises:
|
|
118
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
119
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
120
|
+
|
|
121
|
+
Returns:
|
|
122
|
+
ErrorResponse | TransitionPrepareResponse
|
|
123
|
+
"""
|
|
124
|
+
|
|
125
|
+
return sync_detailed(
|
|
126
|
+
client=client,
|
|
127
|
+
body=body,
|
|
128
|
+
).parsed
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
async def asyncio_detailed(
|
|
132
|
+
*,
|
|
133
|
+
client: AuthenticatedClient,
|
|
134
|
+
body: StudentActivationPrepareRequest,
|
|
135
|
+
) -> Response[ErrorResponse | TransitionPrepareResponse]:
|
|
136
|
+
"""Prepare Student Activation Endpoint
|
|
137
|
+
|
|
138
|
+
Args:
|
|
139
|
+
body (StudentActivationPrepareRequest):
|
|
140
|
+
|
|
141
|
+
Raises:
|
|
142
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
143
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
144
|
+
|
|
145
|
+
Returns:
|
|
146
|
+
Response[ErrorResponse | TransitionPrepareResponse]
|
|
147
|
+
"""
|
|
148
|
+
|
|
149
|
+
kwargs = _get_kwargs(
|
|
150
|
+
body=body,
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
154
|
+
|
|
155
|
+
return _build_response(client=client, response=response)
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
async def asyncio(
|
|
159
|
+
*,
|
|
160
|
+
client: AuthenticatedClient,
|
|
161
|
+
body: StudentActivationPrepareRequest,
|
|
162
|
+
) -> ErrorResponse | TransitionPrepareResponse | None:
|
|
163
|
+
"""Prepare Student Activation Endpoint
|
|
164
|
+
|
|
165
|
+
Args:
|
|
166
|
+
body (StudentActivationPrepareRequest):
|
|
167
|
+
|
|
168
|
+
Raises:
|
|
169
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
170
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
171
|
+
|
|
172
|
+
Returns:
|
|
173
|
+
ErrorResponse | TransitionPrepareResponse
|
|
174
|
+
"""
|
|
175
|
+
|
|
176
|
+
return (
|
|
177
|
+
await asyncio_detailed(
|
|
178
|
+
client=client,
|
|
179
|
+
body=body,
|
|
180
|
+
)
|
|
181
|
+
).parsed
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ... import errors
|
|
8
|
+
from ...client import AuthenticatedClient, Client
|
|
9
|
+
from ...models.error_response import ErrorResponse
|
|
10
|
+
from ...models.transition_prepare_response import TransitionPrepareResponse
|
|
11
|
+
from ...types import Response
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
guild_id: int,
|
|
16
|
+
student_discord_id: int,
|
|
17
|
+
) -> dict[str, Any]:
|
|
18
|
+
|
|
19
|
+
_kwargs: dict[str, Any] = {
|
|
20
|
+
"method": "post",
|
|
21
|
+
"url": "/api/v1/bot/students/{guild_id}/{student_discord_id}/deactivate/prepare".format(
|
|
22
|
+
guild_id=quote(str(guild_id), safe=""),
|
|
23
|
+
student_discord_id=quote(str(student_discord_id), safe=""),
|
|
24
|
+
),
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return _kwargs
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def _parse_response(
|
|
31
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
32
|
+
) -> ErrorResponse | TransitionPrepareResponse | None:
|
|
33
|
+
if response.status_code == 200:
|
|
34
|
+
response_200 = TransitionPrepareResponse.from_dict(response.json())
|
|
35
|
+
|
|
36
|
+
return response_200
|
|
37
|
+
|
|
38
|
+
if response.status_code == 401:
|
|
39
|
+
response_401 = ErrorResponse.from_dict(response.json())
|
|
40
|
+
|
|
41
|
+
return response_401
|
|
42
|
+
|
|
43
|
+
if response.status_code == 403:
|
|
44
|
+
response_403 = ErrorResponse.from_dict(response.json())
|
|
45
|
+
|
|
46
|
+
return response_403
|
|
47
|
+
|
|
48
|
+
if response.status_code == 409:
|
|
49
|
+
response_409 = ErrorResponse.from_dict(response.json())
|
|
50
|
+
|
|
51
|
+
return response_409
|
|
52
|
+
|
|
53
|
+
if response.status_code == 422:
|
|
54
|
+
response_422 = ErrorResponse.from_dict(response.json())
|
|
55
|
+
|
|
56
|
+
return response_422
|
|
57
|
+
|
|
58
|
+
if client.raise_on_unexpected_status:
|
|
59
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
60
|
+
else:
|
|
61
|
+
return None
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def _build_response(
|
|
65
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
66
|
+
) -> Response[ErrorResponse | TransitionPrepareResponse]:
|
|
67
|
+
return Response(
|
|
68
|
+
status_code=HTTPStatus(response.status_code),
|
|
69
|
+
content=response.content,
|
|
70
|
+
headers=response.headers,
|
|
71
|
+
parsed=_parse_response(client=client, response=response),
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def sync_detailed(
|
|
76
|
+
guild_id: int,
|
|
77
|
+
student_discord_id: int,
|
|
78
|
+
*,
|
|
79
|
+
client: AuthenticatedClient,
|
|
80
|
+
) -> Response[ErrorResponse | TransitionPrepareResponse]:
|
|
81
|
+
"""Prepare Student Deactivation Endpoint
|
|
82
|
+
|
|
83
|
+
Args:
|
|
84
|
+
guild_id (int):
|
|
85
|
+
student_discord_id (int):
|
|
86
|
+
|
|
87
|
+
Raises:
|
|
88
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
89
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
90
|
+
|
|
91
|
+
Returns:
|
|
92
|
+
Response[ErrorResponse | TransitionPrepareResponse]
|
|
93
|
+
"""
|
|
94
|
+
|
|
95
|
+
kwargs = _get_kwargs(
|
|
96
|
+
guild_id=guild_id,
|
|
97
|
+
student_discord_id=student_discord_id,
|
|
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
|
+
guild_id: int,
|
|
109
|
+
student_discord_id: int,
|
|
110
|
+
*,
|
|
111
|
+
client: AuthenticatedClient,
|
|
112
|
+
) -> ErrorResponse | TransitionPrepareResponse | None:
|
|
113
|
+
"""Prepare Student Deactivation Endpoint
|
|
114
|
+
|
|
115
|
+
Args:
|
|
116
|
+
guild_id (int):
|
|
117
|
+
student_discord_id (int):
|
|
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
|
+
ErrorResponse | TransitionPrepareResponse
|
|
125
|
+
"""
|
|
126
|
+
|
|
127
|
+
return sync_detailed(
|
|
128
|
+
guild_id=guild_id,
|
|
129
|
+
student_discord_id=student_discord_id,
|
|
130
|
+
client=client,
|
|
131
|
+
).parsed
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
async def asyncio_detailed(
|
|
135
|
+
guild_id: int,
|
|
136
|
+
student_discord_id: int,
|
|
137
|
+
*,
|
|
138
|
+
client: AuthenticatedClient,
|
|
139
|
+
) -> Response[ErrorResponse | TransitionPrepareResponse]:
|
|
140
|
+
"""Prepare Student Deactivation Endpoint
|
|
141
|
+
|
|
142
|
+
Args:
|
|
143
|
+
guild_id (int):
|
|
144
|
+
student_discord_id (int):
|
|
145
|
+
|
|
146
|
+
Raises:
|
|
147
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
148
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
149
|
+
|
|
150
|
+
Returns:
|
|
151
|
+
Response[ErrorResponse | TransitionPrepareResponse]
|
|
152
|
+
"""
|
|
153
|
+
|
|
154
|
+
kwargs = _get_kwargs(
|
|
155
|
+
guild_id=guild_id,
|
|
156
|
+
student_discord_id=student_discord_id,
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
160
|
+
|
|
161
|
+
return _build_response(client=client, response=response)
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
async def asyncio(
|
|
165
|
+
guild_id: int,
|
|
166
|
+
student_discord_id: int,
|
|
167
|
+
*,
|
|
168
|
+
client: AuthenticatedClient,
|
|
169
|
+
) -> ErrorResponse | TransitionPrepareResponse | None:
|
|
170
|
+
"""Prepare Student Deactivation Endpoint
|
|
171
|
+
|
|
172
|
+
Args:
|
|
173
|
+
guild_id (int):
|
|
174
|
+
student_discord_id (int):
|
|
175
|
+
|
|
176
|
+
Raises:
|
|
177
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
178
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
179
|
+
|
|
180
|
+
Returns:
|
|
181
|
+
ErrorResponse | TransitionPrepareResponse
|
|
182
|
+
"""
|
|
183
|
+
|
|
184
|
+
return (
|
|
185
|
+
await asyncio_detailed(
|
|
186
|
+
guild_id=guild_id,
|
|
187
|
+
student_discord_id=student_discord_id,
|
|
188
|
+
client=client,
|
|
189
|
+
)
|
|
190
|
+
).parsed
|