21 lines
508 B
JavaScript

export class PuckoPruttApi {
constructor() {
this.apiUrl = "https://api.puckoprutt.tech"
this.schema = this.apiUrl + "/schema/"
}
async _fetch_json(url) {
const response = await fetch(url);
if (!response.ok) {
return -1;
}
const json = await response.json();
return json;
}
async dagens_lunch(spider) {
return await this._fetch_json(this.apiUrl + "/spiders/dagens_lunch/" + spider + "/?format=json");
}
}