use of com.google.api.codegen.transformer.SurfaceNamer in project toolkit by googleapis.
the class PythonImportSectionTransformer method generateMainAppImports.
private List<ImportFileView> generateMainAppImports(InterfaceContext context) {
List<ImportFileView> imports = generateFileHeaderAppImports(context.getImportTypeTable().getImports());
SurfaceNamer namer = context.getNamer();
imports.add(createImport(namer.getPackageName(), namer.getClientConfigName(context.getInterfaceConfig())));
Collections.sort(imports, importFileViewComparator());
return imports;
}
use of com.google.api.codegen.transformer.SurfaceNamer in project toolkit by googleapis.
the class PythonPackageMetadataTransformer method generateDocFiles.
private List<ViewModel> generateDocFiles(ApiModel model, GapicProductConfig productConfig) {
PackageMetadataNamer namer = new PackageMetadataNamer();
SurfaceNamer surfaceNamer = new PythonSurfaceNamer(productConfig.getPackageName());
String docsGapicPath = docsGapicPath(packageConfig.apiVersion());
String typesOutputPath = String.format("docs/%s/types.rst", docsGapicPath);
String apiOutputPath = String.format("docs/%s/api.rst", docsGapicPath);
return ImmutableList.<ViewModel>builder().add(generateMetadataView(model, productConfig, TYPES_DOC_TEMPLATE_FILE, namer, surfaceNamer, typesOutputPath).build()).add(generateMetadataView(model, productConfig, API_DOC_TEMPLATE_FILE, namer, surfaceNamer, apiOutputPath).build()).build();
}
use of com.google.api.codegen.transformer.SurfaceNamer in project toolkit by googleapis.
the class PythonPackageMetadataTransformer method generateNoxFile.
private ViewModel generateNoxFile(ApiModel model, GapicProductConfig productConfig) {
PackageMetadataNamer namer = new PackageMetadataNamer();
SurfaceNamer surfaceNamer = new PythonSurfaceNamer(productConfig.getPackageName());
String outputPath = "nox.py";
return generateMetadataView(model, productConfig, NOX_TEMPLATE_FILE, namer, surfaceNamer, outputPath).fileHeader(fileHeaderTransformer.generateFileHeader(productConfig, importSectionTransformer.generateNoxImportSection(), new PythonSurfaceNamer(productConfig.getPackageName()))).build();
}
use of com.google.api.codegen.transformer.SurfaceNamer in project toolkit by googleapis.
the class RubyApiMethodParamTransformer method generateMethodParamDocs.
private List<ParamDocView> generateMethodParamDocs(GapicMethodContext context, Iterable<FieldModel> fields) {
SurfaceNamer namer = context.getNamer();
MethodConfig methodConfig = context.getMethodConfig();
ImmutableList.Builder<ParamDocView> docs = ImmutableList.builder();
for (FieldModel field : fields) {
if (isRequestTokenParam(methodConfig, field)) {
continue;
}
SimpleParamDocView.Builder paramDoc = SimpleParamDocView.newBuilder();
paramDoc.paramName(namer.getVariableName(field));
paramDoc.typeName(namer.getParamTypeName(context.getTypeTable(), field.getType()));
ImmutableList.Builder<String> docLines = ImmutableList.builder();
if (isPageSizeParam(methodConfig, field)) {
docLines.add("The maximum number of resources contained in the underlying API", "response. If page streaming is performed per-resource, this", "parameter does not affect the return value. If page streaming is", "performed per-page, this determines the maximum number of", "resources in a page.");
} else {
docLines.addAll(namer.getDocLines(field));
boolean isMessageField = field.isMessage() && !field.isMap();
boolean isMapContainingMessage = field.isMap() && field.getMapValueField().isMessage();
if (isMessageField || isMapContainingMessage) {
String messageType;
if (isMapContainingMessage) {
messageType = context.getTypeTable().getFullNameForElementType(field.getMapValueField());
} else {
messageType = context.getTypeTable().getFullNameForElementType(field);
}
docLines.add(String.format("A hash of the same form as `%s`", messageType));
docLines.add("can also be provided.");
}
}
paramDoc.lines(docLines.build());
docs.add(paramDoc.build());
}
return docs.build();
}
use of com.google.api.codegen.transformer.SurfaceNamer in project toolkit by googleapis.
the class RubyGapicSurfaceDocTransformer method generateOverviewView.
private ModuleView generateOverviewView(ApiModel model, GapicProductConfig productConfig) {
SurfaceNamer namer = new RubySurfaceNamer(productConfig.getPackageName());
RubyPackageMetadataTransformer metadataTransformer = new RubyPackageMetadataTransformer(packageConfig);
RubyPackageMetadataNamer packageNamer = new RubyPackageMetadataNamer(productConfig.getPackageName());
return metadataTransformer.generateReadmeMetadataView(model, productConfig, packageNamer).moduleName(namer.getModuleServiceName()).build();
}
Aggregations