Files
real-e-party-iOS/YuMi/E-P/Common/EPQCloudConfig.swift
2025-10-17 14:52:29 +08:00

54 lines
1.4 KiB
Swift

// Created by AI on 2025-10-11.
import Foundation
struct EPQCloudConfig {
let secretId: String
let secretKey: String
let sessionToken: String
let bucket: String
let region: String
let customDomain: String
let startTime: Int64
let expireTime: Int64
let appId: String
let accelerate: Int
init?(dictionary: [String: Any]) {
guard let secretId = dictionary["secretId"] as? String,
let secretKey = dictionary["secretKey"] as? String,
let sessionToken = dictionary["sessionToken"] as? String,
let bucket = dictionary["bucket"] as? String,
let region = dictionary["region"] as? String,
let customDomain = dictionary["customDomain"] as? String,
let appId = dictionary["appId"] as? String else {
return nil
}
self.secretId = secretId
self.secretKey = secretKey
self.sessionToken = sessionToken
self.bucket = bucket
self.region = region
self.customDomain = customDomain
self.appId = appId
self.startTime = (dictionary["startTime"] as? Int64) ?? 0
self.expireTime = (dictionary["expireTime"] as? Int64) ?? 0
self.accelerate = (dictionary["accelerate"] as? Int) ?? 0
}
var isExpired: Bool {
return Date().timeIntervalSince1970 > Double(expireTime)
}
}