forked from NuGet/NuGet.Client
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(NuGet#9) Provide server related information
Along with moderation related information, provide other data that is provided by the server metadata. - PackageHash - PackageHashAlgorithm - PackageSize - VersionDownloadCount - IsApproved - PackageStatus - PackageSubmittedStatus - PackageTestResultStatus - PackageTestResultStatusDate - PackageValidationResultStatus - PackageValidationResultDate - PackageCleanupResultDate - PackageReviewedDate - PackageApprovedDate - PackageReviewer - IsDownloadCacheAvailable - DownloadCacheDate - DownloadCache Based on these commits: chocolatey/nuget-chocolatey@3866411 chocolatey/nuget-chocolatey@133552a Co-Authored-By: Rob Reynolds <[email protected]>
- Loading branch information
Showing
27 changed files
with
1,358 additions
and
17 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
...lients/NuGet.VisualStudio.Internal.Contracts/ChocolateyTransitivePackageSearchMetadata.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
////////////////////////////////////////////////////////// | ||
// Chocolatey Specific Modification | ||
////////////////////////////////////////////////////////// | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using NuGet.Protocol.Core.Types; | ||
|
||
namespace NuGet.VisualStudio.Internal.Contracts | ||
{ | ||
public partial class TransitivePackageSearchMetadata : IPackageSearchMetadata | ||
{ | ||
public string PackageHash => _packageSearchMetadata.PackageHash; | ||
public string PackageHashAlgorithm => _packageSearchMetadata.PackageHashAlgorithm; | ||
public long? PackageSize => _packageSearchMetadata.PackageSize; | ||
public int? VersionDownloadCount => _packageSearchMetadata.VersionDownloadCount; | ||
public bool IsApproved => _packageSearchMetadata.IsApproved; | ||
public string PackageStatus => _packageSearchMetadata.PackageStatus; | ||
public string PackageSubmittedStatus => _packageSearchMetadata.PackageSubmittedStatus; | ||
public string PackageTestResultStatus => _packageSearchMetadata.PackageTestResultStatus; | ||
public DateTime? PackageTestResultStatusDate => _packageSearchMetadata.PackageTestResultStatusDate; | ||
public string PackageValidationResultStatus => _packageSearchMetadata.PackageValidationResultStatus; | ||
public DateTime? PackageValidationResultDate => _packageSearchMetadata.PackageValidationResultDate; | ||
public DateTime? PackageCleanupResultDate => _packageSearchMetadata.PackageCleanupResultDate; | ||
public DateTime? PackageReviewedDate => _packageSearchMetadata.PackageReviewedDate; | ||
public DateTime? PackageApprovedDate => _packageSearchMetadata.PackageApprovedDate; | ||
public string PackageReviewer => _packageSearchMetadata.PackageReviewer; | ||
|
||
public bool IsDownloadCacheAvailable => _packageSearchMetadata.IsDownloadCacheAvailable; | ||
public DateTime? DownloadCacheDate => _packageSearchMetadata.DownloadCacheDate; | ||
public IEnumerable<DownloadCache> DownloadCache => _packageSearchMetadata.DownloadCache; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 103 additions & 0 deletions
103
src/NuGet.Core/NuGet.Protocol/LegacyFeed/ChocolateyV2FeedPackageInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
////////////////////////////////////////////////////////// | ||
// Chocolatey Specific Modification | ||
////////////////////////////////////////////////////////// | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using NuGet.Packaging.Core; | ||
using NuGet.Versioning; | ||
|
||
namespace NuGet.Protocol | ||
{ | ||
public partial class V2FeedPackageInfo : PackageIdentity | ||
{ | ||
private readonly long? _packageSize; | ||
private readonly int? _versionDownloadCount; | ||
private readonly bool _isApproved; | ||
private readonly string _packageStatus; | ||
private readonly string _packageSubmittedStatus; | ||
private readonly string _packageTestResultStatus; | ||
private readonly DateTime? _packageTestResultStatusDate; | ||
private readonly string _packageValidationResultStatus; | ||
private readonly DateTime? _packageValidationResultDate; | ||
private readonly DateTime? _packageCleanupResultDate; | ||
private readonly DateTime? _packageReviewedDate; | ||
private readonly DateTime? _packageApprovedDate; | ||
private readonly string _packageReviewer; | ||
private readonly bool _isDownloadCacheAvailable; | ||
private readonly DateTime? _downloadCacheDate; | ||
private readonly string _downloadCacheString; | ||
|
||
public V2FeedPackageInfo(PackageIdentity identity, string title, string summary, string description, IEnumerable<string> authors, IEnumerable<string> owners, | ||
string iconUrl, string licenseUrl, string projectUrl, string reportAbuseUrl, string galleryDetailsUrl, | ||
string tags, DateTimeOffset? created, DateTimeOffset? lastEdited, DateTimeOffset? published, string dependencies, bool requireLicenseAccept, string downloadUrl, | ||
string downloadCount, string packageHash, string packageHashAlgorithm, NuGetVersion minClientVersion, long? packageSize, int? versionDownloadCount, bool isApproved, | ||
string packageStatus, string packageSubmittedStatus, string packageTestResultStatus, DateTime? packageTestResultStatusDate, string packageValidationResultStatus, | ||
DateTime? packageValidationResultDate, DateTime? packageCleanupResultDate, DateTime? packageReviewedDate, DateTime? packageApprovedDate, | ||
string packageReviewer, bool isDownloadCacheAvailable, DateTime? downloadCacheDate, string downloadCacheString) | ||
: base(identity.Id, identity.Version) | ||
{ | ||
_summary = summary; | ||
_description = description; | ||
_authors = authors == null ? Array.Empty<string>() : authors.ToArray(); | ||
_owners = owners == null ? Array.Empty<string>() : owners.ToArray(); | ||
_iconUrl = iconUrl; | ||
_licenseUrl = licenseUrl; | ||
_projectUrl = projectUrl; | ||
_reportAbuseUrl = reportAbuseUrl; | ||
_galleryDetailsUrl = galleryDetailsUrl; | ||
_description = description; | ||
_summary = summary; | ||
_tags = tags; | ||
_dependencies = dependencies; | ||
_requireLicenseAcceptance = requireLicenseAccept; | ||
_title = title; | ||
_downloadUrl = downloadUrl; | ||
_downloadCount = downloadCount; | ||
_created = created; | ||
_lastEdited = lastEdited; | ||
_published = published; | ||
_packageHash = packageHash; | ||
_packageHashAlgorithm = packageHashAlgorithm; | ||
_minClientVersion = minClientVersion; | ||
_packageSize = packageSize; | ||
_versionDownloadCount = versionDownloadCount; | ||
_isApproved = isApproved; | ||
_packageStatus = packageStatus; | ||
_packageSubmittedStatus = packageSubmittedStatus; | ||
_packageTestResultStatus = packageTestResultStatus; | ||
_packageTestResultStatusDate = packageTestResultStatusDate; | ||
_packageValidationResultStatus = packageValidationResultStatus; | ||
_packageValidationResultDate = packageValidationResultDate; | ||
_packageCleanupResultDate = packageCleanupResultDate; | ||
_packageReviewedDate = packageReviewedDate; | ||
_packageApprovedDate = packageApprovedDate; | ||
_packageReviewer = packageReviewer; | ||
_isDownloadCacheAvailable = isDownloadCacheAvailable; | ||
_downloadCacheDate = downloadCacheDate; | ||
_downloadCacheString = downloadCacheString; | ||
} | ||
|
||
public long? PackageSize => _packageSize; | ||
public int? VersionDownloadCount => _versionDownloadCount; | ||
public bool IsApproved => _isApproved; | ||
public string PackageStatus => _packageStatus; | ||
public string PackageSubmittedStatus => _packageSubmittedStatus; | ||
public string PackageTestResultStatus => _packageTestResultStatus; | ||
public DateTime? PackageTestResultStatusDate => _packageTestResultStatusDate; | ||
public string PackageValidationResultStatus => _packageValidationResultStatus; | ||
public DateTime? PackageValidationResultDate => _packageValidationResultDate; | ||
public DateTime? PackageCleanupResultDate => _packageCleanupResultDate; | ||
public DateTime? PackageReviewedDate => _packageReviewedDate; | ||
public DateTime? PackageApprovedDate => _packageApprovedDate; | ||
public string PackageReviewer => _packageReviewer; | ||
|
||
public bool IsDownloadCacheAvailable => _isDownloadCacheAvailable; | ||
public DateTime? DownloadCacheDate => _downloadCacheDate; | ||
public string DownloadCacheString => _downloadCacheString; | ||
} | ||
} |
83 changes: 83 additions & 0 deletions
83
src/NuGet.Core/NuGet.Protocol/LegacyFeed/ChocolateyV2FeedParser.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
////////////////////////////////////////////////////////// | ||
// Chocolatey Specific Modification | ||
////////////////////////////////////////////////////////// | ||
|
||
using System; | ||
using System.Xml.Linq; | ||
|
||
namespace NuGet.Protocol | ||
{ | ||
public sealed partial class V2FeedParser : IV2FeedParser | ||
{ | ||
#pragma warning disable IDE1006 // Naming Styles | ||
private static readonly XName _xnamePackageSize = XName.Get("PackageSize", DataServicesNS); | ||
private static readonly XName _xnameVersionDownloadCount = XName.Get("VersionDownloadCount", DataServicesNS); | ||
private static readonly XName _xnameIsApproved = XName.Get("IsApproved", DataServicesNS); | ||
private static readonly XName _xnamePackageStatus = XName.Get("PackageStatus", DataServicesNS); | ||
private static readonly XName _xnamePackageSubmittedStatus = XName.Get("PackageSubmittedStatus", DataServicesNS); | ||
private static readonly XName _xnamePackageTestResultStatus = XName.Get("PackageTestResultStatus", DataServicesNS); | ||
private static readonly XName _xnamePackageTestResultStatusDate = XName.Get("PackageTestResultStatusDate", DataServicesNS); | ||
private static readonly XName _xnamePackageValidationResultStatus = XName.Get("PackageValidationResultStatus", DataServicesNS); | ||
private static readonly XName _xnamePackageValidationResultDate = XName.Get("PackageValidationResultDate", DataServicesNS); | ||
private static readonly XName _xnamePackageCleanupResultDate = XName.Get("PackageCleanupResultDate", DataServicesNS); | ||
private static readonly XName _xnamePackageReviewedDate = XName.Get("PackageReviewedDate", DataServicesNS); | ||
private static readonly XName _xnamePackageApprovedDate = XName.Get("PackageApprovedDate", DataServicesNS); | ||
private static readonly XName _xnamePackageReviewer = XName.Get("PackageReviewer", DataServicesNS); | ||
private static readonly XName _xnameIsDownloadCacheAvailable = XName.Get("IsDownloadCacheAvailable", DataServicesNS); | ||
private static readonly XName _xnameDownloadCacheDate = XName.Get("DownloadCacheDate", DataServicesNS); | ||
private static readonly XName _xnameDownloadCache = XName.Get("DownloadCache", DataServicesNS); | ||
#pragma warning restore IDE1006 // Naming Styles | ||
|
||
|
||
/// <summary> | ||
/// Retrieve an XML <see cref="DateTime"/> value safely | ||
/// </summary> | ||
private static DateTime? GetNoOffsetDate(XElement parent, XName childName) | ||
{ | ||
var dateString = GetString(parent, childName); | ||
|
||
DateTime date; | ||
if (DateTime.TryParse(dateString, out date)) | ||
{ | ||
return date; | ||
} | ||
|
||
return null; | ||
} | ||
|
||
/// <summary> | ||
/// Retrieve an XML <see cref="long"/> value safely | ||
/// </summary> | ||
private static long? GetLong(XElement parent, XName childName) | ||
{ | ||
var numberString = GetString(parent, childName); | ||
|
||
long number; | ||
if (long.TryParse(numberString, out number)) | ||
{ | ||
return number; | ||
} | ||
|
||
return null; | ||
} | ||
|
||
/// <summary> | ||
/// Retrieve an XML <see cref="int"/> value safely | ||
/// </summary> | ||
private static int? GetInt(XElement parent, XName childName) | ||
{ | ||
var numberString = GetString(parent, childName); | ||
|
||
int number; | ||
if (int.TryParse(numberString, out number)) | ||
{ | ||
return number; | ||
} | ||
|
||
return null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.