-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi.js
33 lines (31 loc) · 968 Bytes
/
api.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
export let bearer_token = "";
export let client_id = "";
export let broadcaster_id = "";
export let access_token = "";
export const schedule_api_options = {
method: "PATCH",
headers: {
"Authorization": "Bearer " + bearer_token,
"Client-Id": client_id,
"Content-Type": "application/json",
},
};
export function schedule_api() {
const request = new Request("https://api.twitch.tv/helix/schedule/settings?broadcaster_id=" + broadcaster_id + "&is_vacation_enabled=true&vacation_start_time=2025-10-01T00:00:00Z&vacation_end_time=2029-04-30T23:59:59Z&timezone=America/Los_Angeles", schedule_api_options);
fetch(request)
.then((response) => {
if (response.status === 200) {
alert(response.json);
return response.json();
} else {
throw new Error("Something went wrong on API server!");
}
})
.then((response) => {
console.debug(response);
// …
})
.catch((error) => {
console.error(error);
});
}