ClinicKit Mobile SDK / iOS

iOS Clinic & Room API

A Clinic represents a healthcare facility. A Room is an individual examination or treatment space within the clinic. ClinicService loads both.

Load a clinic or room from a code

Loads the clinic or room for the code the provider gave you.

public func loadClinicOrRoomByCode(_ clinicCode: String,
                                  success: ((_ room: Room?, _ account: Account, _ clinicType: ClinicType) -> ())?,
                                  failure: ((_ error: Error) -> ())?)
ParameterTypeDescription
clinicCodeStringThe clinic code or room code the provider gave you.
successClosureCalled when the clinic or room is loaded. Receives an optional Room, an Account and a ClinicType. ClinicType is either clinic or room.
failureClosureCalled when the request fails. Receives an Error.

Example usage

ClinicService.shared.loadClinicOrRoomByCode(clinicCode) { [weak self] room, account, type in
    // room: room data from the server
    // account: clinic data from the server
    // type: room or clinic
    success?(room, account, type)
} failure: { [weak self] error in
    // Handle the failure and display an error message
    failure?()
}

Load a clinic and room

Loads the account (clinic) and room for the given clinic code.

public func loadAccountAndRoom(_ clinicCode: String,
                              success: @escaping (Account, Room?) -> Void,
                              failure: @escaping (Error) -> Void)
ParameterTypeDescription
clinicCodeStringThe clinic code the provider gave you.
successClosureCalled when the account and room are loaded. Receives an Account and an optional Room.
failureClosureCalled when the request fails. Receives an Error.

Example usage

ClinicService.shared.loadAccountAndRoom(roomcode, success: { account, room in
    // Handle the loaded account and room
}) { error in
    // Handle the failure and display an error message
}

Load a clinic and its rooms

Loads the account (clinic) and the list of its rooms.

public func loadAccountAndListRoom(_ accountCode: String,
                                    success: @escaping (Account?, [Room]?) -> Void,
                                    failure: @escaping (Error) -> Void)
ParameterTypeDescription
accountCodeStringThe clinic code the provider gave you.
successClosureCalled when the account and its rooms are loaded. Receives an optional Account and an optional array of Room objects.
failureClosureCalled when the request fails. Receives an Error.

Load a room

Loads the room for the given room code.

public func loadRoomByCode(_ roomCode: String,
                          success: ((_ room: Room) -> ())?,
                          failure: ((_ error: Error) -> ())?)
ParameterTypeDescription
roomCodeStringThe room code the provider gave you.
successClosureCalled when the room is loaded. Receives a Room.
failureClosureCalled when the request fails. Receives an Error.

Example usage

ClinicService.shared.loadRoomByCode(roomCode, success: { room in
    // Handle the loaded room
}, failure: { error in
    // Handle the failure to load the room
})