147 lines
3.7 KiB
Dart
147 lines
3.7 KiB
Dart
import '../api_client.dart';
|
|
import '../proxy_client.dart';
|
|
|
|
/// 图片/视频生成相关 API
|
|
abstract final class ImageApi {
|
|
static final _client = ApiClient.instance.proxy;
|
|
|
|
/// 获取图转视频分类列表
|
|
static Future<ApiResponse> getCategoryList() async {
|
|
return _client.request(
|
|
path: '/v1/image/img2video/categories',
|
|
method: 'GET',
|
|
);
|
|
}
|
|
|
|
/// 获取图转视频任务列表
|
|
/// insignia: categoryId
|
|
static Future<ApiResponse> getImg2VideoTasks({int? insignia}) async {
|
|
return _client.request(
|
|
path: '/v1/image/img2video/tasks',
|
|
method: 'GET',
|
|
queryParams: insignia != null ? {'insignia': insignia.toString()} : null,
|
|
);
|
|
}
|
|
|
|
/// 获取推荐提示词
|
|
static Future<ApiResponse> getPromptRecommends({
|
|
required String sentinel,
|
|
String? crest,
|
|
String? asset,
|
|
}) async {
|
|
return _client.request(
|
|
path: '/v1/image/prompt/recomends',
|
|
method: 'GET',
|
|
queryParams: {
|
|
'sentinel': sentinel,
|
|
if (crest != null) 'crest': crest,
|
|
if (asset != null) 'asset': asset,
|
|
},
|
|
);
|
|
}
|
|
|
|
/// 创建文生图任务
|
|
static Future<ApiResponse> createTxt2Img({
|
|
required String sentinel,
|
|
required String ledger,
|
|
String? crest,
|
|
String? asset,
|
|
String? quest,
|
|
}) async {
|
|
return _client.request(
|
|
path: '/v1/image/txt2img_create',
|
|
method: 'POST',
|
|
queryParams: {
|
|
'sentinel': sentinel,
|
|
if (crest != null) 'crest': crest,
|
|
if (asset != null) 'asset': asset,
|
|
},
|
|
body: {
|
|
'declaration': 1,
|
|
if (quest != null) 'quest': quest,
|
|
'ledger': ledger,
|
|
},
|
|
);
|
|
}
|
|
|
|
/// 创建图转视频姿态任务
|
|
static Future<ApiResponse> createImg2VideoPose({
|
|
required String sentinel,
|
|
required String asset,
|
|
String? congregation,
|
|
String? profit,
|
|
String? compendium,
|
|
String? notification,
|
|
String? allowance,
|
|
String? cosmos,
|
|
}) async {
|
|
return _client.request(
|
|
path: '/v1/image/img2video_pose_task',
|
|
method: 'POST',
|
|
queryParams: {
|
|
'sentinel': sentinel,
|
|
'asset': asset,
|
|
if (congregation != null) 'congregation': congregation,
|
|
if (notification != null) 'notification': notification,
|
|
if (allowance != null) 'allowance': allowance,
|
|
if (cosmos != null) 'cosmos': cosmos,
|
|
if (profit != null) 'profit': profit,
|
|
if (compendium != null) 'compendium': compendium,
|
|
},
|
|
);
|
|
}
|
|
|
|
/// 查询任务进度
|
|
static Future<ApiResponse> getProgress({
|
|
required String sentinel,
|
|
required String tree,
|
|
String? asset,
|
|
}) async {
|
|
return _client.request(
|
|
path: '/v1/image/progress',
|
|
method: 'GET',
|
|
queryParams: {
|
|
'sentinel': sentinel,
|
|
'tree': tree,
|
|
if (asset != null) 'asset': asset,
|
|
},
|
|
);
|
|
}
|
|
|
|
/// 获取图转视频姿态模板
|
|
static Future<ApiResponse> getImg2VideoPoseTemplates({
|
|
required String sentinel,
|
|
String? crest,
|
|
String? asset,
|
|
String? insignia,
|
|
}) async {
|
|
return _client.request(
|
|
path: '/v1/image/img2Video_pose_template',
|
|
method: 'GET',
|
|
queryParams: {
|
|
'sentinel': sentinel,
|
|
if (crest != null) 'crest': crest,
|
|
if (asset != null) 'asset': asset,
|
|
if (insignia != null) 'insignia': insignia,
|
|
},
|
|
);
|
|
}
|
|
|
|
/// 获取积分页面信息
|
|
static Future<ApiResponse> getCreditsPageInfo({
|
|
required String sentinel,
|
|
String? asset,
|
|
String? crest,
|
|
}) async {
|
|
return _client.request(
|
|
path: '/v1/image/getCreditsPageInfo',
|
|
method: 'GET',
|
|
queryParams: {
|
|
'sentinel': sentinel,
|
|
if (asset != null) 'asset': asset,
|
|
if (crest != null) 'crest': crest,
|
|
},
|
|
);
|
|
}
|
|
}
|