AmplifyInProcessReportingOperation

open class AmplifyInProcessReportingOperation<
    Request: AmplifyOperationRequest,
    InProcess,
    Success,
    Failure: AmplifyError
>: AmplifyOperation<Request, Success, Failure>

An AmplifyOperation that emits InProcess values intermittently during the operation.

Unlike a regular AmplifyOperation, which emits a single Result at the completion of the operation’s work, an AmplifyInProcessReportingOperation may emit intermediate values while its work is ongoing. These values could be incidental to the operation (such as a Storage.downloadFile operation reporting Progress values periodically as the download proceeds), or they could be the primary delivery mechanism for an operation (such as a GraphQLSubscriptionOperation‘s emitting new subscription values).

  • Declaration

    Swift

    public typealias InProcess = InProcess
  • Declaration

    Swift

    public init(categoryType: CategoryType,
                eventName: HubPayloadEventName,
                request: Request,
                inProcessListener: InProcessListener? = nil,
                resultListener: ResultListener? = nil)
  • Classes that override this method must emit a completion to the inProcessPublisher upon cancellation

    Declaration

    Swift

    open override func cancel()
  • Invokes super.dispatch(). On iOS 13+, this method first publishes a .finished completion on the in-process publisher.

    Declaration

    Swift

    public override func dispatch(result: OperationResult)

    Parameters

    result

    The OperationResult to dispatch to the hub as part of the HubPayload

  • Convenience typealias for the inProcessListener callback submitted during Operation creation

    Declaration

    Swift

    typealias InProcessListener = (InProcess) -> Void
  • Dispatches an event to the hub. Internally, creates an AmplifyOperationContext object from the operation’s id, and request

    Declaration

    Swift

    func dispatchInProcess(data: InProcess)

    Parameters

    result

    The OperationResult to dispatch to the hub as part of the HubPayload

  • Removes the listener that was registered during operation instantiation

    Declaration

    Swift

    func removeInProcessResultListener()

Available where Request == StorageDownloadDataOperation.Request, InProcess == StorageDownloadDataOperation.InProcess, Success == StorageDownloadDataOperation.Success, Failure == StorageDownloadDataOperation.Failure

  • Publishes the final result of the operation

    Declaration

    Swift

    var resultPublisher: AnyPublisher<Success, Failure> { get }
  • Publishes the progress of the current operation.

    Note that depending on timing and underlying implementation, this may be called zero or more times before completion. Further, it is not guaranteed that this publisher will report 100% complete before the upload or download is finished.

    Declaration

    Swift

    var progressPublisher: AnyPublisher<Progress, Never> { get }

Available where Request == StorageDownloadFileOperation.Request, InProcess == StorageDownloadFileOperation.InProcess, Success == StorageDownloadFileOperation.Success, Failure == StorageDownloadFileOperation.Failure

  • Publishes the final result of the operation

    Declaration

    Swift

    var resultPublisher: AnyPublisher<Success, Failure> { get }
  • Publishes the progress of the current operation.

    Note that depending on timing and underlying implementation, this may be called zero or more times before completion. Further, it is not guaranteed that this publisher will report 100% complete before the upload or download is finished.

    Declaration

    Swift

    var progressPublisher: AnyPublisher<Progress, Never> { get }

Available where Request == StorageUploadDataOperation.Request, InProcess == StorageUploadDataOperation.InProcess, Success == StorageUploadDataOperation.Success, Failure == StorageUploadDataOperation.Failure

  • Publishes the final result of the operation

    Declaration

    Swift

    var resultPublisher: AnyPublisher<Success, Failure> { get }
  • Publishes the progress of the current operation.

    Note that depending on timing and underlying implementation, this may be called zero or more times before completion. Further, it is not guaranteed that this publisher will report 100% complete before the upload or download is finished.

    Declaration

    Swift

    var progressPublisher: AnyPublisher<Progress, Never> { get }

Available where Request == StorageUploadFileOperation.Request, InProcess == StorageUploadFileOperation.InProcess, Success == StorageUploadFileOperation.Success, Failure == StorageUploadFileOperation.Failure

  • Publishes the final result of the operation

    Declaration

    Swift

    var resultPublisher: AnyPublisher<Success, Failure> { get }
  • Publishes the progress of the current operation.

    Note that depending on timing and underlying implementation, this may be called zero or more times before completion. Further, it is not guaranteed that this publisher will report 100% complete before the upload or download is finished.

    Declaration

    Swift

    var progressPublisher: AnyPublisher<Progress, Never> { get }