use of com.google.api.codegen.viewmodel.StaticLangApiMethodView in project toolkit by googleapis.
the class CSharpGapicSmokeTestTransformer method createSmokeTestCaseApiMethodView.
private StaticLangApiMethodView createSmokeTestCaseApiMethodView(GapicInterfaceContext context, MethodContext methodContext) {
SurfaceNamer namer = context.getNamer();
MethodConfig methodConfig = methodContext.getMethodConfig();
StaticLangApiMethodView.Builder apiMethodView;
if (methodConfig.isPageStreaming()) {
apiMethodView = apiMethodTransformer.generatePagedFlattenedMethod(methodContext).toBuilder();
FieldConfig resourceFieldConfig = methodContext.getMethodConfig().getPageStreaming().getResourcesFieldConfig();
String callerResponseTypeName = namer.getAndSaveCallerPagedResponseTypeName(methodContext, resourceFieldConfig);
apiMethodView.responseTypeName(callerResponseTypeName);
} else if (methodConfig.isLongRunningOperation()) {
ArrayList<ParamWithSimpleDoc> emptyParams = new ArrayList<ParamWithSimpleDoc>();
apiMethodView = apiMethodTransformer.generateOperationFlattenedMethod(methodContext, emptyParams).toBuilder();
} else {
apiMethodView = apiMethodTransformer.generateFlattenedMethod(methodContext).toBuilder();
}
InitCodeTransformer initCodeTransformer = new InitCodeTransformer();
InitCodeView initCodeView = initCodeTransformer.generateInitCode(methodContext, testCaseTransformer.createSmokeTestInitContext(methodContext));
apiMethodView.initCode(initCodeView);
return apiMethodView.build();
}
use of com.google.api.codegen.viewmodel.StaticLangApiMethodView in project toolkit by googleapis.
the class CSharpGapicSnippetsTransformer method generateGrpcStreamingRequestMethod.
private StaticLangApiMethodSnippetView generateGrpcStreamingRequestMethod(MethodContext methodContext) {
SurfaceNamer namer = methodContext.getNamer();
StaticLangApiMethodView method = apiMethodTransformer.generateGrpcStreamingRequestObjectMethod(methodContext);
String callerResponseTypeName = method.name() + "Stream";
return StaticLangApiMethodSnippetView.newBuilder().method(method).snippetMethodName(method.name()).callerResponseTypeName(callerResponseTypeName).apiClassName(namer.getApiWrapperClassName(methodContext.getInterfaceConfig())).apiVariableName(method.apiVariableName()).build();
}
use of com.google.api.codegen.viewmodel.StaticLangApiMethodView in project toolkit by googleapis.
the class CSharpGapicSnippetsTransformer method generatePagedFlattenedAsyncMethod.
private StaticLangApiMethodSnippetView generatePagedFlattenedAsyncMethod(MethodContext methodContext, String suffix, boolean requiresNamedArguments) {
StaticLangApiMethodView method = apiMethodTransformer.generatePagedFlattenedAsyncMethod(methodContext, csharpCommonTransformer.pagedMethodAdditionalParams());
SurfaceNamer namer = methodContext.getNamer();
PageStreamingConfig pageStreaming = methodContext.getMethodConfig().getPageStreaming();
FieldConfig resourceFieldConfig = pageStreaming.getResourcesFieldConfig();
String callerResponseTypeName = namer.getAndSaveCallerAsyncPagedResponseTypeName(methodContext, resourceFieldConfig);
return StaticLangApiMethodSnippetView.newBuilder().method(method).snippetMethodName(method.name() + suffix).callerResponseTypeName(callerResponseTypeName).apiClassName(namer.getApiWrapperClassName(methodContext.getInterfaceConfig())).apiVariableName(method.apiVariableName()).requiresNamedArguments(requiresNamedArguments).build();
}
use of com.google.api.codegen.viewmodel.StaticLangApiMethodView in project toolkit by googleapis.
the class CSharpGapicSnippetsTransformer method generateRequestMethod.
private StaticLangApiMethodSnippetView generateRequestMethod(MethodContext methodContext) {
SurfaceNamer namer = methodContext.getNamer();
StaticLangApiMethodView method = apiMethodTransformer.generateRequestObjectMethod(methodContext);
String callerResponseTypeName = methodContext.getTypeTable().getAndSaveNicknameFor(namer.getStaticLangCallerAsyncReturnTypeName(methodContext));
return StaticLangApiMethodSnippetView.newBuilder().method(method).snippetMethodName(method.name() + "_RequestObject").callerResponseTypeName(callerResponseTypeName).apiClassName(namer.getApiWrapperClassName(methodContext.getInterfaceConfig())).apiVariableName(method.apiVariableName()).build();
}
use of com.google.api.codegen.viewmodel.StaticLangApiMethodView in project toolkit by googleapis.
the class CSharpGapicSnippetsTransformer method generateOperationRequestAsyncMethod.
private StaticLangApiMethodSnippetView generateOperationRequestAsyncMethod(MethodContext methodContext) {
SurfaceNamer namer = methodContext.getNamer();
StaticLangApiMethodView method = apiMethodTransformer.generateAsyncOperationRequestObjectMethod(methodContext, Collections.<ParamWithSimpleDoc>emptyList(), true);
String callerResponseTypeName = method.operationMethod().clientReturnTypeName();
return StaticLangApiMethodSnippetView.newBuilder().method(method).snippetMethodName(method.name() + "_RequestObject").callerResponseTypeName(callerResponseTypeName).apiClassName(namer.getApiWrapperClassName(methodContext.getInterfaceConfig())).apiVariableName(method.apiVariableName()).build();
}
Aggregations