-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Populate
extraPeople
from the FOSDEM track managers
- Loading branch information
1 parent
2636d92
commit e153bb0
Showing
2 changed files
with
55 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,54 @@ | ||
import { Role } from "../../models/schedule"; | ||
import { PretalxApiClient } from "./PretalxApiClient"; | ||
|
||
export interface FOSDEMPerson { | ||
person_id: number, | ||
event_role: Role, | ||
name: string, | ||
email: string, | ||
matrix_id: string, | ||
} | ||
|
||
export interface FOSDEMTalk { | ||
event_id: number, | ||
title: string, | ||
conference_room: string, | ||
start_datetime: string, | ||
duration: number, | ||
track_id: number, | ||
persons: [{ | ||
person_id: number, | ||
event_role: Role, | ||
name: string, | ||
email: string, | ||
matrix_id: string, | ||
}] | ||
persons: FOSDEMPerson[] | ||
} | ||
|
||
export interface FOSDEMTrack { | ||
/* Numeric ID of the track */ | ||
id: number, | ||
|
||
/* URL-safe slug of the track */ | ||
slug: string, | ||
|
||
/* Human-safe name for the track */ | ||
name: string, | ||
|
||
/* What sort of track this is. `"devroom"` or `"maintrack"`. */ | ||
type: string, | ||
|
||
/* List of managers of this track */ | ||
managers: FOSDEMPerson[], | ||
} | ||
|
||
export interface FOSDEMConference { | ||
tracks: FOSDEMTrack[], | ||
talks: FOSDEMTalk[], | ||
} | ||
|
||
export class FOSDEMPretalxApiClient extends PretalxApiClient { | ||
async getFOSDEMTalks(): Promise<FOSDEMTalk[]> { | ||
async getFOSDEMConference(): Promise<FOSDEMConference> { | ||
const url = new URL(this.baseUri + `/p/matrix/`); | ||
const req = await fetch(url, this.requestInit); | ||
if (!req.ok) { | ||
const reason = await req.text(); | ||
throw Error(`Failed to request events from Pretalx: ${req.status} ${reason}`); | ||
} | ||
return (await req.json()).talks as FOSDEMTalk[]; | ||
return (await req.json()) as FOSDEMConference; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters