api: Begin implementing an API
This commit is contained in:
parent
1a5e83be10
commit
2fac0390b1
11 changed files with 186 additions and 23 deletions
|
|
@ -79,6 +79,13 @@ type BundleStatistics struct {
|
|||
TotalMainBundles int `json:"totalMainBundles"`
|
||||
}
|
||||
|
||||
func (bs BundleStatistics) TotalCount() (total int) {
|
||||
for _, bundle := range bs.Bundles {
|
||||
total += bundle.Count
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type LastEdit struct {
|
||||
Time time.Time
|
||||
Valid bool
|
||||
|
|
@ -101,10 +108,7 @@ func (bs BundleStatistics) LastEdit() (le LastEdit) {
|
|||
}
|
||||
|
||||
func (bs BundleStatistics) Summary() string {
|
||||
var totalCount int
|
||||
for _, bundle := range bs.Bundles {
|
||||
totalCount += bundle.Count
|
||||
}
|
||||
totalCount := bs.TotalCount()
|
||||
if totalCount == 0 {
|
||||
return ""
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue