You've already forked AstralRinth
forked from didirus/AstralRinth
87c86c7d0d
* Reapply "fix: start swapping useBaseFetch usages to api-client" This reverts commit f4f33db7019ea861addb2c66c204d736800b7b6c. * fix: bugs * fix: analytics * fix: lint
58 lines
1.4 KiB
TypeScript
58 lines
1.4 KiB
TypeScript
import { AbstractModule } from '../../../core/abstract-module'
|
|
import type { Archon } from '../types'
|
|
|
|
export class ArchonServersV1Module extends AbstractModule {
|
|
public getModuleID(): string {
|
|
return 'archon_servers_v1'
|
|
}
|
|
|
|
/**
|
|
* Get list of servers for the authenticated user
|
|
* GET /v1/servers
|
|
*/
|
|
public async list(): Promise<Archon.Servers.v1.ServerFull[]> {
|
|
return this.client.request<Archon.Servers.v1.ServerFull[]>('/servers', {
|
|
api: 'archon',
|
|
version: 1,
|
|
method: 'GET',
|
|
})
|
|
}
|
|
|
|
/**
|
|
* Get full server details including worlds, backups, and content
|
|
* GET /v1/servers/:server_id
|
|
*/
|
|
public async get(serverId: string): Promise<Archon.Servers.v1.ServerFull> {
|
|
return this.client.request<Archon.Servers.v1.ServerFull>(`/servers/${serverId}`, {
|
|
api: 'archon',
|
|
version: 1,
|
|
method: 'GET',
|
|
})
|
|
}
|
|
|
|
/**
|
|
* Get available regions
|
|
* GET /v1/regions
|
|
*/
|
|
public async getRegions(): Promise<Archon.Servers.v1.Region[]> {
|
|
return this.client.request<Archon.Servers.v1.Region[]>('/regions', {
|
|
api: 'archon',
|
|
version: 1,
|
|
method: 'GET',
|
|
skipAuth: true,
|
|
})
|
|
}
|
|
|
|
/**
|
|
* End the intro flow for a server
|
|
* DELETE /v1/servers/:id/flows/intro
|
|
*/
|
|
public async endIntro(serverId: string): Promise<void> {
|
|
await this.client.request(`/servers/${serverId}/flows/intro`, {
|
|
api: 'archon',
|
|
version: 1,
|
|
method: 'DELETE',
|
|
})
|
|
}
|
|
}
|