From 7b35213ea17897ef5585223bff996d3c5a75f98f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Gon=C3=A7alves?= Date: Tue, 11 Jul 2023 09:57:19 -0300 Subject: [PATCH 1/3] INT-979 Added SDK version and send as headers on each call --- src/Storyblok/BaseClient.php | 4 ++++ src/Storyblok/Client.php | 1 + 2 files changed, 5 insertions(+) diff --git a/src/Storyblok/BaseClient.php b/src/Storyblok/BaseClient.php index 42911c7..1c4be53 100644 --- a/src/Storyblok/BaseClient.php +++ b/src/Storyblok/BaseClient.php @@ -82,6 +82,10 @@ function __construct($apiKey = null, $apiEndpoint = null, $apiVersion = 'v2', $s $this->client = new Guzzle([ 'base_uri' => $this->generateEndpoint($apiEndpoint, $apiVersion, $ssl, $apiRegion), 'handler' => $handlerStack, + 'headers' => [ + 'SB-Agent' => "SB-PHP", + 'SB-Agent-Version' => static::SDK_VERSION ?? '2.0.0', + ] ]); } diff --git a/src/Storyblok/Client.php b/src/Storyblok/Client.php index 56cd804..61b0e42 100644 --- a/src/Storyblok/Client.php +++ b/src/Storyblok/Client.php @@ -13,6 +13,7 @@ */ class Client extends BaseClient { + const SDK_VERSION = '2.6.1'; const CACHE_VERSION_KEY = 'storyblok_cv'; const EXCEPTION_GENERIC_HTTP_ERROR = 'An HTTP Error has occurred!'; From 60c98c64c9d890c753a6d45afcda5c2b654afb4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Gon=C3=A7alves?= Date: Tue, 11 Jul 2023 11:13:32 -0300 Subject: [PATCH 2/3] INT-979 Bring const up to BaseClient --- src/Storyblok/BaseClient.php | 4 +++- src/Storyblok/Client.php | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Storyblok/BaseClient.php b/src/Storyblok/BaseClient.php index 1c4be53..e8c9c09 100644 --- a/src/Storyblok/BaseClient.php +++ b/src/Storyblok/BaseClient.php @@ -18,6 +18,8 @@ */ class BaseClient { + const SDK_VERSION = '2.6.1'; + const EXCEPTION_GENERIC_HTTP_ERROR = 'An HTTP Error has occurred!'; const DEFAULT_PER_PAGE = 25; @@ -84,7 +86,7 @@ function __construct($apiKey = null, $apiEndpoint = null, $apiVersion = 'v2', $s 'handler' => $handlerStack, 'headers' => [ 'SB-Agent' => "SB-PHP", - 'SB-Agent-Version' => static::SDK_VERSION ?? '2.0.0', + 'SB-Agent-Version' => static::SDK_VERSION, ] ]); } diff --git a/src/Storyblok/Client.php b/src/Storyblok/Client.php index 61b0e42..56cd804 100644 --- a/src/Storyblok/Client.php +++ b/src/Storyblok/Client.php @@ -13,7 +13,6 @@ */ class Client extends BaseClient { - const SDK_VERSION = '2.6.1'; const CACHE_VERSION_KEY = 'storyblok_cv'; const EXCEPTION_GENERIC_HTTP_ERROR = 'An HTTP Error has occurred!'; From 2bed715537719978cdb125cad76441552384e771 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Gon=C3=A7alves?= Date: Tue, 11 Jul 2023 11:17:41 -0300 Subject: [PATCH 3/3] INT-979 Run php-cs-fixer --- src/Storyblok/BaseClient.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Storyblok/BaseClient.php b/src/Storyblok/BaseClient.php index e8c9c09..465566e 100644 --- a/src/Storyblok/BaseClient.php +++ b/src/Storyblok/BaseClient.php @@ -85,9 +85,9 @@ function __construct($apiKey = null, $apiEndpoint = null, $apiVersion = 'v2', $s 'base_uri' => $this->generateEndpoint($apiEndpoint, $apiVersion, $ssl, $apiRegion), 'handler' => $handlerStack, 'headers' => [ - 'SB-Agent' => "SB-PHP", + 'SB-Agent' => 'SB-PHP', 'SB-Agent-Version' => static::SDK_VERSION, - ] + ], ]); }