Search in sources :

Example 1 with PageStreamingDescriptorView

use of com.google.api.codegen.viewmodel.PageStreamingDescriptorView in project toolkit by googleapis.

the class PageStreamingTransformer method generateDescriptor.

public PageStreamingDescriptorView generateDescriptor(InterfaceContext context, MethodModel method) {
    MethodConfig methodConfig = context.getMethodConfig(method);
    PageStreamingConfig pageStreaming = methodConfig.getPageStreaming();
    PageStreamingDescriptorView.Builder descriptor = PageStreamingDescriptorView.newBuilder();
    descriptor.varName(context.getNamer().getPageStreamingDescriptorName(method));
    descriptor.requestTokenFieldName(context.getNamer().getRequestTokenFieldName(pageStreaming));
    descriptor.requestTokenGetMethodName(context.getNamer().getFieldGetFunctionName(pageStreaming.getRequestTokenField()));
    descriptor.requestTokenSetMethodName(context.getNamer().getFieldSetFunctionName(pageStreaming.getRequestTokenField()));
    if (pageStreaming.hasPageSizeField()) {
        descriptor.requestPageSizeFieldName(context.getNamer().getPageSizeFieldName(pageStreaming));
        descriptor.requestPageSizeGetMethodName(context.getNamer().getFieldGetFunctionName(pageStreaming.getPageSizeField()));
        descriptor.requestPageSizeSetMethodName(context.getNamer().getFieldSetFunctionName(pageStreaming.getPageSizeField()));
    }
    descriptor.responseTokenFieldName(context.getNamer().getResponseTokenFieldName(pageStreaming));
    descriptor.responseTokenGetMethodName(context.getNamer().getFieldGetFunctionName(pageStreaming.getResponseTokenField()));
    descriptor.resourcesFieldName(context.getNamer().getResourcesFieldName(pageStreaming));
    descriptor.resourcesGetMethodName(context.getNamer().getFieldGetFunctionName(pageStreaming.getResourcesField()));
    descriptor.methodName(context.getNamer().getMethodKey(method));
    descriptor.transportMethodName(context.getNamer().getGrpcMethodName(method));
    return descriptor.build();
}
Also used : MethodConfig(com.google.api.codegen.config.MethodConfig) PageStreamingConfig(com.google.api.codegen.config.PageStreamingConfig) PageStreamingDescriptorView(com.google.api.codegen.viewmodel.PageStreamingDescriptorView)

Aggregations

MethodConfig (com.google.api.codegen.config.MethodConfig)1 PageStreamingConfig (com.google.api.codegen.config.PageStreamingConfig)1 PageStreamingDescriptorView (com.google.api.codegen.viewmodel.PageStreamingDescriptorView)1