feat: impl world scoped power endpoint

This commit is contained in:
Calum H. (IMB11)
2026-06-26 17:09:22 +01:00
parent ad7a4d7d76
commit 2c1b8a2326
10 changed files with 61 additions and 37 deletions
@@ -97,19 +97,6 @@ export class ArchonServersV0Module extends AbstractModule {
})
}
/**
* Send a power action to a server (Start, Stop, Restart, Kill)
* POST /modrinth/v0/servers/:id/power
*/
public async power(serverId: string, action: Archon.Servers.v0.PowerAction): Promise<void> {
await this.client.request(`/servers/${serverId}/power`, {
api: 'archon',
method: 'POST',
version: 'modrinth/v0',
body: { action },
})
}
/**
* Reinstall a server with a new loader or modpack
* POST /modrinth/v0/servers/:id/reinstall
@@ -91,6 +91,23 @@ export class ArchonServersV1Module extends AbstractModule {
})
}
/**
* Run a power action for a specific world
* POST /v1/servers/:id/worlds/:wid/power
*/
public async powerWorld(
serverId: string,
worldId: string,
request: Archon.Servers.v1.WorldPowerActionRequest,
): Promise<void> {
await this.client.request(`/servers/${serverId}/worlds/${worldId}/power`, {
api: 'archon',
version: 1,
method: 'POST',
body: request,
})
}
/**
* Reset a world to onboarding
* POST /v1/servers/:id/worlds/:wid/onboard
@@ -681,8 +681,6 @@ export namespace Archon {
token: string // JWT token for filesystem access
}
export type PowerAction = 'Start' | 'Stop' | 'Restart' | 'Kill'
export type ReinstallLoaderRequest = {
loader: string
loader_version?: string
@@ -715,6 +713,13 @@ export namespace Archon {
}
export namespace v1 {
export type WorldPowerAction = 'start' | 'stop' | 'restart' | 'kill'
export type WorldPowerActionRequest = {
action: WorldPowerAction
shutdown_strategy?: string | null
}
export type ServerFull = {
id: string
name: string