Search in sources :

Example 1 with DefaultFeatureConfig

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

the class PythonGapicSurfaceTransformer method generateServiceSurfaces.

private Iterable<ViewModel> generateServiceSurfaces(Model model, GapicProductConfig productConfig) {
    ModelTypeTable modelTypeTable = new ModelTypeTable(new PythonTypeTable(productConfig.getPackageName()), new PythonModelTypeNameConverter(productConfig.getPackageName()));
    SurfaceNamer namer = new PythonSurfaceNamer(productConfig.getPackageName());
    FeatureConfig featureConfig = new DefaultFeatureConfig();
    ProtoApiModel apiModel = new ProtoApiModel(model);
    ImmutableList.Builder<ViewModel> serviceSurfaces = ImmutableList.builder();
    for (InterfaceModel apiInterface : apiModel.getInterfaces()) {
        GapicInterfaceContext context = GapicInterfaceContext.create(apiInterface, productConfig, modelTypeTable, namer, featureConfig);
        addApiImports(context);
        serviceSurfaces.add(generateApiClass(context));
    }
    GrpcDocView enumFile = generateEnumView(productConfig, modelTypeTable, namer, model.getFiles());
    if (!enumFile.elementDocs().isEmpty()) {
        serviceSurfaces.add(enumFile);
    }
    return serviceSurfaces.build();
}
Also used : ImmutableList(com.google.common.collect.ImmutableList) FeatureConfig(com.google.api.codegen.transformer.FeatureConfig) DefaultFeatureConfig(com.google.api.codegen.transformer.DefaultFeatureConfig) ModelTypeTable(com.google.api.codegen.transformer.ModelTypeTable) GapicInterfaceContext(com.google.api.codegen.transformer.GapicInterfaceContext) ViewModel(com.google.api.codegen.viewmodel.ViewModel) GrpcDocView(com.google.api.codegen.viewmodel.GrpcDocView) InterfaceModel(com.google.api.codegen.config.InterfaceModel) PythonTypeTable(com.google.api.codegen.util.py.PythonTypeTable) ProtoApiModel(com.google.api.codegen.config.ProtoApiModel) DefaultFeatureConfig(com.google.api.codegen.transformer.DefaultFeatureConfig) SurfaceNamer(com.google.api.codegen.transformer.SurfaceNamer)

Aggregations

InterfaceModel (com.google.api.codegen.config.InterfaceModel)1 ProtoApiModel (com.google.api.codegen.config.ProtoApiModel)1 DefaultFeatureConfig (com.google.api.codegen.transformer.DefaultFeatureConfig)1 FeatureConfig (com.google.api.codegen.transformer.FeatureConfig)1 GapicInterfaceContext (com.google.api.codegen.transformer.GapicInterfaceContext)1 ModelTypeTable (com.google.api.codegen.transformer.ModelTypeTable)1 SurfaceNamer (com.google.api.codegen.transformer.SurfaceNamer)1 PythonTypeTable (com.google.api.codegen.util.py.PythonTypeTable)1 GrpcDocView (com.google.api.codegen.viewmodel.GrpcDocView)1 ViewModel (com.google.api.codegen.viewmodel.ViewModel)1 ImmutableList (com.google.common.collect.ImmutableList)1