diff --git a/src/isn.abst/isn.abst.csproj b/src/isn.abst/isn.abst.csproj
index 0b3a272..5f73854 100644
--- a/src/isn.abst/isn.abst.csproj
+++ b/src/isn.abst/isn.abst.csproj
@@ -2,6 +2,7 @@
netcoreapp2.1
+ NETSDK1138
diff --git a/src/isn/Program.cs b/src/isn/Program.cs
index 616ced9..8789561 100644
--- a/src/isn/Program.cs
+++ b/src/isn/Program.cs
@@ -166,7 +166,7 @@ namespace isn
pushoptions.WriteOptionDescriptions(Console.Out);
return;
}
- List reports = PushPkg(pargs);
+ List reports = await PushPkgAsync(pargs);
Console.WriteLine(JsonConvert.SerializeObject(reports));
pushKO = reports.Count(r => !r.OK && !r.AlreadyPresent);
}
diff --git a/src/isn/SourceHelpers.cs b/src/isn/SourceHelpers.cs
index c643c1e..add0256 100644
--- a/src/isn/SourceHelpers.cs
+++ b/src/isn/SourceHelpers.cs
@@ -3,30 +3,23 @@ using System.IO;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
-using isn.Abstract;
using Newtonsoft.Json;
+using isn.Abstract;
namespace isn
{
public static class SourceHelpers
{
- public static ApiIndexViewModel GetServerResources(string url)
+ public static async Task GetServerResourcesAsync(string url)
{
HttpClient client = new HttpClient();
ApiIndexViewModel result = null;
// var json = await client.GetStringAsync(new System.Uri(url));
- try
- {
- Task.Run(async () =>
- {
+
+
var response = await client.GetStringAsync(url);
result = JsonConvert.DeserializeObject(response);
- }).Wait();
- }
- catch(Exception ex)
- {
- throw;
- }
+
return result;
}
diff --git a/src/isn/commands/PushCommand.cs b/src/isn/commands/PushCommand.cs
index cf708b9..0d57c8d 100644
--- a/src/isn/commands/PushCommand.cs
+++ b/src/isn/commands/PushCommand.cs
@@ -9,12 +9,12 @@ namespace isn
{
public class PushCommand
{
- static public PushReport Run(string pkg, string source)
+ static public async Task RunAsync(string pkg, string source)
{
if (source == null) source = Program.Settings.DefaultSource;
if (source == null) throw new InvalidOperationException("source is null");
string apikey = Program.Protector.UnProtect(Program.Settings.Sources[source].ApiKey);
- var resources = SourceHelpers.GetServerResources(source);
+ var resources = await SourceHelpers.GetServerResourcesAsync(source);
if (resources.Resources == null)
throw new InvalidOperationException("source gave no resource");
if (!resources.Resources.Any(res => res.Type == "PackagePublish/3.5.0"))
diff --git a/src/isn/commands/push.cs b/src/isn/commands/push.cs
index 429c207..ef5a302 100644
--- a/src/isn/commands/push.cs
+++ b/src/isn/commands/push.cs
@@ -9,13 +9,13 @@ namespace isn
partial class Program
{
- public static List PushPkg(IEnumerable pkgs)
+ public static async Task> PushPkgAsync(IEnumerable pkgs)
{
List pushReports = new List();
foreach (string pkg in pkgs)
{
- var report = PushCommand.Run(pkg, source);
+ var report = await PushCommand.RunAsync(pkg, source);
pushReports.Add(report);
}
diff --git a/src/isn/isn.csproj b/src/isn/isn.csproj
index 911b692..2366882 100644
--- a/src/isn/isn.csproj
+++ b/src/isn/isn.csproj
@@ -9,6 +9,7 @@
true
WTFPL
true
+ NETSDK1138
diff --git a/src/isnd/Controllers/Packages/ApiIndex.cs b/src/isnd/Controllers/Packages/ApiIndex.cs
new file mode 100644
index 0000000..38953b2
--- /dev/null
+++ b/src/isnd/Controllers/Packages/ApiIndex.cs
@@ -0,0 +1,31 @@
+using System.ComponentModel.DataAnnotations;
+using System.IO;
+using System.Linq;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.DataProtection;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using NuGet.Versioning;
+using isnd.Data;
+using isnd.Entities;
+using Unleash;
+using isnd.Services;
+using isnd.ViewModels;
+using System.Threading.Tasks;
+using isnd.Interfaces;
+using isn.Abstract;
+
+namespace isnd.Controllers
+{
+ public partial class PackagesController : Controller
+ {
+ [HttpGet(_pkgRootPrefix + ApiConfig.Base)]
+ public IActionResult ApiIndex()
+ {
+ return Ok(new ApiIndexViewModel{ Version = PackageManager.BASE_API_LEVEL, Resources = _resources });
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/src/isnd/Controllers/PackagesController.AutoComplete.cs b/src/isnd/Controllers/Packages/AutoComplete.cs
similarity index 98%
rename from src/isnd/Controllers/PackagesController.AutoComplete.cs
rename to src/isnd/Controllers/Packages/AutoComplete.cs
index 60c9cc0..b1435c1 100644
--- a/src/isnd/Controllers/PackagesController.AutoComplete.cs
+++ b/src/isnd/Controllers/Packages/AutoComplete.cs
@@ -1,4 +1,5 @@
using isnd.Services;
+using isnd.Entities;
using Microsoft.AspNetCore.Mvc;
namespace isnd.Controllers
diff --git a/src/isnd/Controllers/PackagesController.Catalog.cs b/src/isnd/Controllers/Packages/Catalog.cs
similarity index 98%
rename from src/isnd/Controllers/PackagesController.Catalog.cs
rename to src/isnd/Controllers/Packages/Catalog.cs
index 6e45692..e064a51 100644
--- a/src/isnd/Controllers/PackagesController.Catalog.cs
+++ b/src/isnd/Controllers/Packages/Catalog.cs
@@ -3,7 +3,7 @@ using System.Threading.Tasks;
using isnd.Data.Catalog;
using isnd.Helpers;
using isnd.Services;
-using isnd.ViewModels;
+using isnd.Entities;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
diff --git a/src/isnd/Controllers/PackagesController.cs b/src/isnd/Controllers/Packages/Ctor.cs
similarity index 88%
rename from src/isnd/Controllers/PackagesController.cs
rename to src/isnd/Controllers/Packages/Ctor.cs
index 2c502e2..bbfbf01 100644
--- a/src/isnd/Controllers/PackagesController.cs
+++ b/src/isnd/Controllers/Packages/Ctor.cs
@@ -49,12 +49,5 @@ namespace isnd.Controllers
_unleashĈlient = unleashĈlient;
_resources = _packageManager.GetResources(_unleashĈlient).ToArray();
}
-
- [HttpGet(_pkgRootPrefix + ApiConfig.Base)]
- public IActionResult ApiIndex()
- {
- return Ok(new ApiIndexViewModel{ Version = PackageManager.BASE_API_LEVEL, Resources = _resources });
- }
}
-
-}
\ No newline at end of file
+}
diff --git a/src/isnd/Controllers/PackagesController.Delete.cs b/src/isnd/Controllers/Packages/Delete.cs
similarity index 96%
rename from src/isnd/Controllers/PackagesController.Delete.cs
rename to src/isnd/Controllers/Packages/Delete.cs
index 3cd90c3..5664e84 100644
--- a/src/isnd/Controllers/PackagesController.Delete.cs
+++ b/src/isnd/Controllers/Packages/Delete.cs
@@ -1,6 +1,7 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using isnd.Helpers;
+using isnd.Entities;
using System.ComponentModel.DataAnnotations;
using isnd.Attributes;
namespace isnd.Controllers
diff --git a/src/isnd/Controllers/PackagesController.Files.cs b/src/isnd/Controllers/Packages/Files.cs
similarity index 80%
rename from src/isnd/Controllers/PackagesController.Files.cs
rename to src/isnd/Controllers/Packages/Files.cs
index 0357b70..255357b 100644
--- a/src/isnd/Controllers/PackagesController.Files.cs
+++ b/src/isnd/Controllers/Packages/Files.cs
@@ -2,15 +2,13 @@ using System.ComponentModel.DataAnnotations;
using System.IO;
using Microsoft.AspNetCore.Mvc;
using isnd.Attributes;
+using isnd.Entities;
namespace isnd.Controllers
{
public partial class PackagesController
{
- // TODO GET GET {@id}/{LOWER_ID}/{LOWER_VERSION}/{LOWER_ID}.{LOWER_VERSION}.nupkg
- // LOWER_ID URL string yes The package ID, lowercase
- // LOWER_VERSION URL string yes The package version, normalized and lowercased
- // response 200 : the package
+ // Web get nupkg
[HttpGet(_pkgRootPrefix + ApiConfig.Get + "/{id}/{lower}/{idf}-{lowerf}.nupkg")]
public IActionResult GetPackage(
[FromRoute][SafeName][Required] string id,
@@ -30,8 +28,7 @@ namespace isnd.Controllers
return File(pkgfi.OpenRead(), "application/zip; charset=binary");
}
- // TODO GET {@id}/{LOWER_ID}/{LOWER_VERSION}/{LOWER_ID}.nuspec
- // response 200 : the nuspec
+ // Web get spec
[HttpGet(_pkgRootPrefix + ApiConfig.Get + "/{id}/{lower}/{idf}-{lowerf}.nuspec")]
public IActionResult GetNuspec(
[FromRoute][SafeName][Required] string id,
diff --git a/src/isnd/Controllers/PackagesController.GetVersions.cs b/src/isnd/Controllers/Packages/GetVersions.cs
similarity index 98%
rename from src/isnd/Controllers/PackagesController.GetVersions.cs
rename to src/isnd/Controllers/Packages/GetVersions.cs
index ea83192..c4bfc94 100644
--- a/src/isnd/Controllers/PackagesController.GetVersions.cs
+++ b/src/isnd/Controllers/Packages/GetVersions.cs
@@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Mvc;
using NuGet.Versioning;
+using isnd.Entities;
namespace isnd.Controllers
{
diff --git a/src/isnd/Controllers/PackagesController.Put.cs b/src/isnd/Controllers/Packages/Put.cs
similarity index 99%
rename from src/isnd/Controllers/PackagesController.Put.cs
rename to src/isnd/Controllers/Packages/Put.cs
index 17ca186..5b12ffd 100644
--- a/src/isnd/Controllers/PackagesController.Put.cs
+++ b/src/isnd/Controllers/Packages/Put.cs
@@ -13,6 +13,7 @@ using NuGet.Packaging.Core;
using NuGet.Versioning;
using isnd.Data;
using isnd.Helpers;
+using isnd.Entities;
using Microsoft.AspNetCore.Http;
using isnd.Data.Catalog;
diff --git a/src/isnd/Controllers/PackagesController.Search.cs b/src/isnd/Controllers/Packages/Search.cs
similarity index 96%
rename from src/isnd/Controllers/PackagesController.Search.cs
rename to src/isnd/Controllers/Packages/Search.cs
index ab237d6..7e2118a 100644
--- a/src/isnd/Controllers/PackagesController.Search.cs
+++ b/src/isnd/Controllers/Packages/Search.cs
@@ -2,6 +2,7 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
+using isnd.Entities;
namespace isnd.Controllers
{
diff --git a/src/isnd/Controllers/PackagesController.Views.cs b/src/isnd/Controllers/Packages/WebViews.cs
similarity index 98%
rename from src/isnd/Controllers/PackagesController.Views.cs
rename to src/isnd/Controllers/Packages/WebViews.cs
index 0a0ad7d..556d910 100644
--- a/src/isnd/Controllers/PackagesController.Views.cs
+++ b/src/isnd/Controllers/Packages/WebViews.cs
@@ -10,7 +10,7 @@ namespace isnd.Controllers
public partial class PackagesController
{
- // GET: PackageVersion
+ // Web search
public async Task Index(PackageIndexViewModel model)
{
var applicationDbContext = _dbContext.Packages.Include(p => p.Versions).Where(
diff --git a/src/isnd/ApiConfig.cs b/src/isnd/Entities/ApiConfig.cs
similarity index 87%
rename from src/isnd/ApiConfig.cs
rename to src/isnd/Entities/ApiConfig.cs
index fc5d3b2..8b5f65e 100644
--- a/src/isnd/ApiConfig.cs
+++ b/src/isnd/Entities/ApiConfig.cs
@@ -1,4 +1,4 @@
-namespace isnd
+namespace isnd.Entities
{
public static class ApiConfig
{
@@ -15,5 +15,7 @@ namespace isnd
public const string Delete = "delete";
+ public const string Registration = "registration";
+
}
}
\ No newline at end of file
diff --git a/src/isnd/Services/PackageManager.cs b/src/isnd/Services/PackageManager.cs
index fd08b11..400b627 100644
--- a/src/isnd/Services/PackageManager.cs
+++ b/src/isnd/Services/PackageManager.cs
@@ -71,33 +71,23 @@ namespace isnd.Services
Type = "SearchQueryService/" + BASE_API_LEVEL,
Comment = "Search Query service"
});
- /*
- {
- "@id": "https://api-v2v3search-0.nuget.org/query",
- "@type": "SearchQueryService/3.0.0-rc",
- "comment": "Query endpoint of NuGet Search service (primary) used by RC clients"
- },
-
if (unleashClient.IsEnabled("pkg-catalog", false))
res.Add(
new Resource
{
Id = extUrl + ApiConfig.Catalog,
- Type = "Catalog/3.0.0",
+ Type = "Catalog/"+ BASE_API_LEVEL,
Comment = "Package Catalog Index"
- });*/
-
- /* TODO ? {
-
- "@id": "https://api.nuget.org/v3/registration5-gz-semver2/",
- "@type": "RegistrationsBaseUrl/Versioned",
- "clientVersion": "4.3.0-alpha",
- "comment": "Base URL of Azure storage where NuGet package registration info is stored in GZIP format. This base URL includes SemVer 2.0.0 packages."
-
-},
-*/
+ });
+ if (unleashClient.IsEnabled("pkg-registration", false))
+ res.Add(
+ new Resource
+ {
+ Id = extUrl + ApiConfig.Registration,
+ Type = "Catalog/" + BASE_API_LEVEL,
+ Comment = "Base URL of storage where isn package registration info is stored in GZIP format. This base URL includes SemVer 2.0.0 packages."
+ });
return res;
-
}
public PackageIndexViewModel SearchByName(string query,
diff --git a/src/isnd/isnd.csproj b/src/isnd/isnd.csproj
index 1486e9b..fc86180 100644
--- a/src/isnd/isnd.csproj
+++ b/src/isnd/isnd.csproj
@@ -6,6 +6,7 @@
1.0.1
true
WTFPL
+ NETSDK1138
diff --git a/test/isn.tests/PushTest.cs b/test/isn.tests/PushTest.cs
index 7d757d3..8e039f6 100644
--- a/test/isn.tests/PushTest.cs
+++ b/test/isn.tests/PushTest.cs
@@ -57,10 +57,10 @@ dataTable.Rows.Add(dataRow);
Assert.NotNull(vm.Resources);
}
[Fact]
- public void TestPush()
+ public async Task TestPush()
{
Program.LoadConfig();
- var report = Program.PushPkg(new string[] { "/home/paul/Nupkgs/Yavsc.Abstract.1.0.8.nupkg" });
+ var report = await Program.PushPkgAsync(new string[] { "/home/paul/Nupkgs/Yavsc.Abstract.1.0.8.nupkg" });
}
[Fact]
diff --git a/test/isn.tests/isn.tests.csproj b/test/isn.tests/isn.tests.csproj
index 1b8f237..d3a7802 100644
--- a/test/isn.tests/isn.tests.csproj
+++ b/test/isn.tests/isn.tests.csproj
@@ -2,8 +2,8 @@
netcoreapp2.1
-
false
+ NETSDK1138
diff --git a/test/isnd.tests/isnd.tests.csproj b/test/isnd.tests/isnd.tests.csproj
index fff32bf..c802fc7 100644
--- a/test/isnd.tests/isnd.tests.csproj
+++ b/test/isnd.tests/isnd.tests.csproj
@@ -5,6 +5,7 @@
false
d7144e46-4e63-4391-ba86-64b61f6e7be4
+ NETSDK1138