-
Notifications
You must be signed in to change notification settings - Fork 1
Trips
Trips module provides interface for creating & managing user trips.
See trips module api-doc.
Working with trips module requires enabled user-data.
Trips module comes with two basic DTOs: TripInfo and Trip.Trip
is a subtype of TripInfo
and contains a days
property of List<TripDay>
type. TripInfo entity represents a partially loaded trip and Trip entity represents a fully loaded trip. Trip day is represented by a TripDay
entity, particular places in the day-itinerary are represented by a TripDayItem
entity.
You may directly manipulate with a trip entity and its related entities. To persist changes to the local stage, call trip's facade save()
method.
Adding an item to the trip's first day:
val trip = sdk.trips.getTrip(tripId) ?: return
trip.days[0].itinerary.add(TripDayItem(placeId))
sdk.trips.saveTrip(trip)
TripDayItem
instance itself does not load place entities, only contains their IDs.
Trip entities itself do not contain Place entities, only place IDs. You may easily fetch related places:
val trip = sdk.trips.getTrip(tripId) ?: return
val placeIds = trip.getPlaceIds()
val places = sdk.places.getPlacesDetailed(placesIds.toList())
Trip may be soft-deleted by setting isDeleted
property. Hard-deleting of trips is done through emptying trash - calling emptyTripTrash()
will remove all soft-deleted trips on the server and consequently in the SDK.