public static string GetTypeString(this OdcmParameter parameter) { switch (@parameter.Type.Name) { case "String": return("str"); case "Int8": case "Int16": case "Int32": case "Int64": return("int"); case "Double": return("float"); case "Guid": return("UUID"); case "DateTimeOffset": return("datetime"); case "Boolean": return("bool"); case "Binary": case "Stream": return("bytes"); default: return(@parameter.Type.Name.ToUpperFirstChar()); } }
public static bool IsComplex(this OdcmParameter property) { string t = property.GetTypeString(); return(!(t == "Integer" || t == "java.util.UUID" || t == "java.util.Calendar" || t == "byte[]" || t == "String" || "long" == t || "Byte[]" == t)); }
private OdcmMethod WriteMethod(OdcmClass odcmClass, IEdmOperation operation) { var parameters = operation.IsBound ? (from parameter in operation.Parameters where parameter != operation.Parameters.First() select parameter) : (operation.Parameters); var isBoundToCollection = operation.IsBound && operation.Parameters.First().Type.IsCollection(); var odcmMethod = new OdcmMethod(operation.Name, odcmClass.Namespace) { IsComposable = operation.IsFunction() && ((IEdmFunction)operation).IsComposable, IsFunction = operation.IsFunction(), IsBoundToCollection = isBoundToCollection, Verbs = operation.IsAction() ? OdcmAllowedVerbs.Post : OdcmAllowedVerbs.Any, Class = odcmClass }; AddVocabularyAnnotations(odcmMethod, operation); if (!odcmMethod.IsDeprecated && odcmClass.IsDeprecated) { odcmMethod.Deprecation = odcmClass.Deprecation; } if (operation.ReturnType != null) { odcmMethod.ReturnType = ResolveType(operation.ReturnType); odcmMethod.IsCollection = operation.ReturnType.IsCollection(); if (!odcmMethod.IsDeprecated && odcmMethod.ReturnType.IsDeprecated) { odcmMethod.Deprecation = odcmMethod.ReturnType.Deprecation; } } var callingConvention = operation.IsAction() ? OdcmCallingConvention.InHttpMessageBody : OdcmCallingConvention.InHttpRequestUri; foreach (var parameter in parameters) { var odcmParameter = new OdcmParameter(parameter.Name) { CallingConvention = callingConvention, Type = ResolveType(parameter.Type), IsCollection = parameter.Type.IsCollection(), IsNullable = parameter.Type.IsNullable }; AddVocabularyAnnotations(odcmParameter, parameter); odcmMethod.Parameters.Add(odcmParameter); } return(odcmMethod); }
public static bool IsComplex(this OdcmParameter property) { string t = property.GetTypeString(); return(!(t == "Integer" || t == "java.util.UUID" || t == "java.util.Calendar" || t == "byte[]" || t == "String" || "long" == t || "Byte[]" == t || t == "Short" || t == "com.microsoft.graph.model.DateOnly")); }
public static Parameter FromOdcmParameter(OdcmParameter odcmParameter) { return(new Parameter { Name = odcmParameter.Name, Type = odcmParameter.IsCollection ? new Type(new Identifier("System.Collections.Generic", "ICollection"), new Type(NamesService.GetConcreteTypeName(odcmParameter.Type))) : TypeService.GetParameterType(odcmParameter) }); }
public static OdcmParameter OdcmParameter(Action <OdcmParameter> config = null) { var retVal = new OdcmParameter(Any.CSharpIdentifier()); if (config != null) { config(retVal); } return(retVal); }
public Given_an_OdcmParameter() { _model = new OdcmModel(Any.ServiceMetadata()); _namespace = Any.EmptyOdcmNamespace(); _model.Namespaces.Add(_namespace); _class = Any.OdcmEntityClass(_namespace); _model.AddType(_class); _method = Any.OdcmMethod(m => m.Parameters.Clear()); _class.Methods.Add(_method); _param = Any.OdcmParameter(); _method.Parameters.Add(_param); _expectedMethodName = _method.Name + "Async"; }
public static string GetTypeString(this OdcmParameter parameter) { switch (parameter.Type.Name) { case "Int32": return("Integer"); case "Int64": return("Long"); case "Guid": return("java.util.UUID"); case "DateTimeOffset": return("java.util.Calendar"); case "Binary": case "Stream": return("byte[]"); default: return(parameter.Type.Name); } }
public static string GetTypeString(this OdcmParameter parameter) { return(GetTypeString(parameter.Type)); }
public static bool IsComplex(this OdcmParameter property) { string t = property.GetTypeString(); return(t.IsComplex()); }
public static Type GetParameterType(OdcmParameter parameter) { return(parameter.IsNullable && IsValueType(parameter.Type) && !(parameter.Type is OdcmEnum) ? GetNullableType(parameter.Type) : new Type(NamesService.GetPublicTypeName(parameter.Type))); }