-
Notifications
You must be signed in to change notification settings - Fork 110
/
Copy pathModels.cs
51 lines (46 loc) · 1.56 KB
/
Models.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System.Collections.Generic;
using Newtonsoft.Json;
namespace PackageDownloadsExample
{
/// <summary>
/// A package that matched a search query.
///
/// See https://docs.microsoft.com/en-us/nuget/api/search-query-service-resource#search-result
/// </summary>
public class SearchResult
{
/// <summary>
/// The ID of the matched package.
/// </summary>
[JsonProperty("id")]
public string PackageId { get; set; }
/// <summary>
/// The total downloads for all versions of the matched package.
/// </summary>
[JsonProperty("totalDownloads")]
public long TotalDownloads { get; set; }
/// <summary>
/// The versions of the matched package.
/// </summary>
[JsonProperty("versions")]
public IReadOnlyList<SearchResultVersion> Versions { get; set; }
}
/// <summary>
/// A single version from a <see cref="SearchResult"/>.
///
/// See https://docs.microsoft.com/en-us/nuget/api/search-query-service-resource#search-result
/// </summary>
public class SearchResultVersion
{
/// <summary>
/// The package's full NuGet version after normalization, including any SemVer 2.0.0 build metadata.
/// </summary>
[JsonProperty("version")]
public string Version { get; set; }
/// <summary>
/// The downloads for this single version of the matched package.
/// </summary>
[JsonProperty("downloads")]
public long Downloads { get; set; }
}
}