private static TypeScriptClassMemberDefinition BuildApiImplMember(IMethodInfo methodInfo, Func <ITypeInfo, TypeScriptType> buildAndImportType) { var functionDefinition = new TypeScriptFunctionDefinition { IsAsync = true, Result = GetMethodResult(methodInfo, buildAndImportType), Body = { CreateCall(methodInfo) } }; functionDefinition.Arguments.AddRange( methodInfo.GetParameters().Select(x => new TypeScriptArgumentDeclaration { Name = x.Name, Type = buildAndImportType(x.ParameterType) }) ); return(new TypeScriptClassMemberDefinition { Name = methodInfo.Name.ToLowerCamelCase(), Definition = functionDefinition }); }
private IEnumerable<TypeScriptClassMemberDefinition> BuildApiImplMember(IMethodInfo methodInfo, Func<ITypeInfo, TypeScriptType> buildAndImportType, ITypeInfo controllerType) { var functionDefinition = new TypeScriptFunctionDefinition { IsAsync = true, Result = GetMethodResult(methodInfo, buildAndImportType), Body = {WrapCall(methodInfo, CreateCall(methodInfo, controllerType))} }; functionDefinition.Arguments.AddRange( methodInfo.GetParameters().Where(x => PassParameterToCall(x, controllerType)).Select(x => new TypeScriptArgumentDeclaration { Name = x.Name, Type = buildAndImportType(x.ParameterType) }) ); yield return new TypeScriptClassMemberDefinition { Name = methodInfo.Name.ToLowerCamelCase(), Definition = functionDefinition }; }
private static TypeScriptClassMemberDefinition BuildApiImplMember(IMethodInfo methodInfo, Func <ITypeInfo, TypeScriptType> buildAndImportType) { var isUrlMethod = IsUrlMethod(methodInfo); var functionDefinition = new TypeScriptFunctionDefinition { IsAsync = !isUrlMethod, Result = GetMethodResult(methodInfo, buildAndImportType), Body = { isUrlMethod?GenerateGetUrlCall(methodInfo) : CreateCall(methodInfo) } }; functionDefinition.Arguments.AddRange( methodInfo.GetParameters().Select(x => new TypeScriptArgumentDeclaration { Name = x.Name, Type = buildAndImportType(x.ParameterType) }) ); return(new TypeScriptClassMemberDefinition { Name = GetMethodName(methodInfo), Definition = functionDefinition }); }
private IEnumerable <TypeScriptClassMemberDefinition> BuildApiImplMember(TypeScriptUnit targetUnit, MethodInfo methodInfo, Func <ICustomAttributeProvider, Type, TypeScriptType> buildAndImportType, Type controllerType) { var functionDefinition = new TypeScriptFunctionDefinition { IsAsync = true, Result = GetMethodResult(targetUnit, methodInfo, buildAndImportType), Body = { CreateCall(methodInfo, controllerType) } }; functionDefinition.Arguments.AddRange( methodInfo.GetParameters().Where(AcceptParameter).Select(x => new TypeScriptArgumentDeclaration { Name = x.Name, Type = buildAndImportType(x, x.ParameterType) }) ); yield return(new TypeScriptClassMemberDefinition { Name = methodInfo.Name.ToLowerCamelCase(), Definition = functionDefinition }); }