Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add spotify_artist data source and add functionality to spotify_album #34

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

ecliptik
Copy link

Few additions and improvements,

  • New spotify_artist data source to query artist ID/URL and retrieve name
  • Update spotify_album to have additional tracks and track_names data

Example of new data sources in-use: https://github.com/ecliptik/minidisc-playlist

@codecov-commenter
Copy link

Codecov Report

Merging #34 (c06892d) into main (4b4fdd9) will decrease coverage by 1.25%.
The diff coverage is 60.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #34      +/-   ##
==========================================
- Coverage   71.60%   70.34%   -1.26%     
==========================================
  Files           9       10       +1     
  Lines         493      553      +60     
==========================================
+ Hits          353      389      +36     
- Misses         97      119      +22     
- Partials       43       45       +2     
Impacted Files Coverage Δ
spotify/data_source_artist.go 53.84% <53.84%> (ø)
spotify/data_source_album.go 76.81% <70.00%> (-2.79%) ⬇️
spotify/provider.go 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4b4fdd9...c06892d. Read the comment docs.

Comment on lines +42 to +53
"tracks": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
Description: "The spotify IDs of the tracks",
},
"track_names": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
Description: "The names of the tracks",
},
Copy link
Owner

@conradludgate conradludgate Aug 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe instead of having 2 lists of strings, we could have a complex list

Suggested change
"tracks": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
Description: "The spotify IDs of the tracks",
},
"track_names": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
Description: "The names of the tracks",
},
"tracks": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Description: "The name of the track",
},
"id": {
Type: schema.TypeString,
Description: "The Spotify ID of the track",
},
},
Description: "The tracks of the album",
},
}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can still get the individual items using splat expressions, so instead of data.spotify_album.foo.track_names it would become data.spotify_album.foo.tracks[*].name

Copy link
Owner

@conradludgate conradludgate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you could add some tests too, thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants