use of com.google.api.codegen.config.DiscoGapicMethodContext in project toolkit by googleapis.
the class JavaDiscoGapicRequestToViewTransformer method getRequestObjectParams.
private RequestObjectParamView getRequestObjectParams(DiscoGapicInterfaceContext context, MethodModel method) {
MethodConfig methodConfig = context.getMethodConfig(method);
// Generate the ResourceName methods.
if (methodConfig.isFlattening()) {
for (FlatteningConfig flatteningGroup : methodConfig.getFlatteningConfigs()) {
DiscoGapicMethodContext defaultMethodContext = context.asRequestMethodContext(method);
MethodContext flattenedMethodContext = context.asFlattenedMethodContext(defaultMethodContext, flatteningGroup);
if (FlatteningConfig.hasAnyRepeatedResourceNameParameter(flatteningGroup)) {
flattenedMethodContext = flattenedMethodContext.withResourceNamesInSamplesOnly();
}
Iterable<FieldConfig> fieldConfigs = flattenedMethodContext.getFlatteningConfig().getFlattenedFieldConfigs().values();
for (FieldConfig fieldConfig : fieldConfigs) {
if (context.getFeatureConfig().useResourceNameFormatOption(fieldConfig)) {
return resourceObjectTransformer.generateRequestObjectParam(flattenedMethodContext, fieldConfig);
}
}
}
}
return null;
}
Aggregations