- Replace the Python implementation with a Go module compiling to a single static binary (no Python/pip runtime dependency) - internal/tonieapi: minimal, dependency-light HTTP client for the TonieCloud REST API (login, households, creative tonies, file upload via presigned S3 request, chapter add/sort/clear) - internal/config: YAML-based mapping of local playlist folders to Kreativ-Tonies, credentials never stored - internal/syncer: diff/apply logic (upload new tracks, prune removed chapters, reorder to match local file order), built against a TonieClient interface for testability - cmd/toni-sync: Cobra CLI with `tonies list`, `config add/list/remove`, `sync [NAME|--all] [--dry-run]` - Unit tests for config persistence and syncer plan/apply logic Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
50 lines
1.5 KiB
Go
50 lines
1.5 KiB
Go
package tonieapi
|
|
|
|
// User is the currently logged in TonieCloud user.
|
|
type User struct {
|
|
UUID string `json:"uuid"`
|
|
Email string `json:"email"`
|
|
}
|
|
|
|
// Household is a TonieCloud household (a "family" account).
|
|
type Household struct {
|
|
ID string `json:"id"`
|
|
Name string `json:"name"`
|
|
OwnerName string `json:"ownerName"`
|
|
Access string `json:"access"`
|
|
CanLeave bool `json:"canLeave"`
|
|
}
|
|
|
|
// Chapter is a single audio chapter on a Creative Tonie.
|
|
type Chapter struct {
|
|
ID string `json:"id"`
|
|
Title string `json:"title"`
|
|
File string `json:"file"`
|
|
Seconds float64 `json:"seconds"`
|
|
Transcoding bool `json:"transcoding"`
|
|
}
|
|
|
|
// CreativeTonie is a single Kreativ-Tonie figure.
|
|
type CreativeTonie struct {
|
|
ID string `json:"id"`
|
|
HouseholdID string `json:"householdId"`
|
|
Name string `json:"name"`
|
|
ImageURL string `json:"imageUrl"`
|
|
SecondsRemaining float64 `json:"secondsRemaining"`
|
|
SecondsPresent float64 `json:"secondsPresent"`
|
|
ChaptersRemaining int `json:"chaptersRemaining"`
|
|
ChaptersPresent int `json:"chaptersPresent"`
|
|
Transcoding bool `json:"transcoding"`
|
|
LastUpdate *string `json:"lastUpdate"`
|
|
Chapters []Chapter `json:"chapters"`
|
|
}
|
|
|
|
// uploadRequest describes the pre-signed S3 upload target returned by POST /file.
|
|
type uploadRequest struct {
|
|
Request struct {
|
|
URL string `json:"url"`
|
|
Fields map[string]string `json:"fields"`
|
|
} `json:"request"`
|
|
FileID string `json:"fileId"`
|
|
}
|