Trying and find a package from API
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
using System.ComponentModel;
|
||||
using System.Net.Sockets;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Newtonsoft.Json;
|
||||
@ -6,10 +7,15 @@ using NuGet.Versioning;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using isnd.Interfaces;
|
||||
using NuGet.Protocol.Core.Types;
|
||||
using NuGet.Protocol;
|
||||
using NuGet.Packaging;
|
||||
using NuGet.Packaging.Core;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace isnd.Data.Catalog
|
||||
{
|
||||
public class PackageDetails : Permalink, IObject
|
||||
public class PackageDetails : Permalink, IObject, IPackageSearchMetadata
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a catalog entry
|
||||
@ -20,11 +26,12 @@ namespace isnd.Data.Catalog
|
||||
{
|
||||
PackageId = pkg.Package.Id;
|
||||
Version = pkg.FullString;
|
||||
authors = $"{pkg.Package.Owner.FullName} <${pkg.Package.Owner.Email}>";
|
||||
Authors = $"{pkg.Package.Owner.FullName} <${pkg.Package.Owner.Email}>";
|
||||
packageContent = apiBase + pkg.NugetLink;
|
||||
CommitId = pkg.CommitId;
|
||||
CommitTimeStamp = pkg.LatestCommit.CommitTimeStamp;
|
||||
|
||||
IsListed = !pkg.IsDeleted && pkg.Package.Public;
|
||||
// TODO Licence Project Urls, Summary, Title, etc ...
|
||||
}
|
||||
|
||||
[JsonProperty("@type")]
|
||||
@ -40,7 +47,8 @@ namespace isnd.Data.Catalog
|
||||
/// Authors
|
||||
/// </summary>
|
||||
/// <value>string or array of strings</value>
|
||||
public string authors { get; set; }
|
||||
[JsonProperty("authors")]
|
||||
public string Authors { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The dependencies of the package, grouped by target framework
|
||||
@ -56,36 +64,45 @@ namespace isnd.Data.Catalog
|
||||
|
||||
[JsonProperty("description")]
|
||||
public string Description { get; set; }
|
||||
public string iconUrl { get; set; }
|
||||
|
||||
[JsonProperty("iconUrl")]
|
||||
public Uri IconUrl { get; set; }
|
||||
|
||||
public string language { get; set; }
|
||||
|
||||
|
||||
public string licenseUrl { get; set; }
|
||||
public string licenseExpression { get; set; }
|
||||
/// <summary>
|
||||
/// Should be considered as listed if absent
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public bool listed { get; set; }
|
||||
public string minClientVersion { get; set; }
|
||||
public string projectUrl { get; set; }
|
||||
[JsonProperty("licenseUrl")]
|
||||
public Uri LicenseUrl { get; set; }
|
||||
|
||||
public bool requireLicenseAcceptance { get; set; }
|
||||
public string summary { get; set; }
|
||||
public string licenseExpression { get; set; }
|
||||
|
||||
public string minClientVersion { get; set; }
|
||||
|
||||
[JsonProperty("projectUrl")]
|
||||
public Uri ProjectUrl { get; set; }
|
||||
|
||||
|
||||
[JsonProperty("requireLicenseAcceptance")]
|
||||
public bool RequireLicenseAcceptance { get; set; }
|
||||
|
||||
[JsonProperty("summary")]
|
||||
public string Summary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The tags
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public string tags { get; set; }
|
||||
public string title { get; set; }
|
||||
|
||||
[JsonProperty("tags")]
|
||||
public string Tags { get; set; }
|
||||
|
||||
[JsonProperty("title")]
|
||||
public string Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The security vulnerabilities of the package
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public Vulnerabilitie[] vulnerabilities { get; set; }
|
||||
public IEnumerable<PackageVulnerabilityMetadata> Vulnerabilities { get; }
|
||||
|
||||
public string packageContent { get; set; }
|
||||
|
||||
@ -94,7 +111,7 @@ namespace isnd.Data.Catalog
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonProperty("published")]
|
||||
public DateTime Published { get; set; }
|
||||
public DateTimeOffset? Published { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The full version string after normalization
|
||||
@ -107,5 +124,36 @@ namespace isnd.Data.Catalog
|
||||
[Required,JsonRequired]
|
||||
[JsonProperty("id")]
|
||||
public string PackageId { get; set; }
|
||||
|
||||
public IEnumerable<PackageDependencyGroup> DependencySets { get; set; }
|
||||
|
||||
public long? DownloadCount { get; set; }
|
||||
|
||||
public PackageIdentity Identity{ get; set; }
|
||||
|
||||
public Uri ReadmeUrl { get; set; }
|
||||
|
||||
public Uri ReportAbuseUrl { get; set; }
|
||||
|
||||
public Uri PackageDetailsUrl { get; set; }
|
||||
|
||||
public string Owners { get; set; }
|
||||
|
||||
[JsonProperty("isListed")]
|
||||
public bool IsListed { get; set; }
|
||||
|
||||
public bool PrefixReserved { get; set; }
|
||||
|
||||
public LicenseMetadata LicenseMetadata { get; set; }
|
||||
|
||||
public Task<PackageDeprecationMetadata> GetDeprecationMetadataAsync()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<IEnumerable<VersionInfo>> GetVersionsAsync()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user