BookingManager

interface BookingManager : SupportBookingManager

Manages user bookings on the units

Functions

createBooking
Link copied to clipboard
abstract suspend fun createBooking(unitId: String, startsAt: String, endsAt: String, uniqueRequestId: String = UUID.randomUUID().toString()): Result<Booking>

Create a booking for the given unitId.

abstract fun createBooking(unitId: String, startsAt: String, endsAt: String, uniqueRequestId: String = UUID.randomUUID().toString(), callback: (Result<Booking>) -> Unit): Cancelable
abstract fun createBooking(unitId: String, startsAt: String, endsAt: String, uniqueRequestId: String = UUID.randomUUID().toString(), lifecycleOwner: LifecycleOwner, callback: (Result<Booking>) -> Unit): Cancelable

Support function to create a booking for the given unitId.

createBookingInClusterLiveData
Link copied to clipboard
abstract fun createBookingInClusterLiveData(unitOrClusterId: String, startsAt: Long): LiveData<SimpleResponse<Booking>?>

After logout LiveData.getValue is set to null. You need to re-observe this LiveData once the user is logged out!

createBookingLiveData
Link copied to clipboard
abstract fun createBookingLiveData(iotUnit: IotUnit, startsAt: Long, endsAt: Long?): LiveData<SimpleResponse<Booking>?>

Create a booking for the given unit. startsAt and endsAt are defined in epoch in milliseconds. endsAt is an optional parameter because some units can have an open ended booking.

endBookingNowLiveData
Link copied to clipboard
abstract fun endBookingNowLiveData(booking: Booking): LiveData<SimpleResponse<Void>?>

Ends an existing booking. That call is used for currently ongoing bookings.

getBookableParameters
Link copied to clipboard
abstract suspend fun getBookableParameters(unitId: String): Result<BookableParams>

Get the booking parameters for a unit.

abstract fun getBookableParameters(unitId: String, callback: (Result<BookableParams>) -> Unit): Cancelable
abstract fun getBookableParameters(unitId: String, lifecycleOwner: LifecycleOwner, callback: (Result<BookableParams>) -> Unit): Cancelable

Support function to get the booking parameters for a unit.

getBookableUnits
Link copied to clipboard
abstract suspend fun getBookableUnits(parentUnitId: String? = null, pageConfig: PageConfig?, endsAfter: String): Result<Paged<SensorbergUnit.BookableUnit>>

Get BookableUnit's in a paginated way.

abstract fun getBookableUnits(parentUnitId: String? = null, pageConfig: PageConfig?, endsAfter: String, callback: (Result<Paged<SensorbergUnit.BookableUnit>>) -> Unit): Cancelable
abstract fun getBookableUnits(parentUnitId: String? = null, pageConfig: PageConfig?, endsAfter: String, lifecycleOwner: LifecycleOwner, callback: (Result<Paged<SensorbergUnit.BookableUnit>>) -> Unit): Cancelable

Support function to get BookableUnit's in a paginated way. Returns a single page with key to next page.

getBookings
Link copied to clipboard
abstract suspend fun getBookings(endsAfter: String, startsBefore: String? = null, pageConfig: PageConfig? = null): Result<Paged<Booking>>

Get Booking's. Bookings are sorted by Booking.startsAt. You will get bookings paginated based on your PageConfig.

abstract fun getBookings(endsAfter: String, startsBefore: String, pageConfig: PageConfig?, callback: (Result<Paged<Booking>>) -> Unit): Cancelable
abstract fun getBookings(endsAfter: String, startsBefore: String, pageConfig: PageConfig?, lifecycleOwner: LifecycleOwner, callback: (Result<Paged<Booking>>) -> Unit): Cancelable

Support function to get Booking's in a paginated way. Returns a single page with key to next page.

getMyBookingsLiveData
Link copied to clipboard
abstract fun getMyBookingsLiveData(): LiveData<SimpleResponse<List<Booking>>?>

Get a LiveData for the logged user existing bookings. Those can be for either DOOR or LOCKER_BOX types.

getSchedules
Link copied to clipboard
abstract suspend fun getSchedules(unitId: String, endsAfter: String, startsBefore: String? = null, pageConfig: PageConfig? = null): Result<Paged<TimePeriod>>

Get a paginated TimePeriod for the given unitId.

abstract fun getSchedules(unitId: String, endsAfter: String, startsBefore: String? = null, pageConfig: PageConfig? = null, callback: (Result<Paged<TimePeriod>>) -> Unit): Cancelable
abstract fun getSchedules(unitId: String, endsAfter: String, startsBefore: String? = null, pageConfig: PageConfig? = null, lifecycleOwner: LifecycleOwner, callback: (Result<Paged<TimePeriod>>) -> Unit): Cancelable

Support function to get a paginated TimePeriod for the given unitId.

getSchedulesLiveData
Link copied to clipboard
abstract fun getSchedulesLiveData(from: LocalDate, to: LocalDate, iotUnit: IotUnit? = null): LiveData<SimpleResponse<List<Schedule>>?>

Get a LiveData with the schedule for the supplied iotUnit, or if null, for all IotUnit the user has access to on the requested periods.

removeBooking
Link copied to clipboard
abstract suspend fun removeBooking(id: String): Result<Unit>

Removes a booking.

abstract fun removeBooking(id: String, callback: (Result<Unit>) -> Unit): Cancelable
abstract fun removeBooking(id: String, lifecycleOwner: LifecycleOwner, callback: (Result<Unit>) -> Unit): Cancelable

Support function to remove a booking.