use of com.google.api.codegen.config.MethodConfig in project toolkit by googleapis.
the class ApiCallableTransformer method setCommonApiCallableFields.
private void setCommonApiCallableFields(MethodContext context, ApiCallableView.Builder apiCallableBuilder) {
MethodModel method = context.getMethodModel();
SurfaceNamer namer = context.getNamer();
MethodConfig methodConfig = context.getMethodConfig();
apiCallableBuilder.methodName(namer.getApiMethodName(method, context.getMethodConfig().getVisibility()));
apiCallableBuilder.asyncMethodName(namer.getAsyncApiMethodName(method, VisibilityConfig.PUBLIC));
apiCallableBuilder.memberName(namer.getSettingsMemberName(method));
apiCallableBuilder.settingsFunctionName(namer.getSettingsFunctionName(method));
apiCallableBuilder.grpcClientVarName(namer.getReroutedGrpcClientVarName(methodConfig));
apiCallableBuilder.methodDescriptorName(namer.getMethodDescriptorName(method));
apiCallableBuilder.transportSettingsVar(namer.getTransportSettingsVar(method));
apiCallableBuilder.httpMethod(generateHttpFields(context));
}
use of com.google.api.codegen.config.MethodConfig in project toolkit by googleapis.
the class BatchingTransformer method generateDescriptorClasses.
public List<BatchingDescriptorClassView> generateDescriptorClasses(InterfaceContext context) {
List<BatchingDescriptorClassView> descriptors = new ArrayList<>();
for (MethodModel method : context.getInterfaceConfigMethods()) {
MethodConfig methodConfig = context.getMethodConfig(method);
if (methodConfig == null) {
continue;
}
if (!methodConfig.isBatching()) {
continue;
}
descriptors.add(generateDescriptorClass(context.asRequestMethodContext(method)));
}
return descriptors;
}
use of com.google.api.codegen.config.MethodConfig in project toolkit by googleapis.
the class DiscoGapicInterfaceContext method getInterfaceConfigMethods.
/**
* Returns a list of methods for this interface. Memoize the result.
*/
@Override
public List<MethodModel> getInterfaceConfigMethods() {
if (interfaceMethods != null) {
return interfaceMethods;
}
ImmutableList.Builder<MethodModel> methodBuilder = ImmutableList.builder();
for (MethodConfig methodConfig : getInterfaceConfig().getMethodConfigs()) {
MethodModel method = methodConfig.getMethodModel();
if (isSupported(method)) {
methodBuilder.add(method);
}
}
interfaceMethods = methodBuilder.build();
return interfaceMethods;
}
use of com.google.api.codegen.config.MethodConfig in project toolkit by googleapis.
the class DynamicLangApiMethodTransformer method removePageTokenFieldConfig.
private Iterable<FieldConfig> removePageTokenFieldConfig(GapicMethodContext context, Iterable<FieldConfig> fieldConfigs) {
MethodConfig methodConfig = context.getMethodConfig();
if (methodConfig == null || !methodConfig.isPageStreaming()) {
return fieldConfigs;
}
final FieldModel requestTokenField = methodConfig.getPageStreaming().getRequestTokenField();
return Iterables.filter(fieldConfigs, new Predicate<FieldConfig>() {
@Override
public boolean apply(FieldConfig fieldConfig) {
return !fieldConfig.getField().equals(requestTokenField);
}
});
}
use of com.google.api.codegen.config.MethodConfig in project toolkit by googleapis.
the class GapicInterfaceContext method getInterfaceConfigMethods.
/**
* Returns a list of methods for this interface that have method configs. Memoize the result.
*/
@Override
public List<MethodModel> getInterfaceConfigMethods() {
if (interfaceMethods != null) {
return interfaceMethods;
}
ImmutableList.Builder<MethodModel> methodBuilder = ImmutableList.builder();
for (MethodConfig methodConfig : getInterfaceConfig().getMethodConfigs()) {
methodBuilder.add(new ProtoMethodModel(((GapicMethodConfig) methodConfig).getMethod()));
}
interfaceMethods = methodBuilder.build();
return interfaceMethods;
}
Aggregations