diff --git a/Rest.Net/Rest.Net.csproj b/Rest.Net/Rest.Net.csproj index c84b907..b2a986c 100644 --- a/Rest.Net/Rest.Net.csproj +++ b/Rest.Net/Rest.Net.csproj @@ -17,7 +17,7 @@ MontoyaTech.Rest.Net MontoyaTech.Rest.Net True - 1.5.2 + 1.5.3 Logo_Symbol_Black_Outline.png diff --git a/Rest.Net/RestJavascriptClientGenerator.cs b/Rest.Net/RestJavascriptClientGenerator.cs index 961c396..03e5d28 100644 --- a/Rest.Net/RestJavascriptClientGenerator.cs +++ b/Rest.Net/RestJavascriptClientGenerator.cs @@ -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} 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