@Override public boolean getRequestStreaming() { return method.getRequestStreaming(); }
/** * Return the streaming type of the method. */ public StreamingType getStreamingType() { if (method.getResponseStreaming()) { if (method.getRequestStreaming()) { return StreamingType.BIDIRECTONAL; } return StreamingType.SERVER_SIDE; } else if (method.getRequestStreaming()) { return StreamingType.CLIENT_SIDE; } return StreamingType.NONE; }
/** * Return the streaming type of the method. */ public StreamingType getStreamingType() { if (method.getResponseStreaming()) { if (method.getRequestStreaming()) { return StreamingType.BIDIRECTONAL; } return StreamingType.SERVER_SIDE; } else if (method.getRequestStreaming()) { return StreamingType.CLIENT_SIDE; } return StreamingType.NONE; }
/** * Returns true when the method is supported by the current codegen context. By default, only non * streaming methods are supported unless subclass explicitly allows. TODO: remove this method * when all languages support gRPC streaming. */ protected boolean isSupported(Method method) { return !method.getRequestStreaming() && !method.getResponseStreaming(); }
@Override public boolean isRetryingSupported(Method method) { return isSupported(method) && !method.getRequestStreaming() && !method.getResponseStreaming(); } }
private static GrpcStreamingType getGrpcStreamingType( DiagCollector diagCollector, Method method) { GrpcStreamingType type = null; if (method.getRequestStreaming() && method.getResponseStreaming()) { type = GrpcStreamingType.BidiStreaming; } else if (method.getResponseStreaming()) { type = GrpcStreamingType.ServerStreaming; } else if (method.getRequestStreaming()) { type = GrpcStreamingType.ClientStreaming; } else { diagCollector.addDiag( Diag.error( SimpleLocation.TOPLEVEL, "The given grpc method does not support streaming: %s", method.getFullName())); } return type; }
/** Return JSDoc callback comment and return type comment for the given method. */ @Override public List<String> getReturnDocLines( TransformationContext context, MethodContext methodContext, Synchronicity synchronicity) { GapicMethodConfig methodConfig = (GapicMethodConfig) methodContext.getMethodConfig(); Method method = methodConfig.getMethod(); if (method.getRequestStreaming() && method.getResponseStreaming()) { return bidiStreamingReturnDocLines(method); } else if (method.getResponseStreaming()) { return responseStreamingReturnDocLines(method); } List<String> callbackLines = returnCallbackDocLines(context.getImportTypeTable(), methodConfig); List<String> returnObjectLines = returnObjectDocLines(context.getImportTypeTable(), methodConfig); return ImmutableList.<String>builder().addAll(callbackLines).addAll(returnObjectLines).build(); }
Method method = methodConfig.getMethod(); ImmutableList.Builder<String> returnMessageLines = ImmutableList.builder(); if (method.getRequestStreaming()) { returnMessageLines.add( "@returns {Stream} - A writable stream which accepts objects representing",
methodParams.add( DynamicLangDefaultableParamView.newBuilder().name("self").defaultValue("").build()); if (context.getMethod().getRequestStreaming()) { methodParams.add( DynamicLangDefaultableParamView.newBuilder()
@VisitsBefore void normalize(Interface iface) { Api.Builder coreApiBuilder = Api.newBuilder().setName(iface.getFullName()); coreApiBuilder.setSourceContext( SourceContext.newBuilder().setFileName(iface.getFile().getLocation().getDisplayString())); coreApiBuilder.setSyntax(iface.getSyntax()); for (Method method : iface.getReachableMethods()) { com.google.protobuf.Method.Builder coreMethodBuilder = com.google.protobuf.Method.newBuilder() .setName(method.getSimpleName()) .setRequestTypeUrl(generateTypeUrl(method.getInputType())) .setResponseTypeUrl(generateTypeUrl(method.getOutputType())); coreMethodBuilder.setRequestStreaming(method.getRequestStreaming()); coreMethodBuilder.setResponseStreaming(method.getResponseStreaming()); coreMethodBuilder.addAllOptions( DescriptorNormalization.getMethodOptions( method.getOptionFields(), false, includeDefaults)); coreApiBuilder.addMethods(coreMethodBuilder); } coreApiBuilder.addAllOptions( DescriptorNormalization.getOptions(iface.getProto(), includeDefaults)); coreApiBuilder.setVersion(iface.getAttribute(VersionAttribute.KEY).majorVersion()); apis.add(coreApiBuilder.build()); }
@VisitsBefore void normalize(Interface iface) { Api.Builder coreApiBuilder = Api.newBuilder().setName(iface.getFullName()); coreApiBuilder.setSourceContext( SourceContext.newBuilder().setFileName(iface.getFile().getLocation().getDisplayString())); coreApiBuilder.setSyntax(iface.getSyntax()); for (Method method : iface.getReachableMethods()) { com.google.protobuf.Method.Builder coreMethodBuilder = com.google.protobuf.Method.newBuilder() .setName(method.getSimpleName()) .setRequestTypeUrl(generateTypeUrl(method.getInputType())) .setResponseTypeUrl(generateTypeUrl(method.getOutputType())); coreMethodBuilder.setRequestStreaming(method.getRequestStreaming()); coreMethodBuilder.setResponseStreaming(method.getResponseStreaming()); coreMethodBuilder.addAllOptions( DescriptorNormalization.getMethodOptions( method.getOptionFields(), false, includeDefaults)); coreApiBuilder.addMethods(coreMethodBuilder); } coreApiBuilder.addAllOptions( DescriptorNormalization.getOptions(iface.getProto(), includeDefaults)); coreApiBuilder.setVersion(iface.getAttribute(VersionAttribute.KEY).majorVersion()); apis.add(coreApiBuilder.build()); }