use of com.google.api.codegen.viewmodel.BatchingDescriptorView in project toolkit by googleapis.
the class BatchingTransformer method generateDescriptors.
public List<BatchingDescriptorView> generateDescriptors(InterfaceContext context) {
SurfaceNamer namer = context.getNamer();
ImmutableList.Builder<BatchingDescriptorView> descriptors = ImmutableList.builder();
for (MethodModel method : context.getBatchingMethods()) {
BatchingConfig batching = context.getMethodConfig(method).getBatching();
BatchingDescriptorView.Builder descriptor = BatchingDescriptorView.newBuilder();
descriptor.methodName(context.getNamer().getMethodKey(method));
descriptor.batchedFieldName(namer.getFieldName(batching.getBatchedField()));
descriptor.discriminatorFieldNames(generateDiscriminatorFieldNames(batching));
if (batching.hasSubresponseField()) {
descriptor.subresponseFieldName(namer.getFieldName(batching.getSubresponseField()));
}
descriptor.byteLengthFunctionName(namer.getByteLengthFunctionName(batching.getBatchedField()));
descriptors.add(descriptor.build());
}
return descriptors.build();
}
use of com.google.api.codegen.viewmodel.BatchingDescriptorView in project toolkit by googleapis.
the class PhpGapicSurfaceTransformer method buildDescriptorConfigViewModel.
private ViewModel buildDescriptorConfigViewModel(GapicInterfaceContext context) {
String outputPath = pathMapper.getOutputPath(context.getInterface().getFullName(), context.getProductConfig());
SurfaceNamer namer = context.getNamer();
return DescriptorConfigView.newBuilder().batchingDescriptors(ImmutableList.<BatchingDescriptorView>of()).pageStreamingDescriptors(pageStreamingTransformer.generateDescriptors(context)).longRunningDescriptors(createLongRunningDescriptors(context)).grpcStreamingDescriptors(createGrpcStreamingDescriptors(context)).interfaceKey(context.getInterface().getFullName()).templateFileName(DESCRIPTOR_CONFIG_TEMPLATE_FILENAME).outputPath(outputPath + namer.getConfigPath(context.getInterfaceConfig(), "descriptor_config")).build();
}
Aggregations