diff --git a/Sources/MuxUploadSDK/PublicAPI/DirectUpload.swift b/Sources/MuxUploadSDK/PublicAPI/DirectUpload.swift index ce4eb38..f345b79 100644 --- a/Sources/MuxUploadSDK/PublicAPI/DirectUpload.swift +++ b/Sources/MuxUploadSDK/PublicAPI/DirectUpload.swift @@ -24,32 +24,28 @@ public typealias DirectUploadResult = Result () /** @@ -170,27 +164,18 @@ public final class DirectUpload { internal var fileWorker: ChunkedFileUploader? - /** - Represents the state of an upload in progress. - */ + /// Represents the state of an upload when it is being + /// sent to Mux over the network public struct TransportStatus : Sendable, Hashable { - /** - The percentage of file bytes received by the server - accepting the upload - */ + /// The percentage of file bytes received at the + /// upload destination public let progress: Progress? - /** - A timestamp indicating when this status was generated - */ + /// Timestamp from when this update was generated public let updatedTime: TimeInterval - /** - The start time of the upload, nil if the upload - has never been started - */ + /// The start time of the upload, nil if the upload + /// has never been started public let startTime: TimeInterval? - /** - Indicates if the upload has been paused - */ + /// Indicates if the upload has been paused public let isPaused: Bool } @@ -398,17 +383,15 @@ public final class DirectUpload { return fileWorker?.inputFileURL } - /** - The remote endpoint that this object uploads to - */ + /// URL of the remote upload destination public var uploadURL: URL { return uploadInfo.uploadURL } - // TODO: Computed Properties for some other UploadInfo properties - - /** - Begins the upload. You can control what happens when the upload is already started. If `forceRestart` is true, the upload will be restarted. Otherwise, nothing will happen. The default is not to restart - */ + + /// Starts the upload. + /// - Parameter forceRestart: if true, the upload will be + /// restarted. If false the upload will resume from where + /// it left off if paused, otherwise the upload will change. public func start(forceRestart: Bool = false) { let videoFile = (input.sourceAsset as! AVURLAsset).url @@ -725,19 +708,20 @@ public final class DirectUpload { inputStatusHandler?(inputStatus) } - /** - Suspends the execution of this upload. Temp files and state will not be changed. The upload will remain paused in this state - even after process death. - Use ``start(forceRestart:)``, passing `false` to start the process over where it was left. - Use ``cancel()`` to remove this upload completely - */ + + /// Suspends upload execution. Temporary files will be + /// kept unchanged and the upload can be resumed by calling + /// ``start(forceRestart:)`` with forceRestart set to `false` + /// to resume the upload from where it left off. + /// + /// Call ``cancel()`` to permanently halt the upload. public func pause() { fileWorker?.pause() } - /** - Cancels an ongoing download. State and Delegates will be cleared. Your delegates will recieve no further calls - */ + /// Cancels an upload that has already been started. + /// Any delegates or handlers set prior to this will + /// receive no further updates. public func cancel() { fileWorker?.cancel() uploadManager.acknowledgeUpload(id: id) @@ -908,9 +892,9 @@ extension DirectUpload { } } -/** - An fatal error that ocurred during the upload process. The last-known state of the upload is available, as well as the Error that stopped the upload - */ +/// An unrecoverable error occurring while the upload was +/// executing The last-known state of the upload is available, +/// as well as the Error that stopped the upload public struct DirectUploadError : Error { /// Represents the possible error cases from a ``DirectUpload`` public enum Kind : Int { diff --git a/Sources/MuxUploadSDK/PublicAPI/DirectUploadManager.swift b/Sources/MuxUploadSDK/PublicAPI/DirectUploadManager.swift index 76edfaa..55fc8c4 100644 --- a/Sources/MuxUploadSDK/PublicAPI/DirectUploadManager.swift +++ b/Sources/MuxUploadSDK/PublicAPI/DirectUploadManager.swift @@ -63,7 +63,7 @@ public final class DirectUploadManager { } /// Returns all uploads currently-managed uploads. - /// Uploads are managed while in-progress or compelted. + /// Uploads are managed while in-progress or completed. /// Uploads become un-managed when canceled, or if the process dies after they complete public func allManagedDirectUploads() -> [DirectUpload] { // Sort upload list for consistent ordering