diff --git a/src/BaGet.Protocol/Models/AlternatePackage.cs b/src/BaGet.Protocol/Models/AlternatePackage.cs
new file mode 100644
index 00000000..6699c240
--- /dev/null
+++ b/src/BaGet.Protocol/Models/AlternatePackage.cs
@@ -0,0 +1,31 @@
+using System.Collections.Generic;
+using Newtonsoft.Json;
+
+namespace BaGet.Protocol.Models
+{
+ ///
+ /// The alternate package that should be used instead of a deprecated package.
+ ///
+ /// See https://docs.microsoft.com/en-us/nuget/api/registration-base-url-resource#package-deprecation
+ ///
+ public class AlternatePackage
+ {
+ [JsonProperty("@id")]
+ public string Url { get; set; }
+
+ [JsonProperty("@type")]
+ public string Type { get; set; }
+
+ ///
+ /// The ID of the alternate package.
+ ///
+ [JsonProperty("id")]
+ public string Id { get; set; }
+
+ ///
+ /// The allowed version range, or * if any version is allowed.
+ ///
+ [JsonProperty("range")]
+ public string Range { get; set; }
+ }
+}
diff --git a/src/BaGet.Protocol/Models/PackageDeprecation.cs b/src/BaGet.Protocol/Models/PackageDeprecation.cs
new file mode 100644
index 00000000..c00a986c
--- /dev/null
+++ b/src/BaGet.Protocol/Models/PackageDeprecation.cs
@@ -0,0 +1,38 @@
+using System.Collections.Generic;
+using Newtonsoft.Json;
+
+namespace BaGet.Protocol.Models
+{
+ ///
+ /// A package's metadata.
+ ///
+ /// See https://docs.microsoft.com/en-us/nuget/api/registration-base-url-resource#package-deprecation
+ ///
+ public class PackageDeprecation
+ {
+ ///
+ /// The URL to the document used to produce this object.
+ ///
+ [JsonProperty("@id")]
+ public string CatalogLeafUrl { get; set; }
+
+ ///
+ /// The reasons why the package was deprecated.
+ /// Deprecation reasons include: "Legacy", "CriticalBugs", and "Other".
+ ///
+ [JsonProperty("reasons")]
+ public IReadOnlyList Reasons { get; set; }
+
+ ///
+ /// The additional details about this deprecation.
+ ///
+ [JsonProperty("message")]
+ public string Message { get; set; }
+
+ ///
+ /// The alternate package that should be used instead.
+ ///
+ [JsonProperty("alternatePackage")]
+ public AlternatePackage AlternatePackage { get; set; }
+ }
+}
diff --git a/src/BaGet.Protocol/Models/PackageMetadata.cs b/src/BaGet.Protocol/Models/PackageMetadata.cs
index 1b570f77..044e3f51 100644
--- a/src/BaGet.Protocol/Models/PackageMetadata.cs
+++ b/src/BaGet.Protocol/Models/PackageMetadata.cs
@@ -35,6 +35,18 @@ public class PackageMetadata
[JsonProperty("authors")]
public string Authors { get; set; }
+ ///
+ /// The dependencies of the package, grouped by target framework.
+ ///
+ [JsonProperty("dependencyGroups")]
+ public IReadOnlyList DependencyGroups { get; set; }
+
+ ///
+ /// The deprecation associated with the package, if any.
+ ///
+ [JsonProperty("deprecation")]
+ public PackageDeprecation Deprecation { get; set; }
+
///
/// The package's description.
///
@@ -113,11 +125,5 @@ public class PackageMetadata
///
[JsonProperty("title")]
public string Title { get; set; }
-
- ///
- /// The dependencies of the package, grouped by target framework.
- ///
- [JsonProperty("dependencyGroups")]
- public IReadOnlyList DependencyGroups { get; set; }
}
}
diff --git a/tests/BaGet.Protocol.Tests/RawPackageMetadataClientTests.cs b/tests/BaGet.Protocol.Tests/RawPackageMetadataClientTests.cs
index b79e521a..97c727b9 100644
--- a/tests/BaGet.Protocol.Tests/RawPackageMetadataClientTests.cs
+++ b/tests/BaGet.Protocol.Tests/RawPackageMetadataClientTests.cs
@@ -72,6 +72,13 @@ public async Task GetRegistrationPage()
Assert.Equal("2.0.0+build", firstMetadata.Version);
}
+ [Fact]
+ public async Task GetRegistrationPageDeprecated()
+ {
+ // TODO
+ await Task.Yield();
+ }
+
[Fact]
public async Task GetsRegistrationLeaf()
{