Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions DataverseGen.Cli/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using CommunityToolkit.Diagnostics;
using DataverseGen.Core.Config;
using DataverseGen.Core.DataConverter;
using DataverseGen.Core.CustomApi;
using DataverseGen.Core.Generators.Scriban;
using DataverseGen.Core.Metadata;
using Meziantou.Framework.Win32;
Expand Down Expand Up @@ -92,10 +93,19 @@ private static void Main(string[] args)

MappingEntity[] data = dataConverter.GetMappedEntities();
WriteLine(@"Finish Load data");

CustomApiModel[] customApis = Array.Empty<CustomApiModel>();
if (config.TemplateEngine.Type.Equals("ts", StringComparison.InvariantCultureIgnoreCase))
{
DataverseCustomApiConverter customApiConverter = new(dataverseConnector);
customApis = customApiConverter.GetCustomApis();
}

Context context = new()
{
Namespace = config.Namespace,
Entities = data
Entities = data,
CustomApis = customApis
};

WriteLine(@"Start generator");
Expand Down Expand Up @@ -154,4 +164,4 @@ private static void ScribanRun(ConfigModel config, Context context)

scribanGenerator.GenerateTemplate();
}
}
}
48 changes: 48 additions & 0 deletions DataverseGen.Core/CustomApi/CustomApiModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using System.Runtime.Serialization;
using Newtonsoft.Json;

namespace DataverseGen.Core.CustomApi;

[Serializable]
[DataContract]
public class CustomApiModel
{
[JsonProperty]
public string Id { get; set; }

[JsonProperty]
public string UniqueName { get; set; }

[JsonProperty]
public string DisplayName { get; set; }

[JsonProperty]
public string Description { get; set; }

[JsonProperty]
public string OperationName { get; set; }

[JsonProperty]
public string BindingType { get; set; }

[JsonProperty]
public string BoundEntityLogicalName { get; set; }

[JsonProperty]
public string ExecutePrivilegeName { get; set; }

[JsonProperty]
public bool IsFunction { get; set; }

[JsonProperty]
public bool IsPrivate { get; set; }

[JsonProperty]
public string RequestClassName { get; set; }

[JsonProperty]
public CustomApiParameterModel[] RequestParameters { get; set; } = Array.Empty<CustomApiParameterModel>();

[JsonProperty]
public CustomApiParameterModel[] ResponseProperties { get; set; } = Array.Empty<CustomApiParameterModel>();
}
48 changes: 48 additions & 0 deletions DataverseGen.Core/CustomApi/CustomApiParameterModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using System.Runtime.Serialization;
using Newtonsoft.Json;

namespace DataverseGen.Core.CustomApi;

[Serializable]
[DataContract]
public class CustomApiParameterModel
{
[JsonProperty]
public string Id { get; set; }

[JsonProperty]
public string CustomApiId { get; set; }

[JsonProperty]
public string UniqueName { get; set; }

[JsonProperty]
public string DisplayName { get; set; }

[JsonProperty]
public string Description { get; set; }

[JsonProperty]
public string Type { get; set; }

[JsonProperty]
public string LogicalEntityName { get; set; }

[JsonProperty]
public bool IsOptional { get; set; }

[JsonProperty]
public int Position { get; set; }

[JsonProperty]
public string PropertyName { get; set; }

[JsonProperty]
public string TypeScriptType { get; set; }

[JsonProperty]
public string WebApiTypeName { get; set; }

[JsonProperty]
public string WebApiStructuralProperty { get; set; }
}
Loading
Loading