Files
suixinkan_uikit/suixinkan/Features/Home/API/HomeAPI.swift

67 lines
2.0 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),
]
)
)
}
}