use of com.google.api.codegen.viewmodel.StaticLangApiMethodView in project toolkit by googleapis.
the class StaticLangApiMethodTransformer method generateAsyncOperationFlattenedMethod.
public StaticLangApiMethodView generateAsyncOperationFlattenedMethod(MethodContext context, List<ParamWithSimpleDoc> additionalParams, ClientMethodType type, boolean requiresOperationMethod) {
MethodModel method = context.getMethodModel();
SurfaceNamer namer = context.getNamer();
StaticLangApiMethodView.Builder methodViewBuilder = StaticLangApiMethodView.newBuilder();
setCommonFields(context, methodViewBuilder);
methodViewBuilder.name(namer.getAsyncApiMethodName(context.getMethodModel(), context.getMethodConfig().getVisibility()));
methodViewBuilder.exampleName(namer.getAsyncApiMethodExampleName(method));
methodViewBuilder.callableName(namer.getCallableName(method));
setFlattenedMethodFields(context, additionalParams, Synchronicity.Async, methodViewBuilder);
if (requiresOperationMethod) {
methodViewBuilder.operationMethod(lroTransformer.generateDetailView(context));
}
TypeModel returnType = context.getMethodConfig().getLongRunningConfig().getReturnType();
methodViewBuilder.responseTypeName(context.getTypeTable().getAndSaveNicknameFor(returnType));
methodViewBuilder.operationMethod(lroTransformer.generateDetailView(context));
return methodViewBuilder.type(type).build();
}
use of com.google.api.codegen.viewmodel.StaticLangApiMethodView in project toolkit by googleapis.
the class StaticLangApiMethodTransformer method generateGrpcStreamingRequestObjectMethod.
public StaticLangApiMethodView generateGrpcStreamingRequestObjectMethod(MethodContext context) {
MethodModel method = context.getMethodModel();
SurfaceNamer namer = context.getNamer();
StaticLangApiMethodView.Builder methodViewBuilder = StaticLangApiMethodView.newBuilder();
setCommonFields(context, methodViewBuilder);
methodViewBuilder.name(namer.getGrpcStreamingApiMethodName(context.getMethodModel(), context.getMethodConfig().getVisibility()));
methodViewBuilder.exampleName(context.getNamer().getGrpcStreamingApiMethodExampleName(context.getInterfaceConfig(), context.getMethodModel()));
setRequestObjectMethodFields(context, namer.getCallableMethodName(method), Synchronicity.Sync, methodViewBuilder);
setStaticLangGrpcStreamingReturnTypeName(context, methodViewBuilder);
return methodViewBuilder.type(ClientMethodType.RequestObjectMethod).build();
}
use of com.google.api.codegen.viewmodel.StaticLangApiMethodView in project toolkit by googleapis.
the class StaticLangApiMethodTransformer method generatePagedCallableMethod.
public StaticLangApiMethodView generatePagedCallableMethod(MethodContext context) {
MethodModel method = context.getMethodModel();
SurfaceNamer namer = context.getNamer();
StaticLangApiMethodView.Builder methodViewBuilder = StaticLangApiMethodView.newBuilder();
setCommonFields(context, methodViewBuilder);
methodViewBuilder.name(namer.getPagedCallableMethodName(method));
methodViewBuilder.exampleName(namer.getPagedCallableMethodExampleName(method));
setListMethodFields(context, Synchronicity.Sync, methodViewBuilder);
setCallableMethodFields(context, namer.getPagedCallableName(method), methodViewBuilder);
return methodViewBuilder.type(ClientMethodType.PagedCallableMethod).build();
}
use of com.google.api.codegen.viewmodel.StaticLangApiMethodView in project toolkit by googleapis.
the class StaticLangApiMethodTransformer method generatePagedRequestObjectAsyncMethod.
public StaticLangApiMethodView generatePagedRequestObjectAsyncMethod(MethodContext context, List<ParamWithSimpleDoc> additionalParams) {
MethodModel method = context.getMethodModel();
SurfaceNamer namer = context.getNamer();
StaticLangApiMethodView.Builder methodViewBuilder = StaticLangApiMethodView.newBuilder();
setCommonFields(context, methodViewBuilder);
methodViewBuilder.name(namer.getAsyncApiMethodName(context.getMethodModel(), context.getMethodConfig().getVisibility()));
methodViewBuilder.exampleName(namer.getAsyncApiMethodExampleName(method));
setListMethodFields(context, Synchronicity.Async, methodViewBuilder);
setRequestObjectMethodFields(context, namer.getPagedCallableMethodName(method), Synchronicity.Async, additionalParams, methodViewBuilder);
return methodViewBuilder.type(ClientMethodType.AsyncPagedRequestObjectMethod).build();
}
use of com.google.api.codegen.viewmodel.StaticLangApiMethodView in project toolkit by googleapis.
the class StaticLangApiMethodTransformer method generateAsyncOperationRequestObjectMethod.
public StaticLangApiMethodView generateAsyncOperationRequestObjectMethod(MethodContext context, List<ParamWithSimpleDoc> additionalParams, boolean requiresOperationMethod) {
MethodModel method = context.getMethodModel();
SurfaceNamer namer = context.getNamer();
StaticLangApiMethodView.Builder methodViewBuilder = StaticLangApiMethodView.newBuilder();
setCommonFields(context, methodViewBuilder);
methodViewBuilder.name(namer.getAsyncApiMethodName(context.getMethodModel(), context.getMethodConfig().getVisibility()));
methodViewBuilder.exampleName(namer.getAsyncApiMethodExampleName(method));
setRequestObjectMethodFields(context, namer.getOperationCallableMethodName(method), Synchronicity.Async, additionalParams, methodViewBuilder);
if (requiresOperationMethod) {
// Only for protobuf-based APIs.
methodViewBuilder.operationMethod(lroTransformer.generateDetailView(context));
}
if (context.getMethodConfig().isLongRunningOperation()) {
// Only for protobuf-based APIs.
TypeModel returnType = context.getMethodConfig().getLongRunningConfig().getReturnType();
methodViewBuilder.responseTypeName(context.getTypeTable().getAndSaveNicknameFor(returnType));
methodViewBuilder.operationMethod(lroTransformer.generateDetailView(context));
} else {
throw new IllegalArgumentException("Discovery-based APIs do not have LongRunning operations.");
}
return methodViewBuilder.type(ClientMethodType.AsyncOperationRequestObjectMethod).build();
}
Aggregations