Search in sources :

Example 1 with StaticLangPagedResponseView

use of com.google.api.codegen.viewmodel.StaticLangPagedResponseView in project toolkit by googleapis.

the class JavaSurfaceTransformer method generatePagedResponseWrapper.

private StaticLangPagedResponseView generatePagedResponseWrapper(MethodContext context, ImportTypeTable typeTable) {
    MethodModel method = context.getMethodModel();
    FieldModel resourceField = context.getMethodConfig().getPageStreaming().getResourcesField();
    StaticLangPagedResponseView.Builder pagedResponseWrapper = StaticLangPagedResponseView.newBuilder();
    String pagedResponseTypeName = context.getNamer().getPagedResponseTypeInnerName(method, typeTable, resourceField);
    pagedResponseWrapper.pagedResponseTypeName(pagedResponseTypeName);
    pagedResponseWrapper.pageTypeName(context.getNamer().getPageTypeInnerName(method, typeTable, resourceField));
    pagedResponseWrapper.fixedSizeCollectionTypeName(context.getNamer().getFixedSizeCollectionTypeInnerName(method, typeTable, resourceField));
    pagedResponseWrapper.requestTypeName(method.getAndSaveRequestTypeName(context.getTypeTable(), context.getNamer()));
    pagedResponseWrapper.responseTypeName(method.getAndSaveResponseTypeName(context.getTypeTable(), context.getNamer()));
    pagedResponseWrapper.resourceTypeName(typeTable.getAndSaveNicknameForElementType(resourceField));
    pagedResponseWrapper.iterateMethods(getIterateMethods(context));
    return pagedResponseWrapper.build();
}
Also used : MethodModel(com.google.api.codegen.config.MethodModel) StaticLangPagedResponseView(com.google.api.codegen.viewmodel.StaticLangPagedResponseView) FieldModel(com.google.api.codegen.config.FieldModel)

Example 2 with StaticLangPagedResponseView

use of com.google.api.codegen.viewmodel.StaticLangPagedResponseView in project toolkit by googleapis.

the class JavaSurfaceTransformer method generatePagedResponseWrappers.

private List<StaticLangPagedResponseView> generatePagedResponseWrappers(InterfaceContext context, GapicProductConfig productConfig, ReleaseLevel releaseLevel) {
    addPagedResponseWrapperImports(context.getImportTypeTable());
    ImmutableList.Builder<StaticLangPagedResponseView> pagedResponseWrappersList = ImmutableList.builder();
    for (MethodModel method : context.getSupportedMethods()) {
        if (context.getMethodConfig(method).isPageStreaming()) {
            pagedResponseWrappersList.add(generatePagedResponseWrapper(context.asRequestMethodContext(method), context.getImportTypeTable()));
        }
    }
    return pagedResponseWrappersList.build();
}
Also used : MethodModel(com.google.api.codegen.config.MethodModel) StaticLangPagedResponseView(com.google.api.codegen.viewmodel.StaticLangPagedResponseView) ImmutableList(com.google.common.collect.ImmutableList)

Aggregations

MethodModel (com.google.api.codegen.config.MethodModel)2 StaticLangPagedResponseView (com.google.api.codegen.viewmodel.StaticLangPagedResponseView)2 FieldModel (com.google.api.codegen.config.FieldModel)1 ImmutableList (com.google.common.collect.ImmutableList)1