/ components / components.go
components.go
 1  package components
 2  
 3  import (
 4  	"time"
 5  )
 6  
 7  // ChannelItem contains di.fm channel metadata
 8  type ChannelItem struct {
 9  	ID       int64  `json:"id"`
10  	Key      string `json:"key"`
11  	Name     string `json:"name"`
12  	Playlist string `json:"playlist"`
13  }
14  
15  // FavoriteItem contains a di.fm favorite channel
16  type FavoriteItem struct {
17  	Name        string
18  	PlaylistURL string
19  }
20  
21  // CurrentlyPlaying contains the currently playing metadata for a di.fm channel
22  type CurrentlyPlaying struct {
23  	ChannelID  int64  `json:"channel_id"`
24  	ChannelKey string `json:"channel_key"`
25  	Track      Track  `json:"track"`
26  }
27  
28  // Track is metadata about a currently playing di.fm track
29  type Track struct {
30  	ID        int       `json:"id"`
31  	Artist    string    `json:"display_artist"`
32  	Title     string    `json:"display_title"`
33  	Duration  float64   `json:"duration"`
34  	StartTime time.Time `json:"start_time"`
35  }
36  
37  // StatusMessage is a message to display in the application for a fixed period of time
38  type StatusMessage struct {
39  	Message  string
40  	Duration time.Duration
41  }
42  
43  // TrackDetails is metadata about a currently playing di.fm track
44  type TrackDetails struct {
45  	ID          int    `json:"id"`
46  	AlbumArtURL string `json:"asset_url"`
47  }