robodock-cli 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- app/__init__.py +1 -0
- app/app.py +14 -0
- app/auth.py +58 -0
- app/task_management.py +97 -0
- config.py +9 -0
- fast_api_client/__init__.py +8 -0
- fast_api_client/api/__init__.py +1 -0
- fast_api_client/api/auth/__init__.py +1 -0
- fast_api_client/api/auth/change_password_api_p_v1_auth_change_password_post.py +172 -0
- fast_api_client/api/auth/forgot_password_api_p_v1_auth_forgot_password_post.py +172 -0
- fast_api_client/api/auth/login_api_p_v1_auth_login_post.py +172 -0
- fast_api_client/api/auth/logout_api_p_v1_auth_logout_post.py +172 -0
- fast_api_client/api/auth/me_api_p_v1_auth_me_get.py +85 -0
- fast_api_client/api/auth/refresh_token_api_p_v1_auth_refresh_post.py +172 -0
- fast_api_client/api/auth/reset_password_api_p_v1_auth_reset_password_post.py +172 -0
- fast_api_client/api/auth/switch_group_api_p_v1_auth_switch_group_post.py +176 -0
- fast_api_client/api/config/__init__.py +1 -0
- fast_api_client/api/config/get_config_api_p_v1_config_get.py +85 -0
- fast_api_client/api/default/__init__.py +1 -0
- fast_api_client/api/default/root_get.py +81 -0
- fast_api_client/api/groups/__init__.py +1 -0
- fast_api_client/api/groups/add_member_api_p_v1_groups_group_id_members_post.py +188 -0
- fast_api_client/api/groups/create_group_api_p_v1_groups_post.py +172 -0
- fast_api_client/api/groups/create_platform_role_binding_api_p_v1_admin_platform_roles_bindings_post.py +172 -0
- fast_api_client/api/groups/delete_group_api_p_v1_groups_group_id_delete.py +167 -0
- fast_api_client/api/groups/delete_platform_role_binding_api_p_v1_admin_platform_roles_bindings_user_id_delete.py +167 -0
- fast_api_client/api/groups/get_group_api_p_v1_groups_group_id_get.py +167 -0
- fast_api_client/api/groups/list_groups_api_p_v1_groups_get.py +85 -0
- fast_api_client/api/groups/list_members_api_p_v1_groups_group_id_members_get.py +167 -0
- fast_api_client/api/groups/list_platform_role_bindings_api_p_v1_admin_platform_roles_bindings_get.py +85 -0
- fast_api_client/api/groups/remove_member_api_p_v1_groups_group_id_members_user_id_delete.py +181 -0
- fast_api_client/api/groups/reset_member_password_api_p_v1_groups_group_id_members_user_id_reset_password_post.py +181 -0
- fast_api_client/api/groups/update_group_api_p_v1_groups_group_id_patch.py +188 -0
- fast_api_client/api/groups/update_member_role_api_p_v1_groups_group_id_members_user_id_patch.py +202 -0
- fast_api_client/api/post_train/__init__.py +1 -0
- fast_api_client/api/post_train/check_patch_duplicate_api_p_v1_singledata_patch_check_post.py +164 -0
- fast_api_client/api/post_train/check_patch_duplicate_batch_api_p_v1_singledata_patch_check_batch_post.py +164 -0
- fast_api_client/api/post_train/create_dataset_api_p_v1_dataset_post.py +172 -0
- fast_api_client/api/post_train/create_patch_upload_api_p_v1_singledata_patch_upload_post.py +164 -0
- fast_api_client/api/post_train/data_ops_overview_api_p_v1_data_ops_overview_get.py +624 -0
- fast_api_client/api/post_train/data_ops_patches_api_p_v1_data_ops_patches_get.py +474 -0
- fast_api_client/api/post_train/delete_dataset_api_p_v1_dataset_dataset_uuid_delete.py +167 -0
- fast_api_client/api/post_train/delete_singledata_api_p_v1_singledata_uuid_delete.py +167 -0
- fast_api_client/api/post_train/delete_singledata_by_patch_api_p_v1_singledata_patch_patch_id_delete.py +167 -0
- fast_api_client/api/post_train/delete_singledata_list_api_p_v1_singledata_delete.py +172 -0
- fast_api_client/api/post_train/download_singledata_api_p_v1_singledata_download_uuid_get.py +167 -0
- fast_api_client/api/post_train/download_singledata_list_api_p_v1_singledata_download_get.py +178 -0
- fast_api_client/api/post_train/get_singledata_api_p_v1_singledata_uuid_get.py +167 -0
- fast_api_client/api/post_train/link_singledata_api_p_v1_singledata_link_post.py +172 -0
- fast_api_client/api/post_train/list_dataset_api_p_v1_dataset_get.py +307 -0
- fast_api_client/api/post_train/list_singledata_api_p_v1_singledata_get.py +737 -0
- fast_api_client/api/post_train/trigger_process_api_p_v1_singledata_trigger_post.py +172 -0
- fast_api_client/api/post_train/unlink_singledata_api_p_v1_singledata_unlink_post.py +172 -0
- fast_api_client/api/post_train/update_dataset_add_api_p_v1_dataset_update_dataset_uuid_post.py +188 -0
- fast_api_client/api/post_train/update_dataset_all_fields_api_p_v1_dataset_uuid_patch.py +188 -0
- fast_api_client/api/post_train/update_dataset_info_api_p_v1_dataset_update_post.py +172 -0
- fast_api_client/api/post_train/update_dataset_reduce_api_p_v1_dataset_reduce_dataset_uuid_post.py +188 -0
- fast_api_client/api/post_train/update_singledata_api_p_v1_singledata_uuid_patch.py +188 -0
- fast_api_client/api/post_train/update_singledata_tag_api_p_v1_singledata_tag_post.py +176 -0
- fast_api_client/api/post_train/update_upload_status_api_p_v1_singledata_upload_status_patch.py +176 -0
- fast_api_client/api/post_train/upload_singledata_api_p_v1_singledata_post.py +172 -0
- fast_api_client/api/post_train/upload_singledata_list_api_p_v1_singledata_list_post.py +172 -0
- fast_api_client/api/task_management/__init__.py +1 -0
- fast_api_client/api/task_management/create_project_api_p_v1_project_project_name_post.py +204 -0
- fast_api_client/api/task_management/create_rl_stage_api_p_v1_run_run_uuid_stage_rl_post.py +180 -0
- fast_api_client/api/task_management/create_run_api_p_v1_run_post.py +172 -0
- fast_api_client/api/task_management/delete_project_api_p_v1_project_uuid_delete.py +159 -0
- fast_api_client/api/task_management/delete_run_api_p_v1_run_uuid_delete.py +159 -0
- fast_api_client/api/task_management/delete_run_stage_api_p_v1_run_run_uuid_stage_stage_name_delete.py +181 -0
- fast_api_client/api/task_management/get_checkpoint_download_url_api_p_v1_run_checkpoint_download_post.py +172 -0
- fast_api_client/api/task_management/get_project_api_p_v1_project_uuid_get.py +159 -0
- fast_api_client/api/task_management/get_run_api_p_v1_run_unique_id_get.py +180 -0
- fast_api_client/api/task_management/get_run_log_info_api_p_v1_run_log_get.py +206 -0
- fast_api_client/api/task_management/get_run_stage_api_p_v1_run_run_uuid_stage_stage_name_get.py +173 -0
- fast_api_client/api/task_management/get_run_status_api_p_v1_run_status_uuid_get.py +159 -0
- fast_api_client/api/task_management/list_projects_api_p_v1_project_get.py +359 -0
- fast_api_client/api/task_management/list_runs_api_p_v1_run_get.py +399 -0
- fast_api_client/api/task_management/open_artifact_api_p_v1_run_artifact_open_post.py +164 -0
- fast_api_client/api/task_management/proxy_argo_log_api_p_v1_run_log_proxy_get.py +85 -0
- fast_api_client/api/task_management/resubmit_run_api_p_v1_run_resubmit_unique_id_post.py +180 -0
- fast_api_client/api/task_management/retry_run_api_p_v1_run_retry_unique_id_post.py +180 -0
- fast_api_client/api/task_management/stop_run_api_p_v1_run_stop_uuid_post.py +159 -0
- fast_api_client/api/task_management/trigger_model_convert_api_p_v1_run_model_convert_trigger_post.py +172 -0
- fast_api_client/api/task_management/update_project_api_p_v1_project_uuid_patch.py +180 -0
- fast_api_client/api/task_management/update_run_api_p_v1_run_unique_id_patch.py +200 -0
- fast_api_client/api/task_mapping/__init__.py +1 -0
- fast_api_client/api/task_mapping/create_task_mapping_api_p_v1_task_mapping_post.py +164 -0
- fast_api_client/api/task_mapping/delete_task_mapping_api_p_v1_task_mapping_task_id_delete.py +159 -0
- fast_api_client/api/task_mapping/get_task_mapping_api_p_v1_task_mapping_task_id_get.py +159 -0
- fast_api_client/api/task_mapping/list_task_mapping_patches_api_p_v1_task_mapping_task_id_patches_get.py +195 -0
- fast_api_client/api/task_mapping/list_task_mappings_api_p_v1_task_mapping_get.py +279 -0
- fast_api_client/api/task_mapping/update_task_mapping_api_p_v1_task_mapping_task_id_patch.py +180 -0
- fast_api_client/client.py +268 -0
- fast_api_client/errors.py +16 -0
- fast_api_client/models/__init__.py +121 -0
- fast_api_client/models/add_member_request.py +89 -0
- fast_api_client/models/artifact_item.py +251 -0
- fast_api_client/models/artifact_item_extra_info_type_0.py +45 -0
- fast_api_client/models/artifact_open_request.py +93 -0
- fast_api_client/models/body_download_singledata_list_api_pv1_singledata_download_get.py +61 -0
- fast_api_client/models/change_password_request.py +69 -0
- fast_api_client/models/checkpoint_download_request.py +69 -0
- fast_api_client/models/create_group_request.py +72 -0
- fast_api_client/models/create_platform_role_binding_request.py +69 -0
- fast_api_client/models/dataset_add_request.py +165 -0
- fast_api_client/models/dataset_create_request.py +253 -0
- fast_api_client/models/dataset_full_update_request.py +133 -0
- fast_api_client/models/dataset_reduce_request.py +84 -0
- fast_api_client/models/dataset_update_request.py +123 -0
- fast_api_client/models/forgot_password_request.py +61 -0
- fast_api_client/models/http_validation_error.py +79 -0
- fast_api_client/models/login_request.py +69 -0
- fast_api_client/models/logout_request.py +61 -0
- fast_api_client/models/model_convert_trigger_request.py +69 -0
- fast_api_client/models/patch_duplicate_batch_item_request.py +69 -0
- fast_api_client/models/patch_duplicate_batch_request.py +75 -0
- fast_api_client/models/patch_duplicate_check_request.py +69 -0
- fast_api_client/models/patch_episode_create_request.py +547 -0
- fast_api_client/models/patch_episode_create_request_lable_info.py +47 -0
- fast_api_client/models/patch_upload_create_request.py +94 -0
- fast_api_client/models/project_create_request.py +174 -0
- fast_api_client/models/project_create_request_default_configs.py +47 -0
- fast_api_client/models/project_update_request.py +175 -0
- fast_api_client/models/project_update_request_default_configs_type_0.py +45 -0
- fast_api_client/models/refresh_request.py +61 -0
- fast_api_client/models/reset_password_request.py +69 -0
- fast_api_client/models/rl_stage_create_request.py +75 -0
- fast_api_client/models/rl_stage_create_request_configs.py +47 -0
- fast_api_client/models/run_create_request.py +243 -0
- fast_api_client/models/run_create_request_configs.py +47 -0
- fast_api_client/models/run_update_request.py +533 -0
- fast_api_client/models/run_update_request_artifacts_type_0.py +45 -0
- fast_api_client/models/run_update_request_configs_type_0.py +45 -0
- fast_api_client/models/run_update_request_stages_type_0_item.py +45 -0
- fast_api_client/models/single_data_create_request.py +189 -0
- fast_api_client/models/single_data_link_request.py +69 -0
- fast_api_client/models/single_data_list_request.py +169 -0
- fast_api_client/models/single_data_tag_request.py +69 -0
- fast_api_client/models/single_data_trigger_request.py +61 -0
- fast_api_client/models/single_data_unlink_request.py +69 -0
- fast_api_client/models/single_data_update_request.py +775 -0
- fast_api_client/models/single_data_update_request_lable_info_type_0.py +45 -0
- fast_api_client/models/stage_artifact_append.py +85 -0
- fast_api_client/models/stage_artifact_append_category.py +10 -0
- fast_api_client/models/switch_group_request.py +61 -0
- fast_api_client/models/task_mapping_create_request.py +111 -0
- fast_api_client/models/task_mapping_update_request.py +93 -0
- fast_api_client/models/update_group_request.py +93 -0
- fast_api_client/models/update_member_request.py +61 -0
- fast_api_client/models/upload_status_request.py +69 -0
- fast_api_client/models/validation_error.py +123 -0
- fast_api_client/models/validation_error_context.py +45 -0
- fast_api_client/py.typed +1 -0
- fast_api_client/types.py +54 -0
- robodock_cli-0.1.0.dist-info/METADATA +97 -0
- robodock_cli-0.1.0.dist-info/RECORD +167 -0
- robodock_cli-0.1.0.dist-info/WHEEL +5 -0
- robodock_cli-0.1.0.dist-info/entry_points.txt +2 -0
- robodock_cli-0.1.0.dist-info/top_level.txt +4 -0
- sdk/__init__.py +1 -0
- sdk/client/__init__.py +1 -0
- sdk/client/auth.py +171 -0
- sdk/client/client.py +9 -0
- sdk/client/task_management.py +29 -0
- sdk/exception.py +95 -0
- sdk/utils/__init__.py +1 -0
- sdk/utils/downloader.py +267 -0
app/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Robodock CLI 命令行入口。"""
|
app/app.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""robodock-cli 命令行入口。"""
|
|
2
|
+
import typer
|
|
3
|
+
|
|
4
|
+
from app.auth import auth_app
|
|
5
|
+
from app.task_management import task_management_app
|
|
6
|
+
|
|
7
|
+
app = typer.Typer(help="Robodock 命令行工具", suggest_commands=True)
|
|
8
|
+
app.add_typer(auth_app, name="auth")
|
|
9
|
+
app.add_typer(task_management_app, name="task")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def main() -> None:
|
|
13
|
+
"""CLI 入口函数,供 console script 与 ``python -m`` 调用。"""
|
|
14
|
+
app()
|
app/auth.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import typer
|
|
2
|
+
|
|
3
|
+
from sdk.client.client import RobodockClient
|
|
4
|
+
from sdk.exception import (
|
|
5
|
+
NotLoggedInError,
|
|
6
|
+
RobodockError,
|
|
7
|
+
UserInfoError
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
auth_app = typer.Typer(help="Robodock登录认证")
|
|
11
|
+
|
|
12
|
+
@auth_app.command("login")
|
|
13
|
+
def login():
|
|
14
|
+
"""登录 Robodock 平台。"""
|
|
15
|
+
username = typer.prompt("用户名或邮箱", hide_input=False)
|
|
16
|
+
password = typer.prompt("密码", hide_input=True)
|
|
17
|
+
|
|
18
|
+
client = RobodockClient()
|
|
19
|
+
try:
|
|
20
|
+
client.auth.login(username=username, password=password)
|
|
21
|
+
except RobodockError as e:
|
|
22
|
+
typer.echo(f"登录失败: {e}", err=True)
|
|
23
|
+
raise typer.Exit(code=1)
|
|
24
|
+
|
|
25
|
+
client.auth.save_state()
|
|
26
|
+
typer.echo("登录成功")
|
|
27
|
+
info() # 显示当前登录状态
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@auth_app.command("logout")
|
|
31
|
+
def logout():
|
|
32
|
+
"""退出登录并清除本地登录态。"""
|
|
33
|
+
client = RobodockClient()
|
|
34
|
+
try:
|
|
35
|
+
client.auth.logout()
|
|
36
|
+
except NotLoggedInError:
|
|
37
|
+
typer.echo("当前未登录", err=False)
|
|
38
|
+
raise typer.Exit(code=1)
|
|
39
|
+
except RobodockError as e:
|
|
40
|
+
typer.echo(f"退出登录失败: {e}", err=True)
|
|
41
|
+
raise typer.Exit(code=1)
|
|
42
|
+
finally:
|
|
43
|
+
client.auth.clear_state()
|
|
44
|
+
typer.echo("已退出登录")
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
@auth_app.command("info")
|
|
48
|
+
def info():
|
|
49
|
+
"""查看当前登录状态。"""
|
|
50
|
+
client = RobodockClient()
|
|
51
|
+
try:
|
|
52
|
+
user_info = client.auth.info()
|
|
53
|
+
except NotLoggedInError as e:
|
|
54
|
+
return typer.echo("当前未登录", err=False)
|
|
55
|
+
except UserInfoError as e:
|
|
56
|
+
typer.echo(f"获取当前登录状态失败: {e}", err=True)
|
|
57
|
+
raise typer.Exit(code=1)
|
|
58
|
+
typer.echo(f"当前已登录: {user_info.get('username')} ({user_info.get('email')})")
|
app/task_management.py
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import typer
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
from typing import Optional
|
|
4
|
+
|
|
5
|
+
from rich.progress import (
|
|
6
|
+
BarColumn,
|
|
7
|
+
DownloadColumn,
|
|
8
|
+
Progress,
|
|
9
|
+
TextColumn,
|
|
10
|
+
TimeRemainingColumn,
|
|
11
|
+
TransferSpeedColumn,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
from sdk.utils.downloader import download_file
|
|
15
|
+
from sdk.client.client import RobodockClient
|
|
16
|
+
from sdk.exception import (
|
|
17
|
+
NotLoggedInError,
|
|
18
|
+
RobodockError,
|
|
19
|
+
UserInfoError
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
ONNX_PATH_SUFFIX = "_onnx.tar"
|
|
23
|
+
MODEL_PATH_SUFIX = ".tar"
|
|
24
|
+
|
|
25
|
+
task_management_app = typer.Typer(help="Robodock训练任务管理")
|
|
26
|
+
|
|
27
|
+
@task_management_app.command("download_checkpoint")
|
|
28
|
+
def download_checkpoint(
|
|
29
|
+
run_uuid:str,
|
|
30
|
+
checkpoint_prefix:str,
|
|
31
|
+
output_path:str=str(Path.cwd()),
|
|
32
|
+
overwrite:bool=False,
|
|
33
|
+
):
|
|
34
|
+
local_path = Path(output_path) / run_uuid / Path(checkpoint_prefix).stem
|
|
35
|
+
checkpoint_model_path = checkpoint_prefix + MODEL_PATH_SUFIX
|
|
36
|
+
checkpoint_onnx_path = checkpoint_prefix + ONNX_PATH_SUFFIX
|
|
37
|
+
client = RobodockClient()
|
|
38
|
+
|
|
39
|
+
def get_model_url() -> str:
|
|
40
|
+
return client.task_management.get_checkpoint_download_url(
|
|
41
|
+
run_uuid=run_uuid,
|
|
42
|
+
checkpoint_path=checkpoint_model_path
|
|
43
|
+
)
|
|
44
|
+
def get_onnx_url() -> str:
|
|
45
|
+
return client.task_management.get_checkpoint_download_url(
|
|
46
|
+
run_uuid=run_uuid,
|
|
47
|
+
checkpoint_path=checkpoint_onnx_path
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
model_url = get_model_url()
|
|
51
|
+
typer.echo("已获取模型下载链接")
|
|
52
|
+
onnx_url = get_onnx_url()
|
|
53
|
+
typer.echo("已获取onnx模型下载链接")
|
|
54
|
+
typer.echo(f"开始下载模型文件到{str(local_path)}")
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
progress = Progress(
|
|
59
|
+
TextColumn("[bold blue]{task.description}", justify="left"),
|
|
60
|
+
BarColumn(bar_width=None),
|
|
61
|
+
"[progress.percentage]{task.percentage:>3.1f}%",
|
|
62
|
+
"•",
|
|
63
|
+
DownloadColumn(),
|
|
64
|
+
"•",
|
|
65
|
+
TransferSpeedColumn(),
|
|
66
|
+
"•",
|
|
67
|
+
TimeRemainingColumn(),
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
with progress:
|
|
71
|
+
onnx_task = progress.add_task(f"正在下载onnx文件", total=None)
|
|
72
|
+
download_file(
|
|
73
|
+
presigned_url=onnx_url,
|
|
74
|
+
local_path=local_path / Path(checkpoint_onnx_path).name,
|
|
75
|
+
get_presigned_url=get_model_url,
|
|
76
|
+
on_progress=lambda downloaded, total: progress.update(
|
|
77
|
+
onnx_task,
|
|
78
|
+
completed=downloaded,
|
|
79
|
+
total=total,
|
|
80
|
+
),
|
|
81
|
+
overwrite=overwrite
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
model_task = progress.add_task(f"正在下载模型文件", total=None)
|
|
85
|
+
download_file(
|
|
86
|
+
presigned_url=model_url,
|
|
87
|
+
local_path=local_path / Path(checkpoint_model_path).name,
|
|
88
|
+
get_presigned_url=get_model_url,
|
|
89
|
+
on_progress=lambda downloaded, total: progress.update(
|
|
90
|
+
model_task,
|
|
91
|
+
completed=downloaded,
|
|
92
|
+
total=total,
|
|
93
|
+
),
|
|
94
|
+
overwrite=overwrite
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
typer.echo("模型下载完成")
|
config.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains methods for accessing the API"""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|
|
@@ -0,0 +1,172 @@
|
|
|
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.change_password_request import ChangePasswordRequest
|
|
9
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
10
|
+
from ...types import Response
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _get_kwargs(
|
|
14
|
+
*,
|
|
15
|
+
body: ChangePasswordRequest,
|
|
16
|
+
) -> dict[str, Any]:
|
|
17
|
+
headers: dict[str, Any] = {}
|
|
18
|
+
|
|
19
|
+
_kwargs: dict[str, Any] = {
|
|
20
|
+
"method": "post",
|
|
21
|
+
"url": "/api/p/v1/auth/change-password",
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
_kwargs["json"] = body.to_dict()
|
|
25
|
+
|
|
26
|
+
headers["Content-Type"] = "application/json"
|
|
27
|
+
|
|
28
|
+
_kwargs["headers"] = headers
|
|
29
|
+
return _kwargs
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _parse_response(
|
|
33
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
34
|
+
) -> Any | HTTPValidationError | None:
|
|
35
|
+
if response.status_code == 200:
|
|
36
|
+
response_200 = response.json()
|
|
37
|
+
return response_200
|
|
38
|
+
|
|
39
|
+
if response.status_code == 422:
|
|
40
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
41
|
+
|
|
42
|
+
return response_422
|
|
43
|
+
|
|
44
|
+
if client.raise_on_unexpected_status:
|
|
45
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
46
|
+
else:
|
|
47
|
+
return None
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def _build_response(
|
|
51
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
52
|
+
) -> Response[Any | HTTPValidationError]:
|
|
53
|
+
return Response(
|
|
54
|
+
status_code=HTTPStatus(response.status_code),
|
|
55
|
+
content=response.content,
|
|
56
|
+
headers=response.headers,
|
|
57
|
+
parsed=_parse_response(client=client, response=response),
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def sync_detailed(
|
|
62
|
+
*,
|
|
63
|
+
client: AuthenticatedClient,
|
|
64
|
+
body: ChangePasswordRequest,
|
|
65
|
+
) -> Response[Any | HTTPValidationError]:
|
|
66
|
+
"""Change Password
|
|
67
|
+
|
|
68
|
+
修改密码
|
|
69
|
+
|
|
70
|
+
Args:
|
|
71
|
+
body (ChangePasswordRequest):
|
|
72
|
+
|
|
73
|
+
Raises:
|
|
74
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
75
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
76
|
+
|
|
77
|
+
Returns:
|
|
78
|
+
Response[Any | HTTPValidationError]
|
|
79
|
+
"""
|
|
80
|
+
|
|
81
|
+
kwargs = _get_kwargs(
|
|
82
|
+
body=body,
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
response = client.get_httpx_client().request(
|
|
86
|
+
**kwargs,
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
return _build_response(client=client, response=response)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def sync(
|
|
93
|
+
*,
|
|
94
|
+
client: AuthenticatedClient,
|
|
95
|
+
body: ChangePasswordRequest,
|
|
96
|
+
) -> Any | HTTPValidationError | None:
|
|
97
|
+
"""Change Password
|
|
98
|
+
|
|
99
|
+
修改密码
|
|
100
|
+
|
|
101
|
+
Args:
|
|
102
|
+
body (ChangePasswordRequest):
|
|
103
|
+
|
|
104
|
+
Raises:
|
|
105
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
106
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
107
|
+
|
|
108
|
+
Returns:
|
|
109
|
+
Any | HTTPValidationError
|
|
110
|
+
"""
|
|
111
|
+
|
|
112
|
+
return sync_detailed(
|
|
113
|
+
client=client,
|
|
114
|
+
body=body,
|
|
115
|
+
).parsed
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
async def asyncio_detailed(
|
|
119
|
+
*,
|
|
120
|
+
client: AuthenticatedClient,
|
|
121
|
+
body: ChangePasswordRequest,
|
|
122
|
+
) -> Response[Any | HTTPValidationError]:
|
|
123
|
+
"""Change Password
|
|
124
|
+
|
|
125
|
+
修改密码
|
|
126
|
+
|
|
127
|
+
Args:
|
|
128
|
+
body (ChangePasswordRequest):
|
|
129
|
+
|
|
130
|
+
Raises:
|
|
131
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
132
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
133
|
+
|
|
134
|
+
Returns:
|
|
135
|
+
Response[Any | HTTPValidationError]
|
|
136
|
+
"""
|
|
137
|
+
|
|
138
|
+
kwargs = _get_kwargs(
|
|
139
|
+
body=body,
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
143
|
+
|
|
144
|
+
return _build_response(client=client, response=response)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
async def asyncio(
|
|
148
|
+
*,
|
|
149
|
+
client: AuthenticatedClient,
|
|
150
|
+
body: ChangePasswordRequest,
|
|
151
|
+
) -> Any | HTTPValidationError | None:
|
|
152
|
+
"""Change Password
|
|
153
|
+
|
|
154
|
+
修改密码
|
|
155
|
+
|
|
156
|
+
Args:
|
|
157
|
+
body (ChangePasswordRequest):
|
|
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
|
+
Any | HTTPValidationError
|
|
165
|
+
"""
|
|
166
|
+
|
|
167
|
+
return (
|
|
168
|
+
await asyncio_detailed(
|
|
169
|
+
client=client,
|
|
170
|
+
body=body,
|
|
171
|
+
)
|
|
172
|
+
).parsed
|
|
@@ -0,0 +1,172 @@
|
|
|
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.forgot_password_request import ForgotPasswordRequest
|
|
9
|
+
from ...models.http_validation_error import HTTPValidationError
|
|
10
|
+
from ...types import Response
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _get_kwargs(
|
|
14
|
+
*,
|
|
15
|
+
body: ForgotPasswordRequest,
|
|
16
|
+
) -> dict[str, Any]:
|
|
17
|
+
headers: dict[str, Any] = {}
|
|
18
|
+
|
|
19
|
+
_kwargs: dict[str, Any] = {
|
|
20
|
+
"method": "post",
|
|
21
|
+
"url": "/api/p/v1/auth/forgot-password",
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
_kwargs["json"] = body.to_dict()
|
|
25
|
+
|
|
26
|
+
headers["Content-Type"] = "application/json"
|
|
27
|
+
|
|
28
|
+
_kwargs["headers"] = headers
|
|
29
|
+
return _kwargs
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _parse_response(
|
|
33
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
34
|
+
) -> Any | HTTPValidationError | None:
|
|
35
|
+
if response.status_code == 200:
|
|
36
|
+
response_200 = response.json()
|
|
37
|
+
return response_200
|
|
38
|
+
|
|
39
|
+
if response.status_code == 422:
|
|
40
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
41
|
+
|
|
42
|
+
return response_422
|
|
43
|
+
|
|
44
|
+
if client.raise_on_unexpected_status:
|
|
45
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
46
|
+
else:
|
|
47
|
+
return None
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def _build_response(
|
|
51
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
52
|
+
) -> Response[Any | HTTPValidationError]:
|
|
53
|
+
return Response(
|
|
54
|
+
status_code=HTTPStatus(response.status_code),
|
|
55
|
+
content=response.content,
|
|
56
|
+
headers=response.headers,
|
|
57
|
+
parsed=_parse_response(client=client, response=response),
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def sync_detailed(
|
|
62
|
+
*,
|
|
63
|
+
client: AuthenticatedClient | Client,
|
|
64
|
+
body: ForgotPasswordRequest,
|
|
65
|
+
) -> Response[Any | HTTPValidationError]:
|
|
66
|
+
"""Forgot Password
|
|
67
|
+
|
|
68
|
+
发送密码重置邮件(Phase 4 完善)
|
|
69
|
+
|
|
70
|
+
Args:
|
|
71
|
+
body (ForgotPasswordRequest):
|
|
72
|
+
|
|
73
|
+
Raises:
|
|
74
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
75
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
76
|
+
|
|
77
|
+
Returns:
|
|
78
|
+
Response[Any | HTTPValidationError]
|
|
79
|
+
"""
|
|
80
|
+
|
|
81
|
+
kwargs = _get_kwargs(
|
|
82
|
+
body=body,
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
response = client.get_httpx_client().request(
|
|
86
|
+
**kwargs,
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
return _build_response(client=client, response=response)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def sync(
|
|
93
|
+
*,
|
|
94
|
+
client: AuthenticatedClient | Client,
|
|
95
|
+
body: ForgotPasswordRequest,
|
|
96
|
+
) -> Any | HTTPValidationError | None:
|
|
97
|
+
"""Forgot Password
|
|
98
|
+
|
|
99
|
+
发送密码重置邮件(Phase 4 完善)
|
|
100
|
+
|
|
101
|
+
Args:
|
|
102
|
+
body (ForgotPasswordRequest):
|
|
103
|
+
|
|
104
|
+
Raises:
|
|
105
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
106
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
107
|
+
|
|
108
|
+
Returns:
|
|
109
|
+
Any | HTTPValidationError
|
|
110
|
+
"""
|
|
111
|
+
|
|
112
|
+
return sync_detailed(
|
|
113
|
+
client=client,
|
|
114
|
+
body=body,
|
|
115
|
+
).parsed
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
async def asyncio_detailed(
|
|
119
|
+
*,
|
|
120
|
+
client: AuthenticatedClient | Client,
|
|
121
|
+
body: ForgotPasswordRequest,
|
|
122
|
+
) -> Response[Any | HTTPValidationError]:
|
|
123
|
+
"""Forgot Password
|
|
124
|
+
|
|
125
|
+
发送密码重置邮件(Phase 4 完善)
|
|
126
|
+
|
|
127
|
+
Args:
|
|
128
|
+
body (ForgotPasswordRequest):
|
|
129
|
+
|
|
130
|
+
Raises:
|
|
131
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
132
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
133
|
+
|
|
134
|
+
Returns:
|
|
135
|
+
Response[Any | HTTPValidationError]
|
|
136
|
+
"""
|
|
137
|
+
|
|
138
|
+
kwargs = _get_kwargs(
|
|
139
|
+
body=body,
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
143
|
+
|
|
144
|
+
return _build_response(client=client, response=response)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
async def asyncio(
|
|
148
|
+
*,
|
|
149
|
+
client: AuthenticatedClient | Client,
|
|
150
|
+
body: ForgotPasswordRequest,
|
|
151
|
+
) -> Any | HTTPValidationError | None:
|
|
152
|
+
"""Forgot Password
|
|
153
|
+
|
|
154
|
+
发送密码重置邮件(Phase 4 完善)
|
|
155
|
+
|
|
156
|
+
Args:
|
|
157
|
+
body (ForgotPasswordRequest):
|
|
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
|
+
Any | HTTPValidationError
|
|
165
|
+
"""
|
|
166
|
+
|
|
167
|
+
return (
|
|
168
|
+
await asyncio_detailed(
|
|
169
|
+
client=client,
|
|
170
|
+
body=body,
|
|
171
|
+
)
|
|
172
|
+
).parsed
|