@@ -3,6 +3,16 @@ import { stripHtml } from "string-strip-html"
3
3
import { SchedSpeaker , ScheduleSession } from "@/app/conf/2023/types"
4
4
import pLimit from "p-limit"
5
5
6
+ const USE_2025 = false
7
+
8
+ const apiUrl = USE_2025
9
+ ? "https://graphqlconf2025.sched.com/api"
10
+ : "https://graphqlconf2024.sched.com/api"
11
+
12
+ const token = USE_2025
13
+ ? process . env . SCHED_ACCESS_TOKEN_2025
14
+ : process . env . SCHED_ACCESS_TOKEN_2024
15
+
6
16
async function fetchData < T > ( url : string ) : Promise < T > {
7
17
try {
8
18
const response = await fetch ( url , {
@@ -21,11 +31,9 @@ async function fetchData<T>(url: string): Promise<T> {
21
31
}
22
32
}
23
33
24
- const token = process . env . SCHED_ACCESS_TOKEN_2024
25
-
26
34
async function getUsernames ( ) : Promise < string [ ] > {
27
35
const response = await fetchData < { username : string } [ ] > (
28
- `https://graphqlconf2024.sched.com/api /user/list?api_key=${ token } &format=json&fields=username` ,
36
+ `${ apiUrl } /user/list?api_key=${ token } &format=json&fields=username` ,
29
37
)
30
38
return response . map ( user => user . username )
31
39
}
@@ -39,7 +47,7 @@ async function getSpeakers(): Promise<SchedSpeaker[]> {
39
47
usernames . map ( username =>
40
48
limit ( ( ) => {
41
49
return fetchData < SchedSpeaker > (
42
- `https://graphqlconf2024.sched.com/api /user/get?api_key=${ token } &by=username&term=${ username } &format=json&fields=username,company,position,name,about,location,url,avatar,role,socialurls` ,
50
+ `${ apiUrl } /user/get?api_key=${ token } &by=username&term=${ username } &format=json&fields=username,company,position,name,about,location,url,avatar,role,socialurls` ,
43
51
)
44
52
} ) ,
45
53
) ,
@@ -59,7 +67,7 @@ async function getSpeakers(): Promise<SchedSpeaker[]> {
59
67
60
68
async function getSchedule ( ) : Promise < ScheduleSession [ ] > {
61
69
const sessions = await fetchData < ScheduleSession [ ] > (
62
- `https://graphqlconf2024.sched.com/api /session/export?api_key=${ token } &format=json` ,
70
+ `${ apiUrl } /session/export?api_key=${ token } &format=json` ,
63
71
)
64
72
65
73
const result = sessions . map ( session => {
0 commit comments