public ApiDefBuilder CreateApiDef(ProjectBuilder proj, FeatureBuilder feature) { var builder = new ApiDefBuilder(proj, feature); Builders.Add(builder); return(builder); }
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 FileResult Build(ApiDefBuilder builder) { var result = new FileResult() { Path = GetFilePath(builder), Contents = GetClassContents(builder) }; return(result); }