Search in sources :

Example 1 with ModifyMethodView

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

the class CSharpGapicClientTransformer method generateModifyMethods.

private List<ModifyMethodView> generateModifyMethods(GapicInterfaceContext context) {
    SurfaceNamer namer = context.getNamer();
    List<ModifyMethodView> modifyMethods = new ArrayList<>();
    Set<String> modifyTypeNames = new HashSet<>();
    for (MethodModel method : csharpCommonTransformer.getSupportedMethods(context)) {
        MethodContext methodContext = context.asRequestMethodContext(method);
        String inputTypeFullName = methodContext.getMethodModel().getInputFullName();
        if (modifyTypeNames.contains(inputTypeFullName)) {
            continue;
        }
        modifyTypeNames.add(inputTypeFullName);
        MethodConfig methodConfig = methodContext.getMethodConfig();
        ModifyMethodView.Builder builder = ModifyMethodView.builder();
        builder.name(namer.getModifyMethodName(methodContext));
        builder.requestTypeName(method.getAndSaveRequestTypeName(context.getImportTypeTable(), context.getNamer()));
        builder.grpcStreamingType(methodConfig.getGrpcStreamingType());
        modifyMethods.add(builder.build());
    }
    return modifyMethods;
}
Also used : MethodConfig(com.google.api.codegen.config.MethodConfig) MethodModel(com.google.api.codegen.config.MethodModel) ArrayList(java.util.ArrayList) GapicMethodContext(com.google.api.codegen.transformer.GapicMethodContext) MethodContext(com.google.api.codegen.transformer.MethodContext) SurfaceNamer(com.google.api.codegen.transformer.SurfaceNamer) ModifyMethodView(com.google.api.codegen.viewmodel.ModifyMethodView) HashSet(java.util.HashSet)

Aggregations

MethodConfig (com.google.api.codegen.config.MethodConfig)1 MethodModel (com.google.api.codegen.config.MethodModel)1 GapicMethodContext (com.google.api.codegen.transformer.GapicMethodContext)1 MethodContext (com.google.api.codegen.transformer.MethodContext)1 SurfaceNamer (com.google.api.codegen.transformer.SurfaceNamer)1 ModifyMethodView (com.google.api.codegen.viewmodel.ModifyMethodView)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1