Search in sources :

Example 1 with LongRunningConfig

use of com.google.api.codegen.config.LongRunningConfig in project toolkit by googleapis.

the class LongRunningTransformer method generateDetailView.

LongRunningOperationDetailView generateDetailView(MethodContext context) {
    MethodConfig methodConfig = context.getMethodConfig();
    LongRunningConfig lroConfig = methodConfig.getLongRunningConfig();
    SurfaceNamer namer = context.getNamer();
    String clientReturnTypeName = namer.getAndSaveOperationResponseTypeName(context.getMethodModel(), context.getTypeTable(), methodConfig);
    String operationPayloadTypeName = namer.getLongRunningOperationTypeName(context.getTypeTable(), lroConfig.getReturnType());
    String metadataTypeName = namer.getLongRunningOperationTypeName(context.getTypeTable(), lroConfig.getMetadataType());
    return LongRunningOperationDetailView.newBuilder().methodName(namer.getApiMethodName(context.getMethodModel(), VisibilityConfig.PUBLIC)).constructorName(namer.getTypeConstructor(clientReturnTypeName)).clientReturnTypeName(clientReturnTypeName).operationPayloadTypeName(operationPayloadTypeName).isEmptyOperation(lroConfig.getReturnType().isEmptyType()).metadataTypeName(metadataTypeName).implementsDelete(lroConfig.implementsDelete()).implementsCancel(lroConfig.implementsCancel()).initialPollDelay(lroConfig.getInitialPollDelay().toMillis()).pollDelayMultiplier(lroConfig.getPollDelayMultiplier()).maxPollDelay(lroConfig.getMaxPollDelay().toMillis()).totalPollTimeout(lroConfig.getTotalPollTimeout().toMillis()).build();
}
Also used : MethodConfig(com.google.api.codegen.config.MethodConfig) LongRunningConfig(com.google.api.codegen.config.LongRunningConfig)

Example 2 with LongRunningConfig

use of com.google.api.codegen.config.LongRunningConfig in project toolkit by googleapis.

the class NodeJSGapicSurfaceTransformer method createLongRunningDescriptors.

private List<LongRunningOperationDetailView> createLongRunningDescriptors(GapicInterfaceContext context) {
    List<LongRunningOperationDetailView> result = new ArrayList<>();
    for (MethodModel method : context.getLongRunningMethods()) {
        GapicMethodContext methodContext = context.asDynamicMethodContext(method);
        LongRunningConfig lroConfig = methodContext.getMethodConfig().getLongRunningConfig();
        TypeModel returnType = lroConfig.getReturnType();
        TypeModel metadataType = lroConfig.getMetadataType();
        result.add(LongRunningOperationDetailView.newBuilder().methodName(context.getNamer().getApiMethodName(method, VisibilityConfig.PUBLIC)).constructorName("").clientReturnTypeName("").operationPayloadTypeName(context.getImportTypeTable().getFullNameFor(returnType)).isEmptyOperation(lroConfig.getReturnType().isEmptyType()).metadataTypeName(context.getImportTypeTable().getFullNameFor(metadataType)).implementsCancel(true).implementsDelete(true).initialPollDelay(lroConfig.getInitialPollDelay().toMillis()).pollDelayMultiplier(lroConfig.getPollDelayMultiplier()).maxPollDelay(lroConfig.getMaxPollDelay().toMillis()).totalPollTimeout(lroConfig.getTotalPollTimeout().toMillis()).build());
    }
    return result;
}
Also used : LongRunningOperationDetailView(com.google.api.codegen.viewmodel.LongRunningOperationDetailView) MethodModel(com.google.api.codegen.config.MethodModel) GapicMethodContext(com.google.api.codegen.transformer.GapicMethodContext) LongRunningConfig(com.google.api.codegen.config.LongRunningConfig) ArrayList(java.util.ArrayList) TypeModel(com.google.api.codegen.config.TypeModel)

Example 3 with LongRunningConfig

use of com.google.api.codegen.config.LongRunningConfig in project toolkit by googleapis.

the class PhpGapicSurfaceTransformer method createLongRunningDescriptors.

private List<LongRunningOperationDetailView> createLongRunningDescriptors(GapicInterfaceContext context) {
    List<LongRunningOperationDetailView> result = new ArrayList<>();
    for (MethodModel method : context.getLongRunningMethods()) {
        GapicMethodContext methodContext = context.asDynamicMethodContext(method);
        LongRunningConfig lroConfig = methodContext.getMethodConfig().getLongRunningConfig();
        TypeModel returnType = lroConfig.getReturnType();
        TypeModel metadataType = lroConfig.getMetadataType();
        result.add(LongRunningOperationDetailView.newBuilder().methodName(context.getNamer().getApiMethodName(method, VisibilityConfig.PUBLIC)).transportMethodName(context.getNamer().getGrpcMethodName(method)).constructorName("").clientReturnTypeName("").operationPayloadTypeName(context.getImportTypeTable().getFullNameFor(returnType)).isEmptyOperation(lroConfig.getReturnType().isEmptyType()).metadataTypeName(context.getImportTypeTable().getFullNameFor(metadataType)).implementsCancel(true).implementsDelete(true).initialPollDelay(lroConfig.getInitialPollDelay().toMillis()).pollDelayMultiplier(lroConfig.getPollDelayMultiplier()).maxPollDelay(lroConfig.getMaxPollDelay().toMillis()).totalPollTimeout(lroConfig.getTotalPollTimeout().toMillis()).build());
    }
    return result;
}
Also used : LongRunningOperationDetailView(com.google.api.codegen.viewmodel.LongRunningOperationDetailView) MethodModel(com.google.api.codegen.config.MethodModel) GapicMethodContext(com.google.api.codegen.transformer.GapicMethodContext) LongRunningConfig(com.google.api.codegen.config.LongRunningConfig) ArrayList(java.util.ArrayList) TypeModel(com.google.api.codegen.config.TypeModel)

Aggregations

LongRunningConfig (com.google.api.codegen.config.LongRunningConfig)3 MethodModel (com.google.api.codegen.config.MethodModel)2 TypeModel (com.google.api.codegen.config.TypeModel)2 GapicMethodContext (com.google.api.codegen.transformer.GapicMethodContext)2 LongRunningOperationDetailView (com.google.api.codegen.viewmodel.LongRunningOperationDetailView)2 ArrayList (java.util.ArrayList)2 MethodConfig (com.google.api.codegen.config.MethodConfig)1