private static List <MemberDeclarationSyntax> CreateConstructor(
     string className,
     string parameterName)
 {
     return(new MemberDeclarationSyntax[]
     {
         SyntaxFactory.GlobalStatement(
             SyntaxFactory.LocalFunctionStatement(
                 SyntaxFactory.IdentifierName(className),
                 SyntaxFactory.MissingToken(SyntaxKind.IdentifierToken))
             .WithModifiers(SyntaxFactory.TokenList(SyntaxTokenFactory.PrivateKeyword()))
             .WithParameterList(SyntaxParameterListFactory.CreateWithOneItem(nameof(ActionResult), parameterName))
             .WithSemicolonToken(
                 SyntaxFactory.MissingToken(
                     SyntaxFactory.TriviaList(),
                     SyntaxKind.SemicolonToken,
                     SyntaxFactory.TriviaList(
                         SyntaxFactory.Trivia(
                             SyntaxFactory.SkippedTokensTrivia()
                             .WithTokens(
                                 SyntaxFactory.TokenList(
                                     SyntaxTokenFactory.Colon()))))))),
         SyntaxFactory.GlobalStatement(
             SyntaxFactory.ExpressionStatement(
                 SyntaxFactory.InvocationExpression(
                     SyntaxFactory.BaseExpression())
                 .WithArgumentList(
                     SyntaxFactory.ArgumentList(
                         SyntaxFactory.SingletonSeparatedList(
                             SyntaxFactory.Argument(SyntaxFactory.IdentifierName(parameterName))))))
             .WithSemicolonToken(SyntaxFactory.MissingToken(SyntaxKind.SemicolonToken))),
         SyntaxFactory.GlobalStatement(SyntaxFactory.Block()),
     }.ToList());
 }
        private static MethodDeclarationSyntax CreateTypeRequestObjectResult(
            string className,
            string methodName,
            string parameterTypeName,
            string parameterName     = "response",
            bool asGenericList       = false,
            bool asGenericPagination = false)
        {
            string?genericListTypeName = null;

            if (asGenericList)
            {
                genericListTypeName = Microsoft.OpenApi.Models.NameConstants.List;
            }
            else if (asGenericPagination)
            {
                genericListTypeName = Microsoft.OpenApi.Models.NameConstants.Pagination;
            }

            if (string.IsNullOrEmpty(parameterTypeName))
            {
                parameterTypeName = "string";
            }

            return(SyntaxFactory.MethodDeclaration(
                       SyntaxFactory.IdentifierName(className),
                       SyntaxFactory.Identifier(methodName))
                   .WithModifiers(SyntaxTokenListFactory.PublicStaticKeyword())
                   .WithParameterList(SyntaxParameterListFactory.CreateWithOneItem(parameterTypeName, parameterName, genericListTypeName))
                   .WithExpressionBody(
                       SyntaxFactory.ArrowExpressionClause(
                           SyntaxObjectCreationExpressionFactory.Create(className)
                           .WithArgumentList(
                               SyntaxFactory.ArgumentList(
                                   SyntaxFactory.SingletonSeparatedList(
                                       SyntaxFactory.Argument(
                                           SyntaxObjectCreationExpressionFactory.Create(methodName + nameof(ObjectResult))
                                           .WithArgumentList(SyntaxArgumentListFactory.CreateWithOneItem(parameterName))))))))
                   .WithSemicolonToken(SyntaxTokenFactory.Semicolon()));
        }