use of com.google.api.tools.framework.model.TypeRef in project toolkit by googleapis.
the class PhpApiMethodParamTransformer method generateMethodParams.
@Override
public List<DynamicLangDefaultableParamView> generateMethodParams(GapicMethodContext context) {
ImmutableList.Builder<DynamicLangDefaultableParamView> methodParams = ImmutableList.builder();
methodParams.addAll(generateDefaultableParams(context));
TypeRef arrayType = TypeRef.fromPrimitiveName("string").makeRepeated();
DynamicLangDefaultableParamView.Builder optionalArgs = DynamicLangDefaultableParamView.newBuilder();
optionalArgs.name(context.getNamer().localVarName(Name.from("optional", "args")));
optionalArgs.defaultValue(context.getTypeTable().getSnippetZeroValueAndSaveNicknameFor(arrayType));
methodParams.add(optionalArgs.build());
return methodParams.build();
}
use of com.google.api.tools.framework.model.TypeRef in project toolkit by googleapis.
the class CSharpModelTypeNameConverterTest method testGetEnumValue.
@Test
public void testGetEnumValue() {
String packageName = "Google.Example.Library.V1";
TypeRef type = ModelTypeNameConverterTestUtil.getTestEnumType(tempDir);
EnumValue value = type.getEnumType().getValues().get(0);
CSharpModelTypeNameConverter converter = new CSharpModelTypeNameConverter(packageName);
Truth.assertThat(converter.getEnumValue(type, value).getValueAndSaveTypeNicknameIn(new CSharpTypeTable(packageName))).isEqualTo("Book.Types.Rating.Good");
}
use of com.google.api.tools.framework.model.TypeRef in project toolkit by googleapis.
the class GoModelTypeNameConverterTest method testGetEnumValue.
@Test
public void testGetEnumValue() {
TypeRef type = ModelTypeNameConverterTestUtil.getTestEnumType(tempDir);
EnumValue value = type.getEnumType().getValues().get(0);
Truth.assertThat(converter.getEnumValue(type, value).getValueAndSaveTypeNicknameIn(new GoTypeTable())).isEqualTo("librarypb.Book_GOOD");
type = ModelTypeNameConverterTestUtil.getTestType(tempDir, "TopLevelEnum");
value = type.getEnumType().getValues().get(0);
Truth.assertThat(converter.getEnumValue(type, value).getValueAndSaveTypeNicknameIn(new GoTypeTable())).isEqualTo("librarypb.TopLevelEnum_FOO");
}
use of com.google.api.tools.framework.model.TypeRef in project toolkit by googleapis.
the class RubyModelTypeNameConverterTest method testGetEnumValue.
@Test
public void testGetEnumValue() {
String packageName = "Library::V1";
TypeRef type = ModelTypeNameConverterTestUtil.getTestEnumType(tempDir);
EnumValue value = type.getEnumType().getValues().get(0);
RubyModelTypeNameConverter converter = new RubyModelTypeNameConverter(packageName);
Truth.assertThat(converter.getEnumValue(type, value).getValueAndSaveTypeNicknameIn(new RubyTypeTable(packageName))).isEqualTo(":GOOD");
}
Aggregations