@@ -2,6 +2,7 @@ import { resolve } from 'path';
22
33import type { Client } from '../client/interfaces/Client' ;
44import { HttpClient } from '../HttpClient' ;
5+ import { Indent } from '../Indent' ;
56import { mkdir , rmdir } from './fileSystem' ;
67import { isSubDirectory } from './isSubdirectory' ;
78import { Templates } from './registerHandlebarTemplates' ;
@@ -24,6 +25,7 @@ import { writeClientServices } from './writeClientServices';
2425 * @param exportModels: Generate models
2526 * @param exportSchemas: Generate schemas
2627 * @param exportSchemas: Generate schemas
28+ * @param indent: Indentation options (4, 2 or tab)
2729 * @param postfix: Service name postfix
2830 * @param request: Path to custom request file
2931 */
@@ -38,6 +40,7 @@ export async function writeClient(
3840 exportServices : boolean ,
3941 exportModels : boolean ,
4042 exportSchemas : boolean ,
43+ indent : Indent ,
4144 postfix : string ,
4245 request ?: string
4346) : Promise < void > {
@@ -54,7 +57,7 @@ export async function writeClient(
5457 if ( exportCore ) {
5558 await rmdir ( outputPathCore ) ;
5659 await mkdir ( outputPathCore ) ;
57- await writeClientCore ( client , templates , outputPathCore , httpClient , request ) ;
60+ await writeClientCore ( client , templates , outputPathCore , httpClient , indent , request ) ;
5861 }
5962
6063 if ( exportServices ) {
@@ -67,20 +70,21 @@ export async function writeClient(
6770 httpClient ,
6871 useUnionTypes ,
6972 useOptions ,
73+ indent ,
7074 postfix
7175 ) ;
7276 }
7377
7478 if ( exportSchemas ) {
7579 await rmdir ( outputPathSchemas ) ;
7680 await mkdir ( outputPathSchemas ) ;
77- await writeClientSchemas ( client . models , templates , outputPathSchemas , httpClient , useUnionTypes ) ;
81+ await writeClientSchemas ( client . models , templates , outputPathSchemas , httpClient , useUnionTypes , indent ) ;
7882 }
7983
8084 if ( exportModels ) {
8185 await rmdir ( outputPathModels ) ;
8286 await mkdir ( outputPathModels ) ;
83- await writeClientModels ( client . models , templates , outputPathModels , httpClient , useUnionTypes ) ;
87+ await writeClientModels ( client . models , templates , outputPathModels , httpClient , useUnionTypes , indent ) ;
8488 }
8589
8690 if ( exportCore || exportServices || exportSchemas || exportModels ) {
0 commit comments