Bumped package version to 1.5.4, changed @method to use @function in client generator for javascript. Added blob support for requests.

This commit is contained in:
MattMo 2023-04-20 16:31:41 -07:00
parent 16c1bb878c
commit 5048640a53
2 changed files with 14 additions and 8 deletions

View File

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

View File

@ -170,6 +170,10 @@ namespace MontoyaTech.Rest.Net
return builder.ToString();
}
else if (type.IsAssignableTo(typeof(Stream)))
{
return "Blob";
}
else if (typeCode == TypeCode.String || typeCode == TypeCode.Char)
{
return "string";
@ -259,7 +263,7 @@ namespace MontoyaTech.Rest.Net
if (!type.IsEnum)
{
writer.WriteBreak().WriteLine("/**").Indent();
writer.WriteLine("@method");
writer.WriteLine("@function");
foreach (var field in fields)
writer.WriteLine($"@param {{{this.GetTypeFullyResolvedName(field.FieldType)}}} {field.Name}");
@ -292,7 +296,7 @@ namespace MontoyaTech.Rest.Net
{
writer.WriteBreak().WriteLine("/**").Indent();
writer.WriteLine("Returns the names of this enums values in an array.");
writer.WriteLine("@method");
writer.WriteLine("@function");
writer.WriteLine("@returns {Array<string>}");
writer.Outdent().WriteLine("*/");
writer.WriteLine("static GetNames() {").Indent();
@ -307,7 +311,7 @@ namespace MontoyaTech.Rest.Net
writer.WriteBreak().WriteLine("/**").Indent();
writer.WriteLine("Returns the values of this enum in an arrray.");
writer.WriteLine("@method");
writer.WriteLine("@function");
writer.WriteLine("@returns {Array<number>}");
writer.Outdent().WriteLine("*/");
writer.WriteLine("static GetValues() {").Indent();
@ -322,7 +326,7 @@ namespace MontoyaTech.Rest.Net
writer.WriteBreak().WriteLine("/**").Indent();
writer.WriteLine("Returns the names and values of this enum in an array.");
writer.WriteLine("@method");
writer.WriteLine("@function");
writer.WriteLine("@returns {Array<object>} Where each element has a name and value key.");
writer.Outdent().WriteLine("*/");
writer.WriteLine("static GetNamesValues() {").Indent();
@ -399,7 +403,7 @@ namespace MontoyaTech.Rest.Net
writer.WriteBreak();
writer.WriteLine("/**").Indent();
writer.WriteLine("@method");
writer.WriteLine("@function");
writer.WriteLine($"@param {{{this.ClientName}}} client");
writer.Outdent().WriteLine("*/");
@ -440,7 +444,7 @@ namespace MontoyaTech.Rest.Net
//Generate the function jsdoc tags
writer.WriteLine("/**").Indent();
writer.WriteLine("@method");
writer.WriteLine("@function");
writer.WriteLine("@async");
writer.WriteLine($"@name {(routeName == null ? methodInfo.Name : routeName.Name)}");
@ -540,10 +544,12 @@ namespace MontoyaTech.Rest.Net
{
if (routeRequest.RequestType.IsAssignableTo(typeof(Stream)))
{
//TODO
writer.WriteLine("headers: new Headers({ 'Content-Type': 'application/octet-stream' }),");
writer.WriteLine("body: request,");
}
else if (routeRequest.Json)
{
writer.WriteLine("body: JSON.stringify(request),");
}
else