26 lines
707 B
Swift
26 lines
707 B
Swift
|
|
import Foundation
|
||
|
|
|
||
|
|
struct NASItem: Identifiable {
|
||
|
|
let id = UUID()
|
||
|
|
let name: String
|
||
|
|
let path: String
|
||
|
|
let isDirectory: Bool
|
||
|
|
let size: Int64
|
||
|
|
let modifiedDate: Date?
|
||
|
|
}
|
||
|
|
|
||
|
|
protocol NASTransferProtocol: AnyObject {
|
||
|
|
var isConnected: Bool { get }
|
||
|
|
|
||
|
|
func connect(to host: String, port: Int, username: String, password: String) async throws
|
||
|
|
func disconnect()
|
||
|
|
func listDirectory(at path: String) async throws -> [NASItem]
|
||
|
|
func createDirectory(at path: String) async throws
|
||
|
|
func fileExists(at remotePath: String) async throws -> Bool
|
||
|
|
func upload(
|
||
|
|
localURL: URL,
|
||
|
|
remotePath: String,
|
||
|
|
progress: @escaping (Int64, Int64) -> Void
|
||
|
|
) async throws
|
||
|
|
}
|