From 74a4b3cb03d4286dbc402400aad75eace84222c6 Mon Sep 17 00:00:00 2001 From: AntoninoP Date: Tue, 9 Jul 2024 15:36:18 +0200 Subject: [PATCH 1/4] ajout card dashboard --- src/App.jsx | 4 ++ src/components/serverCard/serverCard.jsx | 24 +++++---- .../serverCard/serverCard.module.scss | 3 ++ src/pages/NotFound/NotFound.jsx | 18 +++++++ src/pages/NotFound/NotFound.module.scss | 35 +++++++++++++ src/pages/ServerDetails/ServerDetails.jsx | 50 +++++++++++++++++++ .../ServerDetails/ServerDetails.module.scss | 0 7 files changed, 123 insertions(+), 11 deletions(-) create mode 100644 src/pages/NotFound/NotFound.jsx create mode 100644 src/pages/NotFound/NotFound.module.scss create mode 100644 src/pages/ServerDetails/ServerDetails.jsx create mode 100644 src/pages/ServerDetails/ServerDetails.module.scss diff --git a/src/App.jsx b/src/App.jsx index a49c114..63d14b6 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -5,9 +5,11 @@ import { ToastContainer } from 'react-toastify'; import 'react-toastify/dist/ReactToastify.css'; import LoginPage from './pages/LoginPage/LoginPage'; import DashboardPage from './pages/DashboardPage/DashboardPage'; +import ServerDetails from './pages/ServerDetails/ServerDetails'; import { auth } from './service/firebase'; import styles from './App.module.scss'; import Loading from './pages/Loading/loading'; +import NotFound from './pages/NotFound/NotFound'; const App = () => { const [user, setUser] = useState(null); @@ -40,7 +42,9 @@ const App = () => { : } /> : } /> + : } /> {/* Ajout de cette ligne */} } /> + } /> {/* route 404 */} diff --git a/src/components/serverCard/serverCard.jsx b/src/components/serverCard/serverCard.jsx index dd4b286..1334ec5 100644 --- a/src/components/serverCard/serverCard.jsx +++ b/src/components/serverCard/serverCard.jsx @@ -1,13 +1,15 @@ +// src/components/serverCard/serverCard.jsx import React from 'react'; +import { Link } from 'react-router-dom'; import styles from './serverCard.module.scss'; -import paper from '../../assets/frameworks/paper_mc.png' -import spigot from '../../assets/frameworks/spigot.png' -import bukkit from '../../assets/frameworks/bukkit.png' -import vanilla from '../../assets/frameworks/vanilla.png' -import delete_button from '../../assets/frameworks/delete.png' +import paper from '../../assets/frameworks/paper_mc.png'; +import spigot from '../../assets/frameworks/spigot.png'; +import bukkit from '../../assets/frameworks/bukkit.png'; +import vanilla from '../../assets/frameworks/vanilla.png'; +import delete_button from '../../assets/frameworks/delete.png'; -const ServerCard = ({status, version, link, name, framework, onRunClick, onStopClick, onDeleteClick }) => { +const ServerCard = ({ status, version, name, framework, onRunClick, onStopClick, onDeleteClick }) => { const getFrameworkSource = () => { switch (framework) { @@ -20,7 +22,7 @@ const ServerCard = ({status, version, link, name, framework, onRunClick, onStopC default: return vanilla; } - } + }; const handleRun = async () => { try { @@ -47,11 +49,11 @@ const ServerCard = ({status, version, link, name, framework, onRunClick, onStopC }; return ( - +
{name}
- {`${name} + {`${name}
@@ -64,8 +66,8 @@ const ServerCard = ({status, version, link, name, framework, onRunClick, onStopC
Version: {version}
- -
+ + ); }; diff --git a/src/components/serverCard/serverCard.module.scss b/src/components/serverCard/serverCard.module.scss index 34c4d52..55814e0 100644 --- a/src/components/serverCard/serverCard.module.scss +++ b/src/components/serverCard/serverCard.module.scss @@ -10,8 +10,11 @@ background-color: var(--card-bg-color); color: var(--text-color); margin-bottom: 1.5rem; + cursor: pointer; } + + .status { display: flex; align-items: center; diff --git a/src/pages/NotFound/NotFound.jsx b/src/pages/NotFound/NotFound.jsx new file mode 100644 index 0000000..ba92075 --- /dev/null +++ b/src/pages/NotFound/NotFound.jsx @@ -0,0 +1,18 @@ +// src/pages/NotFoundPage/NotFoundPage.jsx +import React from 'react'; +import Navbar from '../../components/navbar/Navbar'; +import styles from './NotFound.module.scss'; + +const NotFoundPage = () => { + return ( +
+ +
+

Page inconnue

+

La page que vous recherchez n'existe pas.

+
+
+ ); +}; + +export default NotFoundPage; diff --git a/src/pages/NotFound/NotFound.module.scss b/src/pages/NotFound/NotFound.module.scss new file mode 100644 index 0000000..f446cfd --- /dev/null +++ b/src/pages/NotFound/NotFound.module.scss @@ -0,0 +1,35 @@ +// src/pages/NotFound/NotFound.module.scss +.notFoundContainer { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + height: 100vh; + text-align: center; + color:white; + } + + .message { + margin-top: 50px; + } + + .message h1 { + font-size: 3rem; + margin-bottom: 20px; + } + + .message p { + font-size: 1.5rem; + margin-bottom: 20px; + } + + .message a { + font-size: 1.2rem; + color: #007bff; + text-decoration: none; + } + + .message a:hover { + text-decoration: underline; + } + \ No newline at end of file diff --git a/src/pages/ServerDetails/ServerDetails.jsx b/src/pages/ServerDetails/ServerDetails.jsx new file mode 100644 index 0000000..2592dcb --- /dev/null +++ b/src/pages/ServerDetails/ServerDetails.jsx @@ -0,0 +1,50 @@ +// src/pages/ServerDetails/ServerDetails.jsx +import React, { useEffect, useState } from 'react'; +import { useParams } from 'react-router-dom'; +import Navbar from '../../components/navbar/Navbar'; +import styles from './ServerDetails.module.scss'; +import serviiApi from "../../service/api.tsx"; +import Loading from '../Loading/loading'; + +const ServerDetails = ({ user }) => { + const { serverName } = useParams(); + const [server, setServer] = useState(null); + const [loading, setLoading] = useState(true); + + useEffect(() => { + const loadServer = async () => { + try { + const ApiResponse = await serviiApi.fetchServer(serverName); + setServer(ApiResponse.message); + } catch (error) { + console.error('Error fetching server data:', error); + } finally { + setLoading(false); + } + }; + loadServer(); + }, [serverName]); + + if (loading) { + return ; + } + + return ( +
+ + {server ? ( +
+

{server.name}

+

Status: {server.running ? 'Running' : 'Stopped'}

+

Version: {server.version}

+

Framework: {server.framework}

+ {/* Ajoutez d'autres détails ici */} +
+ ) : ( +
Server not found
+ )} +
+ ); +}; + +export default ServerDetails; diff --git a/src/pages/ServerDetails/ServerDetails.module.scss b/src/pages/ServerDetails/ServerDetails.module.scss new file mode 100644 index 0000000..e69de29 From 4829bdb66ab98ff5af0eda0121a9b7eb41ab6923 Mon Sep 17 00:00:00 2001 From: AntoninoP Date: Tue, 9 Jul 2024 16:23:09 +0200 Subject: [PATCH 2/4] ajout routes --- src/App.jsx | 17 ++----- src/components/serverCard/serverCard.jsx | 10 ++-- .../serverCard/serverCard.module.scss | 9 ++++ .../NotFoundPage.jsx} | 2 +- .../NotFoundPage.module.scss} | 0 src/pages/ServerDetails/ServerDetails.jsx | 50 ++++++++++++------- .../ServerDetails/ServerDetails.module.scss | 7 +++ 7 files changed, 59 insertions(+), 36 deletions(-) rename src/pages/{NotFound/NotFound.jsx => NotFoundPage/NotFoundPage.jsx} (89%) rename src/pages/{NotFound/NotFound.module.scss => NotFoundPage/NotFoundPage.module.scss} (100%) diff --git a/src/App.jsx b/src/App.jsx index 63d14b6..3ca37a1 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,29 +1,20 @@ -// src/App.js import React, { useEffect, useState } from 'react'; import { BrowserRouter as Router, Route, Routes, Navigate } from 'react-router-dom'; import { ToastContainer } from 'react-toastify'; import 'react-toastify/dist/ReactToastify.css'; import LoginPage from './pages/LoginPage/LoginPage'; import DashboardPage from './pages/DashboardPage/DashboardPage'; -import ServerDetails from './pages/ServerDetails/ServerDetails'; +import ServerDetails from './pages/ServerDetails/ServerDetails'; import { auth } from './service/firebase'; import styles from './App.module.scss'; import Loading from './pages/Loading/loading'; -import NotFound from './pages/NotFound/NotFound'; +import NotFoundPage from './pages/NotFoundPage/NotFoundPage'; const App = () => { const [user, setUser] = useState(null); const [loading, setLoading] = useState(true); useEffect(() => { - const script = document.createElement('script'); - - script.src = 'https://static.cloudflareinsights.com/beacon.min.js'; - script.async = true; - script.defer = true; - script.data = JSON.stringify({ - token: '5cef39a7410e4a4e8ab3dfbe163b73d0', - }); const unsubscribe = auth.onAuthStateChanged((user) => { setUser(user); setLoading(false); @@ -42,9 +33,9 @@ const App = () => { : } /> : } /> - : } /> {/* Ajout de cette ligne */} + : } /> } /> - } /> {/* route 404 */} + } /> diff --git a/src/components/serverCard/serverCard.jsx b/src/components/serverCard/serverCard.jsx index 1334ec5..4f00172 100644 --- a/src/components/serverCard/serverCard.jsx +++ b/src/components/serverCard/serverCard.jsx @@ -1,4 +1,3 @@ -// src/components/serverCard/serverCard.jsx import React from 'react'; import { Link } from 'react-router-dom'; import styles from './serverCard.module.scss'; @@ -24,7 +23,8 @@ const ServerCard = ({ status, version, name, framework, onRunClick, onStopClick, } }; - const handleRun = async () => { + const handleRun = async (event) => { + event.preventDefault(); try { await onRunClick(name); } catch (error) { @@ -32,7 +32,8 @@ const ServerCard = ({ status, version, name, framework, onRunClick, onStopClick, } }; - const handleStop = async () => { + const handleStop = async (event) => { + event.preventDefault(); try { await onStopClick(name); } catch (error) { @@ -40,7 +41,8 @@ const ServerCard = ({ status, version, name, framework, onRunClick, onStopClick, } }; - const handleDelete = async () => { + const handleDelete = async (event) => { + event.preventDefault(); try { await onDeleteClick(name); } catch (error) { diff --git a/src/components/serverCard/serverCard.module.scss b/src/components/serverCard/serverCard.module.scss index 55814e0..e63d961 100644 --- a/src/components/serverCard/serverCard.module.scss +++ b/src/components/serverCard/serverCard.module.scss @@ -49,6 +49,15 @@ transition: background-color 0.3s ease; margin-top: 1rem; } + +.runningButton:hover{ + background-color: #8d213ec1; +} + +.stoppedButton:hover{ + background-color: #008d5fc1; +} + .deleteButton{ width: 20px; height: 20px; diff --git a/src/pages/NotFound/NotFound.jsx b/src/pages/NotFoundPage/NotFoundPage.jsx similarity index 89% rename from src/pages/NotFound/NotFound.jsx rename to src/pages/NotFoundPage/NotFoundPage.jsx index ba92075..e73ba41 100644 --- a/src/pages/NotFound/NotFound.jsx +++ b/src/pages/NotFoundPage/NotFoundPage.jsx @@ -1,7 +1,7 @@ // src/pages/NotFoundPage/NotFoundPage.jsx import React from 'react'; import Navbar from '../../components/navbar/Navbar'; -import styles from './NotFound.module.scss'; +import styles from './NotFoundPage.module.scss'; const NotFoundPage = () => { return ( diff --git a/src/pages/NotFound/NotFound.module.scss b/src/pages/NotFoundPage/NotFoundPage.module.scss similarity index 100% rename from src/pages/NotFound/NotFound.module.scss rename to src/pages/NotFoundPage/NotFoundPage.module.scss diff --git a/src/pages/ServerDetails/ServerDetails.jsx b/src/pages/ServerDetails/ServerDetails.jsx index 2592dcb..d6fa998 100644 --- a/src/pages/ServerDetails/ServerDetails.jsx +++ b/src/pages/ServerDetails/ServerDetails.jsx @@ -1,6 +1,5 @@ -// src/pages/ServerDetails/ServerDetails.jsx import React, { useEffect, useState } from 'react'; -import { useParams } from 'react-router-dom'; +import { useParams, useNavigate } from 'react-router-dom'; import Navbar from '../../components/navbar/Navbar'; import styles from './ServerDetails.module.scss'; import serviiApi from "../../service/api.tsx"; @@ -8,41 +7,56 @@ import Loading from '../Loading/loading'; const ServerDetails = ({ user }) => { const { serverName } = useParams(); + const navigate = useNavigate(); const [server, setServer] = useState(null); const [loading, setLoading] = useState(true); + const [error, setError] = useState(null); useEffect(() => { - const loadServer = async () => { + const fetchServer = async () => { try { - const ApiResponse = await serviiApi.fetchServer(serverName); - setServer(ApiResponse.message); + const ApiResponse = await serviiApi.fetchServers(); + const data = ApiResponse.message; + const foundServer = data.find(server => server.name === serverName); + + if (foundServer) { + setServer(foundServer); + } else { + setError('Server not found'); + } } catch (error) { - console.error('Error fetching server data:', error); + console.error('Error fetching server:', error); + setError('Error fetching server'); } finally { setLoading(false); } }; - loadServer(); + + fetchServer(); }, [serverName]); if (loading) { return ; } + if (error) { + return ( +
+ +
+

{error}

+ +
+
+ ); + } + return (
- {server ? ( -
-

{server.name}

-

Status: {server.running ? 'Running' : 'Stopped'}

-

Version: {server.version}

-

Framework: {server.framework}

- {/* Ajoutez d'autres détails ici */} -
- ) : ( -
Server not found
- )} +
+

{server.name}

+
); }; diff --git a/src/pages/ServerDetails/ServerDetails.module.scss b/src/pages/ServerDetails/ServerDetails.module.scss index e69de29..5e3a723 100644 --- a/src/pages/ServerDetails/ServerDetails.module.scss +++ b/src/pages/ServerDetails/ServerDetails.module.scss @@ -0,0 +1,7 @@ +.details{ + color: white; +} + +.serverDetailsContainer{ + margin-top: 10rem; +} \ No newline at end of file From 92981c205873f585293beb81b7f9de81c2f0f0c5 Mon Sep 17 00:00:00 2001 From: AntoninoP Date: Tue, 9 Jul 2024 22:20:18 +0200 Subject: [PATCH 3/4] fix style et autres jsplu mais gg wp --- src/components/serverCard/serverCard.jsx | 4 ++-- .../DashboardPage/DashboardPage.module.scss | 1 - src/pages/ServerDetails/ServerDetails.jsx | 3 ++- .../ServerDetails/ServerDetails.module.scss | 16 ++++++++++++---- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/components/serverCard/serverCard.jsx b/src/components/serverCard/serverCard.jsx index 4f00172..7786598 100644 --- a/src/components/serverCard/serverCard.jsx +++ b/src/components/serverCard/serverCard.jsx @@ -59,10 +59,10 @@ const ServerCard = ({ status, version, name, framework, onRunClick, onStopClick,
- {!status && ( + {status === "false" && ( )} - {status && ( + {status === true && ( )}
diff --git a/src/pages/DashboardPage/DashboardPage.module.scss b/src/pages/DashboardPage/DashboardPage.module.scss index 9bca5c3..55b587b 100644 --- a/src/pages/DashboardPage/DashboardPage.module.scss +++ b/src/pages/DashboardPage/DashboardPage.module.scss @@ -1,7 +1,6 @@ html, body { margin: 0; padding: 0; - font-family: 'Poppins', system-ui, Avenir, Helvetica, Arial, sans-serif; background-color: var(--main-bg-color); } diff --git a/src/pages/ServerDetails/ServerDetails.jsx b/src/pages/ServerDetails/ServerDetails.jsx index d6fa998..3520b71 100644 --- a/src/pages/ServerDetails/ServerDetails.jsx +++ b/src/pages/ServerDetails/ServerDetails.jsx @@ -45,7 +45,7 @@ const ServerDetails = ({ user }) => {

{error}

- +
); @@ -56,6 +56,7 @@ const ServerDetails = ({ user }) => {

{server.name}

+

{server.difficulty}

); diff --git a/src/pages/ServerDetails/ServerDetails.module.scss b/src/pages/ServerDetails/ServerDetails.module.scss index 5e3a723..87d3df9 100644 --- a/src/pages/ServerDetails/ServerDetails.module.scss +++ b/src/pages/ServerDetails/ServerDetails.module.scss @@ -1,7 +1,15 @@ -.details{ +html, body { + margin: 0; + padding: 0; color: white; } -.serverDetailsContainer{ - margin-top: 10rem; -} \ No newline at end of file +.serverDetailsContainer { + padding-top: var(--navbar-height); + background-color: var(--main-bg-color); + display: flex; + flex-direction: column; + align-items: center; + color: var(--text-color); +} + From 1eccf6da314d461fe03a13a7ec1e137388fa520f Mon Sep 17 00:00:00 2001 From: AntoninoP Date: Wed, 10 Jul 2024 03:03:44 +0200 Subject: [PATCH 4/4] =?UTF-8?q?+=20modifs=20param=C3=A8tres=20serveurs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.css | 7 +- src/pages/DashboardPage/DashboardPage.jsx | 12 ++- .../DashboardPage/DashboardPage.module.scss | 1 + src/pages/ServerDetails/ServerDetails.jsx | 88 ++++++++++++++++++- .../ServerDetails/ServerDetails.module.scss | 82 +++++++++++++++-- src/service/api.tsx | 87 +++++++++--------- 6 files changed, 226 insertions(+), 51 deletions(-) diff --git a/src/main.css b/src/main.css index d65f2ab..009958c 100644 --- a/src/main.css +++ b/src/main.css @@ -1,4 +1,4 @@ -/* index.css */ +/* main.css */ html { font-size: 12px; font-family: 'Poppins', sans-serif; @@ -18,6 +18,11 @@ html { --main-bg-color: #050816; --text-color: white; --text-color-black: black; + --input-bg-color: #44475a; + --input-border-color: #6272a4; + --button-bg-color: #50fa7b; + --button-text-color: #282a36; + --button-bg-color-hover: #8be9fd; } body { diff --git a/src/pages/DashboardPage/DashboardPage.jsx b/src/pages/DashboardPage/DashboardPage.jsx index 2b286af..07fcd69 100644 --- a/src/pages/DashboardPage/DashboardPage.jsx +++ b/src/pages/DashboardPage/DashboardPage.jsx @@ -81,6 +81,13 @@ const DashboardPage = ({ user }) => { } }; + const handleCopyAddress = () => { + const address = `${subdomain}.servii.fr`; + navigator.clipboard.writeText(address) + .then(() => { + }) + }; + if (loading) { return (
@@ -102,7 +109,10 @@ const DashboardPage = ({ user }) => { ) : (
- Adresse de connexion à vos serveurs : {subdomain}.servii.fr + Adresse de connexion à vos serveurs : + + {" " + subdomain}.servii.fr +
+
); + }; export default ServerDetails; diff --git a/src/pages/ServerDetails/ServerDetails.module.scss b/src/pages/ServerDetails/ServerDetails.module.scss index 87d3df9..81dcf6f 100644 --- a/src/pages/ServerDetails/ServerDetails.module.scss +++ b/src/pages/ServerDetails/ServerDetails.module.scss @@ -1,9 +1,4 @@ -html, body { - margin: 0; - padding: 0; - color: white; -} - +/* ServerDetails.module.scss */ .serverDetailsContainer { padding-top: var(--navbar-height); background-color: var(--main-bg-color); @@ -11,5 +6,78 @@ html, body { flex-direction: column; align-items: center; color: var(--text-color); -} + } + + .details { + margin-top: 5rem; + padding: 3rem; + padding-top: 0rem; + background-color: var(--card-bg-color); + width: 60rem; + border-radius: 1rem; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); + } + + .formGroup { + margin-bottom: 2.5rem; + display: flex; + flex-direction: column; + } + + .formGroup label { + font-weight: bold; + margin-bottom: 1.2rem; + font-size: 1.4rem; + } + + .formGroup input, + .formGroup select { + width: calc(100% - 2px); + padding: 1.2rem; + height: 3.5rem; + background-color: var(--input-bg-color); + border: 1px solid var(--input-border-color); + border-radius: 0.5rem; + color: var(--text-color); + font-size: 1.2rem; + box-sizing: border-box; + } + + .saveButton { + padding: 1.2rem 2.5rem; + background-color: var(--button-bg-color); + color: var(--button-text-color); + border: none; + border-radius: 0.5rem; + cursor: pointer; + transition: background-color 0.3s; + font-size: 1.2rem; + align-self: flex-start; + } + + .quitButton{ + padding: 1.2rem 2.5rem; + background-color: gray; + color: var(--button-text-color); + border: none; + border-radius: 0.5rem; + cursor: pointer; + transition: background-color 0.3s; + font-size: 1.2rem; + align-self: flex-start; + margin-left: 3rem; + } + .saveButton:hover { + background-color: var(--button-bg-hover-color); + } + + .error { + color: red; + font-size: 1.2rem; + } + + .details h1 { + font-size: 2.5rem; + margin-bottom: 3rem; + } \ No newline at end of file diff --git a/src/service/api.tsx b/src/service/api.tsx index a711930..08506ac 100644 --- a/src/service/api.tsx +++ b/src/service/api.tsx @@ -1,5 +1,4 @@ -// src/services/serverService.ts -import {getAuth} from 'firebase/auth'; +import { getAuth } from 'firebase/auth'; const apiUrl: string = 'https://www.servii.fr/api'; @@ -8,37 +7,30 @@ interface ApiResponse { message: string; } -//fetchServers, accountCreate, accountDelete, interface BaseRequest { token: string; } -//setSubdomain -interface SubdomainRequest { - token: string; + +interface SubdomainRequest extends BaseRequest { subdomain: string; } -//serverDelete, serverRun, serverStop -interface ServerRequest { - token: string; + +interface ServerRequest extends BaseRequest { name: string; } -//serverCreate -interface ServerCreationRequest { - token: string; + +interface ServerCreationRequest extends BaseRequest { name: string; version: string; framework: string; } -//updateProperty -interface UpdatePropertyRequest { - token: string; + +interface UpdatePropertiesRequest extends BaseRequest { name: string; - prop: string; - value: string; + props: [string, string][]; } -//command -interface CommandRequest { - token: string; + +interface CommandRequest extends BaseRequest { command: string; name: string; } @@ -52,14 +44,14 @@ enum serviiRequest { accountDelete = 'AccountDelete', serverRun = 'ServerRun', serverStop = 'ServerStop', - updateProperty = 'UpdateProperty', + updateProperty = 'UpdateProperties', command = 'Command', } class serviiApi { constructor() {} - private static async call(endpoint: serviiRequest, body: T):Promise{ + private static async call(endpoint: serviiRequest, body: T): Promise { const response = await fetch(`${apiUrl}/${endpoint}`, { method: 'POST', headers: { @@ -67,62 +59,77 @@ class serviiApi { }, body: JSON.stringify(body), }); - const status: number = response.status + const status: number = response.status; const json = await response.json(); if (json.message === undefined) { - if (!(endpoint === serviiRequest.fetchServers)){ - return {return_code: status, message: "Couldn't find an available API, we're sorry for the inconvenience."}; + if (!(endpoint === serviiRequest.fetchServers)) { + return { return_code: status, message: "Couldn't find an available API, we're sorry for the inconvenience." }; } - return {return_code: status, message: json}; + return { return_code: status, message: json }; } - return {return_code: status, message: json.message}; + return { return_code: status, message: json.message }; } private static token(): string { const currentUser = getAuth().currentUser; - if (!currentUser) {throw new Error('No user is currently logged in.');} + if (!currentUser) { + throw new Error('No user is currently logged in.'); + } return currentUser.uid; } public static async setSubdomain(subdomain: string): Promise { - const payload : SubdomainRequest = {token: this.token(), subdomain: subdomain} + const payload: SubdomainRequest = { token: this.token(), subdomain: subdomain }; return this.call(serviiRequest.setSubdomain, payload); } + public static async fetchServers(): Promise { - const payload : BaseRequest = {token: this.token()} + const payload: BaseRequest = { token: this.token() }; return this.call(serviiRequest.fetchServers, payload); } + public static async accountCreate(): Promise { - const payload : BaseRequest = {token: this.token()} + const payload: BaseRequest = { token: this.token() }; return this.call(serviiRequest.accountCreate, payload); } + public static async serverCreate(name: string, version: string, framework: string): Promise { - const payload : ServerCreationRequest = {token: this.token(), name: name, version: version, framework: framework}; + const payload: ServerCreationRequest = { token: this.token(), name: name, version: version, framework: framework }; return this.call(serviiRequest.serverCreate, payload); } + public static async serverDelete(name: string): Promise { - const payload : ServerRequest = {token: this.token(), name: name} + const payload: ServerRequest = { token: this.token(), name: name }; return this.call(serviiRequest.serverDelete, payload); } + public static async accountDelete(): Promise { - const payload : BaseRequest = {token: this.token()} + const payload: BaseRequest = { token: this.token() }; return this.call(serviiRequest.accountDelete, payload); } + public static async serverRun(name: string): Promise { - const payload : ServerRequest = {token: this.token(), name: name} + const payload: ServerRequest = { token: this.token(), name: name }; return this.call(serviiRequest.serverRun, payload); } + public static async serverStop(name: string): Promise { - const payload : ServerRequest = {token: this.token(), name: name} + const payload: ServerRequest = { token: this.token(), name: name }; return this.call(serviiRequest.serverStop, payload); } - public static async updateProperty(name: string, prop: string, value: string): Promise { - const payload : UpdatePropertyRequest = {token: this.token(), name: name, prop: prop, value: value} - return this.call(serviiRequest.updateProperty, payload); + + public static async updateProperties(name: string, props: [string, string][]): Promise { + const payload: UpdatePropertiesRequest = { + token: this.token(), + name: name, + props: props, + }; + return this.call(serviiRequest.updateProperty, payload); // Correct usage here } + public static async command(command: string, name: string): Promise { - const payload : CommandRequest = {token: this.token(), command: command, name: name}; + const payload: CommandRequest = { token: this.token(), command: command, name: name }; return this.call(serviiRequest.command, payload); } }