punchnet-macos/punchnet/Shared/Networking/SDLAPIClient+App.swift
2026-04-17 15:18:08 +08:00

48 lines
1.5 KiB
Swift

//
// SDLAPIClient+App.swift
// punchnet
//
// Created by on 2026/3/21.
//
import Foundation
extension SDLAPIClient {
//
static func appIssue(accessToken: String, contact: String, content: String) async throws -> String {
let params: [String: Any] = [
"access_token": accessToken,
"contact": contact,
"platform": SystemConfig.systemInfo,
"content": content,
"client_id": SystemConfig.getClientId(),
"mac": SystemConfig.macAddressString(mac: SystemConfig.getMacAddress())
]
return try await SDLAPIClient.doPost(path: "/app/issue", params: params, as: String.self)
}
//
static func appPolicies() async throws -> AppPoliciesInfo {
let params: [String: Any] = [
"platform": "macos",
"client_id": SystemConfig.getClientId()
]
return try await SDLAPIClient.doPost(path: "/app/policies", params: params, as: AppPoliciesInfo.self)
}
// app
static func appCheckUpdate() async throws -> AppUpgradeInfo {
let params: [String: Any] = [
"app_id": "Punchnet",
"platform": "macos",
"version": SystemConfig.systemInfo,
"build": SystemConfig.build,
"channel": SystemConfig.channel,
"client_id": SystemConfig.getClientId()
]
return try await SDLAPIClient.doPost(path: "/app/checkUpdate", params: params, as: AppUpgradeInfo.self)
}
}