PharmacyRepository
public protocol PharmacyRepository
Interface for the app to the Pharmacy data layer sourcery: StreamWrapped
-
Loads the
PharmacyLocation
by its telematik ID from a remote server and updates only properties that are loaded from remote. If pharmacy is not jet in local store this method will return an errorDeclaration
Swift
func updateFromRemote(by telematikId: String) -> AnyPublisher<PharmacyLocation, PharmacyRepositoryError>
Parameters
telematikId
The telematik ID of the pharmacy
Return Value
Publisher for the load and saved request or fails
-
Loads the
PharmacyLocation
by its telematik ID from disk or if not present from a remote (server).Declaration
Swift
func loadCached(by telematikId: String) -> AnyPublisher<PharmacyLocation?, PharmacyRepositoryError>
Parameters
telematikId
the telematik ID of the pharmacy
Return Value
Publisher for the load request
-
Loads
PharmacyLocation
s with search term from a remote (server).Declaration
Swift
func searchRemote(searchTerm: String, position: Position?, filter: [PharmacyRepositoryFilter]) -> AnyPublisher<[PharmacyLocation], PharmacyRepositoryError>
Parameters
searchTerm
the
searchTerm
for the pharmacyposition
the Position which is used as a search point for an “around me” search
filter
further filter parameters for pharmacies
Return Value
AnyPublisher
that emits a list ofPharmacyLocation
s or is empty when not found -
Loads the
PharmacyLocation
by its telematik ID from diskDeclaration
Swift
func loadLocal(by telematikId: String) -> AnyPublisher<PharmacyLocation?, PharmacyRepositoryError>
Parameters
telematikId
the telematik ID of the pharmacy
Return Value
Publisher for the load request
-
Load
count
localPharmacyLocation
s (from disk)Declaration
Swift
func loadLocal(count: Int?) -> AnyPublisher<[PharmacyLocation], PharmacyRepositoryError>
Parameters
count
Count of pharmacies to fetch, Nil if no fetch limit should be applied
Return Value
Publisher for the load request
-
Saves an array of
PharmacyLocation
sDeclaration
Swift
func save(pharmacies: [PharmacyLocation]) -> AnyPublisher<Bool, PharmacyRepositoryError>
Parameters
pharmacies
the
PharmacyLocation
s to be savedReturn Value
AnyPublisher
that emits a boolean on success or fails with aPharmacyRepositoryError
-
Delete an array of
PharmacyLocation
sDeclaration
Swift
func delete(pharmacies: [PharmacyLocation]) -> AnyPublisher<Bool, PharmacyRepositoryError>
Parameters
pharmacies
the
PharmacyLocation
s to be deletedReturn Value
AnyPublisher
that emits a boolean on success or fails with aPharmacyRepositoryError
-
Load certificates for a given
PharmacyLocation
idDeclaration
Swift
func loadAvsCertificates(for id: String) -> AnyPublisher<[X509], PharmacyRepositoryError>
Parameters
id
id of
PharmacyLocation
from which to load the certificateReturn Value
Emits an array of certificates on success or fails with a
PharmacyRepositoryError
-
save(pharmacy:
Extension method) Creates or updates a
PharmacyLocation
into the store. Updates if the identifier does already exist in storesourcery: SkipStreamWrapped
Declaration
Swift
public func save(pharmacy: PharmacyLocation) -> AnyPublisher<Bool, PharmacyRepositoryError>
Parameters
pharmacy
Instance of
PharmacyLocation
to be saved -
delete(pharmacy:
Extension method) Deletes a
PharmacyLocation
from the store with the related identifiersourcery: SkipStreamWrapped
Declaration
Swift
public func delete(pharmacy: PharmacyLocation) -> AnyPublisher<Bool, PharmacyRepositoryError>
Parameters
pharmacy
Instance of
PharmacyLocation
to be deleted