47 lines
1.0 KiB
TypeScript
47 lines
1.0 KiB
TypeScript
import { apiRequest } from './client';
|
|
|
|
export interface TemplateGeneration {
|
|
id: string;
|
|
userId: string;
|
|
templateId: string;
|
|
type: 'VIDEO' | 'IMAGE' | 'TEXT';
|
|
resultUrl: string[];
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
status: 'pending' | 'processing' | 'completed' | 'failed';
|
|
creditsCost: number;
|
|
creditsTransactionId: string | null;
|
|
template: {
|
|
id: string;
|
|
title: string;
|
|
titleEn: string;
|
|
};
|
|
}
|
|
|
|
export interface GetTemplateGenerationsParams {
|
|
page?: number;
|
|
limit?: number;
|
|
type?: 'VIDEO' | 'IMAGE';
|
|
}
|
|
|
|
export interface TemplateGenerationsResponseData {
|
|
generations: TemplateGeneration[];
|
|
total: number;
|
|
page: number;
|
|
limit: number;
|
|
}
|
|
|
|
export interface TemplateGenerationsResponse {
|
|
success: boolean;
|
|
data: TemplateGenerationsResponseData;
|
|
}
|
|
|
|
export async function getTemplateGenerations(
|
|
params: GetTemplateGenerationsParams = {}
|
|
): Promise<TemplateGenerationsResponse> {
|
|
return apiRequest<TemplateGenerationsResponse>('/api/template-generations', {
|
|
method: 'GET',
|
|
params
|
|
});
|
|
}
|