Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions pkg/msgs/listici.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand All @@ -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
}
1 change: 1 addition & 0 deletions pkg/msgs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down