private string GetClassContents(ApiDefBuilder builder)
    {
        var Namespace    = builder.GetNamespace();
        var inheritsText = string.IsNullOrWhiteSpace(builder.BaseTypeName)
            ? string.Empty
            : $" : {builder.BaseTypeName}";
        var methodsCode      = GetMethodsContent(builder);
        var fieldsText       = GetFieldsText(builder);
        var additionalUsings = GetAdditionalUsings(builder);

        var classContents = $@"
//ApiDefBuilder
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Refit;
{additionalUsings}

namespace {Namespace}
{{
    public interface {builder.Name}{inheritsText}
    {{
        {methodsCode}
    }}
}}";

        return(CustomCodeFormattingEngine.Format(classContents));
    }
    private string GetClassContents(ClassBuilder builder)
    {
        var Namespace        = builder.GetNamespace();
        var MethodsCode      = GetMethodsContent(builder);
        var inheritsText     = GetInheritsText(builder);
        var fieldsText       = GetFieldsText(builder);
        var constructorsText = GetConstructorsText(builder);
        var usingStatements  = GetUsingStatements(builder);
        var additionalUsings = GetAdditionalUsings(builder);

        var classContents = $@"
//ClassBuilder
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
{usingStatements}
{additionalUsings}

namespace {Namespace}
{{
    public class {builder.Name}{inheritsText}
    {{
        {fieldsText}

        {constructorsText}

        {MethodsCode}
    }}  
}}
";

        return(CustomCodeFormattingEngine.Format(classContents));
    }
    private string GetClassContents(WebApiBuilder builder)
    {
        var Namespace    = builder.GetNamespace();
        var inheritsText = string.IsNullOrWhiteSpace(builder.BaseTypeName)
            ? " : MyControllerBase"
            : $" : {builder.BaseTypeName}";
        var methodsCode        = GetMethodsContent(builder);
        var fieldsText         = GetFieldsText(builder);
        var constructorText    = GetConstructorsText(builder);
        var usingStatements    = GetUsingStatements(builder);
        var additionalUsings   = GetAdditionalUsings(builder);
        var allUsingStatements = usingStatements.Concat(additionalUsings)
                                 .Concat(new [] { "using System;" })
                                 .Distinct()
                                 .OrderBy(z => z)
                                 .ToList();
        var usingText = string.Join(Environment.NewLine, allUsingStatements);

        var overrideBasePath = string.IsNullOrWhiteSpace(builder.BasePath)
            ? string.Empty
            : $"[Route(\"{builder.BasePath})]";

        var classContents = $@"
//WebApiBuilder
{usingText}


namespace {Namespace}
{{
    {overrideBasePath}
    public class {builder.Name}{inheritsText}
    {{
        {fieldsText}

        {constructorText}


        {methodsCode}
    }}
}}";

        return(CustomCodeFormattingEngine.Format(classContents));
    }
    public async Task TestFormat()
    {
        var formattedCode = CustomCodeFormattingEngine.Format(ClassText);

        Console.WriteLine(formattedCode);
    }