use of com.google.api.codegen.viewmodel.GrpcElementDocView in project toolkit by googleapis.
the class GrpcElementDocTransformer method generateMessageDocs.
private List<GrpcElementDocView> generateMessageDocs(ModelTypeTable typeTable, SurfaceNamer namer, ProtoContainerElement containerElement) {
ImmutableList.Builder<GrpcElementDocView> messageDocs = ImmutableList.builder();
for (MessageType message : containerElement.getMessages()) {
// Doesn't have to document map entries because a dictionary is used.
if (message.isMapEntry()) {
continue;
}
GrpcMessageDocView.Builder doc = GrpcMessageDocView.newBuilder();
doc.name(namer.getMessageTypeName(typeTable, message));
doc.fullName(typeTable.getFullNameFor(TypeRef.of(message)));
doc.fileUrl(GapicParser.getFileUrl(message.getFile()));
doc.lines(namer.getDocLines(GapicParser.getDocString(message)));
doc.properties(generateMessagePropertyDocs(typeTable, namer, FieldConfig.toFieldTypeIterableFromField(message.getFields())));
doc.elementDocs(generateElementDocs(typeTable, namer, message));
doc.packageName(message.getFile().getFullName());
messageDocs.add(doc.build());
}
return messageDocs.build();
}
use of com.google.api.codegen.viewmodel.GrpcElementDocView in project toolkit by googleapis.
the class PythonGapicSurfaceTransformer method generateEnumFileElements.
private List<GrpcElementDocView> generateEnumFileElements(ModelTypeTable typeTable, SurfaceNamer namer, ProtoContainerElement containerElement) {
ImmutableList.Builder<GrpcElementDocView> elements = ImmutableList.builder();
elements.addAll(elementDocTransformer.generateEnumDocs(typeTable, namer, containerElement.getEnums()));
for (MessageType message : containerElement.getMessages()) {
List<GrpcElementDocView> elementDocs = generateEnumFileElements(typeTable, namer, message);
if (!elementDocs.isEmpty()) {
GrpcMessageDocView.Builder messageView = GrpcMessageDocView.newBuilder();
messageView.name(namer.publicClassName(Name.upperCamel(message.getSimpleName())));
messageView.fullName(typeTable.getFullNameFor(TypeRef.of(message)));
messageView.fileUrl(GapicParser.getFileUrl(message.getFile()));
messageView.lines(namer.getDocLines(GapicParser.getDocString(message)));
messageView.properties(ImmutableList.<ParamDocView>of());
messageView.elementDocs(elementDocs);
messageView.packageName(message.getFile().getFullName());
elements.add(messageView.build());
}
}
return elements.build();
}
use of com.google.api.codegen.viewmodel.GrpcElementDocView in project toolkit by googleapis.
the class GrpcElementDocTransformer method generateEnumDocs.
public List<GrpcElementDocView> generateEnumDocs(ModelTypeTable typeTable, SurfaceNamer namer, ProtoContainerElement containerElement) {
ImmutableList.Builder<GrpcElementDocView> enumDocs = ImmutableList.builder();
for (EnumType enumElement : containerElement.getEnums()) {
if (!enumElement.isReachable()) {
continue;
}
GrpcEnumDocView.Builder doc = GrpcEnumDocView.newBuilder();
doc.name(namer.getEnumTypeName(typeTable, enumElement));
doc.lines(namer.getDocLines(GapicParser.getDocString(enumElement)));
doc.values(generateEnumValueDocs(namer, enumElement));
doc.packageName(enumElement.getFile().getFullName());
enumDocs.add(doc.build());
}
return enumDocs.build();
}
use of com.google.api.codegen.viewmodel.GrpcElementDocView in project toolkit by googleapis.
the class GrpcElementDocTransformer method generateMessageDocs.
private List<GrpcElementDocView> generateMessageDocs(GapicProductConfig productConfig, ModelTypeTable typeTable, SurfaceNamer namer, Collection<MessageType> messages) {
ImmutableList.Builder<GrpcElementDocView> messageDocs = ImmutableList.builder();
for (MessageType message : messages) {
// Doesn't have to document map entries because a dictionary is used.
if (message.isMapEntry()) {
continue;
}
GrpcMessageDocView.Builder doc = GrpcMessageDocView.newBuilder();
doc.name(namer.getMessageTypeName(typeTable, message));
doc.fullName(typeTable.getFullNameFor(TypeRef.of(message)));
doc.fileUrl(GapicParser.getFileUrl(message.getFile()));
doc.lines(namer.getDocLines(GapicParser.getDocString(message)));
doc.properties(generateMessagePropertyDocs(typeTable, namer, FieldConfig.toFieldTypeIterableFromField(message.getFields())));
doc.elementDocs(generateElementDocs(productConfig, typeTable, namer, message));
doc.packageName(message.getFile().getFullName());
messageDocs.add(doc.build());
}
return messageDocs.build();
}
Aggregations