Booking Manager

The Booking Manager

With the BookingManager you are able to create bookings of a room or a locker, delete bookings which are not started yet or end currently ongoing bookings.
To acquire the single instance of the Unit Controller call sdk.getBookingManager()

Kotlin / Java
sdk.getBookingManager()

Create a booking

To create a booking for a unit call

Kotlin
val response : LiveData<SimpleResponse<Booking>> = bookingManager.createBooking(unit, startsAt, endsAt)
Java

where unit is the unit you want to book, startAt is the time in milliseconds when the booking should start at and the optional endAt if the booking is not open end and have to end at some point.

Delete a booking

To delete a booking call bookingManager.deleteBooking(booking) and the given booking will be deleted. Deleting a booking will remove it from the backend.

val response : LiveData<Response<Void, Void>> = bookingManager.deleteBooking(booking)
Java

End a booking (now)

To end a booking while it is ongoing, call bookingManager.endBookingNow(booking) and the ongoing booking will be ended.

Ending a booking will only update the booking to end at current time (now), this will not delete the booking.

Kotlin
val result : LiveData<Response<Void, Void>> = bookingManager.endBookingNow(booking)
Java

Get my bookings

To get all bookings of the user call bookingManager.getMyBookings()

Kotlin
val myBookings : LiveData<SimpleResponse<List<Bookgin>>> = bookingManager.getMyBookings()
Java

This returns a list of bookings.

Get Schedules

Call bookingManager.getSchedules(localDateFrom, localDateTo, iotUnit) to get a list of schedules for the given iotUnit, or if null, for all IotUnits the user has access to in the requested period.

Kotlin
val schedules : LiveData<SimpleResponse<List<Schedule>>> = bookingManager.getSchedules(localDateFrom, localDateTo, iotUnit)
Java

the schedule object contains a list of TimePeriod with the periods when the provided iotUnit is already booked.