Phase7
This commit is contained in:
30
apps/web/src/lib/api/billing.ts
Normal file
30
apps/web/src/lib/api/billing.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { apiFetch } from "./auth";
|
||||
|
||||
export interface WalletResponse {
|
||||
balance: number;
|
||||
periodStart: string;
|
||||
transactions: Array<{
|
||||
id: string;
|
||||
amount: number;
|
||||
type: string;
|
||||
referenceType: string | null;
|
||||
referenceId: string | null;
|
||||
createdAt: string;
|
||||
}>;
|
||||
}
|
||||
|
||||
export interface IdleStatusResponse {
|
||||
enabled: boolean;
|
||||
playerCount: number | null;
|
||||
idleStopAt: string | null;
|
||||
secondsRemaining: number | null;
|
||||
lastPlayerSeenAt: string | null;
|
||||
}
|
||||
|
||||
export async function getWallet(): Promise<WalletResponse> {
|
||||
return apiFetch<WalletResponse>("/account/wallet");
|
||||
}
|
||||
|
||||
export async function getServerIdleStatus(serverId: string): Promise<IdleStatusResponse> {
|
||||
return apiFetch<IdleStatusResponse>(`/servers/${serverId}/idle`);
|
||||
}
|
||||
@@ -5,9 +5,11 @@ export type GameServerStatus =
|
||||
| "PROVISIONING"
|
||||
| "INSTALLING"
|
||||
| "STOPPED"
|
||||
| "QUEUED"
|
||||
| "STARTING"
|
||||
| "RUNNING"
|
||||
| "STOPPING"
|
||||
| "UNKNOWN"
|
||||
| "ERROR"
|
||||
| "DELETING"
|
||||
| "DELETED";
|
||||
@@ -38,6 +40,8 @@ export interface Server {
|
||||
containerId: string | null;
|
||||
dataPath: string | null;
|
||||
ramMb: number;
|
||||
idleShutdownEnabled: boolean;
|
||||
idleStopAt: string | null;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
@@ -49,6 +53,7 @@ export interface ServerListResponse {
|
||||
export interface ServerActionResponse {
|
||||
server: Server;
|
||||
jobId?: string;
|
||||
queuePosition?: number;
|
||||
}
|
||||
|
||||
export interface CreateServerPayload {
|
||||
|
||||
Reference in New Issue
Block a user