PharmacyRepository
public protocol PharmacyRepository
Interface for the app to the Pharmacy data layer sourcery: StreamWrapped
-
Loads the
PharmacyLocationby 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
telematikIdThe telematik ID of the pharmacy
Return Value
Publisher for the load and saved request or fails
-
Loads the
PharmacyLocationby its telematik ID from disk or if not present from a remote (server).Declaration
Swift
func loadCached(by telematikId: String) -> AnyPublisher<PharmacyLocation?, PharmacyRepositoryError>Parameters
telematikIdthe telematik ID of the pharmacy
Return Value
Publisher for the load request
-
Loads
PharmacyLocations with search term from a remote (server).Declaration
Swift
func searchRemote( searchTerm: String, position: Position?, filter: [PharmacyRepositoryFilter] ) -> AnyPublisher<[PharmacyLocation], PharmacyRepositoryError>Parameters
searchTermthe
searchTermfor the pharmacypositionthe Position which is used as a search point for an “around me” search
filterfurther filter parameters for pharmacies
Return Value
AnyPublisherthat emits a list ofPharmacyLocations or is empty when not found -
Loads the
PharmacyLocationby its telematik ID from diskDeclaration
Swift
func loadLocal(by telematikId: String) -> AnyPublisher<PharmacyLocation?, PharmacyRepositoryError>Parameters
telematikIdthe telematik ID of the pharmacy
Return Value
Publisher for the load request
-
Load
countlocalPharmacyLocations (from disk)Declaration
Swift
func loadLocal(count: Int?) -> AnyPublisher<[PharmacyLocation], PharmacyRepositoryError>Parameters
countCount of pharmacies to fetch, Nil if no fetch limit should be applied
Return Value
Publisher for the load request
-
Saves an array of
PharmacyLocationsDeclaration
Swift
func save(pharmacies: [PharmacyLocation]) -> AnyPublisher<Bool, PharmacyRepositoryError>Parameters
pharmaciesthe
PharmacyLocations to be savedReturn Value
AnyPublisherthat emits a boolean on success or fails with aPharmacyRepositoryError -
Delete an array of
PharmacyLocationsDeclaration
Swift
func delete(pharmacies: [PharmacyLocation]) -> AnyPublisher<Bool, PharmacyRepositoryError>Parameters
pharmaciesthe
PharmacyLocations to be deletedReturn Value
AnyPublisherthat emits a boolean on success or fails with aPharmacyRepositoryError -
Load certificates for a given
PharmacyLocationidDeclaration
Swift
func loadAvsCertificates(for id: String) -> AnyPublisher<[X509], PharmacyRepositoryError>Parameters
idid of
PharmacyLocationfrom which to load the certificateReturn Value
Emits an array of certificates on success or fails with a
PharmacyRepositoryError -
Load
Insuranceby institution identifier (IK) from a remote (server).Declaration
Swift
func fetchInsurance(ikNumber: String) -> AnyPublisher<Insurance?, PharmacyRepositoryError>Parameters
ikNumberThe institution (IK) identifier of the organization to be requested
Return Value
AnyPublisherthat emits theInsuranceor nil when not found -
Loads an array of
Insurancefrom a remote (server).Declaration
Swift
func fetchAllInsurances() -> AnyPublisher<[Insurance], PharmacyRepositoryError>Return Value
AnyPublisherthat emits array ofInsuranceor empty when nothing is found -
save(pharmacy:Extension method) Creates or updates a
PharmacyLocationinto the store. Updates if the identifier does already exist in storesourcery: SkipStreamWrapped
Declaration
Swift
public func save(pharmacy: PharmacyLocation) -> AnyPublisher<Bool, PharmacyRepositoryError>Parameters
pharmacyInstance of
PharmacyLocationto be saved -
delete(pharmacy:Extension method) Deletes a
PharmacyLocationfrom the store with the related identifiersourcery: SkipStreamWrapped
Declaration
Swift
public func delete(pharmacy: PharmacyLocation) -> AnyPublisher<Bool, PharmacyRepositoryError>Parameters
pharmacyInstance of
PharmacyLocationto be deleted
View on GitHub
PharmacyRepository Protocol Reference