Search in sources :

Example 1 with TocContentView

use of com.google.api.codegen.viewmodel.metadata.TocContentView in project toolkit by googleapis.

the class RubyGapicSurfaceDocTransformer method generateTocModuleView.

private TocModuleView generateTocModuleView(ApiModel model, ProtoFile file, ProductConfig productConfig, SurfaceNamer namer, String moduleName) {
    RubyPackageMetadataTransformer metadataTransformer = new RubyPackageMetadataTransformer(packageConfig);
    RubyPackageMetadataNamer packageNamer = new RubyPackageMetadataNamer(productConfig.getPackageName());
    String packageFilePath = file.getFullName().replace(".", File.separator);
    ImmutableList.Builder<TocContentView> tocContents = ImmutableList.builder();
    for (Interface apiInterface : file.getReachableInterfaces()) {
        String description = RubyUtil.getSentence(namer.getDocLines(GapicParser.getDocString(apiInterface)));
        InterfaceConfig interfaceConfig = productConfig.getInterfaceConfig(new ProtoInterfaceModel(apiInterface));
        tocContents.add(metadataTransformer.generateTocContent(description, packageNamer, packageFilePath, namer.getApiWrapperClassName(interfaceConfig)));
    }
    tocContents.add(metadataTransformer.generateTocContent("Data types for " + productConfig.getPackageName(), packageNamer, packageFilePath, "Data Types"));
    return TocModuleView.newBuilder().moduleName(moduleName).fullName(model.getTitle()).contents(tocContents.build()).build();
}
Also used : InterfaceConfig(com.google.api.codegen.config.InterfaceConfig) ProtoInterfaceModel(com.google.api.codegen.config.ProtoInterfaceModel) ImmutableList(com.google.common.collect.ImmutableList) TocContentView(com.google.api.codegen.viewmodel.metadata.TocContentView) Interface(com.google.api.tools.framework.model.Interface)

Aggregations

InterfaceConfig (com.google.api.codegen.config.InterfaceConfig)1 ProtoInterfaceModel (com.google.api.codegen.config.ProtoInterfaceModel)1 TocContentView (com.google.api.codegen.viewmodel.metadata.TocContentView)1 Interface (com.google.api.tools.framework.model.Interface)1 ImmutableList (com.google.common.collect.ImmutableList)1