Exemplo n.º 1
0
        public string GenerateAzureServiceClientImports()
        {
            TSBuilder builder = new TSBuilder();

            builder.ImportAllAs("msRest", "ms-rest-js");

            bool usesAzureOptionsType = OptionalParameterTypeForClientConstructor == "AzureServiceClientOptions";

            if (usesAzureOptionsType || MethodTemplateModels.Any((MethodTS method) => method.IsLongRunningOperation))
            {
                builder.ImportAllAs("msRestAzure", "ms-rest-azure-js");
            }

            if (CodeGeneratorTS.ShouldWriteModelsFiles(this))
            {
                builder.ImportAllAs("Models", "./models");
            }
            if (CodeGeneratorTS.ShouldWriteMappersIndexFile(this))
            {
                builder.ImportAllAs("Mappers", "./models/mappers");
            }

            if (HasMappableParameters)
            {
                builder.ImportAllAs("Parameters", "./models/parameters");
            }

            if (MethodGroupModels.Any())
            {
                builder.ImportAllAs("operations", "./operations");
            }
            builder.Import(new string[] { ContextName }, $"./{ContextName.ToCamelCase()}");

            return(builder.ToString());
        }
        public string GenerateAzureServiceClientImports()
        {
            TSBuilder builder = new TSBuilder();

            builder.ImportAllAs("msRest", "ms-rest-js");

            bool usesAzureOptionsType = OptionalParameterTypeForClientConstructor == "AzureServiceClientOptions";

            if (usesAzureOptionsType)
            {
                builder.ImportAllAs("msRestAzure", "ms-rest-azure-js");
            }

            builder.ImportAllAs("Models", "./models");
            builder.ImportAllAs("Mappers", "./models/mappers");

            if (HasMappableParameters)
            {
                builder.ImportAllAs("Parameters", "./models/parameters");
            }

            if (MethodGroupModels.Any())
            {
                builder.ImportAllAs("operations", "./operations");
            }
            builder.Import(new string[] { ContextName }, $"./{ContextName.ToCamelCase()}");

            return(builder.ToString());
        }
Exemplo n.º 3
0
        public string GenerateServiceClientExports()
        {
            TSBuilder builder = new TSBuilder();

            builder.Export(exports =>
            {
                exports.Export(Name);
                exports.Export(ContextName);
                if (CodeGeneratorTS.ShouldWriteModelsFiles(this))
                {
                    exports.ExportAs("Models", $"{ClientPrefix}Models");
                }
                if (HasMappers())
                {
                    exports.ExportAs("Mappers", $"{ClientPrefix}Mappers");
                }
            });

            if (MethodGroupModels.Any())
            {
                builder.ExportAll("./operations");
            }
            return(builder.ToString());
        }