use of com.google.api.codegen.config.MethodModel in project toolkit by googleapis.
the class RubyImportSectionTransformer method generateImportFilenames.
private Set<String> generateImportFilenames(GapicInterfaceContext context) {
Set<String> filenames = new TreeSet<>();
filenames.add(context.getInterface().getFile().getSimpleName());
for (MethodModel method : context.getSupportedMethods()) {
Interface targetInterface = context.asRequestMethodContext(method).getTargetInterface().getInterface();
filenames.add(targetInterface.getFile().getSimpleName());
}
return filenames;
}
use of com.google.api.codegen.config.MethodModel in project toolkit by googleapis.
the class RubySurfaceNamer method getReturnDocLines.
@Override
public List<String> getReturnDocLines(TransformationContext context, MethodContext methodContext, Synchronicity synchronicity) {
MethodModel method = methodContext.getMethodModel();
MethodConfig methodConfig = methodContext.getMethodConfig();
if (method.getResponseStreaming()) {
String classInfo = method.getOutputTypeName(methodContext.getTypeTable()).getFullName();
return ImmutableList.of("An enumerable of " + classInfo + " instances.", "");
}
if (methodConfig.isPageStreaming()) {
String resourceTypeName = getTypeFormatter().getFullNameForElementType(methodConfig.getPageStreaming().getResourcesField());
return ImmutableList.of("An enumerable of " + resourceTypeName + " instances.", "See Google::Gax::PagedEnumerable documentation for other", "operations such as per-page iteration or access to the response", "object.");
}
return ImmutableList.<String>of();
}
use of com.google.api.codegen.config.MethodModel in project toolkit by googleapis.
the class GoGapicSurfaceTransformerTest method testGetImportsRetry.
@Test
public void testGetImportsRetry() {
MethodModel method = new ProtoMethodModel(getMethod(context.getInterface(), "RetryMethod"));
transformer.addXApiImports(context, Collections.singletonList(method));
transformer.generateRetryConfigDefinitions(context, Collections.singletonList(method));
Truth.assertThat(context.getImportTypeTable().getImports()).containsKey("time");
Truth.assertThat(context.getImportTypeTable().getImports()).doesNotContainKey("cloud.google.com/go/longrunning");
}
use of com.google.api.codegen.config.MethodModel in project toolkit by googleapis.
the class GoGapicSurfaceTransformerTest method testGetExampleImportsBidiStream.
@Test
public void testGetExampleImportsBidiStream() {
MethodModel method = new ProtoMethodModel(getMethod(context.getInterface(), "BidiStreamMethod"));
transformer.addXExampleImports(context, Collections.singletonList(method));
Truth.assertThat(context.getImportTypeTable().getImports()).containsKey("io");
}
use of com.google.api.codegen.config.MethodModel in project toolkit by googleapis.
the class GoGapicSurfaceTransformerTest method testGetExampleImportsServerStream.
@Test
public void testGetExampleImportsServerStream() {
MethodModel method = new ProtoMethodModel(getMethod(context.getInterface(), "ServerStreamMethod"));
transformer.addXExampleImports(context, Collections.singletonList(method));
Truth.assertThat(context.getImportTypeTable().getImports()).containsKey("io");
}
Aggregations