diff --git a/pkg/msgs/listici.go b/pkg/msgs/listici.go index 0b5dce0..8ba87c3 100644 --- a/pkg/msgs/listici.go +++ b/pkg/msgs/listici.go @@ -20,6 +20,15 @@ type Listici struct { Tip string `json:"tip"` } +type ListiciSeek struct { + VrstaUplate string `json:"vrsta_uplate"` + Tip string `json:"tip"` + Status int64 `json:"status"` + StatusUpdatedAt string `json:"status_updated_at"` + Time string `json:"time"` + Limit int64 `json:"limit"` +} + //ParseListici parsiraj json func ParseListici(body string, isTestIgrac bool) (*Listici, error) { l := &Listici{} @@ -41,3 +50,24 @@ func ParseListici(body string, isTestIgrac bool) (*Listici, error) { } return l, nil } + +func ParseListiciSeek(body string, isTestIgrac bool) (*ListiciSeek, error) { + l := &ListiciSeek{} + if err := json.Unmarshal([]byte(body), l); err != nil { + log.Printf("[ERROR] %s while parsing %s", err, body) + return nil, err + } + if l.VrstaUplate == "" { + l.VrstaUplate = vrstaUplateInternet + } + if l.VrstaUplate == vrstaUplateInternet && isTestIgrac { + l.VrstaUplate = vrstaUplateTest + } + if l.Limit > 100 { + l.Limit = 100 + } + if l.Tip == "" { + l.Tip = tipSportski + } + return l, nil +} diff --git a/pkg/msgs/main.go b/pkg/msgs/main.go index 72cc7b7..97ad3e2 100644 --- a/pkg/msgs/main.go +++ b/pkg/msgs/main.go @@ -5,6 +5,7 @@ const ( TypeAppVersion = "app_version" TypeMojiListici = "moji_listici" TypeMojiListiciTip = "moji_listici_tip" + TypeMojiListiciSeek = "moji_listici_seek" TypeSync = "sync" TypeListic = "listic" TypeDodajListic = "dodaj_listic"