import ts from "typescript" ; import { TsGenerator } from "../../api" ; import type { CodeGenerator } from "../../types" ; import * as ApiClientArgument from "./ApiClientArgument" ; import * as ApiClientClass from "./ApiClientClass" ; import type { Option } from "./types" ; export { Option } ; export const generator = ( codeGeneratorParamsList , option ? ) : CodeGenerator . IntermediateCode [ ] => { const statements = [ ] ; const factory = TsGenerator . Factory . create ( ) ; codeGeneratorParamsList . forEach ( codeGeneratorParams => { const { convertedParams } = codeGeneratorParams ; if ( convertedParams . hasRequestBody ) { statements . push ( ApiClientArgument . createRequestContentTypeReference ( factory , codeGeneratorParams ) ) ; } if ( convertedParams . responseSuccessNames . length > 0 ) { statements . push ( ApiClientArgument . createResponseContentTypeReference ( factory , codeGeneratorParams ) ) ; } const typeDeclaration = ApiClientArgument . create ( factory , codeGeneratorParams ) ; if ( typeDeclaration ) { statements . push ( typeDeclaration ) ; } } ) ; ApiClientClass . create ( factory , codeGeneratorParamsList , option || { } ) . forEach ( newStatement => { statements . push ( newStatement ) ; } ) ; return statements ; } ;