diff --git a/Rest.Net/Rest.Net.csproj b/Rest.Net/Rest.Net.csproj
index 1a5fe09..f13b072 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.8.9
+ 1.9.0
Logo_Symbol_Black_Outline.png
README.md
diff --git a/Rest.Net/RestJavascriptClientGenerator.cs b/Rest.Net/RestJavascriptClientGenerator.cs
index a625286..24ef589 100644
--- a/Rest.Net/RestJavascriptClientGenerator.cs
+++ b/Rest.Net/RestJavascriptClientGenerator.cs
@@ -16,15 +16,21 @@ namespace MontoyaTech.Rest.Net
public class RestJavascriptClientGenerator : RestClientGenerator
{
///
- /// Whether or not to generate static code, if true the client will be static.
+ /// Whether or not to generate static code, if true the client will be static. Default is false.
///
public bool StaticCode = false;
///
- /// Whether or not to use Json Property names instead of the Field/Property names.
+ /// Whether or not to use Json Property names instead of the Field/Property names. Default is false.
///
public bool UseJsonNames = false;
+ ///
+ /// Whether or not to generate route functions to accept named parameters instead
+ /// of positional ones. Default is false.
+ ///
+ public bool NamedParameters = false;
+
///
/// Generates a Javascript Client from a given set of routes and returns it.
///
@@ -367,6 +373,7 @@ namespace MontoyaTech.Rest.Net
writer.Outdent().WriteLine("*/");
writer.Write("constructor(");
+ writer.WriteAssert(this.UseJsonNames, "{");
//Write the default fields
foreach (var field in fields)
@@ -386,6 +393,7 @@ namespace MontoyaTech.Rest.Net
writer.WriteSeparator().Write(EscapeName(property.Name)).Write(" = ").Write(this.GetTypeDefaultValue(property.PropertyType));
}
+ writer.WriteAssert(this.UseJsonNames, "} = {}");
writer.WriteLine(") {").Indent();
//Init the default fields
diff --git a/Rest.Net/RouteListener.cs b/Rest.Net/RouteListener.cs
index 1fc8f63..6a4b903 100644
--- a/Rest.Net/RouteListener.cs
+++ b/Rest.Net/RouteListener.cs
@@ -237,8 +237,8 @@ namespace MontoyaTech.Rest.Net
///
/// Generates a C# client from this Route Listener and returns the code.
///
- /// The name of the Client. Default is Client.
- /// Whether or not to generate a static client.
+ /// The name of the Client class. Default is Client.
+ /// Whether or not to generate a static client. Default is false.
///
public string GenerateCSharpClient(string clientName = "Client", bool staticCode = false)
{
@@ -253,16 +253,19 @@ namespace MontoyaTech.Rest.Net
///
/// Generates a Javascript client from this Route Listener and returns the code.
///
- ///
- ///
+ /// The name of the Client class. Default is Client.
+ /// Whether or not to generate a static client. Default is false.
+ /// Whether or not to use JSON Property name overrides during code generation. Default is false.
+ /// Whether or not to generate routes that use named parameters over positional parameters. Default is false.
///
- public string GenerateJavascriptClient(string clientName = "Client", bool staticCode = false, bool useJsonNames = false)
+ public string GenerateJavascriptClient(string clientName = "Client", bool staticCode = false, bool useJsonNames = false, bool namedParameters = false)
{
var generator = new RestJavascriptClientGenerator();
generator.ClientName = clientName;
generator.StaticCode = staticCode;
generator.UseJsonNames = useJsonNames;
+ generator.NamedParameters = namedParameters;
return generator.Generate(this);
}