ErxLocalDataStore
public protocol ErxLocalDataStore
Interface for the local data store
-
Fetch the ErxTask by its id and accessCode when required by
Self
Declaration
Swift
func fetchTask(by id: ErxTask.ID, accessCode: String?) -> AnyPublisher<ErxTask?, LocalStoreError>
Parameters
id
the ErxTask ID
accessCode
AccessCode, optional as required by implementing DataStore
Return Value
Publisher for the fetch request
-
List all tasks contained in the store
Declaration
Swift
func listAllTasks() -> AnyPublisher<[ErxTask], LocalStoreError>
-
Fetch the most recent
lastModified
of allErxTask
sDeclaration
Swift
func fetchLatestLastModifiedForErxTasks() -> AnyPublisher<String?, LocalStoreError>
-
Creates or updates a sequence of tasks into the store
Declaration
Swift
func save(tasks: [ErxTask], updateProfileLastAuthenticated: Bool) -> AnyPublisher<Bool, LocalStoreError>
Parameters
tasks
Array of
ErxTasks
s that should be savedupdateProfileLastAuthenticated
true
if the profile last authenticated should be updated,false
otherwise.Return Value
A publisher that finishes with
true
on completion or fails with an error. -
Deletes a sequence of tasks from the store
Declaration
Swift
func delete(tasks: [ErxTask]) -> AnyPublisher<Bool, LocalStoreError>
-
List all tasks without relationship to a
Profile
Declaration
Swift
func listAllTasksWithoutProfile() -> AnyPublisher<[ErxTask], LocalStoreError>
-
List all communications for the given profile contained in the store
Declaration
Swift
func listAllCommunications( for profile: ErxTask.Communication.Profile ) -> AnyPublisher<[ErxTask.Communication], LocalStoreError>
Parameters
profile
Filters for the passed Profile type
Return Value
array of the fetched communications or error
-
Fetch the most recent
timestamp
of allCommunication
sDeclaration
Swift
func fetchLatestTimestampForCommunications() -> AnyPublisher<String?, LocalStoreError>
-
Creates or updates the passes sequence of
ErxTaskCommunication
sDeclaration
Swift
func save(communications: [ErxTask.Communication]) -> AnyPublisher<Bool, LocalStoreError>
Parameters
communications
Array of communications that should be stored
Return Value
true
if save operation was successful -
Returns all unread communications for the given profile
Declaration
Swift
func allUnreadCommunications( for profile: ErxTask.Communication.Profile ) -> AnyPublisher<[ErxTask.Communication], LocalStoreError>
Parameters
profile
profile for which you want to have the count
-
List all medication dispenses contained in the store
Declaration
Swift
func listAllMedicationDispenses() -> AnyPublisher<[ErxMedicationDispense], LocalStoreError>
-
Creates or updates the passed sequence of
ErxTask.MedicationDispense
sDeclaration
Swift
func save(medicationDispenses: [ErxMedicationDispense]) -> AnyPublisher<Bool, LocalStoreError>
Parameters
medicationDispenses
Array of medication dispenses that should be stored
Return Value
true
if save operation was successful
-
Fetch the ErxChargeItem by its id when required by
Self
Declaration
Swift
func fetchChargeItem( by chargeItemID: ErxSparseChargeItem.ID ) -> AnyPublisher<ErxSparseChargeItem?, LocalStoreError>
Parameters
id
the ErxChargeItem ID
Return Value
Publisher for the fetch request
-
Fetch the most recent
enteredDate
of allChargeItem
sDeclaration
Swift
func fetchLatestTimestampForChargeItems() -> AnyPublisher<String?, LocalStoreError>
-
List all charge items with the given local contained in the store
Declaration
Swift
func listAllChargeItems() -> AnyPublisher<[ErxSparseChargeItem], LocalStoreError>
Return Value
Array of the fetched charge items or error
-
Creates or updates the passed sequence of
ErxSparseChargeItem
sDeclaration
Swift
func save(chargeItems: [ErxSparseChargeItem]) -> AnyPublisher<Bool, LocalStoreError>
Parameters
chargeItems
Array of charge items that should be stored
Return Value
true
if save operation was successful -
Deletes a sequence of charge items from the store
Declaration
Swift
func delete(chargeItems: [ErxSparseChargeItem]) -> AnyPublisher<Bool, LocalStoreError>
Parameters
chargeItems
Array of charge items that should be deleted
Return Value
true
if delete operation was successful