Search in sources :

Example 71 with MethodModel

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

the class StaticLangApiMethodTransformer method generateOperationRequestObjectMethod.

public StaticLangApiMethodView generateOperationRequestObjectMethod(MethodContext context, List<ParamWithSimpleDoc> additionalParams) {
    MethodModel method = context.getMethodModel();
    SurfaceNamer namer = context.getNamer();
    StaticLangApiMethodView.Builder methodViewBuilder = StaticLangApiMethodView.newBuilder();
    setCommonFields(context, methodViewBuilder);
    methodViewBuilder.name(namer.getApiMethodName(method, context.getMethodConfig().getVisibility()));
    methodViewBuilder.exampleName(namer.getApiMethodExampleName(context.getInterfaceConfig(), method));
    setRequestObjectMethodFields(context, namer.getCallableMethodName(method), Synchronicity.Sync, additionalParams, methodViewBuilder);
    methodViewBuilder.operationMethod(lroTransformer.generateDetailView(context));
    TypeModel returnType = context.getMethodConfig().getLongRunningConfig().getReturnType();
    methodViewBuilder.responseTypeName(context.getTypeTable().getAndSaveNicknameFor(returnType));
    return methodViewBuilder.type(ClientMethodType.OperationRequestObjectMethod).build();
}
Also used : Builder(com.google.api.codegen.viewmodel.StaticLangApiMethodView.Builder) MethodModel(com.google.api.codegen.config.MethodModel) StaticLangApiMethodView(com.google.api.codegen.viewmodel.StaticLangApiMethodView) TypeModel(com.google.api.codegen.config.TypeModel)

Example 72 with MethodModel

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

the class StaticLangApiMethodTransformer method generateCallableMethod.

public StaticLangApiMethodView generateCallableMethod(MethodContext context) {
    MethodModel method = context.getMethodModel();
    SurfaceNamer namer = context.getNamer();
    StaticLangApiMethodView.Builder methodViewBuilder = StaticLangApiMethodView.newBuilder();
    setCommonFields(context, methodViewBuilder);
    methodViewBuilder.name(namer.getCallableMethodName(method));
    methodViewBuilder.exampleName(context.getNamer().getCallableMethodExampleName(method));
    setCallableMethodFields(context, namer.getCallableName(method), methodViewBuilder);
    methodViewBuilder.responseTypeName(context.getMethodModel().getAndSaveResponseTypeName(context.getTypeTable(), context.getNamer()));
    return methodViewBuilder.type(ClientMethodType.CallableMethod).build();
}
Also used : Builder(com.google.api.codegen.viewmodel.StaticLangApiMethodView.Builder) MethodModel(com.google.api.codegen.config.MethodModel) StaticLangApiMethodView(com.google.api.codegen.viewmodel.StaticLangApiMethodView)

Example 73 with MethodModel

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

the class StaticLangApiMethodTransformer method getRequestObjectParamDocs.

public List<SimpleParamDocView> getRequestObjectParamDocs(MethodContext context) {
    MethodModel method = context.getMethodModel();
    SimpleParamDocView doc = SimpleParamDocView.newBuilder().paramName("request").typeName(method.getAndSaveRequestTypeName(context.getTypeTable(), context.getNamer())).lines(Arrays.<String>asList("The request object containing all of the parameters for the API call.")).build();
    return ImmutableList.of(doc);
}
Also used : MethodModel(com.google.api.codegen.config.MethodModel) SimpleParamDocView(com.google.api.codegen.viewmodel.SimpleParamDocView)

Example 74 with MethodModel

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

the class StaticLangApiMethodTransformer method generatePagedFlattenedAsyncMethod.

public StaticLangApiMethodView generatePagedFlattenedAsyncMethod(MethodContext context, List<ParamWithSimpleDoc> additionalParams) {
    MethodModel methodModel = context.getMethodModel();
    SurfaceNamer namer = context.getNamer();
    StaticLangApiMethodView.Builder methodViewBuilder = StaticLangApiMethodView.newBuilder();
    setCommonFields(context, methodViewBuilder);
    methodViewBuilder.name(namer.getAsyncApiMethodName(methodModel, context.getMethodConfig().getVisibility()));
    methodViewBuilder.exampleName(namer.getAsyncApiMethodExampleName(methodModel));
    setListMethodFields(context, Synchronicity.Async, methodViewBuilder);
    setFlattenedMethodFields(context, additionalParams, Synchronicity.Async, methodViewBuilder);
    return methodViewBuilder.type(ClientMethodType.PagedFlattenedAsyncMethod).build();
}
Also used : Builder(com.google.api.codegen.viewmodel.StaticLangApiMethodView.Builder) MethodModel(com.google.api.codegen.config.MethodModel) StaticLangApiMethodView(com.google.api.codegen.viewmodel.StaticLangApiMethodView)

Example 75 with MethodModel

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

the class StaticLangApiMethodTransformer method generateFlattenedAsyncMethod.

public StaticLangApiMethodView generateFlattenedAsyncMethod(MethodContext context, List<ParamWithSimpleDoc> additionalParams, ClientMethodType type) {
    MethodModel method = context.getMethodModel();
    SurfaceNamer namer = context.getNamer();
    StaticLangApiMethodView.Builder methodViewBuilder = StaticLangApiMethodView.newBuilder();
    setCommonFields(context, methodViewBuilder);
    methodViewBuilder.name(namer.getAsyncApiMethodName(method, context.getMethodConfig().getVisibility()));
    methodViewBuilder.exampleName(namer.getCallableMethodExampleName(method));
    methodViewBuilder.callableName(namer.getCallableName(method));
    setFlattenedMethodFields(context, additionalParams, Synchronicity.Async, methodViewBuilder);
    setStaticLangAsyncReturnTypeName(context, methodViewBuilder);
    return methodViewBuilder.type(type).build();
}
Also used : Builder(com.google.api.codegen.viewmodel.StaticLangApiMethodView.Builder) MethodModel(com.google.api.codegen.config.MethodModel) StaticLangApiMethodView(com.google.api.codegen.viewmodel.StaticLangApiMethodView)

Aggregations

MethodModel (com.google.api.codegen.config.MethodModel)95 ArrayList (java.util.ArrayList)30 MethodConfig (com.google.api.codegen.config.MethodConfig)29 StaticLangApiMethodView (com.google.api.codegen.viewmodel.StaticLangApiMethodView)23 GapicMethodContext (com.google.api.codegen.transformer.GapicMethodContext)20 ImmutableList (com.google.common.collect.ImmutableList)16 FlatteningConfig (com.google.api.codegen.config.FlatteningConfig)14 Builder (com.google.api.codegen.viewmodel.StaticLangApiMethodView.Builder)14 SurfaceNamer (com.google.api.codegen.transformer.SurfaceNamer)12 DiscoveryMethodModel (com.google.api.codegen.config.DiscoveryMethodModel)11 FieldConfig (com.google.api.codegen.config.FieldConfig)11 ProtoMethodModel (com.google.api.codegen.config.ProtoMethodModel)9 Test (org.junit.Test)9 FieldModel (com.google.api.codegen.config.FieldModel)8 MethodContext (com.google.api.codegen.transformer.MethodContext)8 SymbolTable (com.google.api.codegen.util.SymbolTable)8 TypeModel (com.google.api.codegen.config.TypeModel)7 TestCaseView (com.google.api.codegen.viewmodel.testing.TestCaseView)7 InterfaceModel (com.google.api.codegen.config.InterfaceModel)6 PageStreamingConfig (com.google.api.codegen.config.PageStreamingConfig)6