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 error

    Declaration

    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 PharmacyLocations 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 pharmacy

    position

    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 of PharmacyLocations or is empty when not found

  • Loads the PharmacyLocation by its telematik ID from disk

    Declaration

    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 local PharmacyLocations (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 PharmacyLocations

    Declaration

    Swift

    func save(pharmacies: [PharmacyLocation]) -> AnyPublisher<Bool, PharmacyRepositoryError>

    Parameters

    pharmacies

    the PharmacyLocations to be saved

    Return Value

    AnyPublisher that emits a boolean on success or fails with a PharmacyRepositoryError

  • Delete an array of PharmacyLocations

    Declaration

    Swift

    func delete(pharmacies: [PharmacyLocation]) -> AnyPublisher<Bool, PharmacyRepositoryError>

    Parameters

    pharmacies

    the PharmacyLocations to be deleted

    Return Value

    AnyPublisher that emits a boolean on success or fails with a PharmacyRepositoryError

  • Load certificates for a given PharmacyLocation id

    Declaration

    Swift

    func loadAvsCertificates(for id: String) -> AnyPublisher<[X509], PharmacyRepositoryError>

    Parameters

    id

    id of PharmacyLocation from which to load the certificate

    Return 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 store

    sourcery: 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 identifier

    sourcery: SkipStreamWrapped

    Declaration

    Swift

    public func delete(pharmacy: PharmacyLocation) -> AnyPublisher<Bool, PharmacyRepositoryError>

    Parameters

    pharmacy

    Instance of PharmacyLocation to be deleted