mirror of
https://github.com/modrinth/code.git
synced 2026-08-31 12:05:53 +00:00
feat: impl world scoped power endpoint
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user