[PR #179] [MERGED] Fix not allowing from token as market/country #293

Closed
opened 2026-02-27 20:24:07 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ramsayleung/rspotify/pull/179
Author: @Qluxzz
Created: 1/25/2021
Status: Merged
Merged: 2/7/2021
Merged by: @marioortizmanero

Base: masterHead: fix-not-allowing-from-token


📝 Commits (7)

📊 Changes

4 files changed (+107 additions, -76 deletions)

View changed files

📝 src/client.rs (+58 -64)
📝 src/model/enums/misc.rs (+20 -0)
📝 tests/test_with_credential.rs (+6 -3)
📝 tests/test_with_oauth.rs (+23 -9)

📄 Description

Description

Fixes "from_token" not being a valid option for market/country.

Create Market enum which can be a country or from_token in order to satisfy both conditions.

Update usages of Country to instead use Market enum.

Update mentions and parameters of country/market to be consistent with spotify API docs.

Fixes #28

Motivation and Context

To allow market to be automatically selected from the users access-token instead of having to be supplied manually.

Dependencies

Type of change

Please delete options that are not relevant.

  • This change requires a documentation update
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.

Please also list any relevant details for your test configuration:
I ran all tests but the most interesting ones would be the following since they used the old Country enum

  • Market::Country: test_artist_top_tracks
  • Market::Country: test_categories
  • Market::Country: test_category_playlists
  • Market::Country: test_recommendations
  • Market::Country: test_search_artist

I've also added a test that uses Market::FromToken functionality, but since the market supplied is not static and changes with the oauth token credentials, it maybe wouldn't be such a good test?

  • Market::FromToken: test_search_artist_with_from_token

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ramsayleung/rspotify/pull/179 **Author:** [@Qluxzz](https://github.com/Qluxzz) **Created:** 1/25/2021 **Status:** ✅ Merged **Merged:** 2/7/2021 **Merged by:** [@marioortizmanero](https://github.com/marioortizmanero) **Base:** `master` ← **Head:** `fix-not-allowing-from-token` --- ### 📝 Commits (7) - [`ac297fd`](https://github.com/ramsayleung/rspotify/commit/ac297fd5e11207feadeda120c0b0519b6d91bc81) Add Market enum - [`edeadd7`](https://github.com/ramsayleung/rspotify/commit/edeadd73ff026a15f2310634f7a32f13ae9c4d8e) Update usages - [`bbeaf96`](https://github.com/ramsayleung/rspotify/commit/bbeaf96015dde139d4a5c41b46624ebfd96b31fa) Update existing tests - [`b636931`](https://github.com/ramsayleung/rspotify/commit/b636931281b3e9c1d7be41262d01db3193d758fb) Add test displaying FromToken functionality - [`e6b5642`](https://github.com/ramsayleung/rspotify/commit/e6b56429df59061ebccc3c69ed9a187d31c52d90) Remove into - [`714a113`](https://github.com/ramsayleung/rspotify/commit/714a113ed60a641b920531a79499e97d9a168522) Newline - [`bca5867`](https://github.com/ramsayleung/rspotify/commit/bca5867e930bdaffbfc8359836eb14e3b9833775) Impl to_string trait instead of into ### 📊 Changes **4 files changed** (+107 additions, -76 deletions) <details> <summary>View changed files</summary> 📝 `src/client.rs` (+58 -64) 📝 `src/model/enums/misc.rs` (+20 -0) 📝 `tests/test_with_credential.rs` (+6 -3) 📝 `tests/test_with_oauth.rs` (+23 -9) </details> ### 📄 Description ## Description Fixes "from_token" not being a valid option for market/country. Create Market enum which can be a country or from_token in order to satisfy both conditions. Update usages of Country to instead use Market enum. Update mentions and parameters of country/market to be consistent with spotify API docs. Fixes #28 ## Motivation and Context To allow market to be automatically selected from the users access-token instead of having to be supplied manually. ## Dependencies ## Type of change Please delete options that are not relevant. - [X] This change requires a documentation update - [X] Breaking change (fix or feature that would cause existing functionality to not work as expected) ## How Has This Been Tested? Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration: I ran all tests but the most interesting ones would be the following since they used the old Country enum - [X] ```Market::Country```: test_artist_top_tracks - [X] ```Market::Country```: test_categories - [X] ```Market::Country```: test_category_playlists - [X] ```Market::Country```: test_recommendations - [X] ```Market::Country```: test_search_artist I've also added a test that uses Market::FromToken functionality, but since the market supplied is not static and changes with the oauth token credentials, it maybe wouldn't be such a good test? - [X] ```Market::FromToken```: test_search_artist_with_from_token --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 20:24:07 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/rspotify#293
No description provided.