Search in sources :

Example 1 with GapicInterfaceContext

use of com.google.api.codegen.transformer.GapicInterfaceContext in project toolkit by googleapis.

the class CSharpGapicSmokeTestTransformer method transform.

@Override
public List<ViewModel> transform(ApiModel model, GapicProductConfig productConfig) {
    List<ViewModel> surfaceDocs = new ArrayList<>();
    SurfaceNamer namer = new CSharpSurfaceNamer(productConfig.getPackageName());
    for (InterfaceModel apiInterface : model.getInterfaces()) {
        GapicInterfaceContext context = GapicInterfaceContext.create(apiInterface, productConfig, csharpCommonTransformer.createTypeTable(namer.getPackageName()), namer, new CSharpFeatureConfig());
        csharpCommonTransformer.addCommonImports(context);
        SmokeTestClassView smokeTests = generateSmokeTest(context);
        if (smokeTests != null) {
            surfaceDocs.add(smokeTests);
            surfaceDocs.add(generateSmokeTestCsproj(context));
        }
    }
    return surfaceDocs;
}
Also used : InterfaceModel(com.google.api.codegen.config.InterfaceModel) SmokeTestClassView(com.google.api.codegen.viewmodel.testing.SmokeTestClassView) ArrayList(java.util.ArrayList) GapicInterfaceContext(com.google.api.codegen.transformer.GapicInterfaceContext) ViewModel(com.google.api.codegen.viewmodel.ViewModel) SurfaceNamer(com.google.api.codegen.transformer.SurfaceNamer)

Example 2 with GapicInterfaceContext

use of com.google.api.codegen.transformer.GapicInterfaceContext in project toolkit by googleapis.

the class CSharpGapicSnippetsTransformer method transform.

@Override
public List<ViewModel> transform(ApiModel model, GapicProductConfig productConfig) {
    List<ViewModel> surfaceDocs = new ArrayList<>();
    SurfaceNamer namer = new CSharpSurfaceNamer(productConfig.getPackageName());
    for (InterfaceModel apiInterface : model.getInterfaces()) {
        GapicInterfaceContext context = GapicInterfaceContext.create(apiInterface, productConfig, csharpCommonTransformer.createTypeTable(namer.getExamplePackageName()), namer, new CSharpFeatureConfig());
        csharpCommonTransformer.addCommonImports(context);
        context.getImportTypeTable().saveNicknameFor("Google.Protobuf.Bytestring");
        context.getImportTypeTable().saveNicknameFor("System.Linq.__import__");
        SnippetsFileView snippets = generateSnippets(context);
        surfaceDocs.add(snippets);
    }
    return surfaceDocs;
}
Also used : InterfaceModel(com.google.api.codegen.config.InterfaceModel) ArrayList(java.util.ArrayList) GapicInterfaceContext(com.google.api.codegen.transformer.GapicInterfaceContext) ViewModel(com.google.api.codegen.viewmodel.ViewModel) SurfaceNamer(com.google.api.codegen.transformer.SurfaceNamer) SnippetsFileView(com.google.api.codegen.viewmodel.SnippetsFileView)

Example 3 with GapicInterfaceContext

use of com.google.api.codegen.transformer.GapicInterfaceContext in project toolkit by googleapis.

the class CSharpGapicUnitTestTransformer method transform.

@Override
public List<ViewModel> transform(ApiModel model, GapicProductConfig productConfig) {
    List<ViewModel> surfaceDocs = new ArrayList<>();
    SurfaceNamer namer = new CSharpSurfaceNamer(productConfig.getPackageName());
    for (InterfaceModel apiInterface : model.getInterfaces()) {
        GapicInterfaceContext context = GapicInterfaceContext.create(apiInterface, productConfig, csharpCommonTransformer.createTypeTable(namer.getPackageName()), namer, new CSharpFeatureConfig());
        csharpCommonTransformer.addCommonImports(context);
        ModelTypeTable typeTable = context.getImportTypeTable();
        typeTable.saveNicknameFor("Xunit.FactAttribute");
        typeTable.saveNicknameFor("Moq.Mock");
        if (context.getLongRunningMethods().iterator().hasNext()) {
            typeTable.saveNicknameFor("Google.LongRunning.Operations");
        }
        surfaceDocs.add(generateUnitTest(context));
        surfaceDocs.add(generateUnitTestCsproj(context));
    }
    return surfaceDocs;
}
Also used : InterfaceModel(com.google.api.codegen.config.InterfaceModel) ArrayList(java.util.ArrayList) ModelTypeTable(com.google.api.codegen.transformer.ModelTypeTable) GapicInterfaceContext(com.google.api.codegen.transformer.GapicInterfaceContext) ViewModel(com.google.api.codegen.viewmodel.ViewModel) SurfaceNamer(com.google.api.codegen.transformer.SurfaceNamer)

Example 4 with GapicInterfaceContext

use of com.google.api.codegen.transformer.GapicInterfaceContext in project toolkit by googleapis.

the class GoGapicSurfaceTransformer method transform.

@Override
public List<ViewModel> transform(ApiModel model, GapicProductConfig productConfig) {
    List<ViewModel> models = new ArrayList<>();
    GoSurfaceNamer namer = new GoSurfaceNamer(productConfig.getPackageName());
    for (InterfaceModel apiInterface : model.getInterfaces()) {
        GapicInterfaceContext context = GapicInterfaceContext.create(apiInterface, productConfig, createTypeTable(), namer, featureConfig);
        models.add(generate(context));
        context = GapicInterfaceContext.create(apiInterface, productConfig, createTypeTable(), namer, featureConfig);
        models.add(generateExample(context));
    }
    models.add(generatePackageInfo(model, productConfig, namer));
    return models;
}
Also used : InterfaceModel(com.google.api.codegen.config.InterfaceModel) ProtoInterfaceModel(com.google.api.codegen.config.ProtoInterfaceModel) ArrayList(java.util.ArrayList) GapicInterfaceContext(com.google.api.codegen.transformer.GapicInterfaceContext) ViewModel(com.google.api.codegen.viewmodel.ViewModel)

Example 5 with GapicInterfaceContext

use of com.google.api.codegen.transformer.GapicInterfaceContext in project toolkit by googleapis.

the class PhpGapicSurfaceTransformer method transform.

@Override
public List<ViewModel> transform(ApiModel model, GapicProductConfig productConfig) {
    List<ViewModel> surfaceDocs = new ArrayList<>();
    for (InterfaceModel apiInterface : model.getInterfaces()) {
        ModelTypeTable modelTypeTable = new ModelTypeTable(new PhpTypeTable(productConfig.getPackageName()), new PhpModelTypeNameConverter(productConfig.getPackageName()));
        GapicInterfaceContext context = GapicInterfaceContext.create(apiInterface, productConfig, modelTypeTable, new PhpSurfaceNamer(productConfig.getPackageName()), new PhpFeatureConfig());
        surfaceDocs.addAll(transform(context));
    }
    return surfaceDocs;
}
Also used : InterfaceModel(com.google.api.codegen.config.InterfaceModel) ArrayList(java.util.ArrayList) ModelTypeTable(com.google.api.codegen.transformer.ModelTypeTable) GapicInterfaceContext(com.google.api.codegen.transformer.GapicInterfaceContext) ViewModel(com.google.api.codegen.viewmodel.ViewModel) PhpTypeTable(com.google.api.codegen.util.php.PhpTypeTable)

Aggregations

InterfaceModel (com.google.api.codegen.config.InterfaceModel)10 GapicInterfaceContext (com.google.api.codegen.transformer.GapicInterfaceContext)10 ViewModel (com.google.api.codegen.viewmodel.ViewModel)10 ArrayList (java.util.ArrayList)8 SurfaceNamer (com.google.api.codegen.transformer.SurfaceNamer)5 ModelTypeTable (com.google.api.codegen.transformer.ModelTypeTable)3 ImmutableList (com.google.common.collect.ImmutableList)2 ProtoApiModel (com.google.api.codegen.config.ProtoApiModel)1 ProtoInterfaceModel (com.google.api.codegen.config.ProtoInterfaceModel)1 DefaultFeatureConfig (com.google.api.codegen.transformer.DefaultFeatureConfig)1 FeatureConfig (com.google.api.codegen.transformer.FeatureConfig)1 PhpTypeTable (com.google.api.codegen.util.php.PhpTypeTable)1 PythonTypeTable (com.google.api.codegen.util.py.PythonTypeTable)1 GrpcDocView (com.google.api.codegen.viewmodel.GrpcDocView)1 SnippetsFileView (com.google.api.codegen.viewmodel.SnippetsFileView)1 SmokeTestClassView (com.google.api.codegen.viewmodel.testing.SmokeTestClassView)1