use of com.google.api.codegen.transformer.SurfaceNamer 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.transformer.SurfaceNamer 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.transformer.SurfaceNamer 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.transformer.SurfaceNamer in project toolkit by googleapis.
the class CSharpGapicSnippetsTransformer method transform.
@Override
public List<ViewModel> transform(ApiModel model, GapicProductConfig productConfig) {
List<ViewModel> surfaceDocs = new ArrayList<>();
SurfaceNamer namer = new CSharpSurfaceNamer(productConfig.getPackageName());
for (InterfaceModel apiInterface : model.getInterfaces()) {
GapicInterfaceContext context = GapicInterfaceContext.create(apiInterface, productConfig, csharpCommonTransformer.createTypeTable(namer.getExamplePackageName()), namer, new CSharpFeatureConfig());
csharpCommonTransformer.addCommonImports(context);
context.getImportTypeTable().saveNicknameFor("Google.Protobuf.Bytestring");
context.getImportTypeTable().saveNicknameFor("System.Linq.__import__");
SnippetsFileView snippets = generateSnippets(context);
surfaceDocs.add(snippets);
}
return surfaceDocs;
}
use of com.google.api.codegen.transformer.SurfaceNamer 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