Phase9
This commit is contained in:
@@ -218,3 +218,21 @@ export {
|
||||
type EdgeStartRequest,
|
||||
type EdgeStartResponse,
|
||||
} from './join';
|
||||
|
||||
export {
|
||||
whmcsHealthResponseSchema,
|
||||
whmcsPlanCatalogResponseSchema,
|
||||
whmcsUpsertClientRequestSchema,
|
||||
whmcsUpsertClientResponseSchema,
|
||||
whmcsProvisionServiceRequestSchema,
|
||||
whmcsServiceResponseSchema,
|
||||
whmcsChangePackageRequestSchema,
|
||||
whmcsSuspendRequestSchema,
|
||||
type WhmcsHealthResponse,
|
||||
type WhmcsPlanCatalogResponse,
|
||||
type WhmcsProvisionServiceRequest,
|
||||
type WhmcsServiceResponse,
|
||||
type WhmcsUpsertClientRequest,
|
||||
type WhmcsUpsertClientResponse,
|
||||
type WhmcsChangePackageRequest,
|
||||
} from './whmcs';
|
||||
|
||||
71
packages/contracts/src/whmcs.ts
Normal file
71
packages/contracts/src/whmcs.ts
Normal file
@@ -0,0 +1,71 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
import { serverResponseSchema } from './servers';
|
||||
|
||||
export const whmcsHealthResponseSchema = z.object({
|
||||
status: z.literal('ok'),
|
||||
integrationId: z.string(),
|
||||
billingProvider: z.string(),
|
||||
});
|
||||
|
||||
export const whmcsPlanCatalogItemSchema = z.object({
|
||||
id: z.string().uuid(),
|
||||
slug: z.string(),
|
||||
name: z.string(),
|
||||
maxRamMb: z.number().int(),
|
||||
isFree: z.boolean(),
|
||||
});
|
||||
|
||||
export const whmcsPlanCatalogResponseSchema = z.object({
|
||||
plans: z.array(whmcsPlanCatalogItemSchema),
|
||||
});
|
||||
|
||||
export const whmcsUpsertClientRequestSchema = z.object({
|
||||
email: z.string().email(),
|
||||
username: z.string().min(3).max(32),
|
||||
displayName: z.string().max(64).optional(),
|
||||
});
|
||||
|
||||
export const whmcsUpsertClientResponseSchema = z.object({
|
||||
userId: z.string().uuid(),
|
||||
externalClientId: z.string(),
|
||||
created: z.boolean(),
|
||||
});
|
||||
|
||||
export const whmcsProvisionServiceRequestSchema = z.object({
|
||||
externalServiceId: z.string().min(1).max(64),
|
||||
externalClientId: z.string().min(1).max(64),
|
||||
externalProductId: z.string().max(64).optional(),
|
||||
planSlug: z.string().min(1).max(64),
|
||||
serverName: z.string().min(1).max(64),
|
||||
minecraftVersion: z.string().min(1).max(32).default('1.21.1'),
|
||||
softwareFamily: z
|
||||
.enum(['VANILLA', 'PAPER', 'PURPUR', 'FABRIC', 'FORGE', 'NEOFORGE', 'QUILT', 'BEDROCK_DEDICATED'])
|
||||
.default('VANILLA'),
|
||||
edition: z.enum(['JAVA', 'BEDROCK']).default('JAVA'),
|
||||
eulaAccepted: z.literal(true),
|
||||
});
|
||||
|
||||
export const whmcsServiceResponseSchema = z.object({
|
||||
externalServiceId: z.string(),
|
||||
status: z.enum(['PENDING', 'ACTIVE', 'SUSPENDED', 'TERMINATED']),
|
||||
server: serverResponseSchema,
|
||||
});
|
||||
|
||||
export const whmcsChangePackageRequestSchema = z.object({
|
||||
planSlug: z.string().min(1).max(64),
|
||||
ramMb: z.number().int().min(512).max(65536).optional(),
|
||||
});
|
||||
|
||||
export const whmcsSuspendRequestSchema = z.object({
|
||||
reason: z.string().max(256).optional(),
|
||||
});
|
||||
|
||||
export type WhmcsHealthResponse = z.infer<typeof whmcsHealthResponseSchema>;
|
||||
export type WhmcsPlanCatalogResponse = z.infer<typeof whmcsPlanCatalogResponseSchema>;
|
||||
export type WhmcsUpsertClientRequest = z.infer<typeof whmcsUpsertClientRequestSchema>;
|
||||
export type WhmcsUpsertClientResponse = z.infer<typeof whmcsUpsertClientResponseSchema>;
|
||||
export type WhmcsProvisionServiceRequest = z.infer<typeof whmcsProvisionServiceRequestSchema>;
|
||||
export type WhmcsServiceResponse = z.infer<typeof whmcsServiceResponseSchema>;
|
||||
export type WhmcsChangePackageRequest = z.infer<typeof whmcsChangePackageRequestSchema>;
|
||||
export type WhmcsSuspendRequest = z.infer<typeof whmcsSuspendRequestSchema>;
|
||||
Reference in New Issue
Block a user