use of com.google.api.codegen.viewmodel.CredentialsClassView in project toolkit by googleapis.
the class RubyGapicSurfaceTransformer method generateCredentialsView.
private ViewModel generateCredentialsView(ApiModel model, GapicProductConfig productConfig) {
SurfaceNamer namer = new RubySurfaceNamer(productConfig.getPackageName());
CredentialsClassView credentialsClass = generateCredentialsClass(model, productConfig);
ImportSectionView importSection = ImportSectionView.newBuilder().externalImports(ImmutableList.of(ImportFileView.newBuilder().moduleName("googleauth").types(ImmutableList.<ImportTypeView>of()).build())).build();
List<String> modules = namer.getApiModules();
InterfaceModel apiInterface = model.getInterfaces(productConfig).stream().filter(productConfig::hasInterfaceConfig).findFirst().orElseThrow(() -> new NoSuchElementException("reachable API interfaces"));
GapicInterfaceContext context = createContext(apiInterface, productConfig);
String subPath = pathMapper.getOutputPath(context.getInterface().getFullName(), context.getProductConfig());
return CredentialsClassFileView.newBuilder().outputPath(namer.getSourceFilePath(subPath, "Credentials")).templateFileName(CREDENTIALS_CLASS_TEMPLATE_FILE).credentialsClass(credentialsClass).fileHeader(fileHeaderTransformer.generateFileHeader(productConfig, importSection, namer, ImmutableList.copyOf(modules))).build();
}
Aggregations