FHIRClient
extension FHIRClient
-
Convenience function for requesting a certain task by ID
Declaration
Swift
public func fetchTask(by id: ErxTask.ID, accessCode: String?) -> AnyPublisher<ErxTask?, FHIRClient.Error>
Parameters
id
The ID of the task to be requested
accessCode
code to access the given
id
or nil when not required due to (previous|other) authorizationReturn Value
AnyPublisher
that emits the task or nil when not found -
Convenience function for requesting all task ids
Note
the simplifier (and the gematik specification) documentation is not clear as how to handle multiple tasks in one bundle/requests
Declaration
Swift
public func fetchAllTaskIDs(after referenceDate: String?) -> AnyPublisher<PagedContent<[String]>, FHIRClient.Error>
Parameters
referenceDate
Tasks with modification date greater or equal
referenceDate
will be fetchedReturn Value
AnyPublisher
that emits the ids for the found tasks -
Convenience function for requesting all task ids of a next page from a previous page.
Declaration
Swift
public func fetchTasksNextPage(of previousPage: PagedContent<[ErxTask]>) -> AnyPublisher<PagedContent<[String]>, FHIRClient.Error>
Parameters
previousPage
The previous page retrieved from the service
-
Convenience function for deleting a task
Declaration
Swift
public func deleteTask(by id: ErxTask.ID, accessCode: String?) -> AnyPublisher<Bool, FHIRClient.Error>
Parameters
id
The ID of the task to be requested
accessCode
code to access the given
id
or nil when not required due to (previous|other) authorizationReturn Value
AnyPublisher
that emits the task or nil when not found -
Convenience function for requesting a certain audit event by ID
Declaration
Swift
public func fetchAuditEvent(by id: ErxAuditEvent.ID) -> AnyPublisher<ErxAuditEvent?, FHIRClient.Error>
Parameters
id
The ID of the audit event to be requested
accessCode
code to access the given
id
or nil when not required due to (previous|other) authorizationReturn Value
AnyPublisher
that emits the audit event or nil when not found -
Convenience function for requesting audit events
Declaration
Swift
public func fetchAllAuditEvents( after referenceDate: String? = nil, for locale: String? = nil ) -> AnyPublisher<PagedContent<[ErxAuditEvent]>, FHIRClient.Error>
Parameters
referenceDate
Audit-Events with date greater or equal
referenceDate
will be fetched. Passnil
for fetching all audit eventslocale
Locale key for which language the audit events will be fetched. Nil if all languages should be fetched
Return Value
AnyPublisher
that emits the audit events -
Convenience function for requesting audit events
Declaration
Swift
public func fetchAuditEventsNextPage(from url: URL, locale: String?) -> AnyPublisher<PagedContent<[ErxAuditEvent]>, FHIRClient.Error>
Parameters
url
Link to load next page
locale
Location type of the language in which the result should be returned
Return Value
AnyPublisher
that emits the audit events -
Convenience function for redeeming an
ErxTask
in a pharmacyDeclaration
Swift
public func redeem(order: ErxTaskOrder) -> AnyPublisher<ErxTaskOrder, FHIRClient.Error>
Parameters
order
The information relevant for placing the order
Return Value
true
if the server responds without error and parsing has been successful, otherwise error -
Requests all communication Resources for the logged in user
[REQ:gemSpec_eRp_FdV:A_19984] validate pharmacy data format conforming to FHIR
Declaration
Swift
public func communicationResources( after referenceDate: String? ) -> AnyPublisher<[ErxTask.Communication], FHIRClient.Error>
Parameters
referenceDate
Communications with
timestamp
greater or equalreferenceDate
will be fetchedReturn Value
Array of all loaded communication resources
-
Requests medication dispenses for a specific
Prescription
Declaration
Swift
public func fetchMedicationDispenses( for id: ErxTask.ID ) -> AnyPublisher<[ErxMedicationDispense], FHIRClient.Error>
Parameters
id
MedicationDispense for the corresponding
ErxTask.ID
will be fetched.Return Value
AnyPublisher
that emitsMedicationDispense
s -
Convenience function for requesting a certain charge item by ID
Declaration
Swift
public func fetchChargeItem(by id: ErxChargeItem.ID) -> AnyPublisher<ErxChargeItem?, FHIRClient.Error>
Parameters
id
The ID of the charge item to be requested
Return Value
AnyPublisher
that emits the charge item or nil when not found -
Convenience function for requesting all charge item ids
Declaration
Swift
public func fetchAllChargeItemIDs(after referenceDate: String?) -> AnyPublisher<[String], FHIRClient.Error>
Parameters
referenceDate
Charge items with entered date greater or equal
referenceDate
will be fetchedReturn Value
AnyPublisher
that emits the ids for the found charge items -
Convenience function for deleting a charge item
Declaration
Swift
public func deleteChargeItem( by id: ErxChargeItem.ID, accessCode: String? ) -> AnyPublisher<Bool, FHIRClient.Error>
Parameters
id
The ID of the charge item to be deleted
accessCode
code to access the given
id
or nil when not required due to (previous/other) authorisationReturn Value
AnyPublisher
that emits true if the item was deleted -
Loads All consents of a given profile Uses the request headers ACCESS_TOKEN with the containing insurance id
Declaration
Swift
public func fetchConsents() -> AnyPublisher<[ErxConsent], FHIRClient.Error>
Return Value
Array of all loaded
ErxConsent
-
Send a grant consent request of an
ErxConsent
Declaration
Swift
public func grantConsent(_ consent: ErxConsent) -> AnyPublisher<ErxConsent?, FHIRClient.Error>
Parameters
consent
Consent that contains information about the type of consent and insurance id which the consent will be granted for
Return Value
The
ErxConsent
that was granted or nil when not found -
Delete an consent of
ErxConsent
to revoke itDeclaration
Swift
public func revokeConsent(_ category: ErxConsent.Category) -> AnyPublisher<Bool, FHIRClient.Error>
Parameters
category
the
ErxConsent.Category
of the consent to be revokedReturn Value
Publisher for the load request