Documentation ¶
Index ¶
- Constants
- func GetListenHistory(user string) (*http.Response, error)
- func GetSubmissionTime(d time.Duration) (time.Duration, error)
- func SubmitPlayingNow(track Track, token string) (*http.Response, error)
- func SubmitRequest(json []byte, token string) (*http.Response, error)
- func SubmitSingle(track Track, token string, time int64) (*http.Response, error)
- type Payload
- type Payloads
- type Submission
- type Track
Constants ¶
const ( // Maximum overall listen size in bytes, to prevent egregious spamming. MaxListenSize = 10240 // The maximum number of listens returned in a single GET request. MaxItemsPerGet = 100 // The default number of listens returned in a single GET request. DefaultItemsPerGet = 25 // The maximum number of tags per listen. MaxTagsPerListen = 50 // The maximum length of a tag MaxTagSize = 64 )
source: https://listenbrainz.readthedocs.io/en/latest/dev/api.html#constants
Variables ¶
This section is empty.
Functions ¶
func GetListenHistory ¶
GetListenHistory fetches the listen history of the given user.
func GetSubmissionTime ¶
GetSubmissionTime returns the number of seconds after which a track should be submitted.
func SubmitPlayingNow ¶
SubmitPlayingNow posts the given track to ListenBrainz as what's playing now.
func SubmitRequest ¶
SubmitRequest creates and executes a request containing the JSON that's passed, to the account delineated by the token.
Types ¶
type Payload ¶
type Payload struct { ListenedAt int64 `json:"listened_at,omitempty"` Track `json:"track_metadata"` }
Payload is a helper struct for marshalling the JSON payload
type Payloads ¶
type Payloads []Payload
Payloads is a helper struct for marshalling the JSON payload
type Submission ¶
type Submission struct { ListenType string `json:"listen_type"` Payloads []Payload `json:"payload"` }
Submission is a struct for marshalling the JSON payload
func FormatPlayingNow ¶
func FormatPlayingNow(track Track) Submission
FormatPlayingNow formats a Track as a playing_now Submission.
func FormatSingle ¶
func FormatSingle(track Track, time int64) Submission
FormatSingle formats a Track as a single Submission.