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

Uri enum #414

Open
blueforesticarus opened this issue May 25, 2023 · 4 comments
Open

Uri enum #414

blueforesticarus opened this issue May 25, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@blueforesticarus
Copy link

blueforesticarus commented May 25, 2023

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.

@blueforesticarus blueforesticarus added the enhancement New feature or request label May 25, 2023
@ramsayleung
Copy link
Owner

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

@blueforesticarus blueforesticarus changed the title AnyId enum Uri enum May 26, 2023
blueforesticarus added a commit to segfault-s-pull-requests/rspotify that referenced this issue May 26, 2023
@blueforesticarus
Copy link
Author

blueforesticarus commented May 26, 2023

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
Copy link
Owner

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

Copy link

github-actions bot commented Dec 5, 2023

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

@github-actions github-actions bot added the Stale label Dec 5, 2023
@ramsayleung ramsayleung removed the Stale label Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants