Search in sources :

Example 1 with GrpcStreamingDetailView

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

the class NodeJSGapicSurfaceTransformer method createGrpcStreamingDescriptors.

private List<GrpcStreamingDetailView> createGrpcStreamingDescriptors(GapicInterfaceContext context) {
    List<GrpcStreamingDetailView> result = new ArrayList<>();
    for (MethodModel method : context.getGrpcStreamingMethods()) {
        GrpcStreamingConfig grpcStreamingConfig = context.asDynamicMethodContext(method).getMethodConfig().getGrpcStreaming();
        String resourcesFieldGetFunction = null;
        if (grpcStreamingConfig.hasResourceField()) {
            resourcesFieldGetFunction = context.getNamer().getFieldGetFunctionName(grpcStreamingConfig.getResourcesField());
        }
        result.add(GrpcStreamingDetailView.newBuilder().methodName(context.getNamer().getApiMethodName(method, VisibilityConfig.PUBLIC)).grpcStreamingType(grpcStreamingConfig.getType()).grpcResourcesField(resourcesFieldGetFunction).streamTypeName(context.getNamer().getStreamTypeName(grpcStreamingConfig.getType())).build());
    }
    return result;
}
Also used : MethodModel(com.google.api.codegen.config.MethodModel) ArrayList(java.util.ArrayList) GrpcStreamingDetailView(com.google.api.codegen.viewmodel.GrpcStreamingDetailView) GrpcStreamingConfig(com.google.api.codegen.config.GrpcStreamingConfig)

Example 2 with GrpcStreamingDetailView

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

the class PhpGapicSurfaceTransformer method createGrpcStreamingDescriptors.

private List<GrpcStreamingDetailView> createGrpcStreamingDescriptors(GapicInterfaceContext context) {
    List<GrpcStreamingDetailView> result = new ArrayList<>();
    for (MethodModel method : context.getGrpcStreamingMethods()) {
        GrpcStreamingConfig grpcStreamingConfig = context.asDynamicMethodContext(method).getMethodConfig().getGrpcStreaming();
        String resourcesFieldGetFunction = null;
        if (grpcStreamingConfig.hasResourceField()) {
            resourcesFieldGetFunction = context.getNamer().getFieldGetFunctionName(grpcStreamingConfig.getResourcesField());
        }
        result.add(GrpcStreamingDetailView.newBuilder().methodName(context.getNamer().getApiMethodName(method, VisibilityConfig.PUBLIC)).transportMethodName(context.getNamer().getGrpcMethodName(method)).grpcStreamingType(grpcStreamingConfig.getType()).grpcResourcesField(resourcesFieldGetFunction).build());
    }
    return result;
}
Also used : MethodModel(com.google.api.codegen.config.MethodModel) ArrayList(java.util.ArrayList) GrpcStreamingDetailView(com.google.api.codegen.viewmodel.GrpcStreamingDetailView) GrpcStreamingConfig(com.google.api.codegen.config.GrpcStreamingConfig)

Aggregations

GrpcStreamingConfig (com.google.api.codegen.config.GrpcStreamingConfig)2 MethodModel (com.google.api.codegen.config.MethodModel)2 GrpcStreamingDetailView (com.google.api.codegen.viewmodel.GrpcStreamingDetailView)2 ArrayList (java.util.ArrayList)2