1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

feat: add missing query params to wakatime endpoints (resolve #109)

This commit is contained in:
Ferdinand Mütsch
2021-01-31 16:23:47 +01:00
parent 979549448c
commit 3e5a51c272
6 changed files with 57 additions and 47 deletions

View File

@@ -29,7 +29,7 @@ func NewFiltersWith(entity uint8, key string) *Filters {
return &Filters{}
}
func (f *Filters) First() (bool, uint8, string) {
func (f *Filters) One() (bool, uint8, string) {
if f.Project != "" {
return true, SummaryProject, f.Project
} else if f.OS != "" {
@@ -43,25 +43,3 @@ func (f *Filters) First() (bool, uint8, string) {
}
return false, 0, ""
}
func (f *Filters) All() []*FilterElement {
all := make([]*FilterElement, 0)
if f.Project != "" {
all = append(all, &FilterElement{Type: SummaryProject, Key: f.Project})
}
if f.Editor != "" {
all = append(all, &FilterElement{Type: SummaryEditor, Key: f.Editor})
}
if f.Language != "" {
all = append(all, &FilterElement{Type: SummaryLanguage, Key: f.Language})
}
if f.Machine != "" {
all = append(all, &FilterElement{Type: SummaryMachine, Key: f.Machine})
}
if f.OS != "" {
all = append(all, &FilterElement{Type: SummaryOS, Key: f.OS})
}
return all
}