WIP: started working on lilJuddApi implementation

Signed-off-by: moonleay <contact@moonleay.net>
This commit is contained in:
moonleay 2024-01-01 04:12:23 +01:00
parent e6803f6474
commit 734ac1b74c
Signed by: moonleay
GPG key ID: 82667543CCD715FB
2 changed files with 43 additions and 1 deletions

View file

@ -1,6 +1,6 @@
/* /*
* lilJudd * lilJudd
* Copyright (C) 2023 moonleay * Copyright (C) 2024 moonleay
* *
* This program is free software: you can redistribute it and/or modify * 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 * 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 dbName: String
lateinit var dbUser: String lateinit var dbUser: String
lateinit var dbPassword: String lateinit var dbPassword: String
lateinit var apiDomain: String
lateinit var apiToken: String
///Load the needed credentials, generate a config if there is none ///Load the needed credentials, generate a config if there is none
fun load() { fun load() {
@ -51,6 +53,8 @@ object CredentialManager {
dbName = prop.getProperty("dbName") dbName = prop.getProperty("dbName")
dbUser = prop.getProperty("dbUser") dbUser = prop.getProperty("dbUser")
dbPassword = prop.getProperty("dbPassword") dbPassword = prop.getProperty("dbPassword")
apiDomain = prop.getProperty("apiDomain")
apiToken = prop.getProperty("apiToken")
input.close() input.close()
} catch (e: IOException) { } catch (e: IOException) {
e.printStackTrace() e.printStackTrace()
@ -83,6 +87,8 @@ object CredentialManager {
prop.setProperty("dbName", "empty") prop.setProperty("dbName", "empty")
prop.setProperty("dbUser", "empty") prop.setProperty("dbUser", "empty")
prop.setProperty("dbPassword", "empty") prop.setProperty("dbPassword", "empty")
prop.setProperty("apiDomain", "empty")
prop.setProperty("apiToken", "empty")
prop.store(output, null) prop.store(output, null)
output.close() output.close()

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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/<guild_id>/
// DELETE https://liljudd.ink/api/config/<guild_id>/
// GET https://liljudd.ink/api/tp_messages/<guild_id>/
// PUT https://liljudd.ink/api/tp_messages/<guild_id>/
// POST https://liljudd.ink/api/match/<guild_id>/<channel_id>/
// PUT https://liljudd.ink/api/match/<guild_id>/<channel_id>/<match_message_id>/
// GET https://liljudd.ink/api/match/<guild_id>/
}