2026-04-21 22:07:29 +08:00
|
|
|
import Foundation
|
|
|
|
|
|
|
|
|
|
public struct SDKConfig: Sendable {
|
|
|
|
|
public let appId: String
|
|
|
|
|
public let appKey: String
|
|
|
|
|
public let appSecret: String
|
|
|
|
|
public let apiBaseURL: URL
|
|
|
|
|
public let imWebSocketURL: URL
|
|
|
|
|
public let debug: Bool
|
|
|
|
|
|
|
|
|
|
public init(
|
|
|
|
|
appId: String,
|
|
|
|
|
appKey: String,
|
|
|
|
|
appSecret: String,
|
|
|
|
|
apiBaseURL: URL,
|
|
|
|
|
imWebSocketURL: URL,
|
|
|
|
|
debug: Bool = false
|
|
|
|
|
) {
|
|
|
|
|
self.appId = appId
|
|
|
|
|
self.appKey = appKey
|
|
|
|
|
self.appSecret = appSecret
|
|
|
|
|
self.apiBaseURL = apiBaseURL
|
|
|
|
|
self.imWebSocketURL = imWebSocketURL
|
|
|
|
|
self.debug = debug
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-04-28 16:08:06 +08:00
|
|
|
|
|
|
|
|
public extension SDKConfig {
|
|
|
|
|
static func development(
|
|
|
|
|
appId: String,
|
|
|
|
|
appSecret: String,
|
|
|
|
|
appKey: String? = nil,
|
|
|
|
|
debug: Bool = false
|
|
|
|
|
) -> SDKConfig {
|
|
|
|
|
SDKConfig(
|
|
|
|
|
appId: appId,
|
|
|
|
|
appKey: appKey ?? appId,
|
|
|
|
|
appSecret: appSecret,
|
|
|
|
|
apiBaseURL: URL(string: "http://192.168.116.9:8081")!,
|
|
|
|
|
imWebSocketURL: URL(string: "ws://192.168.116.9:8082/ws/im")!,
|
|
|
|
|
debug: debug
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|