File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# Changelog
2+ ## Unreleased
3+ ### Added
4+ - Add support to API key authorization
5+
26## [ v0.9.8] - 2024.01.16
37### Changed
48Compatibility
Original file line number Diff line number Diff line change @@ -25,6 +25,9 @@ class ClientBuilder
2525 /** @var string */
2626 private $ version = Version::NG ;
2727
28+ /** @var string */
29+ private $ apiKey = '' ;
30+
2831 public function withServerUrl (string $ serverUrl ): ClientBuilder
2932 {
3033 $ this ->serverUrl = (string ) new ServerUrl ($ serverUrl );
@@ -37,6 +40,13 @@ public function withCredentials(Credentials $credentials): ClientBuilder
3740 return $ this ;
3841 }
3942
43+ public function withApiKey (string $ apiKey ): ClientBuilder
44+ {
45+ $ this ->apiKey = $ apiKey ;
46+
47+ return $ this ;
48+ }
49+
4050 public function withVersion (string $ version ): ClientBuilder
4151 {
4252 $ this ->version = $ version ;
@@ -60,6 +70,12 @@ public function build(): ClientInterface
6070
6171 private function ngConfig (array $ config ): array
6272 {
73+ if (!empty ($ this ->apiKey )) {
74+ $ config ['headers ' ]['X-FF-API-Key ' ] = $ this ->apiKey ;
75+
76+ return $ config ;
77+ }
78+
6379 return ['auth ' => $ this ->credentials ->getAuth ()] + $ config ;
6480 }
6581
You can’t perform that action at this time.
0 commit comments