# Clinic & Room API URL: https://developers.vsee.com/guides/clinickit/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. ```swift public func loadClinicOrRoomByCode(_ clinicCode: String, success: ((_ room: Room?, _ account: Account, _ clinicType: ClinicType) -> ())?, failure: ((_ error: Error) -> ())?) ``` | Parameter | Type | Description | | --- | --- | --- | | `clinicCode` | `String` | The clinic code or room code the provider gave you. | | `success` | `Closure` | Called when the clinic or room is loaded. Receives an optional `Room`, an `Account` and a `ClinicType`. `ClinicType` is either clinic or room. | | `failure` | `Closure` | Called when the request fails. Receives an `Error`. | #### Example usage ```swift 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. ```swift public func loadAccountAndRoom(_ clinicCode: String, success: @escaping (Account, Room?) -> Void, failure: @escaping (Error) -> Void) ``` | Parameter | Type | Description | | --- | --- | --- | | `clinicCode` | `String` | The clinic code the provider gave you. | | `success` | `Closure` | Called when the account and room are loaded. Receives an `Account` and an optional `Room`. | | `failure` | `Closure` | Called when the request fails. Receives an `Error`. | #### Example usage ```swift 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. ```swift public func loadAccountAndListRoom(_ accountCode: String, success: @escaping (Account?, [Room]?) -> Void, failure: @escaping (Error) -> Void) ``` | Parameter | Type | Description | | --- | --- | --- | | `accountCode` | `String` | The clinic code the provider gave you. | | `success` | `Closure` | Called when the account and its rooms are loaded. Receives an optional `Account` and an optional array of `Room` objects. | | `failure` | `Closure` | Called when the request fails. Receives an `Error`. | ### Load a room Loads the room for the given room code. ```swift public func loadRoomByCode(_ roomCode: String, success: ((_ room: Room) -> ())?, failure: ((_ error: Error) -> ())?) ``` | Parameter | Type | Description | | --- | --- | --- | | `roomCode` | `String` | The room code the provider gave you. | | `success` | `Closure` | Called when the room is loaded. Receives a `Room`. | | `failure` | `Closure` | Called when the request fails. Receives an `Error`. | #### Example usage ```swift ClinicService.shared.loadRoomByCode(roomCode, success: { room in // Handle the loaded room }, failure: { error in // Handle the failure to load the room }) ```