client

package
v0.1.0-test.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CollectionSource DataSource = iota
	WishlistSource
	OrdersSource

	// CollectionURL is the URL for the user's collection.
	CollectionURL string = "https://api.discogs.com/users/%s/collection/folders/0/releases"
	// WishlistURL is the URL for the user's wishlist.
	WishlistURL string = "https://api.discogs.com/users/%s/wants"
	// OrdersURL is the URL for the user's orders.
	OrdersURL string = "https://api.discogs.com/users/%s/orders"
)

Variables

View Source
var (
	ErrTokenGenerationFailed = errors.New("failed to generate OAuth token")
)

Functions

This section is empty.

Types

type DataSource

type DataSource int

type DiscogsClient

type DiscogsClient struct {
	*http.Client

	Identity DiscogsIdentity
	// contains filtered or unexported fields
}

func New

func New() (*DiscogsClient, error)

New returns an authenticated http.Client for the Discogs API

func NewWithContext

func NewWithContext(ctx context.Context) (*DiscogsClient, error)

NewWithContext returns an authenticated http.Client for the Discogs API with context support

func (*DiscogsClient) GetCollection

func (c *DiscogsClient) GetCollection() ([]dto.ReleaseModel, error)

func (*DiscogsClient) GetOrders

func (c *DiscogsClient) GetOrders() ([]dto.ReleaseModel, error)

func (*DiscogsClient) GetThumbImage

func (c *DiscogsClient) GetThumbImage(url string) (image.Image, error)

GetThumbImage maintains backward compatibility

func (*DiscogsClient) GetThumbImageWithContext

func (c *DiscogsClient) GetThumbImageWithContext(ctx context.Context, url string) (image.Image, error)

GetThumbImageWithContext gets thumbnail image with context support

func (*DiscogsClient) GetWishlist

func (c *DiscogsClient) GetWishlist() ([]dto.ReleaseModel, error)

type DiscogsIdentity

type DiscogsIdentity struct {
	Id           int    `json:"id"`
	Username     string `json:"username"`
	ResourceUrl  string `json:"resource_url"`
	ConsumerName string `json:"consumer_name"`
}

type TokenConfig

type TokenConfig struct {
	Token       string `json:"token"`
	TokenSecret string `json:"token_secret"`
}

Jump to

Keyboard shortcuts

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