Documentation ¶
Index ¶
- Variables
- func GetHTTPGetCount() int
- func GetMainLabel(labels []*pb.Label) *pb.Label
- func GetReleaseArtist(rel *pb.Release) string
- type AddToFolderResponse
- type BasicRelease
- type ByLabelCat
- type CollectionRelease
- type CollectionResponse
- type DiscogsRetriever
- func (r *DiscogsRetriever) AddToFolder(ctx context.Context, folderID int32, releaseID int32) (int, error)
- func (r *DiscogsRetriever) AddToWantlist(ctx context.Context, releaseID int) error
- func (r *DiscogsRetriever) DeleteInstance(ctx context.Context, folderID int, releaseID int, instanceID int) error
- func (r *DiscogsRetriever) ExpireSale(ctx context.Context, saleID int, releaseID int, price float32) error
- func (r *DiscogsRetriever) GetCollection(ctx context.Context) []*pb.Release
- func (r *DiscogsRetriever) GetCurrentSalePrice(ctx context.Context, saleID int64) float32
- func (r *DiscogsRetriever) GetCurrentSaleState(ctx context.Context, saleID int64) (pb.SaleState, error)
- func (r *DiscogsRetriever) GetFolders(ctx context.Context) []pb.Folder
- func (r *DiscogsRetriever) GetInstanceID(ctx context.Context, releaseID int) int32
- func (r *DiscogsRetriever) GetInstanceInfo(ctx context.Context, rid int32) (map[int32]*InstanceInfo, error)
- func (r *DiscogsRetriever) GetInventory(ctx context.Context) ([]*pb.ForSale, error)
- func (r *DiscogsRetriever) GetOrder(ctx context.Context, order string) (map[int64]int32, time.Time, error)
- func (r *DiscogsRetriever) GetRateLimit(ctx context.Context) int
- func (r *DiscogsRetriever) GetRelease(ctx context.Context, id int32) (*pb.Release, error)
- func (r *DiscogsRetriever) GetSalePrice(ctx context.Context, releaseID int) (float32, error)
- func (r *DiscogsRetriever) GetStats(ctx context.Context, rid int32) (*Stats, error)
- func (r *DiscogsRetriever) GetWantlist(ctx context.Context) ([]*pb.Release, error)
- func (r *DiscogsRetriever) Log(ctx context.Context, text string)
- func (r *DiscogsRetriever) MoveToFolder(ctx context.Context, folderID int, releaseID int, instanceID int, ...) (string, error)
- func (r *DiscogsRetriever) RemoveFromSale(ctx context.Context, saleID int, releaseID int) error
- func (r *DiscogsRetriever) RemoveFromWantlist(ctx context.Context, releaseID int) error
- func (r *DiscogsRetriever) SellRecord(ctx context.Context, releaseID int, price float32, state string, ...) (int64, error)
- func (r *DiscogsRetriever) SetNotes(iid, fid, id int32, value string) error
- func (r *DiscogsRetriever) SetRating(ctx context.Context, releaseID int, rating int) error
- func (r *DiscogsRetriever) UpdateSalePrice(ctx context.Context, saleID int, releaseID int, condition, sleeve string, ...) error
- type FoldersResponse
- type InstanceInfo
- type InventoryEntry
- type InventoryResponse
- type Item
- type OrderResponse
- type Pagination
- type PriceResponse
- type Pricing
- type ReleaseBack
- type ReleaseResponse
- type SellResponse
- type Stats
- type Urls
- type Version
- type VersionsResponse
- type WantlistResponse
Constants ¶
This section is empty.
Variables ¶
var ( // DiscogsRequests request out to discogs DiscogsRequests = promauto.NewCounterVec(prometheus.CounterOpts{ Name: "godiscogs_requests", Help: "The number of server requests", }, []string{"method", "path1"}) // DiscogsRequests request out to discogs RequestLatency = promauto.NewHistogramVec(prometheus.HistogramOpts{ Name: "godiscogs_request_latency", Help: "The number of server requests", Buckets: []float64{5, 10, 25, 50, 100, 250, 500, 1000, 2000, 4000, 8000, 16000, 32000, 64000, 128000, 256000, 1024000}, }, []string{"method", "path1"}) )
Functions ¶
func GetMainLabel ¶
GetMainLabel gets the main label from the release - this is the label to be used in e.g. sorting
func GetReleaseArtist ¶
GetReleaseArtist Gets a string of the release artist of this record
Types ¶
type AddToFolderResponse ¶
type AddToFolderResponse struct { InstanceID int `json:"instance_id"` ResourceURL string Simple int }
AddToFolderResponse the response back from an add request
type BasicRelease ¶
type BasicRelease struct {
ID int
}
BasicRelease is the release returned from the inventory pull
type ByLabelCat ¶
ByLabelCat is a sorting function that sorts by label name, then catalogue number
func (ByLabelCat) Len ¶
func (a ByLabelCat) Len() int
func (ByLabelCat) Less ¶
func (a ByLabelCat) Less(i, j int) bool
func (ByLabelCat) Swap ¶
func (a ByLabelCat) Swap(i, j int)
type CollectionRelease ¶
type CollectionRelease struct { ID int `json:"id"` FolderID int `json:"folder_id"` InstanceID int `json:"instance_id"` Rating int `json:"rating"` Notes []*pb.Note }
CollectionRelease returned from collection pull
type CollectionResponse ¶
type CollectionResponse struct { Pagination Pagination Releases []*CollectionRelease }
CollectionResponse returned from discogs
type DiscogsRetriever ¶
type DiscogsRetriever struct {
// contains filtered or unexported fields
}
DiscogsRetriever Main retriever type
func NewDiscogsRetriever ¶
func NewDiscogsRetriever(token string, logger func(context.Context, string)) *DiscogsRetriever
NewDiscogsRetriever Build a production retriever
func (*DiscogsRetriever) AddToFolder ¶
func (r *DiscogsRetriever) AddToFolder(ctx context.Context, folderID int32, releaseID int32) (int, error)
AddToFolder adds the release to the given folder
func (*DiscogsRetriever) AddToWantlist ¶
func (r *DiscogsRetriever) AddToWantlist(ctx context.Context, releaseID int) error
AddToWantlist adds a record to the wantlist
func (*DiscogsRetriever) DeleteInstance ¶
func (r *DiscogsRetriever) DeleteInstance(ctx context.Context, folderID int, releaseID int, instanceID int) error
DeleteInstance removes a record from the collection
func (*DiscogsRetriever) ExpireSale ¶
func (r *DiscogsRetriever) ExpireSale(ctx context.Context, saleID int, releaseID int, price float32) error
ExpireSale removes the listing from sale
func (*DiscogsRetriever) GetCollection ¶
func (r *DiscogsRetriever) GetCollection(ctx context.Context) []*pb.Release
GetCollection gets all the releases in the users collection
func (*DiscogsRetriever) GetCurrentSalePrice ¶
func (r *DiscogsRetriever) GetCurrentSalePrice(ctx context.Context, saleID int64) float32
GetCurrentSalePrice gets the current sale price
func (*DiscogsRetriever) GetCurrentSaleState ¶
func (r *DiscogsRetriever) GetCurrentSaleState(ctx context.Context, saleID int64) (pb.SaleState, error)
GetCurrentSaleState gets the current sale state
func (*DiscogsRetriever) GetFolders ¶
func (r *DiscogsRetriever) GetFolders(ctx context.Context) []pb.Folder
GetFolders gets all the folders for a given user
func (*DiscogsRetriever) GetInstanceID ¶
func (r *DiscogsRetriever) GetInstanceID(ctx context.Context, releaseID int) int32
GetInstanceID Gets the instance ID for this release
func (*DiscogsRetriever) GetInstanceInfo ¶
func (r *DiscogsRetriever) GetInstanceInfo(ctx context.Context, rid int32) (map[int32]*InstanceInfo, error)
GetInstanceInfo gets the info for an instance
func (*DiscogsRetriever) GetInventory ¶
GetInventory gets all the releases that are for sale
func (*DiscogsRetriever) GetOrder ¶
func (r *DiscogsRetriever) GetOrder(ctx context.Context, order string) (map[int64]int32, time.Time, error)
GetCurrentSalePrice gets the current sale price
func (*DiscogsRetriever) GetRateLimit ¶
func (r *DiscogsRetriever) GetRateLimit(ctx context.Context) int
GetRateLimit returns the rate limit
func (*DiscogsRetriever) GetRelease ¶
GetRelease returns a release from the discogs system
func (*DiscogsRetriever) GetSalePrice ¶
GetSalePrice gets the sale price for a release
func (*DiscogsRetriever) GetWantlist ¶
GetWantlist returns the wantlist for the given user
func (*DiscogsRetriever) Log ¶
func (r *DiscogsRetriever) Log(ctx context.Context, text string)
Log out a value to the log function
func (*DiscogsRetriever) MoveToFolder ¶
func (r *DiscogsRetriever) MoveToFolder(ctx context.Context, folderID int, releaseID int, instanceID int, newFolderID int) (string, error)
MoveToFolder Moves the given release to the new folder
func (*DiscogsRetriever) RemoveFromSale ¶
RemoveFromSale removes the listing from sale
func (*DiscogsRetriever) RemoveFromWantlist ¶
func (r *DiscogsRetriever) RemoveFromWantlist(ctx context.Context, releaseID int) error
RemoveFromWantlist adds a record to the wantlist
func (*DiscogsRetriever) SellRecord ¶
func (r *DiscogsRetriever) SellRecord(ctx context.Context, releaseID int, price float32, state string, condition, sleeve string, weight int) (int64, error)
SellRecord sells a given release
func (*DiscogsRetriever) SetNotes ¶
func (r *DiscogsRetriever) SetNotes(iid, fid, id int32, value string) error
func (*DiscogsRetriever) UpdateSalePrice ¶
func (r *DiscogsRetriever) UpdateSalePrice(ctx context.Context, saleID int, releaseID int, condition, sleeve string, price float32) error
UpdateSalePrice updates the sale price
type FoldersResponse ¶
type FoldersResponse struct { Pagination Pagination Folders []pb.Folder }
FoldersResponse returned from discogs
type InstanceInfo ¶
type InstanceInfo struct { DateAdded int64 RecordCondition string SleeveCondition string LastCleanDate string Width string Weight string Sleeve string Keep string }
InstanceInfo some basic details about the instance
type InventoryEntry ¶
type InventoryEntry struct { Price Pricing ID int64 `json:"id"` Release BasicRelease Posted string `json:"posted"` }
InventoryEntry returned from invetory pull
type InventoryResponse ¶
type InventoryResponse struct { Pagination Pagination Listings []*InventoryEntry }
InventoryResponse returned from discogs
type OrderResponse ¶
type Pagination ¶
Pagination the pagination structure
type PriceResponse ¶
PriceResponse response from get sale details
type ReleaseBack ¶
type ReleaseBack struct { DateAdded string `json:"date_added"` InstanceID int32 `json:"instance_id"` Notes []*pb.Note `json:"notes"` }
ReleaseBack what we get for a single release
type ReleaseResponse ¶
type ReleaseResponse struct { Pagination Pagination Releases []ReleaseBack }
ReleaseResponse what we get back from release
type SellResponse ¶
type SellResponse struct {
ListingID int64 `json:"listing_id"`
}
SellResponse response from selling a record
type Version ¶
type Version struct { Released string Format string MajorFormats []string `json:"major_formats"` ID int32 }
Version a version of a master release
type VersionsResponse ¶
type VersionsResponse struct { Pagination Pagination Versions []Version }
VersionsResponse returned from discogs
type WantlistResponse ¶
type WantlistResponse struct { Pagination Pagination Wants []*pb.Release }
WantlistResponse returned from discogs