use of com.google.api.codegen.configgen.viewmodel.PageStreamingRequestView in project toolkit by googleapis.
the class MethodTransformer method generatePageStreaming.
private void generatePageStreaming(MethodModel method, MethodView.Builder methodView) {
PageStreamingRequestView request = generatePageStreamingRequest(method);
if (request == null) {
return;
}
PageStreamingResponseView response = helperTransformer.generatePageStreamingResponse(method);
if (response == null) {
return;
}
methodView.pageStreaming(PageStreamingView.newBuilder().request(request).response(response).build());
}
use of com.google.api.codegen.configgen.viewmodel.PageStreamingRequestView in project toolkit by googleapis.
the class MethodTransformer method generatePageStreamingRequest.
private PageStreamingRequestView generatePageStreamingRequest(MethodModel method) {
PageStreamingRequestView.Builder requestBuilder = PageStreamingRequestView.newBuilder();
for (FieldModel field : method.getInputFields()) {
String fieldName = field.getSimpleName();
if (fieldName.equals(helperTransformer.getPagingParameters().getNameForPageToken())) {
requestBuilder.tokenField(fieldName);
} else if (fieldName.equals(helperTransformer.getPagingParameters().getNameForPageSize())) {
requestBuilder.pageSizeField(fieldName);
}
}
PageStreamingRequestView request = requestBuilder.build();
return request.tokenField() == null && request.pageSizeField() == null ? null : request;
}
Aggregations