feat: add AI retouch task center
This commit is contained in:
@@ -51,10 +51,20 @@ protocol TravelAlbumServing {
|
||||
func aiRetouchTemplates(scenicId: Int) async throws -> TravelAlbumAIRetouchTemplatesResponse
|
||||
|
||||
/// 提交相册素材 AI 修图任务。
|
||||
func submitAIRetouch(_ request: TravelAlbumAIRetouchRequest) async throws
|
||||
func submitAIRetouch(_ request: TravelAlbumAIRetouchRequest) async throws -> TravelAlbumAIJobSubmission
|
||||
|
||||
/// 提交单张素材重新修图任务。
|
||||
func submitAIReretouch(_ request: TravelAlbumAIReretouchRequest) async throws
|
||||
func submitAIReretouch(_ request: TravelAlbumAIReretouchRequest) async throws -> TravelAlbumAIJobSubmission
|
||||
|
||||
/// 拉取当前账号的 AI 修图任务列表。
|
||||
func aiRetouchJobList(
|
||||
statusGroup: TravelAlbumAIJobFilter,
|
||||
limit: Int,
|
||||
cursor: String?
|
||||
) async throws -> TravelAlbumAIJobListResponse
|
||||
|
||||
/// 拉取指定 AI 修图任务详情。
|
||||
func aiRetouchJobInfo(batchId: Int) async throws -> TravelAlbumAIJobDetail
|
||||
}
|
||||
|
||||
@MainActor
|
||||
@@ -197,17 +207,42 @@ final class TravelAlbumAPI: TravelAlbumServing {
|
||||
)
|
||||
}
|
||||
|
||||
/// 提交相册素材 AI 修图任务;服务端 data 内容无需客户端消费。
|
||||
func submitAIRetouch(_ request: TravelAlbumAIRetouchRequest) async throws {
|
||||
let _: EmptyPayload = try await client.send(
|
||||
APIRequest(method: .post, path: "\(basePath)/ai-retouch", body: request)
|
||||
/// 提交相册素材 AI 修图任务并返回任务摘要。
|
||||
func submitAIRetouch(_ request: TravelAlbumAIRetouchRequest) async throws -> TravelAlbumAIJobSubmission {
|
||||
try await client.send(APIRequest(method: .post, path: "\(basePath)/ai-retouch", body: request))
|
||||
}
|
||||
|
||||
/// 提交重新修图任务并返回任务摘要。
|
||||
func submitAIReretouch(_ request: TravelAlbumAIReretouchRequest) async throws -> TravelAlbumAIJobSubmission {
|
||||
try await client.send(APIRequest(method: .post, path: "\(basePath)/ai-reretouch", body: request))
|
||||
}
|
||||
|
||||
/// 拉取当前账号的 AI 修图任务列表。
|
||||
func aiRetouchJobList(
|
||||
statusGroup: TravelAlbumAIJobFilter,
|
||||
limit: Int = 20,
|
||||
cursor: String? = nil
|
||||
) async throws -> TravelAlbumAIJobListResponse {
|
||||
var queryItems = [
|
||||
URLQueryItem(name: "status_group", value: statusGroup.rawValue),
|
||||
URLQueryItem(name: "limit", value: String(min(50, max(1, limit)))),
|
||||
]
|
||||
if let cursor = cursor?.trimmingCharacters(in: .whitespacesAndNewlines), !cursor.isEmpty {
|
||||
queryItems.append(URLQueryItem(name: "cursor", value: cursor))
|
||||
}
|
||||
return try await client.send(
|
||||
APIRequest(method: .get, path: "\(basePath)/ai-retouch-job-list", queryItems: queryItems)
|
||||
)
|
||||
}
|
||||
|
||||
/// 提交重新修图任务;服务端返回的批次与额度信息当前无需消费。
|
||||
func submitAIReretouch(_ request: TravelAlbumAIReretouchRequest) async throws {
|
||||
let _: EmptyPayload = try await client.send(
|
||||
APIRequest(method: .post, path: "\(basePath)/ai-reretouch", body: request)
|
||||
/// 拉取指定 AI 修图任务详情。
|
||||
func aiRetouchJobInfo(batchId: Int) async throws -> TravelAlbumAIJobDetail {
|
||||
try await client.send(
|
||||
APIRequest(
|
||||
method: .get,
|
||||
path: "\(basePath)/ai-retouch-job-info",
|
||||
queryItems: [URLQueryItem(name: "ai_retouch_batch_id", value: String(batchId))]
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user