These Docs were AI Generated
- MCSS API
- Client Documentation
- Table of Contents
- Constructor
- Methods
getStats(): Promise<AppResponse>
getServers(filter: ServerFilter | number = 0): Promise<AppResponse>
getServerCount(filter: ServerCountFilter | number = 0, serverType: ServerType | string): Promise<AppResponse>
getSettings(): Promise<AppResponse>
updateSettings(deleteOldBackupsThreshold: number): Promise<AppResponse>
- AppResponse Interface
- Enums
- Servers Documentation
- Scheduler Documentation
- Table of Contents
- Constructor
- Methods
get(): Promise<AppResponse>
getTasks(filter: TaskFilter | number = 0): Promise<AppResponse>
getTask(Id: string): Promise<AppResponse>
create(data: any | Task): Promise<AppResponse>
update(Id: string, data: any | Task): Promise<AppResponse>
delete(Id: string): Promise<AppResponse>
run(Id: string): Promise<AppResponse>
- Enums
- Backups Documentation
- Table of Contents
- Constructor
- Methods
get(): Promise<AppResponse>
getStats(): Promise<AppResponse>
getBackup(backup: string): Promise<AppResponse>
create(data: Backup): Promise<AppResponse>
update(backup: string, data: Backup): Promise<AppResponse>
delete(backup: string): Promise<AppResponse>
run(backup: string): Promise<AppResponse>
getHistory(): Promise<AppResponse>
clearHistory(): Promise<AppResponse>
- Users Documentation
npm install @mcserversoft/mcss-api
or
pnpm install @mcserversoft/mcss-api
The Client
class is a JavaScript/TypeScript client for interacting with an API that manages Minecraft servers. This documentation provides an overview of the class and its methods.
Creates an instance of the Client
class to interact with the Minecraft server management API.
ip
: The IP address of the server.port
: The port number of the server (can benull
).apiKey
: The API key for authentication.https
: A boolean indicating whether to use HTTPS (default istrue
).
Example:
const client = new Client('127.0.0.1', 8080, 'your_api_key', true);
Gets the statistics of the panel.
Returns:
- A promise resolving to an
AppResponse
object.
Example:
const stats = await client.getStats();
Gets all servers based on the specified filter.
filter
: The filter to use (default isServerFilter.NONE
).
Returns:
- A promise resolving to an
AppResponse
object.
Example:
const servers = await client.getServers(ServerFilter.MINIMAL);
getServerCount(filter: ServerCountFilter | number = 0, serverType: ServerType | string): Promise<AppResponse>
Gets the count of servers based on the specified filter and server type.
filter
: The filter to use (default isServerCountFilter.NONE
).serverType
: The server type for counting.
Returns:
- A promise resolving to an
AppResponse
object.
Example:
const serverCount = await client.getServerCount(ServerCountFilter.ONLINE, ServerType.VANILLA);
Gets the MCSS settings.
Returns:
- A promise resolving to an
AppResponse
object.
Example:
const settings = await client.getSettings();
Updates the MCSS settings, specifically the number of backups to keep.
deleteOldBackupsThreshold
: The number of backups to keep.
Returns:
- A promise resolving to an
AppResponse
object.
Example:
const updatedSettings = await client.updateSettings(5);
The AppResponse
interface represents the response from the API and has the following structure:
interface AppResponse {
status: number;
data?: any;
error?: {
message: string;
};
}
status
: The HTTP status code of the response.data
: The data payload of the response (optional).error
: An object containing an error message (optional).
NONE
: 0MINIMAL
: 1STATUS
: 2
NONE
: 0ONLINE
: 1OFFLINE
: 2BYSERVERTYPE
: 3
VANILLA
: "349bf6c7-2d19-4e42-bcee-592fa862bcee"CRAFTBUKKIT
: "afa8b9d6-592d-4016-9dd7-eed4185ca8b8"SPIGOT
: "de188054-f3ac-472d-81d6-c57f0412bfa6"PAPER
: "f738fb40-223e-4010-bd07-af4caabdf3dd"BUNGEECORD
: "1a1bb7be-219f-4dc8-9a6a-4a10dc725391"WATERFALL
: "f49ad4bf-7900-45a4-940b-c97468fbba1f"FORGE
: "8e3aecd7-b81b-4827-a3e2-93a701cdd3b4"FABRIC
: "c45acfcf-b4a1-4733-aab0-f78e1091ae16"BEDROCK
: "87c2620f-48a0-47e6-97c1-ff5fbbc128f3"PURPUR
: "984ed3d3-636d-4535-82b2-7c1048782c64"
The Servers
class is a part of a JavaScript/TypeScript client for interacting with an API that manages Minecraft servers. This documentation provides an overview of the class and its methods.
Creates an instance of the Servers
class to interact with the Minecraft server management API.
obj
: An instance of theClient
class.
Example:
const client = new Client('127.0.0.1', 8080, 'your_api_key', true);
const servers = new Servers(client);
Gets the server with the specified ID.
Id
: The server ID.filter
: The filter to apply (default isServerFilter.NONE
).
Returns:
- A promise resolving to a
ServerResponse
object.
Example:
const server = await servers.get('server_id', ServerFilter.MINIMAL);
Executes a command on the specified servers.
servers
: An array of server IDs.command
: The command to execute.
Returns:
- A promise resolving to an
AppResponse
object.
Example:
const response = await servers.execute(['server_id'], ServerAction.Restart);
The ServerResponse
interface represents the response from the server-related API calls and has the following structure:
interface ServerResponse {
status: number;
data?: any;
error?: {
message: string;
};
getStats?: () => Promise<AppResponse>;
getIcon?: () => Promise<AppResponse>;
execute?: (...command: any) => Promise<AppResponse>;
edit?: (obj: Server | object) => Promise<AppResponse>;
getConsole?: (AmountOfLines?: number, Reversed?: boolean, takeFromBeginning?: boolean) => Promise<AppResponse>;
isConsoleOutdated?: () => Promise<AppResponse>;
scheduler?: Scheduler;
backups?: Backups;
}
status
: The HTTP status code of the response.data
: The data payload of the response (optional).error
: An object containing an error message (optional).- Additional methods for interacting with the server, such as
getStats
,getIcon
,execute
,edit
,getConsole
,isConsoleOutdated
,scheduler
, andbackups
.
InvalidOrEmpty
: 0Stop
: 1Start
: 2Kill
: 3Restart
: 4
The Scheduler
class is part of a JavaScript/TypeScript client for interacting with an API that manages tasks and scheduling on Minecraft servers. This documentation provides an overview of the class and its methods.
Creates an instance of the Scheduler
class to interact with the Minecraft server scheduler API.
obj
: An instance of theServers
class.
Example:
const client = new Client('127.0.0.1', 8080, 'your_api_key', true);
const servers = new Servers(client);
const scheduler = new Scheduler(servers);
Gets the current status of the scheduler.
Returns:
- A promise resolving to an
AppResponse
object.
Example:
const schedulerStatus = await scheduler.get();
Gets all tasks based on the specified filter.
filter
: The filter to apply (default isTaskFilter.None
).
Returns:
- A promise resolving to an
AppResponse
object.
Example:
const tasks = await scheduler.getTasks(TaskFilter.FixedTime);
Gets a specific task by ID.
Id
: The ID of the task.
Returns:
- A promise resolving to an
AppResponse
object.
Example:
const taskDetails = await scheduler.getTask('task_id');
Creates a new task.
data
: The task data.
Returns:
- A promise resolving to an
AppResponse
object.
Example:
const newTask = await scheduler.create({ name: 'Task 1', type: 'fixed', time: '12:00' });
Updates an existing task by ID.
Id
: The ID of the task.data
: The updated task data.
Returns:
- A promise resolving to an
AppResponse
object.
Example:
const updatedTask = await scheduler.update('task_id', { name: 'Updated Task', type: 'interval', interval: 300 });
Deletes a task by ID.
Id
: The ID of the task to delete.
Returns:
- A promise resolving to an
AppResponse
object.
Example:
const deleteResponse = await scheduler.delete('task_id');
Executes a task by ID.
Id
: The ID of the task to execute.
Returns:
- A promise resolving to an
AppResponse
object.
Example:
const executionResponse = await scheduler.run('task_id');
None
: 0FixedTime
: 1Interval
: 2Timeless
: 3
The Backups
class is part of a JavaScript/TypeScript client for interacting with an API that manages backups on Minecraft servers. This documentation provides an overview of the class and its methods.
Creates an instance of the Backups
class to interact with the Minecraft server backups API.
obj
: An instance of theServers
class.
Example:
const client = new Client('127.0.0.1', 8080, 'your_api_key', true);
const servers = new Servers(client);
const backups = new Backups(servers);
Gets all backups.
Returns:
- A promise resolving to an
AppResponse
object.
Example:
const allBackups = await backups.get();
Gets backup statistics.
Returns:
- A promise resolving to an
AppResponse
object.
Example:
const backupStats = await backups.getStats();
Gets details about a specific backup by ID.
backup
: The ID of the backup.
Returns:
- A promise resolving to an
AppResponse
object.
Example:
const backupDetails = await backups.getBackup('backup_id');
Creates a new backup.
data
: The backup data.
Returns:
- A promise resolving to an
AppResponse
object.
Example:
const newBackup = await backups.create({ name: 'Backup 1', destination: '/path/to/backup' });
Updates an existing backup by ID.
backup
: The ID of the backup.data
: The updated backup data.
Returns:
- A promise resolving to an
AppResponse
object.
Example:
const updatedBackup = await backups.update('backup_id', { name: 'Updated Backup', destination: '/new/path' });
Deletes a backup by ID.
backup
: The ID of the backup.
Returns:
- A promise resolving to an
AppResponse
object.
Example:
const deleteResponse = await backups.delete('backup_id');
Runs a backup by ID.
backup
: The ID of the backup.
Returns:
- A promise resolving to an
AppResponse
object.
Example:
const runResponse = await backups.run('backup_id');
Gets the backup history for the server.
Returns:
- A promise resolving to an
AppResponse
object.
Example:
const backupHistory = await backups.getHistory();
Clears the backup history for the server.
Returns:
- A promise resolving to an
AppResponse
object.
Example:
const clearHistoryResponse = await backups.clearHistory();
The Users
class is part of a JavaScript/TypeScript client for interacting with an API that manages users on Minecraft servers. This documentation provides an overview of the class and its methods.
Creates an instance of the Users
class to interact with the Minecraft server users API.
obj
: An instance of theClient
class.
Example:
const client = new Client('127.0.0.1', 8080, 'your_api_key', true);
const users = new Users(client);
Gets all users.
Returns:
- A promise resolving to an
AppResponse
object.
Example:
const allUsers = await users.get();
Gets details about a specific user by ID.
id
: The ID of the user.
Returns:
- A promise resolving to an
AppResponse
object.
Example:
const userDetails = await users.getUser('user_id');
Creates a new user.
user
: The user data.
Returns:
- A promise resolving to an
AppResponse
object.
Example:
const newUser = await users.createUser({ username: 'new_user', password: 'password123' });
Updates an existing user by ID.
id
: The ID of the user.user
: The updated user data.
Returns:
- A promise resolving to an
AppResponse
object.
Example:
const updatedUser = await users.updateUser('user_id', { username: 'updated_user', password: 'new_password' });
Deletes a user by ID.
id
: The ID of the user.
Returns:
- A promise resolving to an
AppResponse
object.
Example:
const deleteUserResponse = await users.deleteUser('user_id');
Wipes all user sessions.
Returns:
- A promise resolving to an
AppResponse
object.
Example:
const wipeSessionsResponse = await users.wipeSessions();