use of com.google.api.codegen.transformer.ModelTypeTable in project toolkit by googleapis.
the class CSharpCommonTransformer method addCommonImports.
public void addCommonImports(GapicInterfaceContext context) {
ModelTypeTable typeTable = context.getImportTypeTable();
// Common imports, only one class per required namespace is needed.
typeTable.saveNicknameFor("Google.Api.Gax.GaxPreconditions");
typeTable.saveNicknameFor("Google.Api.Gax.Grpc.ServiceSettingsBase");
typeTable.saveNicknameFor("Google.Protobuf.WellKnownTypes.SomeSortOfWellKnownType");
typeTable.saveNicknameFor("Grpc.Core.StatusCode");
typeTable.saveNicknameFor("System.Collections.ObjectModel.ReadOnlyCollection");
typeTable.saveNicknameFor("System.Threading.Tasks.Task");
typeTable.saveNicknameFor("System.Threading.Thread");
typeTable.saveNicknameFor("System.NotImplementedException");
typeTable.saveNicknameFor("System.Collections.IEnumerable");
typeTable.saveNicknameFor("System.Collections.Generic.IEnumerable");
}
use of com.google.api.codegen.transformer.ModelTypeTable in project toolkit by googleapis.
the class CSharpGapicUnitTestTransformer 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.getPackageName()), namer, new CSharpFeatureConfig());
csharpCommonTransformer.addCommonImports(context);
ModelTypeTable typeTable = context.getImportTypeTable();
typeTable.saveNicknameFor("Xunit.FactAttribute");
typeTable.saveNicknameFor("Moq.Mock");
if (context.getLongRunningMethods().iterator().hasNext()) {
typeTable.saveNicknameFor("Google.LongRunning.Operations");
}
surfaceDocs.add(generateUnitTest(context));
surfaceDocs.add(generateUnitTestCsproj(context));
}
return surfaceDocs;
}
use of com.google.api.codegen.transformer.ModelTypeTable in project toolkit by googleapis.
the class NodeJSGapicSurfaceDocTransformer method generateDoc.
private ViewModel generateDoc(ProtoFile file, GapicProductConfig productConfig) {
ModelTypeTable typeTable = new ModelTypeTable(new JSTypeTable(productConfig.getPackageName()), new NodeJSModelTypeNameConverter(productConfig.getPackageName()));
// Use file path for package name to get file-specific package instead of package for the API.
SurfaceNamer namer = new NodeJSSurfaceNamer(productConfig.getPackageName(), NodeJSUtils.isGcloud(productConfig));
JSCommentReformatter commentReformatter = new JSCommentReformatter();
GrpcDocView.Builder doc = GrpcDocView.newBuilder();
doc.templateFileName(DOC_TEMPLATE_FILENAME);
doc.outputPath(getOutputPath(namer, file));
doc.fileHeader(fileHeaderTransformer.generateFileHeader(productConfig, ImportSectionView.newBuilder().build(), namer));
doc.elementDocs(grpcElementDocTransformer.generateElementDocs(typeTable, namer, file));
return doc.build();
}
use of com.google.api.codegen.transformer.ModelTypeTable in project toolkit by googleapis.
the class PhpGapicSurfaceTestTransformer method createContext.
private GapicInterfaceContext createContext(InterfaceModel apiInterface, GapicProductConfig productConfig, PhpSurfaceNamer.TestKind testKind) {
PhpSurfaceNamer surfacePackageNamer = new PhpSurfaceNamer(productConfig.getPackageName());
String testPackageName = surfacePackageNamer.getTestPackageName(testKind);
ModelTypeTable typeTable = new ModelTypeTable(new PhpTypeTable(testPackageName), new PhpModelTypeNameConverter(testPackageName));
return GapicInterfaceContext.create(apiInterface, productConfig, typeTable, surfacePackageNamer, featureConfig);
}
use of com.google.api.codegen.transformer.ModelTypeTable in project toolkit by googleapis.
the class PhpGapicSurfaceTransformer method addApiImports.
private void addApiImports(GapicInterfaceContext context) {
ModelTypeTable typeTable = context.getImportTypeTable();
GapicInterfaceConfig interfaceConfig = context.getInterfaceConfig();
typeTable.saveNicknameFor("\\Google\\ApiCore\\ApiException");
typeTable.saveNicknameFor("\\Google\\ApiCore\\Call");
typeTable.saveNicknameFor("\\Google\\ApiCore\\GapicClientTrait");
typeTable.saveNicknameFor("\\Google\\ApiCore\\PathTemplate");
typeTable.saveNicknameFor("\\Google\\ApiCore\\RequestParamsHeaderDescriptor");
typeTable.saveNicknameFor("\\Google\\ApiCore\\RetrySettings");
typeTable.saveNicknameFor("\\Google\\ApiCore\\Transport\\TransportInterface");
typeTable.saveNicknameFor("\\Google\\ApiCore\\ValidationException");
typeTable.saveNicknameFor("\\Google\\Auth\\CredentialsLoader");
typeTable.saveNicknameFor("\\Grpc\\Channel");
typeTable.saveNicknameFor("\\Grpc\\ChannelCredentials");
if (interfaceConfig.hasLongRunningOperations()) {
typeTable.saveNicknameFor("\\Google\\ApiCore\\LongRunning\\OperationsClient");
typeTable.saveNicknameFor("\\Google\\ApiCore\\OperationResponse");
}
}
Aggregations