(payload any)
| 143 | } |
| 144 | |
| 145 | func (n Normalizer) NormalizeAssets(payload any) []Asset { |
| 146 | items, ok := payload.([]any) |
| 147 | if !ok { |
| 148 | return nil |
| 149 | } |
| 150 | |
| 151 | out := make([]Asset, 0, len(items)) |
| 152 | seenLinks := make(map[string]struct{}) |
| 153 | for _, item := range items { |
| 154 | m, ok := item.(map[string]any) |
| 155 | if !ok { |
| 156 | continue |
| 157 | } |
| 158 | |
| 159 | link, _ := m["link"].(string) |
| 160 | link = strings.TrimSpace(link) |
| 161 | if link == "" { |
| 162 | continue |
| 163 | } |
| 164 | if _, ok := seenLinks[link]; ok { |
| 165 | continue |
| 166 | } |
| 167 | seenLinks[link] = struct{}{} |
| 168 | |
| 169 | asset := Asset{Link: link} |
| 170 | if name, ok := nonEmptyString(m["name"]); ok { |
| 171 | asset.Name = &name |
| 172 | } |
| 173 | if image, ok := nonEmptyString(m["image"]); ok { |
| 174 | asset.Image = &image |
| 175 | } |
| 176 | out = append(out, asset) |
| 177 | } |
| 178 | |
| 179 | return out |
| 180 | } |
| 181 | |
| 182 | func (n Normalizer) NormalizeDeadline(payload any) StoredDeadline { |
| 183 | switch v := payload.(type) { |
no test coverage detected