Files
suixinkan_ios_new/suixinkan/Features/ScenicPermission/API/ScenicPermissionAPI.swift
汉秋 703078352c 从 iOS 17 Observation 迁移至 iOS 16 兼容的 Combine 架构
将最低部署版本降至 iOS 16,以 ObservableObject 替换 @Observable,新增导航与 UI 兼容层,并补充登录冒烟 UI 测试。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 10:16:35 +08:00

121 lines
3.7 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// ScenicPermissionAPI.swift
// suixinkan
//
// Created by Codex on 2026/6/23.
//
import Foundation
import Combine
///
@MainActor
protocol ScenicPermissionServing {
///
func scenicListAll() async throws -> ScenicListAllResponse
///
func areas() async throws -> [ScenicAreaNode]
///
func scenicApplicationPendingAll() async throws -> ScenicApplicationPendingsResponse
///
func scenicSubmit(_ request: ScenicApplicationSubmitRequest) async throws
///
func scenicApplicationUploadPlaceholder(_ items: [ScenicApplicationUploadPlaceholder]) async throws
///
func roleApplyAll() async throws -> [RoleApplyPendingResponse]
///
func roleApplySubmit(roleId: Int, scenicIds: [Int]) async throws
}
@MainActor
/// API
final class ScenicPermissionAPI {
private let client: APIClient
/// API
init(client: APIClient) {
self.client = client
}
///
func scenicListAll() async throws -> ScenicListAllResponse {
try await client.send(
APIRequest(
method: .get,
path: "/api/yf-handset-app/photog/scenic/list-all"
)
)
}
///
func areas() async throws -> [ScenicAreaNode] {
try await client.send(
APIRequest(
method: .get,
path: "/api/app/config/areas"
)
)
}
///
func scenicApplicationPendingAll() async throws -> ScenicApplicationPendingsResponse {
try await client.send(
APIRequest(
method: .get,
path: "/api/yf-handset-app/photog/scenic-apply/all"
)
)
}
///
func scenicSubmit(_ request: ScenicApplicationSubmitRequest) async throws {
let _: EmptyPayload = try await client.send(
APIRequest(
method: .post,
path: "/api/yf-handset-app/photog/scenic-apply/submit",
body: request
)
)
}
///
func scenicApplicationUploadPlaceholder(_ items: [ScenicApplicationUploadPlaceholder]) async throws {
let _: EmptyPayload = try await client.send(
APIRequest(
method: .post,
path: "/api/yf-handset-app/photog/scenic-apply/upload-placeholder",
body: ["files": items]
)
)
}
///
func roleApplyAll() async throws -> [RoleApplyPendingResponse] {
try await client.send(
APIRequest(
method: .get,
path: "/api/yf-handset-app/photog/role-apply/all"
)
)
}
///
func roleApplySubmit(roleId: Int, scenicIds: [Int]) async throws {
let _: EmptyPayload = try await client.send(
APIRequest(
method: .post,
path: "/api/yf-handset-app/photog/role-apply/submit",
body: RoleApplySubmitRequest(scenicId: scenicIds, roleId: roleId)
)
)
}
}
extension ScenicPermissionAPI: ScenicPermissionServing {}