Documentation
¶
Overview ¶
Package gotidal provides an unofficial Go SDK for interacting with the TIDAL API.
Index ¶
- Constants
- Variables
- type Album
- type AlbumProperties
- type AlbumResource
- type Artist
- type Client
- func (c *Client) GetAlbumByBarcodeID(ctx context.Context, barcodeID string) ([]Album, error)
- func (c *Client) GetAlbumTracks(ctx context.Context, id string) ([]Track, error)
- func (c *Client) GetAlbumsByArtist(ctx context.Context, id string, params PaginationParams) ([]Album, error)
- func (c *Client) GetMultipleAlbums(ctx context.Context, ids []string) ([]Album, error)
- func (c *Client) GetMultipleArtists(ctx context.Context, ids []string) ([]Artist, error)
- func (c *Client) GetMultipleTracks(ctx context.Context, ids []string) ([]Track, error)
- func (c *Client) GetSimilarAlbums(ctx context.Context, id string, params PaginationParams) ([]string, error)
- func (c *Client) GetSimilarArtists(ctx context.Context, id string, params PaginationParams) ([]string, error)
- func (c *Client) GetSingleAlbum(ctx context.Context, id string) (*Album, error)
- func (c *Client) GetSingleArtist(ctx context.Context, id string) (*Artist, error)
- func (c *Client) GetSingleTrack(ctx context.Context, id string) (*Track, error)
- func (c *Client) GetTracksByISRC(ctx context.Context, isrc string, params PaginationParams) ([]Track, error)
- func (c *Client) Search(ctx context.Context, params SearchParams) (*SearchResults, error)
- type HTTPClient
- type Image
- type ItemMetaData
- type MediaMetaData
- type PaginationParams
- type ProviderInfo
- type SearchParams
- type SearchResults
- type Track
- type Video
- type VideoProperties
Constants ¶
const ( SearchTypeAlbums = "ALBUMS" SearchTypeArtists = "ARTISTS" SearchTypeTracks = "TRACKS" SearchTypeVideos = "VIDEOS" SearchPopularityWorldwide = "WORLDWIDE" SearchPopularityCountry = "COUNTRY" )
Variables ¶
var ErrMissingRequiredParameters = errors.New("both the Query and the CountryCode parameters are required")
var ErrUnexpectedResponseCode = errors.New("returned an unexpected status code")
Functions ¶
This section is empty.
Types ¶
type Album ¶
type Album struct {
AlbumResource `json:"resource"`
}
Album represents an individual release.
type AlbumProperties ¶
type AlbumProperties struct {
Content []string `json:"content"`
}
AlbumProperties represents the properties of an album.
type AlbumResource ¶
type AlbumResource struct {
ID string `json:"id"`
BarcodeID string `json:"barcodeID"`
Title string `json:"title"`
Artists []artistResource `json:"artists"`
Duration int `json:"duration"`
ReleaseDate string `json:"releaseDate"`
ImageCover []Image `json:"imageCover"`
VideoCover []Image `json:"videoCover"`
NumberOfVolumes int `json:"numberOfVolumes"`
NumberOfTracks int `json:"numberOfTracks"`
NumberOfVideos int `json:"numberOfVideos"`
Type string `json:"type"`
Copyright string `json:"copyright"`
MediaMetaData MediaMetaData `json:"mediaMetadata"`
Properties AlbumProperties `json:"properties"`
TidalURL string `json:"tidalUrl"`
ProviderInfo ProviderInfo `json:"providerInfo"`
}
type Artist ¶
type Artist struct {
// contains filtered or unexported fields
}
Artist represents an individual artist.
type Client ¶
type Client struct {
HTTPClient HTTPClient
ContentType string
Environment string
Token string
CountryCode string
}
Client defines the parameters needed to create a TIDAL API client.
func (*Client) GetAlbumByBarcodeID ¶
GetAlbumByBarcodeID returns a list of albums that match a barcode ID.
func (*Client) GetAlbumTracks ¶
GetAlbumTracks returns a list of album tracks.
The items endpoint is paginated so we set a fairly high limit (100 items) in the hope to catch most cases in one round-trip. If the metadata reports a higher total then we make susequent API calls until all the tracks are returned.
This endpoint also supports videos but it was hard to find any examples of this, so for the moment this is tracks only.
func (*Client) GetAlbumsByArtist ¶
func (c *Client) GetAlbumsByArtist(ctx context.Context, id string, params PaginationParams) ([]Album, error)
GetAlbumsByArtist returns a paginated list of albums for an artist.
func (*Client) GetMultipleAlbums ¶
GetMultipleAlbums returns a list of albums filtered by their IDs.
func (*Client) GetMultipleArtists ¶
GetMultipleArtists returns a list of artists filtered by their IDs.
func (*Client) GetMultipleTracks ¶
GetMultipleTracks returns a list of tracks filtered by their IDs.
func (*Client) GetSimilarAlbums ¶
func (c *Client) GetSimilarAlbums(ctx context.Context, id string, params PaginationParams) ([]string, error)
GetSimilarAlbums returns a slice of album IDs that can be used as a parameter in the GetMultipleAlbums function.
func (*Client) GetSimilarArtists ¶
func (c *Client) GetSimilarArtists(ctx context.Context, id string, params PaginationParams) ([]string, error)
GetSimilarArtists returns a slice of artist IDs that can be used as a parameter in the GetMultipleArtists function.
func (*Client) GetSingleAlbum ¶
GetSingleAlbum returns an album that matches an ID.
func (*Client) GetSingleArtist ¶
GetSingleArtist returns an artist that matches an ID.
func (*Client) GetSingleTrack ¶
GetAlbumsByArtist returns a list of albums that match an artist ID.
func (*Client) GetTracksByISRC ¶
func (c *Client) GetTracksByISRC(ctx context.Context, isrc string, params PaginationParams) ([]Track, error)
GetTracksByISRC returns a list of tracks that match an ISRC.
ISRC lookup can be found here. This is a useful tool for finding ISRCs for testing purposes: https://isrcsearch.ifpi.org/
func (*Client) Search ¶
func (c *Client) Search(ctx context.Context, params SearchParams) (*SearchResults, error)
type HTTPClient ¶
HTTPClient provides an interface to make HTTP requests.
type ItemMetaData ¶
type ItemMetaData struct {
Total int `json:"total"`
}
type MediaMetaData ¶
type MediaMetaData struct {
Tags []string `json:"tags"`
}
MediaMetaData represents the metadata of an album.
type PaginationParams ¶
PaginationParams defines the limit and offset for pagination functions.
type ProviderInfo ¶
ProviderInfo represents the provider of an album.
type SearchParams ¶
type SearchParams struct {
// Search query in plain text.
// Example: Beyoncé
Query string `json:"query"`
// Target search type. Optional. Searches for all types if not specified.
// Example: ARTISTS, ALBUMS, TRACKS, VIDEOS
Type string `json:"type"`
// Pagination offset (in number of items). Required if 'query' is provided.
// Example: 0
Offset int `json:"offset"`
// Page size. Required if 'query' is provided.
// Example: 10
Limit int `json:"limit"`
// Specify which popularity type to apply for query result: either worldwide or country popularity.
// Worldwide popularity is used by default if nothing is specified.
// Example: WORLDWIDE, COUNTRY
Popularity string `json:"popularity"`
}
SearchParams defines the request parameters used by the TIDAL search API endpoint. See: https://developer.tidal.com/apiref?spec=search&ref=search
type SearchResults ¶
type Track ¶
type Track struct {
// contains filtered or unexported fields
}
Track represents an individual track on an album.
type Video ¶
type Video struct {
// contains filtered or unexported fields
}
Video represents an individula video.