bandcamp

package
v0.0.0-...-a4f1fcb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package bandcamp provides Web API access to undocumented user API.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoData   = errors.New("no download data found")
	ErrNoFormat = errors.New("format not found for downloadable")
)

Functions

This section is empty.

Types

type APIError

type APIError struct {
	IsError bool   `json:"error"`
	Message string `json:"error_message"`
}

func (APIError) Error

func (e APIError) Error() string

type AlbumID

type AlbumID int64

type ArtID

type ArtID int64

type BandID

type BandID int64

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(bandcampCookie string) *Client

func (*Client) Download

func (c *Client) Download(d *DigitalItemDownload) (*http.Response, error)

func (*Client) GetCollectionItems

func (c *Client) GetCollectionItems(id FanID) (*CollectionItems, error)

func (*Client) GetCollectionSummary

func (c *Client) GetCollectionSummary() (*FanSummary, error)

func (*Client) GetDigitalItem

func (c *Client) GetDigitalItem(item *Item) (*DigitalItem, error)

func (*Client) GetDigitalItemDownload

func (c *Client) GetDigitalItemDownload(item *Item, format string) (*DigitalItemDownload, error)

func (*Client) GetItems

func (c *Client) GetItems(id FanID) ([]Item, error)

func (*Client) Request

func (c *Client) Request(method, endpoint string, body, data interface{}) error

type CollectionItem

type CollectionItem struct {
	// Many fields ommitted - out of scope
	AlsoCollectedCount int64        `json:"also_collected_count"`
	BandID             BandID       `json:"band_id"`
	BandName           string       `json:"band_name"`
	BandURL            string       `json:"band_url"`
	FanID              FanID        `json:"fan_id"`
	HasDigitalDownload bool         `json:"has_digital_download"`
	Hidden             bool         `json:"hidden"`
	Art                ItemArt      `json:"item_art"`   // Replacement for "item_art_"*
	ID                 ItemID       `json:"item_id"`    // Replacement for "album_id" & "tralbum_id"
	Title              string       `json:"item_title"` // Replacement for "album_title"
	Type               ItemType     `json:"item_type"`  // Replacement(?) for "tralbum_type"
	URL                string       `json:"item_url"`
	SaleItemID         SaleItemID   `json:"sale_item_id"`
	SaleItemType       SaleItemType `json:"sale_item_type"`
	Token              string       `json:"token"`
}

func (CollectionItem) String

func (ci CollectionItem) String() string

type CollectionItems

type CollectionItems struct {
	LastToken      string           `json:"last_token"`
	Items          []CollectionItem `json:"items"`
	MoreAvailable  bool             `json:"more_available"`
	RedownloadURLs DownloadURLs     `json:"redownload_urls"`
}

type CollectionSummary

type CollectionSummary struct {
	ID       FanID                        `json:"fan_id"`
	Username string                       `json:"username"`
	URL      string                       `json:"url"`
	Lookup   map[string]CollectionSummary `json:"tralbum_lookup"`
	Follows  FollowsFans                  `json:"follows"`
}

type CollectionSummaryItem

type CollectionSummaryItem struct {
	Type   ItemType `json:"item_type"`
	ID     ItemID   `json:"item_id"`
	BandID BandID   `json:"band_id"`
}

type DigitalItem

type DigitalItem struct {
	// Many fields omitted - out of scope
	Type            ItemType                       `json:"type"`
	Title           string                         `json:"title"`
	Artist          string                         `json:"artist"`
	ArtID           ArtID                          `json:"art_id"`
	ID              ItemID                         `json:"item_id"`
	ItemType        ItemType                       `json:"item_type"`
	Downloads       map[string]DigitalItemDownload `json:"downloads"`
	DownloadTypeStr ItemType                       `json:"download_type_str"`
}

type DigitalItemDownload

type DigitalItemDownload struct {
	Size        string `json:"size_mb"`
	Description string `json:"description"`
	Encoding    string `json:"encoding_name"`
	URL         string `json:"url"`
}

type DownloadURLs

type DownloadURLs map[string]string

[SaleItemType+SaleItemID]URL

type EncodingsID

type EncodingsID int64

type FanID

type FanID int64

type FanSummary

type FanSummary struct {
	ID         FanID             `json:"fan_id"`
	Collection CollectionSummary `json:"collection_summary"`
}

type FollowsFans

type FollowsFans struct {
	Following map[FanID]bool `json:"following"`
}

type GenreID

type GenreID int64

type Item

type Item struct {
	DownloadURL string
	CollectionItem
}

type ItemArt

type ItemArt struct {
	ArtID    ArtID  `json:"art_id"`
	ThumbURL string `json:"thumb_url"`
	URL      string `json:"url"`
}

type ItemArtID

type ItemArtID int64

type ItemID

type ItemID int64

type ItemType

type ItemType string
const (
	// ...Why...???
	AlbumShort ItemType = "a"
	TrackShort ItemType = "t"
	AlbumLong  ItemType = "album"
	TrackLong  ItemType = "track"
)

func (ItemType) IsAlbum

func (it ItemType) IsAlbum() bool

func (ItemType) IsTrack

func (it ItemType) IsTrack() bool

func (ItemType) Short

func (it ItemType) Short() string

func (ItemType) String

func (it ItemType) String() string

type MerchID

type MerchID int64

type PaymentID

type PaymentID int64

type SaleItemID

type SaleItemID int64

type SaleItemType

type SaleItemType string

type TrackID

type TrackID int64

type TralbumID

type TralbumID int64

type URLHints

type URLHints struct {
	// Unknown fields ommitted
	ItemType  ItemType `json:"item_type"`
	Slug      string   `json:"slug"`
	Subdomain string   `json:"subdomain"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL