Files
suixinkan_uikit/suixinkan/Features/Home/API/HomeAPI.swift
汉秋 2bea05b1d9 Add scenic selection and cooperation order flows aligned with Android.
Upgrade scenic picker with search, location sorting, permission apply/status, and blocking home dialog; add cooperation order module and order source picker improvements with unit tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-07 10:48:43 +08:00

92 lines
2.9 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.

//
// HomeAPI.swift
// suixinkan
//
import Foundation
@MainActor
/// API
final class HomeAPI {
private let client: APIClient
init(client: APIClient) {
self.client = client
}
///
func rolePermissions() async throws -> [RolePermissionResponse] {
try await client.send(
APIRequest(method: .get, path: "/api/yf-handset-app/role-permission")
)
}
///
func storeList() async throws -> StoreListResponse {
try await client.send(
APIRequest(method: .get, path: "/api/app/store/all")
)
}
///
func locationDetail(staffId: String) async throws -> LocationDetailResponse {
try await client.send(
APIRequest(
method: .get,
path: "/api/yf-handset-app/photog/loacation/detail",
queryItems: [URLQueryItem(name: "staff_id", value: staffId)]
)
)
}
///
func reportLocation(
staffId: String,
latitude: Double,
longitude: Double,
address: String,
type: Int,
scenicId: String
) async throws -> LocationReportResponse {
try await client.send(
APIRequest(
method: .post,
path: "/api/yf-handset-app/photog/loacation/report",
queryItems: [
URLQueryItem(name: "staff_id", value: staffId),
URLQueryItem(name: "latitude", value: String(latitude)),
URLQueryItem(name: "longitude", value: String(longitude)),
URLQueryItem(name: "address", value: address),
URLQueryItem(name: "type", value: String(type)),
URLQueryItem(name: "scenic_id", value: scenicId),
]
)
)
}
///
func roleApplyPending() async throws -> [RoleApplyPendingResponse] {
try await client.send(
APIRequest(method: .get, path: "/api/yf-handset-app/photog/role-apply/all")
)
}
///
func scenicListAll() async throws -> ScenicListAllResponse {
try await client.send(
APIRequest(method: .get, path: "/api/yf-handset-app/photog/scenic/list-all")
)
}
///
func submitRoleApply(scenicIds: [Int], roleId: Int) async throws -> RoleApplySubmitResult {
try await client.send(
APIRequest(
method: .post,
path: "/api/yf-handset-app/photog/role-apply/submit",
body: RoleApplySubmitRequest(scenicId: scenicIds, roleId: roleId)
)
)
}
}