From 54e64f38b01bb0c0b8bea511f34c9a675eddac41 Mon Sep 17 00:00:00 2001 From: Stefan Koopmanschap Date: Thu, 19 Sep 2024 12:06:04 +0200 Subject: [PATCH 1/2] Respect the api version that is being set in the ConfigurationVO --- src/MastodonAPI.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MastodonAPI.php b/src/MastodonAPI.php index fdf2287..1893f76 100755 --- a/src/MastodonAPI.php +++ b/src/MastodonAPI.php @@ -53,7 +53,7 @@ public function __construct( private function getResponse(string $endpoint, string $method, array $json, bool $authenticate = true): mixed { $uri = $this->config->getBaseUrl() . '/api/'; - $uri .= ConfigurationVO::API_VERSION . $endpoint; + $uri .= $this->config->apiVersion . $endpoint; $allowedMethods = array_column(HttpOperation::cases(), 'name'); if (!in_array($method, $allowedMethods)) { From b8546b819c19e77b7fef2679e61662ffda7e581d Mon Sep 17 00:00:00 2001 From: Stefan Koopmanschap Date: Thu, 19 Sep 2024 14:27:32 +0200 Subject: [PATCH 2/2] Respect the API version when using OAuth as well --- src/MastodonOAuth.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/MastodonOAuth.php b/src/MastodonOAuth.php index ada7f3c..d556270 100644 --- a/src/MastodonOAuth.php +++ b/src/MastodonOAuth.php @@ -22,10 +22,12 @@ class MastodonOAuth * Creates the OAuth object from the configuration. */ public function __construct( - $client_name = ConfigurationVO::DEFAULT_NAME, - $mastodon_instance = ConfigurationVO::DEFAULT_INSTANCE + string $client_name = ConfigurationVO::DEFAULT_NAME, + string $mastodon_instance = ConfigurationVO::DEFAULT_INSTANCE, + string $redirectUris = ConfigurationVO::DEFAULT_REDIRECT_URIS, + string $api_version = ConfigurationVO::API_VERSION ) { - $this->config = new ConfigurationVO($client_name, $mastodon_instance); + $this->config = new ConfigurationVO($client_name, $mastodon_instance, $redirectUris, $api_version); $this->client = new Client(); }