feat: implement world creation flow routes

This commit is contained in:
Calum H. (IMB11)
2026-06-26 17:09:22 +01:00
parent 0a451d9f9a
commit 54e6fe09cd
65 changed files with 834 additions and 1307 deletions
@@ -170,6 +170,15 @@ export class ArchonContentV1Module extends AbstractModule {
})
}
/** POST /v1/:server_id/worlds/:world_id/content/reset-world */
public async resetWorld(serverId: string, worldId: string): Promise<void> {
await this.client.request<void>(`/servers/${serverId}/worlds/${worldId}/content/reset-world`, {
api: 'archon',
version: 1,
method: 'POST',
})
}
/** POST /v1/:server_id/worlds/:world_id/content/unlink-modpack */
public async unlinkModpack(serverId: string, worldId: string): Promise<void> {
await this.client.request<void>(
@@ -43,6 +43,42 @@ export class ArchonServersV1Module extends AbstractModule {
})
}
/**
* Create a world
* POST /v1/servers/:id/worlds
*/
public async createWorld(
serverId: string,
request: Archon.Servers.v1.CreateWorld,
): Promise<Archon.Servers.v1.CreateWorldResponse> {
return this.client.request<Archon.Servers.v1.CreateWorldResponse>(
`/servers/${serverId}/worlds`,
{
api: 'archon',
version: 1,
method: 'POST',
body: request,
},
)
}
/**
* Modify a world
* PATCH /v1/servers/:id/worlds/:wid
*/
public async patchWorld(
serverId: string,
worldId: string,
request: Archon.Servers.v1.PatchWorld,
): Promise<void> {
await this.client.request(`/servers/${serverId}/worlds/${worldId}`, {
api: 'archon',
version: 1,
method: 'PATCH',
body: request,
})
}
/**
* End the intro flow for a server
* DELETE /v1/servers/:id/flows/intro
@@ -66,16 +102,4 @@ export class ArchonServersV1Module extends AbstractModule {
method: 'POST',
})
}
/**
* Switch the server to a world
* POST /v1/servers/:id/worlds/:wid/active
*/
public async switchWorld(serverId: string, worldId: string): Promise<void> {
await this.client.request(`/servers/${serverId}/worlds/${worldId}/active`, {
api: 'archon',
version: 1,
method: 'POST',
})
}
}
@@ -761,6 +761,34 @@ export namespace Archon {
readiness: WorldReadiness
}
export type WorldContent =
| {
content_variant: 'modpack'
spec: Archon.Content.v1.ModpackSpec
}
| {
content_variant: 'bare'
loader: Archon.Content.v1.Modloader
version: string
game_version?: string | null
}
export type CreateWorld = {
name: string
icon_data?: string | null
properties?: Archon.Content.v1.PropertiesFields | null
content: WorldContent
}
export type CreateWorldResponse = {
id: string
}
export type PatchWorld = {
name?: string | null
icon_data?: string | null
}
export type WorldReadiness = {
data_synchronized_fetched: boolean
}