AliyunpanClient
public class AliyunpanClient
Undocumented
-
获取当前持久化的 accessToken
Declaration
Swift
@MainActor public var accessToken: String? { get }
-
下载器
Declaration
Swift
public lazy var downloader: AliyunpanDownloader { get set }
-
上传器
Declaration
Swift
public lazy var uploader: AliyunpanUploader { get set }
-
Undocumented
Declaration
Swift
public init(_ config: AliyunpanClientConfig)
-
Undocumented
Declaration
Swift
public convenience init(appId: String, scope: String, identifier: String? = nil)
-
强制清除 token 持久化
Declaration
Swift
@MainActor public func cleanToken()
-
authorize(credentials:
Asynchronous) 授权 如本地持久化未过期会取持久化,否则会开始授权
Declaration
Swift
@discardableResult public func authorize( credentials: AliyunpanCredentials = .pkce ) async throws -> AliyunpanToken
Parameters
credentials
授权方式
Return Value
token
-
send(_:
Asynchronous) 发送请求
Throws
DecodingError
: JSON 解析错误AliyunpanAuthorizeError
: 授权错误AliyunpanServerError
: 服务端错误AliyunpanNetworkSystemError
: 网络系统错误Declaration
Swift
public func send<T>(_ command: T) async throws -> T.Response where T : AliyunpanCommand
-
发送请求
Throws
DecodingError
: JSON 解析错误AliyunpanAuthorizeError
: 授权错误AliyunpanServerError
: 服务端错误AliyunpanNetworkSystemError
: 网络系统错误Declaration
Swift
public func send<T: AliyunpanCommand>( _ command: T, completionHandle: @escaping (Result<T.Response, Error>) -> Void) where T.Response: Decodable