Add OperatingArea and PilotCertification modules with live push readiness.
Migrate operating area and pilot certification from home placeholders, extend Live with playback and push readiness flows, and add pilot certificate OSS upload. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@ -0,0 +1,58 @@
|
||||
//
|
||||
// PilotCertificationAPI.swift
|
||||
// suixinkan
|
||||
//
|
||||
// Created by Codex on 2026/6/25.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Observation
|
||||
|
||||
/// 飞手认证服务协议,定义认证详情、短信、提交和编辑接口。
|
||||
@MainActor
|
||||
protocol PilotCertificationServing {
|
||||
func flyerDetail() async throws -> FlyerDetailResponse
|
||||
func flyerSendCode(phone: String) async throws
|
||||
func flyerApply(_ request: FlyerApplyRequest) async throws
|
||||
func flyerEdit(_ request: FlyerEditRequest) async throws
|
||||
}
|
||||
|
||||
@MainActor
|
||||
@Observable
|
||||
/// 飞手认证 API,封装 `/api/app/flyer` 认证相关接口。
|
||||
final class PilotCertificationAPI {
|
||||
@ObservationIgnored private let client: APIClient
|
||||
|
||||
/// 初始化飞手认证 API,并注入共享网络客户端。
|
||||
init(client: APIClient) {
|
||||
self.client = client
|
||||
}
|
||||
|
||||
/// 获取飞手认证详情。
|
||||
func flyerDetail() async throws -> FlyerDetailResponse {
|
||||
try await client.send(APIRequest(method: .get, path: "/api/app/flyer/detail"))
|
||||
}
|
||||
|
||||
/// 发送飞手认证短信验证码。
|
||||
func flyerSendCode(phone: String) async throws {
|
||||
let _: EmptyPayload = try await client.send(
|
||||
APIRequest(method: .post, path: "/api/app/flyer/send-code", body: FlyerSendCodeRequest(phone: phone))
|
||||
)
|
||||
}
|
||||
|
||||
/// 首次提交飞手认证申请。
|
||||
func flyerApply(_ request: FlyerApplyRequest) async throws {
|
||||
let _: EmptyPayload = try await client.send(
|
||||
APIRequest(method: .post, path: "/api/app/flyer/apply", body: request)
|
||||
)
|
||||
}
|
||||
|
||||
/// 驳回后编辑并重新提交飞手认证申请。
|
||||
func flyerEdit(_ request: FlyerEditRequest) async throws {
|
||||
let _: EmptyPayload = try await client.send(
|
||||
APIRequest(method: .post, path: "/api/app/flyer/edit", body: request)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
extension PilotCertificationAPI: PilotCertificationServing {}
|
||||
Reference in New Issue
Block a user