stage2-2 and docs
This commit is contained in:
@@ -1914,3 +1914,141 @@ export async function fetchContentById(id: number): Promise<Content> {
|
||||
return fetchAPI(`/v1/writer/content/${id}/`);
|
||||
}
|
||||
|
||||
// Site Builder API
|
||||
export interface SiteBlueprint {
|
||||
id: number;
|
||||
name: string;
|
||||
description?: string;
|
||||
config_json: Record<string, any>;
|
||||
structure_json: Record<string, any>;
|
||||
status: string;
|
||||
hosting_type: string;
|
||||
version: number;
|
||||
deployed_version?: number;
|
||||
site_id: number;
|
||||
sector_id: number;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
pages?: PageBlueprint[];
|
||||
workflow_state?: WorkflowState;
|
||||
gating_messages?: string[];
|
||||
}
|
||||
|
||||
export interface PageBlueprint {
|
||||
id: number;
|
||||
site_blueprint_id: number;
|
||||
site_blueprint?: number;
|
||||
slug: string;
|
||||
title: string;
|
||||
type: string;
|
||||
blocks_json: any[];
|
||||
status: string;
|
||||
order: number;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface WorkflowState {
|
||||
current_step: string;
|
||||
step_status: Record<string, { status: string; code?: string; message?: string; updated_at?: string }>;
|
||||
blocking_reason?: string;
|
||||
completed: boolean;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface WizardContext {
|
||||
workflow: WorkflowState;
|
||||
cluster_summary: {
|
||||
total: number;
|
||||
attached: number;
|
||||
coverage_stats: {
|
||||
complete: number;
|
||||
in_progress: number;
|
||||
pending: number;
|
||||
};
|
||||
clusters: Array<{
|
||||
id: number;
|
||||
name: string;
|
||||
keywords_count: number;
|
||||
volume: number;
|
||||
context_type?: string;
|
||||
dimension_meta?: Record<string, any>;
|
||||
coverage_status: string;
|
||||
role: string;
|
||||
}>;
|
||||
};
|
||||
taxonomy_summary: {
|
||||
total: number;
|
||||
by_type: Record<string, number>;
|
||||
taxonomies: Array<{
|
||||
id: number;
|
||||
name: string;
|
||||
slug: string;
|
||||
taxonomy_type: string;
|
||||
cluster_count: number;
|
||||
}>;
|
||||
};
|
||||
sitemap_summary: {
|
||||
total_pages: number;
|
||||
by_type: Record<string, number>;
|
||||
coverage_percentage: number;
|
||||
};
|
||||
next_actions: Array<{
|
||||
step: string;
|
||||
action: string;
|
||||
message: string;
|
||||
}>;
|
||||
}
|
||||
|
||||
export async function fetchSiteBlueprints(filters?: {
|
||||
site_id?: number;
|
||||
sector_id?: number;
|
||||
status?: string;
|
||||
page?: number;
|
||||
page_size?: number;
|
||||
}): Promise<{ count: number; next: string | null; previous: string | null; results: SiteBlueprint[] }> {
|
||||
const params = new URLSearchParams();
|
||||
if (filters?.site_id) params.append('site_id', filters.site_id.toString());
|
||||
if (filters?.sector_id) params.append('sector_id', filters.sector_id.toString());
|
||||
if (filters?.status) params.append('status', filters.status);
|
||||
if (filters?.page) params.append('page', filters.page.toString());
|
||||
if (filters?.page_size) params.append('page_size', filters.page_size.toString());
|
||||
|
||||
const queryString = params.toString();
|
||||
return fetchAPI(`/v1/site-builder/siteblueprint/${queryString ? `?${queryString}` : ''}`);
|
||||
}
|
||||
|
||||
export async function fetchSiteBlueprintById(id: number): Promise<SiteBlueprint> {
|
||||
return fetchAPI(`/v1/site-builder/siteblueprint/${id}/`);
|
||||
}
|
||||
|
||||
export async function createSiteBlueprint(data: Partial<SiteBlueprint>): Promise<SiteBlueprint> {
|
||||
return fetchAPI('/v1/site-builder/siteblueprint/', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
}
|
||||
|
||||
export async function updateSiteBlueprint(id: number, data: Partial<SiteBlueprint>): Promise<SiteBlueprint> {
|
||||
return fetchAPI(`/v1/site-builder/siteblueprint/${id}/`, {
|
||||
method: 'PATCH',
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
}
|
||||
|
||||
export async function fetchWizardContext(blueprintId: number): Promise<WizardContext> {
|
||||
return fetchAPI(`/v1/site-builder/siteblueprint/${blueprintId}/workflow/context/`);
|
||||
}
|
||||
|
||||
export async function updateWorkflowStep(
|
||||
blueprintId: number,
|
||||
step: string,
|
||||
status: string,
|
||||
metadata?: Record<string, any>
|
||||
): Promise<WorkflowState> {
|
||||
return fetchAPI(`/v1/site-builder/siteblueprint/${blueprintId}/workflow/step/`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ step, status, metadata }),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user