discogs

package module
v0.0.0-...-439f08e Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 19 Imported by: 4

README

discogs

Golang based interface to discogs. Also a discogs -> protobuf translator.

Documentation

Index

Constants

View Source
const (
	THROTTLE_REQUESTS = 60
	THROTTLE_WINDOW   = time.Minute
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddWantResponse

type AddWantResponse struct {
	Id               int
	BasicInformation BasicInformation `json:"basic_information"`
}

type Artist

type Artist struct {
	Name string
	Id   int
}

type BasicInformation

type BasicInformation struct {
	Formats []Format
	Labels  []Label
	Title   string
	Artists []Artist
}

type CollectionRelease

type CollectionRelease struct {
	Id               int
	InstanceId       int `json:"instance_id"`
	FolderId         int `json:"folder_id"`
	Rating           int
	Title            string
	Notes            []Note
	BasicInformation BasicInformation `json:"basic_information"`
	Released         string
}

type CollectionResponse

type CollectionResponse struct {
	Pagination Pagination
	Releases   []CollectionRelease
	Message    string
}

type CreateFolderResponse

type CreateFolderResponse struct {
	Id   int
	Name string
}

type CreateSaleResponse

type CreateSaleResponse struct {
	ListingId int64 `json:"listing_id"`
}

type DeleteFolderResponse

type DeleteFolderResponse struct{}

type Discogs

type Discogs interface {
	GetLoginURL() (string, string, string, error)
	HandleDiscogsResponse(ctx context.Context, secret, token, verifier string) (string, string, error)

	GetDiscogsUser(ctx context.Context) (*pb.User, error)

	GetCollection(ctx context.Context, page int32) ([]*pb.Release, *pb.Pagination, error)

	GetUserId() int32

	SetDownloader(downloader Downloader)

	ForUser(user *pb.User) Discogs

	GetFields(ctx context.Context) ([]*pb.Field, error)
	SetField(ctx context.Context, r *pb.Release, fnum int, value string) error

	GetUserFolders(ctx context.Context) ([]*pb.Folder, error)
	CreateFolder(ctx context.Context, folderName string) (*pb.Folder, error)
	DeleteFolder(ctx context.Context, folderId int32) error

	CreateSale(ctx context.Context, params SaleParams) (int64, error)
	GetSale(ctx context.Context, saleId int64) (*pb.SaleItem, error)
	UpdateSale(ctx context.Context, saleId int64, releaseId int64, condition string, newPrice int32) error
	UpdateSaleState(ctx context.Context, saleId, releaseId int64, condition string, saleSate pb.SaleStatus) error
	ListSales(ctx context.Context, page int32) ([]*pb.SaleItem, *pb.Pagination, error)
	GetOrder(ctx context.Context, orderId string) (*pb.Order, error)

	GetReleaseStats(ctx context.Context, releaseId int64) (*pb.ReleaseStats, error)

	SetFolder(ctx context.Context, instanceId, releaseId, folderId, newFolderId int64) error

	GetRelease(ctx context.Context, releaseId int64) (*pb.Release, error)
	SetRating(ctx context.Context, releaseId int64, rating int32) error

	GetWants(ctx context.Context, page int32) ([]*pb.Want, *pb.Pagination, error)
	AddWant(ctx context.Context, releaseId int64) (*pb.Want, error)
	DeleteWant(ctx context.Context, wantId int64) error

	GetMasterReleases(ctx context.Context, masterId int64, page int32, sort pb.MasterSort) ([]*pb.MasterRelease, error)

	Throttle()
}

func DiscogsWithAuth

func DiscogsWithAuth(key, secret, callback string) Discogs

type DiscogsUser

type DiscogsUser struct {
	AvatarURL    string `json:"avatar_url"`
	ID           int32  `json:"id"`
	Username     string `json:"username"`
	CurrencyAbbr string `json:"curr_abbr"`
}

type Downloader

type Downloader interface {
	Download(ctx context.Context, url string) (string, error)
}

Option for doing remote downloads

type Field

type Field struct {
	Id   int
	Name string
}

type FieldsResponse

type FieldsResponse struct {
	Fields []Field
}

type Folder

type Folder struct {
	Id   int
	Name string
}

type Format

type Format struct {
	Descriptions []string
	Name         string
	Qty          string
}

type GetFolderResponse

type GetFolderResponse struct {
	Folders []Folder
}

type GetSaleResponse

type GetSaleResponse struct {
	Status    string
	Id        int64
	Release   Release
	Price     Price
	Condition string
}

type GetWantsResponse

type GetWantsResponse struct {
	Pagination Pagination
	Wants      []Want
}

type IndividualRelease

type IndividualRelease struct {
	Id               int
	InstanceId       int `json:"instance_id"`
	FolderId         int `json:"folder_id"`
	Rating           int
	Title            string
	BasicInformation BasicInformation `json:"basic_information"`
	Released         string
	Artists          []Artist
	Labels           []Label
	Formats          []Format
}

type InventoryResponse

type InventoryResponse struct {
	Pagination Pagination
	Listings   []GetSaleResponse
}

type Label

type Label struct {
	Name  string
	Catno string
	Id    int
}

type MasterRelease

type MasterRelease struct {
	Id       int
	Released string
}

type MasterReleasesResponse

type MasterReleasesResponse struct {
	Versions []MasterRelease
}

type NewFolder

type NewFolder struct {
	FolderId int `json:"folder_id"`
}

type Note

type Note struct {
	FieldId int `json:"field_id"`
	Value   string
}

type Order

type Order struct {
	Id     string
	Status string
	Items  []OrderItem
}

type OrderItem

type OrderItem struct {
	Release Release
	Price   Price
	Id      int64
}

type Pagination

type Pagination struct {
	Pages int `json:"pages"`
	Page  int `json:"page"`
}

type Price

type Price struct {
	Value    float32
	Currency string
}

type Rating

type Rating struct {
	Rating int
}

type RatingResponse

type RatingResponse struct{}

type Release

type Release struct {
	Id int64
}

type SaleJson

type SaleJson struct {
	ReleaseId int64   `json:"release_id"`
	Condition string  `json:"condition"`
	Price     float32 `json:"price"`
	Status    string  `json:"status"`
}

type SaleParams

type SaleParams struct {
	ReleaseId       int32
	Condition       string
	SleeveCondition string
	Price           int32
	Comments        string
	AllowOffers     bool
	Status          string
	ExternalId      string
	Location        string
	Weight          int32
	FormatQuantity  int32
}

type SetFolderResponse

type SetFolderResponse struct{}

type TestDiscogsClient

type TestDiscogsClient struct {
	UserId  int32
	Fields  []*pb.Field
	Folders []*pb.Folder
	Sales   []*pb.SaleItem
	Rating  map[int64]int32
	Wants   map[int64]*pb.Want
	Masters map[int64]*pb.Release
	// contains filtered or unexported fields
}

func GetTestClient

func GetTestClient() *TestDiscogsClient

func (*TestDiscogsClient) AddCNonollectionRelease

func (t *TestDiscogsClient) AddCNonollectionRelease(r *pb.Release)

func (*TestDiscogsClient) AddCollectionRelease

func (t *TestDiscogsClient) AddCollectionRelease(r *pb.Release)

func (*TestDiscogsClient) AddWant

func (t *TestDiscogsClient) AddWant(ctx context.Context, releaseId int64) (*pb.Want, error)

func (*TestDiscogsClient) CreateFolder

func (t *TestDiscogsClient) CreateFolder(ctx context.Context, folderName string) (*pb.Folder, error)

func (*TestDiscogsClient) CreateSale

func (t *TestDiscogsClient) CreateSale(ctx context.Context, params SaleParams) (int64, error)

func (*TestDiscogsClient) DeleteFolder

func (t *TestDiscogsClient) DeleteFolder(ctx context.Context, folderId int32) error

func (*TestDiscogsClient) DeleteWant

func (t *TestDiscogsClient) DeleteWant(ctx context.Context, wantId int64) error

func (*TestDiscogsClient) ForUser

func (t *TestDiscogsClient) ForUser(user *pb.User) Discogs

func (*TestDiscogsClient) GetCollection

func (t *TestDiscogsClient) GetCollection(ctx context.Context, page int32) ([]*pb.Release, *pb.Pagination, error)

func (*TestDiscogsClient) GetDiscogsUser

func (t *TestDiscogsClient) GetDiscogsUser(ctx context.Context) (*pb.User, error)

func (*TestDiscogsClient) GetFields

func (t *TestDiscogsClient) GetFields(_ context.Context) ([]*pb.Field, error)

func (*TestDiscogsClient) GetLoginURL

func (t *TestDiscogsClient) GetLoginURL() (string, string, string, error)

func (*TestDiscogsClient) GetMasterReleases

func (t *TestDiscogsClient) GetMasterReleases(ctx context.Context, masterId int64, page int32, sort pb.MasterSort) ([]*pb.MasterRelease, error)

func (*TestDiscogsClient) GetOrder

func (t *TestDiscogsClient) GetOrder(ctx context.Context, orderId string) (*pb.Order, error)

func (*TestDiscogsClient) GetRelease

func (t *TestDiscogsClient) GetRelease(ctx context.Context, releaseId int64) (*pb.Release, error)

func (*TestDiscogsClient) GetReleaseStats

func (t *TestDiscogsClient) GetReleaseStats(ctx context.Context, releaseId int64) (*pb.ReleaseStats, error)

func (*TestDiscogsClient) GetSale

func (t *TestDiscogsClient) GetSale(ctx context.Context, saleId int64) (*pb.SaleItem, error)

func (*TestDiscogsClient) GetUserFolders

func (t *TestDiscogsClient) GetUserFolders(_ context.Context) ([]*pb.Folder, error)

func (*TestDiscogsClient) GetUserId

func (t *TestDiscogsClient) GetUserId() int32

func (*TestDiscogsClient) GetWants

func (t *TestDiscogsClient) GetWants(ctx context.Context, page int32) ([]*pb.Want, *pb.Pagination, error)

func (*TestDiscogsClient) HandleDiscogsResponse

func (t *TestDiscogsClient) HandleDiscogsResponse(ctx context.Context, secret, token, verifier string) (string, string, error)

func (*TestDiscogsClient) ListSales

func (t *TestDiscogsClient) ListSales(ctx context.Context, page int32) ([]*pb.SaleItem, *pb.Pagination, error)

func (*TestDiscogsClient) SetDownloader

func (t *TestDiscogsClient) SetDownloader(_ Downloader)

func (*TestDiscogsClient) SetField

func (t *TestDiscogsClient) SetField(ctx context.Context, r *pb.Release, fnum int, value string) error

func (*TestDiscogsClient) SetFolder

func (t *TestDiscogsClient) SetFolder(ctx context.Context, instanceId, releaseId, folderId, newFolderId int64) error

func (*TestDiscogsClient) SetRating

func (t *TestDiscogsClient) SetRating(ctx context.Context, releaseId int64, newScore int32) error

func (*TestDiscogsClient) Throttle

func (t *TestDiscogsClient) Throttle()

func (*TestDiscogsClient) UpdateSale

func (t *TestDiscogsClient) UpdateSale(ctx context.Context, saleId int64, releaseId int64, condition string, newPrice int32) error

func (*TestDiscogsClient) UpdateSaleState

func (t *TestDiscogsClient) UpdateSaleState(ctx context.Context, saleId int64, releaseId int64, condition string, saleState pb.SaleStatus) error

type Want

type Want struct {
	Title   string
	Id      int
	Artists []Artist
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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