This commit is contained in:
alorig
2025-11-19 21:56:03 +05:00
parent 7321803006
commit 38f6026e73
13 changed files with 2370 additions and 142 deletions

View File

@@ -2052,3 +2052,110 @@ export async function updateWorkflowStep(
});
}
// Cluster attachment endpoints
export async function attachClustersToBlueprint(
blueprintId: number,
clusterIds: number[],
role: 'hub' | 'supporting' | 'attribute' = 'hub'
): Promise<{ attached_count: number; clusters: Array<{ id: number; name: string; role: string; link_id: number }> }> {
return fetchAPI(`/v1/site-builder/siteblueprint/${blueprintId}/clusters/attach/`, {
method: 'POST',
body: JSON.stringify({ cluster_ids: clusterIds, role }),
});
}
export async function detachClustersFromBlueprint(
blueprintId: number,
clusterIds?: number[],
role?: 'hub' | 'supporting' | 'attribute'
): Promise<{ detached_count: number }> {
return fetchAPI(`/v1/site-builder/siteblueprint/${blueprintId}/clusters/detach/`, {
method: 'POST',
body: JSON.stringify({ cluster_ids: clusterIds, role }),
});
}
// Taxonomy endpoints
export interface Taxonomy {
id: number;
name: string;
slug: string;
taxonomy_type: 'blog_category' | 'blog_tag' | 'product_category' | 'product_tag' | 'product_attribute' | 'service_category';
description?: string;
cluster_ids: number[];
external_reference?: string;
created_at: string;
updated_at: string;
}
export interface TaxonomyCreateData {
name: string;
slug: string;
taxonomy_type: 'blog_category' | 'blog_tag' | 'product_category' | 'product_tag' | 'product_attribute' | 'service_category';
description?: string;
cluster_ids?: number[];
external_reference?: string;
}
export interface TaxonomyImportRecord {
name: string;
slug: string;
taxonomy_type?: string;
description?: string;
external_reference?: string;
}
export async function fetchBlueprintsTaxonomies(blueprintId: number): Promise<{ count: number; taxonomies: Taxonomy[] }> {
return fetchAPI(`/v1/site-builder/siteblueprint/${blueprintId}/taxonomies/`);
}
export async function createBlueprintTaxonomy(
blueprintId: number,
data: TaxonomyCreateData
): Promise<Taxonomy> {
return fetchAPI(`/v1/site-builder/siteblueprint/${blueprintId}/taxonomies/`, {
method: 'POST',
body: JSON.stringify(data),
});
}
export async function importBlueprintsTaxonomies(
blueprintId: number,
records: TaxonomyImportRecord[],
defaultType: string = 'blog_category'
): Promise<{ imported_count: number; taxonomies: Taxonomy[] }> {
return fetchAPI(`/v1/site-builder/siteblueprint/${blueprintId}/taxonomies/import/`, {
method: 'POST',
body: JSON.stringify({ records, default_type: defaultType }),
});
}
// Page blueprint endpoints
export async function updatePageBlueprint(
pageId: number,
data: Partial<PageBlueprint>
): Promise<PageBlueprint> {
return fetchAPI(`/v1/site-builder/pageblueprint/${pageId}/`, {
method: 'PATCH',
body: JSON.stringify(data),
});
}
export async function regeneratePageBlueprint(
pageId: number
): Promise<{ success: boolean; task_id?: string }> {
return fetchAPI(`/v1/site-builder/pageblueprint/${pageId}/regenerate/`, {
method: 'POST',
});
}
export async function generatePageContent(
pageId: number,
force?: boolean
): Promise<{ success: boolean; task_id?: string }> {
return fetchAPI(`/v1/site-builder/pageblueprint/${pageId}/generate_content/`, {
method: 'POST',
body: JSON.stringify({ force: force || false }),
});
}