32 lines
826 B
Go
32 lines
826 B
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
)
|
|
|
|
type UgoiraManifestFrame struct {
|
|
File string `json:"file"`
|
|
Delay int `json:"delay"`
|
|
}
|
|
|
|
type UgoiraManifestBodyDesc struct {
|
|
Src string `json:"src"`
|
|
OriginalSrc string `json:"originalSrc"`
|
|
MimeType string `json:"mime_type"`
|
|
Frames []UgoiraManifestFrame `json:"frames"`
|
|
}
|
|
|
|
type UgoiraManifest struct {
|
|
Error bool `json:"error"`
|
|
Message string `json:"message"`
|
|
Body UgoiraManifestBodyDesc `json:"body"`
|
|
}
|
|
|
|
func decodeUgoiraManifest(jsonData []byte) (UgoiraManifest, error) {
|
|
var manifest UgoiraManifest
|
|
if err := json.Unmarshal(jsonData, &manifest); err != nil {
|
|
return manifest, fmt.Errorf("Could not decode manifest JSON: %w", err)
|
|
}
|
|
return manifest, nil
|
|
}
|