public static string GetCSharpType(this ApiMethodParameter parameter) { // Handle primitive types switch (parameter.Type) { case ApiObjectType.Integer: return("int?"); case ApiObjectType.Boolean: return("bool?"); case ApiObjectType.Number: return("double?"); case ApiObjectType.Multiple: // TODO: Think about this type case ApiObjectType.String: return("string"); case ApiObjectType.Array: if (parameter.Items != null) { var genericType = string.IsNullOrWhiteSpace(parameter.Items.Name) ? parameter.Items.GetCSharpType(false) : parameter.Items.Name.ToBeautifiedName(); return($"IEnumerable<{genericType}>"); } return("IEnumerable<object>"); // TODO: Maybe throw an exception here later...? } return("object"); // TODO: Maybe throw an exception here later...? }
protected virtual void Process(HierarchyMethod parent, ApiMethodParameter parameter) { var hierarchyMethodParameter = CreateHierarchyElementInternal <HierarchyMethodParameter> (parent); hierarchyMethodParameter.Init(parameter); parent.AddMember(hierarchyMethodParameter); }
public override void Init(ApiElement apiElement) { base.Init(apiElement); apiMethodParameter = EnsureApiElementType <ApiMethodParameter> (apiElement); JniType = apiMethodParameter.JniType; }
public static string ResolveType(ApiMethodParameter parameter) { if (parameter.Type == ApiObjectType.Array) { return($"IEnumerable<{MapType(parameter.Items.Type) ?? "string"}>"); } if (parameter.Type == ApiObjectType.String && JsonArrayParameters.Contains(parameter.Name)) { return("JsonArray"); } return(ResolveDate(parameter.Name, MapType(parameter.Type), parameter.Description)); }
public static bool IsArray(this ApiMethodParameter parameter) => parameter.Type == ApiObjectType.Array && parameter.Items != null;
public static bool IsEnum(this ApiMethodParameter parameter) => EnumObjectTypes.Contains(parameter.Type) && parameter.Enum != null;