ramsayleung / rspotify

Spotify Web API SDK implemented on Rust
MIT License
639 stars 123 forks source link

Uri enum #414

Open blueforesticarus opened 1 year ago

blueforesticarus commented 1 year ago

Is your feature request related to a problem? Please describe. I am making a cli for testing parts of my application and want to pass a spotify uri as an arg. A way to parse this as a valid spotify uri, then match on it, would be useful. It would also serve as a useful type for parts of my application which are generic over Album, Playlist, or Track, of which there are many.

Describe the solution you'd like It would be convenient to have an Uri enum covering all the Id types, so we can always parse a uri, and match over the various ids.

Describe alternatives you've considered Manually calling parse_uri and matching over the result. Alternatively Uri could be a struct with id and type. Though I think this is maybe more cumbersome for matching.

ramsayleung commented 1 year ago

Please follow the issue template to describe your problem with context information, it would be helpful for others to understand your issue.

blueforesticarus commented 1 year ago

I think this is a sufficient implementation for what I am talking about (if you agree it is desirable). Although someone may have suggestions.

Someone could argue that Uri should be a struct with id and type, perhaps with another type for the enum.

ramsayleung commented 1 year ago

I think it makes sense to me, feel free to create a PR :)

github-actions[bot] commented 11 months ago

Message to comment on stale issues. If none provided, will not mark issues stale