use of com.google.api.codegen.config.GapicMethodConfig 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;
}
use of com.google.api.codegen.config.GapicMethodConfig in project toolkit by googleapis.
the class HeaderRequestParamTransformer method generateHeaderRequestParams.
public List<HeaderRequestParamView> generateHeaderRequestParams(MethodContext context) {
if (!context.getProductConfig().getTransportProtocol().equals(TransportProtocol.GRPC)) {
return ImmutableList.of();
}
GapicMethodConfig methodConfig = (GapicMethodConfig) context.getMethodConfig();
Method method = methodConfig.getMethod();
SurfaceNamer namer = context.getNamer();
if (method.getInputType() == null || !method.getInputType().isMessage()) {
return ImmutableList.of();
}
ImmutableList.Builder<HeaderRequestParamView> headerRequestParams = ImmutableList.builder();
MessageType inputMessageType = method.getInputType().getMessageType();
for (String headerRequestParam : methodConfig.getHeaderRequestParams()) {
headerRequestParams.add(generateHeaderRequestParam(headerRequestParam, inputMessageType, namer));
}
return headerRequestParams.build();
}
Aggregations