DBUploadTask

Objective-C

@interface DBUploadTask<TResponse, TError> : DBTask

Swift

class DBUploadTask<TResponse, TError> : DBTask where TResponse : AnyObject, TError : AnyObject

Dropbox Upload-style Network Task.

After an Upload network request is made via DBTransportClient, a subclass of DBUploadTask is returned, from which response and progress handlers can be installed, and the network response paused or cancelled.

TResponse is the generic representation of the route-specific result, and TError is the generic representation of the route-specific error.

Response / error deserialization is performed with this class.

  • Installs a response handler for the current request.

    Executes handler on main queue/thread.

    Note

    Any existing handlers are replaced by the supplied handler.

    Declaration

    Objective-C

    - (nonnull DBUploadTask<TResponse, TError> *)setResponseBlock:
        (nonnull DBUploadResponseBlock)responseBlock;

    Swift

    func setResponseBlock(_ responseBlock: @escaping DBUploadResponseBlock) -> DBUploadTask<TResponse, TError>

    Parameters

    responseBlock

    The handler block to be executed in the event of a successful or unsuccessful network request. The first argument is the route-specific result. The second argument is the route-specific error. And the third argument is the more general network error (which includes information like Dropbox request ID, http status code, etc.).

    Return Value

    The current DBUploadTask instance.

  • Installs a response handler for the current request with a specific queue on which to execute handler code.

    Executes handler on supplied queue/thread.

    Note

    Any existing handlers are replaced by the supplied handler.

    Declaration

    Objective-C

    - (nonnull DBUploadTask<TResponse, TError> *)
        setResponseBlock:(nonnull DBUploadResponseBlock)responseBlock
                   queue:(nullable NSOperationQueue *)queue;

    Swift

    func setResponseBlock(_ responseBlock: @escaping DBUploadResponseBlock, queue: OperationQueue?) -> DBUploadTask<TResponse, TError>

    Parameters

    responseBlock

    The handler block to be executed in the event of a successful or unsuccessful network request. The first argument is the route-specific result. The second argument is the route-specific error. And the third argument is the more general network error (which includes information like Dropbox request ID, http status code, etc.).

    queue

    The operation queue on which to execute the response.

    Return Value

    The current DBUploadTask instance.

  • Installs a progress handler for the current request.

    Executes handler on main queue/thread.

    Note

    Any existing handlers are replaced by the supplied handler.

    Declaration

    Objective-C

    - (nonnull DBUploadTask *)setProgressBlock:
        (nonnull DBProgressBlock)progressBlock;

    Swift

    func setProgressBlock(_ progressBlock: @escaping DBProgressBlock) -> DBUploadTask<AnyObject, AnyObject>

    Parameters

    progressBlock

    The progress block to be executed in the event of a request update. The first argument is the number of bytes uploaded. The second argument is the number of total bytes uploaded. And the third argument is the number of total bytes expected to be uploaded.

    Return Value

    The current DBUploadTask instance.

  • Installs a progress handler for the current request.

    Executes handler on supplied queue/thread.

    Note

    Any existing handlers are replaced by the supplied handler.

    Declaration

    Objective-C

    - (nonnull DBUploadTask *)setProgressBlock:
                                  (nonnull DBProgressBlock)progressBlock
                                         queue:(nullable NSOperationQueue *)queue;

    Swift

    func setProgressBlock(_ progressBlock: @escaping DBProgressBlock, queue: OperationQueue?) -> DBUploadTask<AnyObject, AnyObject>

    Parameters

    progressBlock

    The progress block to be executed in the event of a request update. The first argument is the number of bytes uploaded. The second argument is the number of total bytes uploaded. And the third argument is the number of total bytes expected to be uploaded.

    queue

    The operation queue on which to execute the response.

    Return Value

    The current DBUploadTask instance.