PCloudAPIDownloadTaskBuilder

public struct PCloudAPIDownloadTaskBuilder

Utility struct containing logic for building DownloadTask instances.

  • Undocumented

    Declaration

    Swift

    public init(hostProvider: HostProvider,
    			authenticator: Authenticator,
    			defaultTimeoutInterval: TimeInterval? = nil,
    			operationBuilder: @escaping (Download.Request) -> DownloadOperation)
  • Creates a DownloadTask instance for downloading a file from a remote address.

    Declaration

    Swift

    public func createTask(with resourceAddress: URL,
    					   downloadTag: String? = nil,
    					   timeoutInterval: TimeInterval? = nil,
    					   destination: @escaping (URL) throws -> URL) -> DownloadTask

    Parameters

    resourceAddress

    The location of the file to download.

    downloadTag

    To be passed alongside FileLink.Metadata resource addresses. Authenticates this client to the storage servers.

    timeoutInterval

    The timeout interval for this call task. If nil, the default timeout interval will be used.

    destination

    A block called with the temporary location of the file on disk. The block must either move the file or open it for reading, otherwise the file gets deleted after the block returns. The block should return the new path of the file.

    Return Value

    An instance of DownloadTask in suspended state.