CallTask

public final class CallTask<Method> : Cancellable where Method : PCloudAPIMethod
extension CallTask: CustomStringConvertible

Executes a network call to the pCloud API.

  • Undocumented

    Declaration

    Swift

    public typealias Parser = Method.Parser
  • Undocumented

    Declaration

    Swift

    public typealias CompletionBlock = (Result<Method.Value, CallError<Method.Error>>) -> Void
  • true if cancel() has been invoked on this instance, false otherwise.

    Declaration

    Swift

    public var isCancelled: Bool { get }
  • Initializes a non-running task with a network operation and a parser.

    Declaration

    Swift

    public init(operation: CallOperation, responseParser: @escaping Parser)

    Parameters

    operation

    An operation in a suspended state that would execute the network call.

    responseParser

    A block parsing an object from a response dictionary.

  • Adds a completion block to this instance to be called when the task completes either successfully or with a failure.

    Declaration

    Swift

    @discardableResult
    public func addCompletionBlock(_ block: @escaping CompletionBlock) -> CallTask

    Parameters

    block

    A block called on the main thread with the result of the task.

    Return Value

    This task.

  • Starts the task if it is not already running.

    Declaration

    Swift

    @discardableResult
    public func start() -> CallTask

    Return Value

    This task.

  • Interrupts and invalidates the task. An invalidated task cannot run again.

    Declaration

    Swift

    public func cancel()
  • Declaration

    Swift

    public var description: String { get }