With the BookingManager
you can create bookings of a room or a locker, delete bookings that are not started yet, or end currently ongoing bookings.
To acquire the single instance of the Unit Controller call sdk.getBookingManager()
sdk.getBookingManager()
To create a booking for a unit call
val response : Result<Booking>> = bookingManager.createBooking(unitId, startsAt, endsAt)
Result<Booking> response = bookingManager.createBooking(unitId, startsAt, endsAt);
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.
To delete a booking call bookingManager.removeBooking(id)
and the given booking will be deleted. Deleting a booking will remove it from the backend.
val response : Result<Unit>> = bookingManager.removeBooking(id)
Result<Unit> response = bookingManager.removeBooking(id);
To end a booking while it is ongoing, call bookingManager.removeBooking(id)
and pass the corresponding id
, the ongoing booking will be ended and removed from the backend.
val result : Result<Unit> = bookingManager.removeBooking(id)
Result<Unit> result = bookingManager.removeBooking(id);
To get all bookings of the user call bookingManager.getMyBookings(from, to, pageConfig)
val myBookings : Result<Paged<Booking> = bookingManager.getMyBookings(from, to, pageConfig)
Result<Paged<Booking> myBookings = bookingManager.getMyBookings(from, to, pageConfig);
where from
is the time in milliseconds in string format and to
is the time in milliseconds in string format and an optional pageConfig
to load the next page.
Call bookingManager.getSchedules(unitId, from, to, pageConfig)
to get a list of schedules for the given unitId
, or if null, for all Units the user has access to in the requested period.
val schedules : Result<Paged<TimePeriod>> = bookingManager.getSchedules(unitId, from, to, pageConfig)
Result<Paged<TimePeriod>> schedules = bookingManager.getSchedules(unitId, from, to, pageConfig)
the schedule object contains a list of TimePeriod
with the periods when the provided unitId
is already booked.