@@ -14,7 +14,11 @@ import {
1414} from '../types/ComponentStructure' ;
1515import { Deploy , ProjectDeployResponse } from '../types/Deploy' ;
1616import { ProjectLog } from '../types/ProjectLog' ;
17- import { MigrateAppResponse , PollAppResponse } from '../types/Migration' ;
17+ import {
18+ MigrateAppResponse ,
19+ CloneAppResponse ,
20+ PollAppResponse ,
21+ } from '../types/Migration' ;
1822
1923const PROJECTS_API_PATH = 'dfs/v1/projects' ;
2024const PROJECTS_DEPLOY_API_PATH = 'dfs/deploy/v1' ;
@@ -318,3 +322,35 @@ export async function checkMigrationStatus(
318322 url : `${ MIGRATIONS_API_PATH } /migrations/${ id } ` ,
319323 } ) ;
320324}
325+
326+ export async function cloneApp (
327+ accountId : number ,
328+ appId : number
329+ ) : Promise < CloneAppResponse > {
330+ return http . post ( accountId , {
331+ url : `${ MIGRATIONS_API_PATH } /exports` ,
332+ data : {
333+ componentId : appId ,
334+ componentType : 'PUBLIC_APP_ID' ,
335+ } ,
336+ } ) ;
337+ }
338+
339+ export async function checkCloneStatus (
340+ accountId : number ,
341+ exportId : number
342+ ) : Promise < CloneAppResponse > {
343+ return http . get ( accountId , {
344+ url : `${ MIGRATIONS_API_PATH } /exports/statuses/${ exportId } ` ,
345+ } ) ;
346+ }
347+
348+ export async function downloadClonedProject (
349+ accountId : number ,
350+ exportId : number
351+ ) : Promise < Buffer > {
352+ return http . get ( accountId , {
353+ url : `${ MIGRATIONS_API_PATH } /exports/${ exportId } /download-as-clone` ,
354+ responseType : 'arraybuffer' ,
355+ } ) ;
356+ }
0 commit comments