protected async Task Generate <TCodeModel>(TemplateFactory <TCodeModel> templateFactory, TCodeModel codeModel) where TCodeModel : CodeModelTS { if (!IsMultiapiLatest(codeModel)) { await WriteServiceClientCodeFile(templateFactory, codeModel); await WriteServiceClientContextCodeFile(templateFactory, codeModel); if (ShouldWriteModelsFiles(codeModel)) { await WriteModelsIndexFile(codeModel); if (codeModel.HasMappers()) { await WriteMappersIndexFile(codeModel); } } if (ShouldWriteParameterMappersFile(codeModel)) { await WriteParameterMappersFile(codeModel); } if (ShouldWriteMethodGroupFiles(codeModel)) { await WriteMethodGroupIndexFile(codeModel); bool shouldWriteModelsFiles = ShouldWriteModelsFiles(codeModel); foreach (MethodGroupTS methodGroup in codeModel.MethodGroupModels) { if (shouldWriteModelsFiles) { await WriteMethodGroupMappersFile(methodGroup); } await WriteMethodGroupFile(methodGroup); } } } else { await WriteAliasFile(codeModel); } if (ShouldWritePackageJsonFile(codeModel)) { await WritePackageJsonFile(codeModel); } if (ShouldWriteReadmeMdFile(codeModel)) { await WriteReadmeMdFile(codeModel); } if (ShouldWriteLicenseFile(codeModel)) { await WriteLicenseFile(codeModel); } if (ShouldWriteMetadata(codeModel)) { await WriteTsConfig(codeModel); await WriteRollupConfig(codeModel); } }
protected async Task Generate <TCodeModel>(TemplateFactory <TCodeModel> templateFactory, TCodeModel codeModel) where TCodeModel : CodeModelTS { if (!IsMultiapiLatest(codeModel)) { // await WriteServiceClientCodeFile(templateFactory, codeModel); // await WriteServiceClientContextCodeFile(templateFactory, codeModel); // Generate server models bool shouldWriteModelsFiles = ShouldWriteModelsFiles(codeModel); if (shouldWriteModelsFiles) { await WriteModelsIndexFile(codeModel); if (codeModel.HasMappers()) { // Generate server mappers await WriteMappersIndexFile(codeModel); } } // Generate operation enum await WriteOperationEnumFile(codeModel); // Generate parameters if (ShouldWriteParameterMappersFile(codeModel)) { await WriteParameterMappersFile(codeModel); } // Generate specifications await WriteSpecificationFile(codeModel); if (ShouldWriteMethodGroupFiles(codeModel)) { // await WriteMethodGroupIndexFile(codeModel); foreach (MethodGroupTS methodGroup in codeModel.MethodGroupModels) { // if (shouldWriteModelsFiles) // { // await WriteMethodGroupMappersFile(methodGroup); // } await WriteMethodGroupFile(methodGroup); } // Write handler mappers await WriteHandlerMappersFile(codeModel); await WriteIHandlersFile(codeModel); } } else { await WriteAliasFile(codeModel); } if (ShouldWritePackageJsonFile(codeModel)) { await WritePackageJsonFile(codeModel); } if (ShouldWriteReadmeMdFile(codeModel)) { await WriteReadmeMdFile(codeModel); } if (ShouldWriteLicenseFile(codeModel)) { await WriteLicenseFile(codeModel); } if (ShouldWriteMetadata(codeModel)) { await WriteTsConfig(codeModel); await WriteRollupConfig(codeModel); } }