VirtualService
public protocol VirtualService
Base Protocol to create, setup, cancel Virtual Visits
-
Resumes a Virtual Visit
Precondition
Must callpatientService.getPatient()before calling this methodDeclaration
Swift
func resumeVirtualVisit(visitId: String, presentingViewController: UIViewController, dexCarePatient: DexcarePatient, onCompletion: @escaping VisitCompletion, success: @escaping () -> Void, failure: @escaping (VirtualVisitFailedReason) -> Void)Parameters
visitIdAn existing VisitId that is active
presentingViewControllerA ViewController from which the DexcareSDK will present the waiting room view and eventually the virtual meeting
dexCarePatientThe DexcarePatient for this visit, loaded from a previous
patientService.getPatient()call. This patient’s display name will be used during the visit.onCompletionA closure called when a visit has been completed successfully or has ended with an error. A VisitCompletionReason is passed in as a paramter.
successA closure called when a visit is successfully resumed.
failureA 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
visitIdAn existing VisitId that is active
presentingViewControllerA ViewController from which the DexcareSDK will present the waiting room view and eventually the virtual meeting
ehrPatientThe EhrPatient for this visit. This patient’s display name will be used during the visit.
onCompletionA closure called when a visit has been completed successfully or has ended with an error. A VisitCompletionReason is passed in as a paramter.
successA closure called when a visit is successfully resumed.
failureA closure called if any VirtualVisitFailedReason errors are returned
-
Updates a push notification device token
Declaration
Swift
func updatePushNotificationDeviceToken(token: Data)Parameters
tokena 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
SeeVirtualEventDelegatefor more informationDeclaration
Swift
func setVirtualEventDelegate(delegate: VirtualEventDelegate?) -
Fetches the estimated
WaitTimefor a virtual visitImportant
WaitTimeis 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
visitIdA
idfrom a start or a resume virtual visit.successA closure called with a
WaitTimereturn valuefailureA closure called if any
WaitTimeFailedReasonerrors 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
SeeVideoCallStatisticsfor more information on values returnedDeclaration
Swift
func getVideoCallStatistics() -> VideoCallStatistics?Return Value
An optional
VideoCallStatisticsobject 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
visitIdA
idfrom a start or a resume virtual visit.successA closure called with a
VisitStatusenum return valuefailureA closure called if any
FailedReasonerrors are returned -
getVirtualVisitStatus(visitId:Asynchronous) 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 -> VisitStatusParameters
visitIdThe ID of a started or resumed virtual visit.
Return Value
A
VisitStatuscontaining the latest status of the virtual visit. -
getVirtualVisit(visitId:Asynchronous) Retrieves more information about the scheduled virtual visit.
Throws
FailedReasonDeclaration
Swift
func getVirtualVisit(visitId: String) async throws -> VirtualVisitParameters
visitIdAn
idfrom a start or a resume virtual visit.Return Value
A
VirtualVisitcontaining 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
visitIdAn
idfrom a start or a resume virtual visit.successA closure called with a
VirtualVisitcontaining more information about the visit.failureA closure called with a
FailedReasonif an error occurs. -
getWaitTimeAvailability(regionCodes:assignmentQualifiers: visitTypeNames: practiceId: homeMarket: includeSpecialties: success: failure: ) Fetches the WaitTimes and Availabilities
If no extra parameters are passed in to filter on, all
WaitTimeAvailabilityare returned, including any that are currently not available.Declaration
Swift
func getWaitTimeAvailability(regionCodes: [String]?, assignmentQualifiers: [VirtualVisitAssignmentQualifier]?, visitTypeNames: [VirtualVisitTypeName]?, practiceId: String?, homeMarket: String?, includeSpecialties: Bool?, success: @escaping ([WaitTimeAvailability]) -> Void, failure: @escaping (FailedReason) -> Void)Parameters
regionCodesAn optional array of RegionCodes to filter the results on
assignmentQualifiersAn optional array of
VirtualVisitAssignmentQualifierto filter the results onvisitTypeNamesAn optional array of
VirtualVisitTyperepresenting VisitTypeNames to filter the results onpracticeIdA
VirtualPractice.practiceIdto filter the results onhomeMarketA string to filter the results for a homeMarket
includeSpecialtiesA flag to filter results by specialty. Specialties can be passed via the
assignmentQualifiersparameter.successA closure called with a
WaitTimeAvailabilityarray return valuefailureA closure called if any
FailedReasonerrors are returned -
Fetches the supported
VirtualVisitAssignmentQualifierobjects that can be used to schedule a virtual visit and filterWaitTimeAvailability.Declaration
Swift
func getAssignmentQualifiers(success: @escaping ([VirtualVisitAssignmentQualifier]) -> Void, failure: @escaping (FailedReason) -> Void)Parameters
successA closure called with a
VirtualVisitAssignmentQualifierarray return valuefailureA closure called if any
FailedReasonerrors are returned -
Fetches the supported
VirtualVisitModalityobjectsDeclaration
Swift
func getModalities(success: @escaping ([VirtualVisitModality]) -> Void, failure: @escaping (FailedReason) -> Void)Parameters
successA closure called with a
VirtualVisitModalityarray return valuefailureA closure called if any
FailedReasonerrors are returned -
createVirtualVisit(presentingViewController:dexcarePatient: virtualVisitDetails: paymentMethod: actor: onCompletion: success: failure: ) Starts or creates a virtual visit with a
DexcarePatientCall 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 upVirtualVisitDetails.visitTypeNameof.phonetheonCompletionclosure will be called with aVisitCompletionReason.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
presentingViewControllerA view controller from which the virtual visit UI (waiting room, video call screen, feedback) will be presented.
dexcarePatienta
DexcarePatientobject used to book the virtual visit under. When booking for a dependent, this will be the dependent patientvirtualVisitDetailsA struct containing details specific to this visit request
paymentMethodAn enumeration with payment/billing information for this visit
actora
DexcarePatientobject when booking a virtual visit for a dependent. ArelationshipToPatientmust be set on the virtualVisitDetails property in order to book.onCompletionA closure called when a visit has been completed successfully or has ended with an error. A VisitCompletionReason is passed in as a parameter.
successA closure called when a visit is successfully created. The new visitId is passed back as the only parameter.
failureA closure called if any FailedReason errors are returned
-
createVirtualVisit(presentingViewController:ehrPatient: virtualVisitDetails: paymentMethod: actor: onCompletion: success: failure: ) Starts or creates a virtual visit with an
EhrPatientCall this method to create a new virtual visit and show its full-screen user interface on the specified view controller.
Important
If you pass upVirtualVisitDetails.visitTypeNameof.phonetheonCompletionclosure will be called with aVisitCompletionReason.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
presentingViewControllerA view controller from which the virtual visit UI (waiting room, video call screen, feedback) will be presented.
ehrPatientan
EhrPatientobject used to book the virtual visit under. When booking for a dependent, this will be the dependent patientvirtualVisitDetailsA struct containing details specific to this visit request
paymentMethodAn enumeration with payment/billing information for this visit
actora
EhrPatientobject when booking a virtual visit for a dependent. ArelationshipToPatientmust be set on the virtualVisitDetails property in order to book.onCompletionA closure called when a visit has been completed successfully or has ended with an error. A VisitCompletionReason is passed in as a parameter.
successA closure called when a visit is successfully created. The new visitId is passed back as the only parameter.
failureA closure called if any FailedReason errors are returned
-
fetchCancellationReasons()AsynchronousReturns supported
CancelReasonoptions 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, viacancelVideoVisit(visitId: String)instead.Declaration
Swift
func fetchCancellationReasons() async -> [CancelReason]Return Value
[CancelReason]array if canceling with a reason is supported.
-
cancelVideoVisit(visitId:Asynchronousreason: ) Cancels an existing valid virtual visit.
Throws
Throws:When the cancel visit fails.
VirtualVisitFailedReason.virtualVisitNotFoundis returned when visit no longer exists.VirtualVisitFailedReason.missingInformationis returned when visitId or reason code is an empty string.
Declaration
Swift
func cancelVideoVisit(visitId: String, reason: String) async throwsParameters
visitIdThe visitId that you wish to cancel
reasonThe 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
visitIdThe visitId that you wish to cancel
reasonThe code for the reason the visit was cancelled
emailEmail to send email cancellation confirmation to
successclosure when the visit was successfully cancelled
failureclosure when the cancel visit fails. If
VirtualVisitFailedReason.virtualVisitNotFoundis returned it means the visit no longer exists andVirtualVisitFailedReason.missingInformationis returned when visitId or reason code is an empty string. -
cancelPhoneVisit(visitId:Asynchronousreason: email: ) Cancels an existing valid phone visit.
Throws
Throws:When the cancel visit fails.
VirtualVisitFailedReason.virtualVisitNotFoundis returned when visit no longer exists.VirtualVisitFailedReason.missingInformationis returned when visitId or reason code is an empty string.
Declaration
Swift
func cancelPhoneVisit(visitId: String, reason: String, email: String) async throwsParameters
visitIdThe visitId that you wish to cancel
emailThe email address of the patient the cancellation confirmation will be sent to
reasonThe 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
visitIdThe ID of the visit you wish to cancel.
reasonThe code for the reason the visit was cancelled.
emailThe email address of the patient the cancellation confirmation will be sent to
successA closure called when the visit is successfully cancelled.
failureA closure called with a
VirtualVisitFailedReasonif the cancellation fails. -
cancelVirtualVisit(visitId:Asynchronous) Cancels an existing valid virtual visit.
Throws
Throws:When the cancel visit fails.VirtualVisitFailedReason.virtualVisitNotFoundis returned when visit no longer exists.
Declaration
Swift
func cancelVirtualVisit(visitId: String) async throwsParameters
visitIdThe visitId that you wish to cancel
Return Value
When successfully cancelled
-
getEstimatedWaitTime(visitId:Asynchronous) Fetches the estimated
WaitTimefor a virtual visitImportant
WaitTimeis estimated and may change. The time returned should not be used as a definitive time when a Virtual Visit will begin.Throws
Throws:WaitTimeFailedReasonDeclaration
Swift
func getEstimatedWaitTime(visitId: String) async throws -> WaitTimeParameters
visitIdA
idfrom a start or a resume virtual visit.Return Value
WaitTimeobject -
getAssignmentQualifiers()AsynchronousFetches the supported
VirtualVisitAssignmentQualifierobjects that can be used to schedule a virtual visit and filterWaitTimeAvailability.Throws
Throws:FailedReasonDeclaration
Swift
func getAssignmentQualifiers() async throws -> [VirtualVisitAssignmentQualifier]Return Value
: A
VirtualVisitAssignmentQualifierarray -
getModalities()AsynchronousFetches the supported
VirtualVisitModalityobjectsThrows
Throws:FailedReasonDeclaration
Swift
func getModalities() async throws -> [VirtualVisitModality]Return Value
VirtualVisitModalityarray -
Resumes a Virtual Visit
Throws
VirtualVisitFailedReasonPrecondition
Must callpatientService.getPatient()before calling this methodDeclaration
Swift
func resumeVirtualVisit(visitId: String, presentingViewController: UIViewController, dexCarePatient: DexcarePatient, onCompletion: @escaping VisitCompletion) async throwsParameters
visitIdAn existing VisitId that is active
presentingViewControllerA ViewController from which the DexcareSDK will present the waiting room view and eventually the virtual meeting
dexCarePatientThe DexcarePatient for this visit, loaded from a previous
patientService.getPatient()call. This patient’s display name will be used during the visit.onCompletionA 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
Throws
VirtualVisitFailedReasonDeclaration
Swift
func resumeVirtualVisit(visitId: String, presentingViewController: UIViewController, ehrPatient: EhrPatient, onCompletion: @escaping VisitCompletion) async throwsParameters
visitIdAn existing VisitId that is active
presentingViewControllerA ViewController from which the DexcareSDK will present the waiting room view and eventually the virtual meeting
ehrPatientThe EhrPatient for this visit. This patient’s display name will be used during the visit.
onCompletionA 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
-
getWaitTimeAvailability(regionCodes:AsynchronousassignmentQualifiers: visitTypeNames: practiceId: homeMarket: includeSpecialties: ) Fetches the WaitTimes and Availabilities
If no extra parameters are passed in to filter on, all
WaitTimeAvailabilityare returned, including any that are currently not available.Throws
FailedReasonDeclaration
Swift
func getWaitTimeAvailability(regionCodes: [String]?, assignmentQualifiers: [VirtualVisitAssignmentQualifier]?, visitTypeNames: [VirtualVisitTypeName]?, practiceId: String?, homeMarket: String?, includeSpecialties: Bool?) async throws -> [WaitTimeAvailability]Parameters
regionCodesAn optional array of RegionCodes to filter the results on
assignmentQualifiersAn optional array of
VirtualVisitAssignmentQualifierto filter the results onvisitTypeNamesAn optional array of
VirtualVisitTyperepresenting VisitTypeNames to filter the results onpracticeIdA
VirtualPractice.practiceIdto filter the results onhomeMarketA string to filter the results for a homeMarket
includeSpecialtiesA flag to filter results by specialty. Specialties can be passed via the
assignmentQualifiersparameter.Return Value
WaitTimeAvailabilityarray
View on GitHub
Install in Dash