VirtualService

public protocol VirtualService

Base Protocol to create, setup, cancel Virtual Visits

  • Resumes a Virtual Visit

    Precondition

    Must call patientService.getPatient() before calling this method

    Declaration

    Swift

    func resumeVirtualVisit(visitId: String, presentingViewController: UIViewController, dexCarePatient: DexcarePatient, onCompletion: @escaping VisitCompletion, success: @escaping () -> Void, failure: @escaping (VirtualVisitFailedReason) -> Void)

    Parameters

    visitId

    An existing VisitId that is active

    presentingViewController

    A ViewController from which the DexcareSDK will present the waiting room view and eventually the virtual meeting

    dexCarePatient

    The DexcarePatient for this visit, loaded from a previous patientService.getPatient() call. This patient’s display name will be used during the visit.

    onCompletion

    A closure called when a visit has been completed successfully or has ended with an error. A VisitCompletionReason is passed in as a paramter.

    success

    A closure called when a visit is successfully resumed.

    failure

    A closure called if any VirtualVisitFailedReason errors are returned

  • Resumes a Virtual Visit

    Declaration

    Swift

    func resumeVirtualVisit(visitId: String, presentingViewController: UIViewController, ehrPatient: EhrPatient, onCompletion: @escaping VisitCompletion, success: @escaping () -> Void, failure: @escaping (VirtualVisitFailedReason) -> Void)

    Parameters

    visitId

    An existing VisitId that is active

    presentingViewController

    A ViewController from which the DexcareSDK will present the waiting room view and eventually the virtual meeting

    ehrPatient

    The EhrPatient for this visit. This patient’s display name will be used during the visit.

    onCompletion

    A closure called when a visit has been completed successfully or has ended with an error. A VisitCompletionReason is passed in as a paramter.

    success

    A closure called when a visit is successfully resumed.

    failure

    A closure called if any VirtualVisitFailedReason errors are returned

  • Updates a push notification device token

    Declaration

    Swift

    func updatePushNotificationDeviceToken(token: Data)

    Parameters

    token

    a device token that is returned by an iOS device in AppDelegate.application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data)

  • Sets the delegate to invoke various events allowing you to capture analytics.

    Note

    See VirtualEventDelegate for more information

    Declaration

    Swift

    func setVirtualEventDelegate(delegate: VirtualEventDelegate?)
  • Fetches the estimated WaitTime for a virtual visit

    Important

    WaitTime is estimated and may change. The time returned should not be used as a definitive time when a Virtual Visit will begin.

    Declaration

    Swift

    func getEstimatedWaitTime(visitId: String, success: @escaping (WaitTime) -> Void, failure: @escaping (WaitTimeFailedReason) -> Void)

    Parameters

    visitId

    A id from a start or a resume virtual visit.

    success

    A closure called with a WaitTime return value

    failure

    A closure called if any WaitTimeFailedReason errors are returned

  • Gets the statistics report from the OpenTok (Vonage) SDK from a virtual visit. Virtual Visit must have been started in the current app session, and the Provider must have started the visit for this method to return any results. These statistics are only stored in memory, and are cleared upon starting a new visit, calling DexCareSDK.signOut(), or by closing the app (since they’re only in memory)

    Note

    See VideoCallStatistics for more information on values returned

    Declaration

    Swift

    func getVideoCallStatistics() -> VideoCallStatistics?

    Return Value

    An optionalVideoCallStatistics object containing stats about the visit

  • Fetches the latest status for a virtual visit

    Declaration

    Swift

    @available(*, deprecated, message: "Use getVirtualVisit(﹚ instead to get visit status")
    func getVirtualVisitStatus(visitId: String, success: @escaping (VisitStatus) -> Void, failure: @escaping (FailedReason) -> Void)

    Parameters

    visitId

    A id from a start or a resume virtual visit.

    success

    A closure called with a VisitStatus enum return value

    failure

    A closure called if any FailedReason errors are returned

  • Fetches the latest status for a virtual visit.

    Throws

    Declaration

    Swift

    @available(*, deprecated, message: "Use getVirtualVisit(﹚ instead to get visit status")
    func getVirtualVisitStatus(visitId: String) async throws -> VisitStatus

    Parameters

    visitId

    The ID of a started or resumed virtual visit.

    Return Value

    A VisitStatus containing the latest status of the virtual visit.

  • Retrieves more information about the scheduled virtual visit.

    Throws

    FailedReason

    Declaration

    Swift

    func getVirtualVisit(visitId: String) async throws -> VirtualVisit

    Parameters

    visitId

    An id from a start or a resume virtual visit.

    Return Value

    A VirtualVisit containing more information about the visit.

  • Retrieves more information about the scheduled virtual visit.

    Declaration

    Swift

    func getVirtualVisit(visitId: String, success: @escaping (VirtualVisit) -> Void, failure: @escaping (FailedReason) -> Void)

    Parameters

    visitId

    An id from a start or a resume virtual visit.

    success

    A closure called with a VirtualVisit containing more information about the visit.

    failure

    A closure called with a FailedReason if an error occurs.

  • Fetches the WaitTimes and Availabilities

    If no extra parameters are passed in to filter on, all WaitTimeAvailability are returned, including any that are currently not available.

    Declaration

    Swift

    func getWaitTimeAvailability(regionCodes: [String]?, assignmentQualifiers: [VirtualVisitAssignmentQualifier]?, visitTypeNames: [VirtualVisitTypeName]?, practiceId: String?, homeMarket: String?, success: @escaping ([WaitTimeAvailability]) -> Void, failure: @escaping (FailedReason) -> Void)

    Parameters

    regionCodes

    An optional array of RegionCodes to filter the results on

    assignmentQualifiers

    An optional array of VirtualVisitAssignmentQualifier to filter the results on

    visitTypeNames

    An optional array of VirtualVisitType representing VisitTypeNames to filter the results on

    practiceId

    A VirtualPractice.practiceId to filter the results on

    homeMarket

    A string to filter the results for a homeMarket

    success

    A closure called with a WaitTimeAvailability array return value

    failure

    A closure called if any FailedReason errors are returned

  • Fetches the supported VirtualVisitAssignmentQualifier objects that can be used to schedule a virtual visit and filter WaitTimeAvailability.

    Declaration

    Swift

    func getAssignmentQualifiers(success: @escaping ([VirtualVisitAssignmentQualifier]) -> Void, failure: @escaping (FailedReason) -> Void)

    Parameters

    success

    A closure called with a VirtualVisitAssignmentQualifier array return value

    failure

    A closure called if any FailedReason errors are returned

  • Fetches the supported VirtualVisitModality objects

    Declaration

    Swift

    func getModalities(success: @escaping ([VirtualVisitModality]) -> Void, failure: @escaping (FailedReason) -> Void)

    Parameters

    success

    A closure called with a VirtualVisitModality array return value

    failure

    A closure called if any FailedReason errors are returned

  • Starts or creates a virtual visit with a DexcarePatient

    Call this method to create a new virtual visit and show its full-screen user interface on the specified view controller. Before calling this method, at least one patient must be created by calling patientService.findOrCreatePatient() if the current user is the patient, patientService.findOrCreateDependentPatient() if the patient is a dependent (anyone other than the logged in user) must call.

    If the patient already exists, you do not need to call the above method, but the demographic must exist in the ehrSystem you are trying to book to.

    Important

    If you pass up VirtualVisitDetails.visitTypeName of .phone the onCompletion closure will be called with a VisitCompletionReason.phoneVisit. This does not mean the visit is complete, but that you have successfully scheduled a visit and the provider will phone you. The full screen user interface will not show on a phone visit.

    Declaration

    Swift

    func createVirtualVisit(presentingViewController: UIViewController, dexcarePatient: DexcarePatient, virtualVisitDetails: VirtualVisitDetails, paymentMethod: PaymentMethod, actor: DexcarePatient?, onCompletion: @escaping VisitCompletion, success: @escaping (String) -> Void, failure: @escaping (VirtualVisitFailedReason) -> Void)

    Parameters

    presentingViewController

    A view controller from which the virtual visit UI (waiting room, video call screen, feedback) will be presented.

    dexcarePatient

    a DexcarePatient object used to book the virtual visit under. When booking for a dependent, this will be the dependent patient

    virtualVisitDetails

    A struct containing details specific to this visit request

    paymentMethod

    An enumeration with payment/billing information for this visit

    actor

    a DexcarePatient object when booking a virtual visit for a dependent. A relationshipToPatient must be set on the virtualVisitDetails property in order to book.

    onCompletion

    A closure called when a visit has been completed successfully or has ended with an error. A VisitCompletionReason is passed in as a parameter.

    success

    A closure called when a visit is successfully created. The new visitId is passed back as the only parameter.

    failure

    A closure called if any FailedReason errors are returned

  • Starts or creates a virtual visit with an EhrPatient

    Call this method to create a new virtual visit and show its full-screen user interface on the specified view controller.

    Important

    If you pass up VirtualVisitDetails.visitTypeName of .phone the onCompletion closure will be called with a VisitCompletionReason.phoneVisit. This does not mean the visit is complete, but that you have successfully scheduled a visit and the provider will phone you. The full screen user interface will not show on a phone visit.

    Declaration

    Swift

    func createVirtualVisit(presentingViewController: UIViewController, ehrPatient: EhrPatient, virtualVisitDetails: VirtualVisitDetails, paymentMethod: PaymentMethod, actor: EhrPatient?, onCompletion: @escaping VisitCompletion, success: @escaping (String) -> Void, failure: @escaping (VirtualVisitFailedReason) -> Void)

    Parameters

    presentingViewController

    A view controller from which the virtual visit UI (waiting room, video call screen, feedback) will be presented.

    ehrPatient

    an EhrPatient object used to book the virtual visit under. When booking for a dependent, this will be the dependent patient

    virtualVisitDetails

    A struct containing details specific to this visit request

    paymentMethod

    An enumeration with payment/billing information for this visit

    actor

    a EhrPatient object when booking a virtual visit for a dependent. A relationshipToPatient must be set on the virtualVisitDetails property in order to book.

    onCompletion

    A closure called when a visit has been completed successfully or has ended with an error. A VisitCompletionReason is passed in as a parameter.

    success

    A closure called when a visit is successfully created. The new visitId is passed back as the only parameter.

    failure

    A closure called if any FailedReason errors are returned

  • Returns supported CancelReason options used when canceling virtual visits (cancelVideoVisit(visitId: String, reason: String))

    Important

    Returns an empty array if canceling with reason is not supported. If an empty array is returned cancelation request must be submitted without a reason, via cancelVideoVisit(visitId: String) instead.

    Declaration

    Swift

    func fetchCancellationReasons() async -> [CancelReason]

    Return Value

    [CancelReason] array if canceling with a reason is supported.

ASYNC FUNCTIONS

  • Cancels an existing valid virtual visit.

    Throws

    Throws:When the cancel visit fails.

    Declaration

    Swift

    func cancelVideoVisit(visitId: String, reason: String) async throws

    Parameters

    visitId

    The visitId that you wish to cancel

    reason

    The code for the reason the visit was cancelled

    Return Value

    When successfully cancelled

  • Cancels an existing valid virtual visit.

    Declaration

    Swift

    func cancelVideoVisit(visitId: String, reason: String, success: @escaping () -> Void, failure: @escaping (VirtualVisitFailedReason) -> Void)

    Parameters

    visitId

    The visitId that you wish to cancel

    reason

    The code for the reason the visit was cancelled

    email

    Email to send email cancellation confirmation to

    success

    closure when the visit was successfully cancelled

    failure

    closure when the cancel visit fails. If VirtualVisitFailedReason.virtualVisitNotFound is returned it means the visit no longer exists and VirtualVisitFailedReason.missingInformation is returned when visitId or reason code is an empty string.

  • Cancels an existing valid phone visit.

    Throws

    Throws:When the cancel visit fails.

    Declaration

    Swift

    func cancelPhoneVisit(visitId: String, reason: String, email: String) async throws

    Parameters

    visitId

    The visitId that you wish to cancel

    email

    The email address of the patient the cancellation confirmation will be sent to

    reason

    The code for the reason the visit was cancelled

    Return Value

    When successfully cancelled

  • Cancels an existing valid phone visit.

    Declaration

    Swift

    @available(*, deprecated, message: "Use cancelPhoneVisit(﹚ or cancelVideoVisit instead to cancel visits")
    func cancelPhoneVisit(visitId: String, reason: String, email: String, success: @escaping () -> Void, failure: @escaping (VirtualVisitFailedReason) -> Void)

    Parameters

    visitId

    The ID of the visit you wish to cancel.

    reason

    The code for the reason the visit was cancelled.

    email

    The email address of the patient the cancellation confirmation will be sent to

    success

    A closure called when the visit is successfully cancelled.

    failure

    A closure called with a VirtualVisitFailedReason if the cancellation fails.

  • Cancels an existing valid virtual visit.

    Throws

    Throws:When the cancel visit fails.

    Declaration

    Swift

    func cancelVirtualVisit(visitId: String) async throws

    Parameters

    visitId

    The visitId that you wish to cancel

    Return Value

    When successfully cancelled

  • Fetches the estimated WaitTime for a virtual visit

    Important

    WaitTime is estimated and may change. The time returned should not be used as a definitive time when a Virtual Visit will begin.

    Throws

    Throws:WaitTimeFailedReason

    Declaration

    Swift

    func getEstimatedWaitTime(visitId: String) async throws -> WaitTime

    Parameters

    visitId

    A id from a start or a resume virtual visit.

    Return Value

    WaitTime object

  • Fetches the supported VirtualVisitAssignmentQualifier objects that can be used to schedule a virtual visit and filter WaitTimeAvailability.

    Throws

    Throws:FailedReason

    Declaration

    Swift

    func getAssignmentQualifiers() async throws -> [VirtualVisitAssignmentQualifier]

    Return Value

    : A VirtualVisitAssignmentQualifier array

  • getModalities() Asynchronous

    Fetches the supported VirtualVisitModality objects

    Throws

    Throws:FailedReason

    Declaration

    Swift

    func getModalities() async throws -> [VirtualVisitModality]

    Return Value

    VirtualVisitModality array

  • Resumes a Virtual Visit

    Precondition

    Must call patientService.getPatient() before calling this method

    Declaration

    Swift

    func resumeVirtualVisit(visitId: String, presentingViewController: UIViewController, dexCarePatient: DexcarePatient, onCompletion: @escaping VisitCompletion) async throws

    Parameters

    visitId

    An existing VisitId that is active

    presentingViewController

    A ViewController from which the DexcareSDK will present the waiting room view and eventually the virtual meeting

    dexCarePatient

    The DexcarePatient for this visit, loaded from a previous patientService.getPatient() call. This patient’s display name will be used during the visit.

    onCompletion

    A closure called when a visit has been completed successfully or has ended with an error. A VisitCompletionReason is passed in as a parameter.

    Return Value

    When a visit is successfully resumed

  • Resumes a Virtual Visit

    Declaration

    Swift

    func resumeVirtualVisit(visitId: String, presentingViewController: UIViewController, ehrPatient: EhrPatient, onCompletion: @escaping VisitCompletion) async throws

    Parameters

    visitId

    An existing VisitId that is active

    presentingViewController

    A ViewController from which the DexcareSDK will present the waiting room view and eventually the virtual meeting

    ehrPatient

    The EhrPatient for this visit. This patient’s display name will be used during the visit.

    onCompletion

    A closure called when a visit has been completed successfully or has ended with an error. A VisitCompletionReason is passed in as a parameter.

    Return Value

    When a visit is successfully resumed

  • Fetches the WaitTimes and Availabilities

    If no extra parameters are passed in to filter on, all WaitTimeAvailability are returned, including any that are currently not available.

    Throws

    FailedReason

    Declaration

    Swift

    func getWaitTimeAvailability(regionCodes: [String]?, assignmentQualifiers: [VirtualVisitAssignmentQualifier]?, visitTypeNames: [VirtualVisitTypeName]?, practiceId: String?, homeMarket: String?) async throws -> [WaitTimeAvailability]

    Parameters

    regionCodes

    An optional array of RegionCodes to filter the results on

    assignmentQualifiers

    An optional array of VirtualVisitAssignmentQualifier to filter the results on

    visitTypeNames

    An optional array of VirtualVisitType representing VisitTypeNames to filter the results on

    practiceId

    A VirtualPractice.practiceId to filter the results on

    homeMarket

    A string to filter the results for a homeMarket

    Return Value

    WaitTimeAvailability array