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

Respect the api version that is being set in the ConfigurationVO #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

skoop
Copy link

@skoop skoop commented Sep 19, 2024

What happened?

I was creating a ConfigurationVO object and I was setting the $apiVersion parameter to v2. When I then used the MastodonAPI object that I can created using the ConfigurationVO object, when I called (in my case) the /search endpoint, I got a 404 error from the API, because it was trying to call /api/v1/search. It did not respect the v2 I had set because the code was using the ConfigurationVO::API_VERSION constant, which is set to v1.

The solution

Instead of using the constant from the ConfigurationVO class, I use the $apiVersion property of the $this->config instead of the VO. Now, when I call the getPublicData('/search'), it respects the version and calls the v2 API.

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.

1 participant