Skip to content

Commit 46acdaa

Browse files
authored
Add explicit property names on custom protocol (loic-sharma#365)
1 parent b13239a commit 46acdaa

5 files changed

+17
-24
lines changed

src/BaGet.Core/Metadata/BaGetPackageMetadata.cs

+10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Collections.Generic;
22
using BaGet.Protocol.Models;
3+
using Newtonsoft.Json;
34

45
namespace BaGet.Core
56
{
@@ -9,10 +10,19 @@ namespace BaGet.Core
910
/// </summary>
1011
public class BaGetPackageMetadata : PackageMetadata
1112
{
13+
[JsonProperty("downloads")]
1214
public long Downloads { get; set; }
15+
16+
[JsonProperty("hasReadme")]
1317
public bool HasReadme { get; set; }
18+
19+
[JsonProperty("packageTypes")]
1420
public IReadOnlyList<string> PackageTypes { get; set; }
21+
22+
[JsonProperty("repositoryUrl")]
1523
public string RepositoryUrl { get; set; }
24+
25+
[JsonProperty("repositoryType")]
1626
public string RepositoryType { get; set; }
1727
}
1828
}

src/BaGet.Core/Metadata/BaGetRegistrationIndexResponse.cs

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using BaGet.Protocol.Models;
2+
using Newtonsoft.Json;
23

34
namespace BaGet.Core
45
{
@@ -11,6 +12,7 @@ public class BaGetRegistrationIndexResponse : RegistrationIndexResponse
1112
/// <summary>
1213
/// How many times all versions of this package have been downloaded.
1314
/// </summary>
15+
[JsonProperty("totalDownloads")]
1416
public long TotalDownloads { get; set; }
1517
}
1618
}

src/BaGet.Core/Metadata/BaGetRegistrationLeafResponse.cs

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using BaGet.Protocol.Models;
2+
using Newtonsoft.Json;
23

34
namespace BaGet.Core
45
{
@@ -8,6 +9,7 @@ namespace BaGet.Core
89
/// </summary>
910
public class BaGetRegistrationLeafResponse : RegistrationLeafResponse
1011
{
12+
[JsonProperty("downloads")]
1113
public long Downloads { get; set; }
1214
}
1315
}

src/BaGet.Core/Search/DependentsRequest.cs

-24
This file was deleted.

src/BaGet.Core/Search/DependentsResponse.cs

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Collections.Generic;
2+
using Newtonsoft.Json;
23

34
namespace BaGet.Core
45
{
@@ -11,11 +12,13 @@ public class DependentsResponse
1112
/// <summary>
1213
/// The total number of matches, disregarding skip and take.
1314
/// </summary>
15+
[JsonProperty("totalHits")]
1416
public long TotalHits { get; set; }
1517

1618
/// <summary>
1719
/// The package IDs matched by the dependent query.
1820
/// </summary>
21+
[JsonProperty("data")]
1922
public IReadOnlyList<string> Data { get; set; }
2023
}
2124
}

0 commit comments

Comments
 (0)