Search in sources :

Example 1 with BatchingDescriptorView

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();
}
Also used : BatchingDescriptorView(com.google.api.codegen.viewmodel.BatchingDescriptorView) MethodModel(com.google.api.codegen.config.MethodModel) ImmutableList(com.google.common.collect.ImmutableList) BatchingConfig(com.google.api.codegen.config.BatchingConfig)

Example 2 with BatchingDescriptorView

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();
}
Also used : BatchingDescriptorView(com.google.api.codegen.viewmodel.BatchingDescriptorView) SurfaceNamer(com.google.api.codegen.transformer.SurfaceNamer)

Aggregations

BatchingDescriptorView (com.google.api.codegen.viewmodel.BatchingDescriptorView)2 BatchingConfig (com.google.api.codegen.config.BatchingConfig)1 MethodModel (com.google.api.codegen.config.MethodModel)1 SurfaceNamer (com.google.api.codegen.transformer.SurfaceNamer)1 ImmutableList (com.google.common.collect.ImmutableList)1