use of com.google.api.codegen.viewmodel.StaticLangApiMethodView in project toolkit by googleapis.
the class StaticLangApiMethodTransformer method generateOperationFlattenedMethod.
// Used by: C#
public StaticLangApiMethodView generateOperationFlattenedMethod(MethodContext context, List<ParamWithSimpleDoc> additionalParams, SampleContext sampleContext) {
MethodModel method = context.getMethodModel();
SurfaceNamer namer = context.getNamer();
StaticLangApiMethodView.Builder methodViewBuilder = StaticLangApiMethodView.newBuilder();
setCommonFields(context, methodViewBuilder);
methodViewBuilder.name(namer.getApiMethodName(method, context.getMethodConfig().getVisibility()));
methodViewBuilder.exampleName(namer.getApiMethodExampleName(context.getInterfaceConfig(), method));
methodViewBuilder.callableName(namer.getCallableName(method));
setFlattenedMethodFields(context, additionalParams, Synchronicity.Sync, methodViewBuilder, context.getCallingForms(), sampleContext);
methodViewBuilder.operationMethod(lroTransformer.generateDetailView(context));
TypeModel returnType = context.getLongRunningConfig().getReturnType();
methodViewBuilder.responseTypeName(context.getTypeTable().getAndSaveNicknameFor(returnType));
return methodViewBuilder.type(ClientMethodType.OperationFlattenedMethod).build();
}
use of com.google.api.codegen.viewmodel.StaticLangApiMethodView in project toolkit by googleapis.
the class StaticLangApiMethodTransformer method generateFlattenedMethod.
// Used by: C# (and indirectly by Java via the overload above)
public StaticLangApiMethodView generateFlattenedMethod(MethodContext context, List<ParamWithSimpleDoc> additionalParams, SampleContext sampleContext) {
MethodModel method = context.getMethodModel();
SurfaceNamer namer = context.getNamer();
StaticLangApiMethodView.Builder methodViewBuilder = StaticLangApiMethodView.newBuilder();
setCommonFields(context, methodViewBuilder);
methodViewBuilder.name(namer.getApiMethodName(method, context.getMethodConfig().getVisibility()));
methodViewBuilder.exampleName(namer.getApiMethodExampleName(context.getInterfaceConfig(), method));
methodViewBuilder.callableName(namer.getCallableName(method));
setFlattenedMethodFields(context, additionalParams, Synchronicity.Sync, methodViewBuilder, context.getCallingForms(), sampleContext);
setStaticLangReturnTypeName(context, methodViewBuilder);
return methodViewBuilder.type(ClientMethodType.FlattenedMethod).build();
}
use of com.google.api.codegen.viewmodel.StaticLangApiMethodView in project toolkit by googleapis.
the class StaticLangApiMethodTransformer method generateGrpcStreamingFlattenedMethod.
// Used by CSharp.
public StaticLangApiMethodView generateGrpcStreamingFlattenedMethod(MethodContext context, List<ParamWithSimpleDoc> additionalParams, SampleContext sampleContext) {
MethodModel method = context.getMethodModel();
SurfaceNamer namer = context.getNamer();
StaticLangApiMethodView.Builder methodViewBuilder = StaticLangApiMethodView.newBuilder();
setCommonFields(context, methodViewBuilder);
methodViewBuilder.name(namer.getGrpcStreamingApiMethodName(method, context.getMethodConfig().getVisibility()));
methodViewBuilder.exampleName(namer.getGrpcStreamingApiMethodExampleName(context.getInterfaceConfig(), method));
methodViewBuilder.callableName(namer.getCallableName(method));
setFlattenedMethodFields(context, additionalParams, Synchronicity.Sync, methodViewBuilder, context.getCallingForms(), sampleContext);
setStaticLangGrpcStreamingReturnTypeName(context, methodViewBuilder);
return methodViewBuilder.type(ClientMethodType.FlattenedMethod).build();
}
use of com.google.api.codegen.viewmodel.StaticLangApiMethodView in project toolkit by googleapis.
the class StaticLangApiMethodTransformer method generateOperationRequestObjectMethod.
// Used by: C#
public StaticLangApiMethodView generateOperationRequestObjectMethod(MethodContext context, List<ParamWithSimpleDoc> additionalParams, SampleContext sampleContext) {
MethodModel method = context.getMethodModel();
SurfaceNamer namer = context.getNamer();
StaticLangApiMethodView.Builder methodViewBuilder = StaticLangApiMethodView.newBuilder();
setCommonFields(context, methodViewBuilder);
methodViewBuilder.name(namer.getApiMethodName(method, context.getMethodConfig().getVisibility()));
methodViewBuilder.exampleName(namer.getApiMethodExampleName(context.getInterfaceConfig(), method));
setRequestObjectMethodFields(context, namer.getCallableMethodName(method), Synchronicity.Sync, additionalParams, methodViewBuilder, context.getCallingForms(), sampleContext);
methodViewBuilder.operationMethod(lroTransformer.generateDetailView(context));
TypeModel returnType = context.getLongRunningConfig().getReturnType();
methodViewBuilder.responseTypeName(context.getTypeTable().getAndSaveNicknameFor(returnType));
return methodViewBuilder.type(ClientMethodType.OperationRequestObjectMethod).build();
}
use of com.google.api.codegen.viewmodel.StaticLangApiMethodView in project toolkit by googleapis.
the class StaticLangApiMethodTransformer method generateUnpagedListCallableMethod.
// Used by: Java
public StaticLangApiMethodView generateUnpagedListCallableMethod(MethodContext context, SampleContext sampleContext) {
MethodModel method = context.getMethodModel();
SurfaceNamer namer = context.getNamer();
StaticLangApiMethodView.Builder methodViewBuilder = StaticLangApiMethodView.newBuilder();
setCommonFields(context, methodViewBuilder);
methodViewBuilder.name(namer.getCallableMethodName(method));
methodViewBuilder.exampleName(namer.getCallableMethodExampleName(method));
setListMethodFields(context, Synchronicity.Sync, methodViewBuilder);
setCallableMethodFields(context, namer.getCallableName(method), methodViewBuilder, context.getCallingForms(), sampleContext);
String getResourceListCallName = namer.getFieldGetFunctionName(context.getFeatureConfig(), context.getMethodConfig().getPageStreaming().getResourcesFieldConfig());
String resourceListParseFunction = "";
PageStreamingConfig pageStreaming = context.getMethodConfig().getPageStreaming();
FieldConfig resourceFieldConfig = pageStreaming.getResourcesFieldConfig();
if (context.getFeatureConfig().useResourceNameConverters(resourceFieldConfig)) {
resourceListParseFunction = namer.getResourceTypeParseListMethodName(context.getTypeTable(), resourceFieldConfig);
}
UnpagedListCallableMethodDetailView unpagedListCallableDetails = UnpagedListCallableMethodDetailView.newBuilder().resourceListGetFunction(getResourceListCallName).resourceListParseFunction(resourceListParseFunction).build();
methodViewBuilder.unpagedListCallableMethod(unpagedListCallableDetails);
methodViewBuilder.responseTypeName(context.getMethodModel().getAndSaveResponseTypeName(context.getTypeTable(), context.getNamer()));
return methodViewBuilder.type(ClientMethodType.UnpagedListCallableMethod).build();
}
Aggregations