use of com.google.api.codegen.config.ApiModel in project toolkit by googleapis.
the class NodeJSGapicSurfaceTransformer method prepareApiClassBuilder.
private DynamicLangXApiView.Builder prepareApiClassBuilder(GapicInterfaceContext context) {
SurfaceNamer namer = context.getNamer();
List<OptionalArrayMethodView> methods = apiMethodTransformer.generateApiMethods(context);
DynamicLangXApiView.Builder xapiClass = DynamicLangXApiView.newBuilder();
xapiClass.fileHeader(fileHeaderTransformer.generateFileHeader(context));
xapiClass.protoFilename(context.getInterface().getFile().getSimpleName());
xapiClass.name(namer.getApiWrapperClassName(context.getInterfaceConfig()));
xapiClass.doc(serviceTransformer.generateServiceDoc(context, methods.get(0), context.getProductConfig()));
xapiClass.stubs(grpcStubTransformer.generateGrpcStubs(context));
ApiModel model = context.getApiModel();
xapiClass.serviceHostname(productServiceConfig.getServiceHostname(context.getServiceAddress()));
xapiClass.servicePort(productServiceConfig.getServicePort(context.getServiceAddress()));
xapiClass.serviceTitle(model.getTitle());
xapiClass.authScopes(model.getAuthScopes(context.getProductConfig()));
xapiClass.hasDefaultServiceAddress(context.getInterfaceConfig().hasDefaultServiceAddress());
xapiClass.hasDefaultServiceScopes(context.getInterfaceConfig().hasDefaultServiceScopes());
xapiClass.pageStreamingDescriptors(pageStreamingTransformer.generateDescriptors(context));
xapiClass.batchingDescriptors(batchingTransformer.generateDescriptors(context));
xapiClass.longRunningDescriptors(createLongRunningDescriptors(context));
xapiClass.grpcStreamingDescriptors(createGrpcStreamingDescriptors(context));
xapiClass.hasPageStreamingMethods(context.getInterfaceConfig().hasPageStreamingMethods());
xapiClass.hasBatchingMethods(context.getInterfaceConfig().hasBatchingMethods());
xapiClass.hasLongRunningOperations(context.getInterfaceConfig().hasLongRunningOperations());
xapiClass.pathTemplates(pathTemplateTransformer.generatePathTemplates(context));
xapiClass.formatResourceFunctions(pathTemplateTransformer.generateFormatResourceFunctions(context));
xapiClass.parseResourceFunctions(pathTemplateTransformer.generateParseResourceFunctions(context));
xapiClass.pathTemplateGetterFunctions(ImmutableList.of());
xapiClass.interfaceKey(context.getInterface().getFullName());
xapiClass.clientConfigPath(namer.getClientConfigPath(context.getInterfaceConfig()));
xapiClass.grpcClientTypeName(namer.getAndSaveNicknameForGrpcClientTypeName(context.getImportTypeTable(), context.getInterfaceModel()));
xapiClass.supportsGrpcTransport(true);
xapiClass.apiMethods(new ArrayList<>(methods));
String packageName = context.getProductConfig().getPackageName();
xapiClass.apiVersion(packageName.substring(packageName.lastIndexOf('.') + 1));
xapiClass.validDescriptorsNames(generateValidDescriptorsNames(context));
return xapiClass;
}
Aggregations