Esempio n. 1
0
        public virtual void Write(ICodeFragment fragment, IOutputCache output)
        {
            TypeScriptTemplate template = (TypeScriptTemplate)fragment;

            output.Add(template.Code);
            if (template.CloseAfter)
            {
                output.CloseLine();
            }
            if (template.BreakAfter)
            {
                output.BreakLine();
            }
            if (template.StartBlockAfter)
            {
                output.StartBlock();
            }
            if (template.EndBlockAfter)
            {
                output.EndBlock();
            }
            if (template.IndentAfter)
            {
                output.Indent();
            }
            if (template.UnindentAfter)
            {
                output.UnIndent();
            }
        }
        public string Gen(SwaggerDocument service, SwaggerToolSettings setting, TypeScriptTemplate Template)
        {
            var settings = new SwaggerToTypeScriptClientGeneratorSettings
            {
                ClassName =setting.TypeScriptGen.ClassName,
                Template = Template,
                PromiseType=PromiseType.Promise,
                TypeScriptGeneratorSettings=new NJsonSchema.CodeGeneration.TypeScript.TypeScriptGeneratorSettings() { ModuleName= setting.TypeScriptGen.ModuleName }
            };
        

        var generator = new SwaggerToTypeScriptClientGenerator(service, settings);
        var code = generator.GenerateFile();
            return code;
    }
Esempio n. 3
0
        public string Gen(SwaggerDocument service, SwaggerToolSettings setting, TypeScriptTemplate Template)
        {
            var settings = new SwaggerToTypeScriptClientGeneratorSettings
            {
                ClassName   = setting.TypeScriptGen.ClassName,
                Template    = Template,
                PromiseType = PromiseType.Promise,
                TypeScriptGeneratorSettings = { ModuleName = setting.TypeScriptGen.ModuleName }
            };


            var generator = new SwaggerToTypeScriptClientGenerator(service, settings);
            var code      = generator.GenerateFile();

            return(code);
        }
 public static TypeScriptTemplate BreakLine(this TypeScriptTemplate template)
 {
     template.BreakAfter = true;
     return(template);
 }
 public static TypeScriptTemplate Unindent(this TypeScriptTemplate template)
 {
     template.UnindentAfter = true;
     return(template);
 }
 public static TypeScriptTemplate EndBlock(this TypeScriptTemplate template)
 {
     template.EndBlockAfter = true;
     return(template);
 }
 public static TypeScriptTemplate Close(this TypeScriptTemplate template)
 {
     template.CloseAfter = true;
     return(template);
 }