Files
Genarrative/src/services/creationEntryConfigService.ts

76 lines
1.7 KiB
TypeScript

import { requestJson } from './apiClient';
export type CreationEntryTypeConfig = {
id: string;
title: string;
subtitle: string;
badge: string;
imageSrc: string;
visible: boolean;
open: boolean;
sortOrder: number;
categoryId: string;
categoryLabel: string;
categorySortOrder: number;
updatedAtMicros: number;
unifiedCreationSpec?: UnifiedCreationSpec | null;
};
export type UnifiedCreationField = {
id: string;
kind: 'text' | 'select' | 'image' | 'audio';
label: string;
required: boolean;
};
export type UnifiedCreationSpec = {
playId: 'puzzle' | 'match3d' | 'jump-hop' | 'wooden-fish';
title: string;
workspaceStage:
| 'puzzle-agent-workspace'
| 'match3d-agent-workspace'
| 'jump-hop-workspace'
| 'wooden-fish-workspace';
generationStage:
| 'puzzle-generating'
| 'match3d-generating'
| 'jump-hop-generating'
| 'wooden-fish-generating';
resultStage:
| 'puzzle-result'
| 'match3d-result'
| 'jump-hop-result'
| 'wooden-fish-result';
fields: UnifiedCreationField[];
};
export type CreationEntryConfig = {
startCard: {
title: string;
description: string;
idleBadge: string;
busyBadge: string;
};
typeModal: {
title: string;
description: string;
};
eventBanner: {
title: string;
description: string;
coverImageSrc: string;
prizePoolMudPoints: number;
startsAtText: string;
endsAtText: string;
};
creationTypes: CreationEntryTypeConfig[];
};
export async function fetchCreationEntryConfig(): Promise<CreationEntryConfig> {
return requestJson<CreationEntryConfig>(
'/api/creation-entry/config',
{ method: 'GET' },
'读取创作入口配置失败',
);
}