Skip to content
This repository has been archived by the owner on Feb 28, 2024. It is now read-only.
Martina Kellnerová edited this page Feb 26, 2018 · 5 revisions

Trips module provides interface for creating & managing user trips.

See trips module api-doc.

Working with trips module requires enabled user-data.

Architecture

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())

Trips' State

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.

Clone this wiki locally