@jordon It is possible with some array manipulations. In the below example:
Get all bookings with status “CONFIRMED”
Filter only group session (in case there are appointments in the list)
Get a list of unique classes, class name and time
const res = await bookings . queryBookings ()
. ge ( “startTime” , startDate )
. le ( “endTime” , endDate )
. eq ( “status” , “CONFIRMED” )
. limit ( 1000 )
. find ({ suppressAuth : true });
const classesOnly = res . items . filter ( book => book . bookedEntity . tags [ 0 ]=== “GROUP” )
return [… new Set ( classesOnly . map ( book => book . bookedEntity . singleSession . sessionId ))]
. map ( sessionId =>{
const sessionInfo = classesOnly . find ( book => book . bookedEntity . singleSession . sessionId == sessionId );
return {
“className” : sessionInfo . bookedEntity . title ,
“startTime” : sessionInfo . bookedEntity . singleSession . start . toDateString (),
“sessionId” : sessionId
}
})