@@ -26,15 +26,14 @@ export interface Talk {
2626 } ;
2727}
2828
29- // Reference: https://docs.pretalx.org/api/resources/talks/
29+ // Reference: https://docs.pretalx.org/api/resources/#tag/submissions
3030type TalksResponse = PaginatedResponse < {
3131 code : string ;
32- slot ?: {
33- end : string ;
34- room : { en : string } ;
35- room_id : number ;
32+ slots : Array < {
3633 start : string ;
37- } ;
34+ end : string ;
35+ room : { name : { en : string } , id : number } ;
36+ } > ;
3837 state :
3938 | "accepted"
4039 | "canceled"
@@ -50,24 +49,29 @@ type TalksResponse = PaginatedResponse<{
5049export const getTalks = async ( event : string ) : Promise < Talk [ ] > => {
5150 const talks : Talk [ ] = [ ] ;
5251
53- const url = `${ origin } /api/events/${ event } /talks/?limit=100 ` ;
52+ const url = `${ origin } /api/events/${ event } /submissions/?state=confirmed&expand=slots,slots.room ` ;
5453 for await ( const page of pages < TalksResponse > ( url ) )
55- for ( const { code, slot, state, title } of page )
54+ for ( const { code, slots, state, title } of page ) {
55+ // TODO: handle there being more than one slot
56+ const slot = slots [ 0 ] ;
5657 talks . push ( {
5758 id : code ,
5859 title,
5960 url : `${ origin } /${ event } /talk/${ code } /` ,
61+ // TODO: we should *probably* just remove the confirmed state check?
62+ // Since we filter in the query parameter now.
6063 ...( slot && state === "confirmed"
6164 ? {
6265 scheduled : {
6366 beginning : DateTime . fromISO ( slot . start ) ,
6467 end : DateTime . fromISO ( slot . end ) ,
65- roomId : slot . room_id . toString ( ) ,
66- roomName : slot . room . en ,
68+ roomId : slot . room . id . toString ( ) ,
69+ roomName : slot . room . name . en ,
6770 } ,
6871 }
6972 : { } ) ,
7073 } ) ;
74+ }
7175
7276 return talks ;
7377} ;
0 commit comments