Added GetNamesValues function to javascript client generator output. Bumped package version to 1.5.3.

This commit is contained in:
MattMo 2023-04-20 08:50:28 -07:00
parent 54e1fbefec
commit 16c1bb878c
2 changed files with 15 additions and 1 deletions

View File

@ -17,7 +17,7 @@
<AssemblyName>MontoyaTech.Rest.Net</AssemblyName>
<RootNamespace>MontoyaTech.Rest.Net</RootNamespace>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<Version>1.5.2</Version>
<Version>1.5.3</Version>
<PackageReleaseNotes></PackageReleaseNotes>
<PackageIcon>Logo_Symbol_Black_Outline.png</PackageIcon>
</PropertyGroup>

View File

@ -319,6 +319,20 @@ namespace MontoyaTech.Rest.Net
writer.Outdent().WriteLine("];");
writer.Outdent().WriteLine("}");
writer.WriteBreak().WriteLine("/**").Indent();
writer.WriteLine("Returns the names and values of this enum in an array.");
writer.WriteLine("@method");
writer.WriteLine("@returns {Array<object>} Where each element has a name and value key.");
writer.Outdent().WriteLine("*/");
writer.WriteLine("static GetNamesValues() {").Indent();
writer.WriteLine("return [").Indent();
for (int i = 0; i < names.Length; i++)
writer.WriteLine($"{{ name: `{names[i]}`, value: {Convert.ToInt32(values.GetValue(i))} }},");
writer.Outdent().WriteLine("];");
writer.Outdent().WriteLine("}");
}
//Close off the class