Files
e-party-iOS/yana/APIs/APIEndpoints.swift
edwinQQQ 007c10daaf feat: 添加Swift Package管理和API功能模块
新增Package.swift和Package.resolved文件以支持Swift Package管理,创建API相关文件(API.swift、APICaller.swift、APIConstants.swift、APIEndpoints.swift、APIService.swift、APILogger.swift、APIModels.swift、Integration-Guide.md)以实现API请求管理和网络交互功能,增强项目的功能性和可扩展性。同时更新.gitignore以排除构建文件和临时文件。
2025-06-04 17:25:21 +08:00

39 lines
1.1 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.

import Foundation
// MARK: - API Endpoints
enum APIEndpoint: String, CaseIterable {
case config = "/client/config"
case login = "/auth/login"
//
var path: String {
return self.rawValue
}
}
// MARK: - API Configuration
struct APIConfiguration {
static let baseURL = "http://beta.api.molistar.xyz"
static let timeout: TimeInterval = 30.0
static let maxDataSize: Int = 50 * 1024 * 1024 // 50MB
//
static let defaultHeaders: [String: String] = [
"Content-Type": "application/json",
"Accept": "application/json",
// "User-Agent": "yana-iOS/\(Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "1.0.0")"
"User-Agent": "YuMi/20.20.61 (iPhone; iOS 18.3.1; Scale/3.00)",
"Accept-Language": "zh-Hant",
"Accept-Encoding": "gzip, br"
]
}
// MARK: - Request Models
struct LoginRequest: Codable {
let username: String
let password: String
}
// MARK: - Empty Request
struct EmptyRequest: Codable {}