Documentation
¶
Overview ¶
Package bandcamp provides required Web API access to undocumented user API.
Index ¶
- Constants
- Variables
- type Client
- func (c *Client) GetCollection(id FanID) (Collection, error)
- func (c *Client) GetFan() (*Fan, error)
- func (c *Client) GetItemDownload(item *Item, format string) (*Download, error)
- func (c *Client) Request(method, endpoint string, body, v any) error
- func (c *Client) Value(f *Fan, items Collection, target string) (float64, error)
- type Collection
- type Download
- type Error
- type Fan
- type FanID
- type Item
- type ItemID
- type ItemType
- type Sale
- type SaleID
- type SaleType
- type StatusError
- type Time
- type Track
Constants ¶
View Source
const ( ItemTypeAlbum = "a" ItemTypeTrack = "t" )
Variables ¶
View Source
var Extensions = map[string]string{
"mp3-v0": ".mp3",
"mp3-320": ".mp3",
"flac": ".flac",
"aac-hi": ".m4a",
"vorbis": ".ogg",
"alac": ".m4a",
"wav": ".wav",
"aiff-lossless": ".aiff",
}
While bandcamp stores the extension metadata, this is required to check if a given track exists for the given format.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client embeds an http.Client to make currently implemented Bandcamp API calls that are undocumented.
func New ¶
New returns a new Client. To make authenticated API calls, an authenticated auoted Bandcamp login 'identity' cookie is required.
func (*Client) GetCollection ¶
func (c *Client) GetCollection(id FanID) (Collection, error)
func (*Client) GetItemDownload ¶
type Collection ¶
type Collection []Item
Bandcamp store this behind the fancollection/1/collection_items endpoint, and also keep it under the page-data if visited the user's profile.
func (*Collection) UnmarshalJSON ¶
func (c *Collection) UnmarshalJSON(b []byte) error
type Item ¶
type Item struct {
// Extraneous metadata stripped, such as fan id,
// genre, dates, "why", URLs, etc.
ID ItemID `json:"item_id"`
Type ItemType `json:"tralbum_type"`
BandName string `json:"band_name"`
Title string `json:"item_title"`
Purchased Time `json:"purchased"`
ArtURL string `json:"item_art_url"`
Sale
Price float64 `json:"price"`
Currency string `json:"currency"`
Download string `json:"-"`
Tracks []Track `json:"-"`
}
type StatusError ¶
type StatusError struct {
StatusCode int
}
func (*StatusError) Error ¶
func (e *StatusError) Error() string
type Time ¶
func (*Time) UnmarshalJSON ¶
Click to show internal directories.
Click to hide internal directories.