use of com.google.api.codegen.viewmodel.MethodDescriptorView in project toolkit by googleapis.
the class ApiCallableTransformer method generateMethodDescriptors.
public List<MethodDescriptorView> generateMethodDescriptors(InterfaceContext context) {
List<MethodDescriptorView> callables = new ArrayList<>();
boolean excludeMixins = !context.getFeatureConfig().enableMixins();
for (MethodModel method : context.getSupportedMethods()) {
if (excludeMixins && context.getMethodConfig(method).getRerouteToGrpcInterface() != null) {
continue;
}
callables.add(generateMethodDescriptor(context.asRequestMethodContext(method)));
}
return callables;
}
use of com.google.api.codegen.viewmodel.MethodDescriptorView in project toolkit by googleapis.
the class ApiCallableTransformer method generateMethodDescriptor.
private MethodDescriptorView generateMethodDescriptor(MethodContext context) {
ImportTypeTable typeTable = context.getTypeTable();
MethodModel method = context.getMethodModel();
MethodConfig methodConfig = context.getMethodConfig();
SurfaceNamer namer = context.getNamer();
MethodDescriptorView.Builder methodDescriptorBuilder = MethodDescriptorView.newBuilder();
if (methodConfig.isGrpcStreaming()) {
methodDescriptorBuilder.grpcStreamingType(methodConfig.getGrpcStreaming().getType());
}
methodDescriptorBuilder.requestTypeName(method.getAndSaveRequestTypeName(typeTable, namer));
methodDescriptorBuilder.responseTypeName(method.getAndSaveResponseTypeName(typeTable, namer));
methodDescriptorBuilder.hasResponse(!method.isOutputTypeEmpty());
methodDescriptorBuilder.name(namer.getMethodDescriptorName(method));
methodDescriptorBuilder.protoMethodName(method.getSimpleName());
methodDescriptorBuilder.fullServiceName(context.getTargetInterface().getFullName());
methodDescriptorBuilder.transportSettingsVar(namer.getTransportSettingsVar(method));
methodDescriptorBuilder.headerRequestParams(headerRequestParamTransformer.generateHeaderRequestParams(context));
methodDescriptorBuilder.httpMethod(generateHttpFields(context));
return methodDescriptorBuilder.build();
}
Aggregations