From 734ac1b74cbdc5451765b4558652361b1462a4ba Mon Sep 17 00:00:00 2001 From: moonleay Date: Mon, 1 Jan 2024 04:12:23 +0100 Subject: [PATCH] WIP: started working on lilJuddApi implementation Signed-off-by: moonleay --- .../lilJudd/data/CredentialManager.kt | 8 ++++- .../lilJudd/data/api/liljudd/LilJuddApi.kt | 36 +++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 src/main/kotlin/net/moonleay/lilJudd/data/api/liljudd/LilJuddApi.kt diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/CredentialManager.kt b/src/main/kotlin/net/moonleay/lilJudd/data/CredentialManager.kt index 0320d82..e406414 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/data/CredentialManager.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/data/CredentialManager.kt @@ -1,6 +1,6 @@ /* * lilJudd - * Copyright (C) 2023 moonleay + * Copyright (C) 2024 moonleay * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,6 +29,8 @@ object CredentialManager { lateinit var dbName: String lateinit var dbUser: String lateinit var dbPassword: String + lateinit var apiDomain: String + lateinit var apiToken: String ///Load the needed credentials, generate a config if there is none fun load() { @@ -51,6 +53,8 @@ object CredentialManager { dbName = prop.getProperty("dbName") dbUser = prop.getProperty("dbUser") dbPassword = prop.getProperty("dbPassword") + apiDomain = prop.getProperty("apiDomain") + apiToken = prop.getProperty("apiToken") input.close() } catch (e: IOException) { e.printStackTrace() @@ -83,6 +87,8 @@ object CredentialManager { prop.setProperty("dbName", "empty") prop.setProperty("dbUser", "empty") prop.setProperty("dbPassword", "empty") + prop.setProperty("apiDomain", "empty") + prop.setProperty("apiToken", "empty") prop.store(output, null) output.close() diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/liljudd/LilJuddApi.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/liljudd/LilJuddApi.kt new file mode 100644 index 0000000..d6379fa --- /dev/null +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/liljudd/LilJuddApi.kt @@ -0,0 +1,36 @@ +/* + * lilJudd + * Copyright (C) 2024 moonleay + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.moonleay.lilJudd.data.api.liljudd + +import net.moonleay.lilJudd.data.CredentialManager + +object LilJuddApi { + val CONFIG_BASE = "${CredentialManager.apiDomain}/config/" + val MATCH_BASE = "${CredentialManager.apiDomain}/match/" + val TIMEPLANNINGMESSAGES_BASE = "${CredentialManager.apiDomain}/tp_messages/" + + // GET https://liljudd.ink/api/config// + // DELETE https://liljudd.ink/api/config// + // GET https://liljudd.ink/api/tp_messages// + // PUT https://liljudd.ink/api/tp_messages// + // POST https://liljudd.ink/api/match/// + // PUT https://liljudd.ink/api/match//// + // GET https://liljudd.ink/api/match// + +}