From 903cbba69ae4436d9a22ee5a430fe270e41544be Mon Sep 17 00:00:00 2001 From: unknown <55nknown@pm.me> Date: Sun, 12 Sep 2021 19:33:26 +0200 Subject: [PATCH] basics --- filcnaplo/lib/api/client.dart | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/filcnaplo/lib/api/client.dart b/filcnaplo/lib/api/client.dart index 8005fd0..4a51afa 100644 --- a/filcnaplo/lib/api/client.dart +++ b/filcnaplo/lib/api/client.dart @@ -8,10 +8,16 @@ import 'package:filcnaplo_kreta_api/models/school.dart'; import 'package:http/http.dart' as http; class FilcAPI { + // Public API static const SCHOOL_LIST = "https://filcnaplo.hu/v2/school_list.json"; - static const CONFIG = "https://filcnaplo.hu/v2/config.json"; static const NEWS = "https://filcnaplo.hu/v2/news.json"; static const SUPPORTERS = "https://filcnaplo.hu/v2/supporters.json"; + + // Private API + static const CONFIG = "https://api.filcnaplo.hu/config"; + static const REPORT = "https://api.filcnaplo.hu/report"; + + // Updates static const REPO = "filc/naplo"; static const RELEASES = "https://api.github.com/repos/$REPO/releases"; @@ -35,9 +41,14 @@ class FilcAPI { } } + // TODO: implement `x-filc-id` header static Future getConfig() async { + Map headers = { + "x-filc-id": "", + }; + try { - http.Response res = await http.get(Uri.parse(CONFIG)); + http.Response res = await http.get(Uri.parse(CONFIG), headers: headers); if (res.statusCode == 200) { return Config.fromJson(jsonDecode(res.body));