38 lines
1021 B
C#
38 lines
1021 B
C#
using isnd.Data.Packages;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace isnd.Data.Catalog
|
|
{
|
|
public class PackageRegistration : Permalink
|
|
{
|
|
|
|
public PackageRegistration(string url) : base(url)
|
|
{
|
|
Items = new List<CatalogPage>();
|
|
}
|
|
|
|
public PackageRegistration(string bid, string apiBase, Packages.Package pkg) : base(bid + $"/{pkg.Id}/index.json")
|
|
{
|
|
Items = new List<CatalogPage>
|
|
{
|
|
new CatalogPage(bid, pkg.Id, apiBase, pkg.Versions)
|
|
};
|
|
CommitId = pkg.LatestCommit.CommitId;
|
|
CommitTimeStamp = pkg.LatestCommit.CommitTimeStamp;
|
|
}
|
|
|
|
[JsonProperty("count")]
|
|
public int Count { get => Items.Count; }
|
|
|
|
[JsonProperty("items")]
|
|
public List<CatalogPage> Items { get; set; }
|
|
|
|
public string CommitId { get; set; }
|
|
public DateTimeOffset CommitTimeStamp { get; internal set; }
|
|
|
|
|
|
}
|
|
} |