Change api domain and authorization with header

This commit is contained in:
Alex
2025-09-29 19:25:28 +03:00
parent 31f109db7e
commit ddc57d7ab8
3 changed files with 20 additions and 11 deletions
+2 -2
View File
@@ -48,11 +48,11 @@ use RuntimeException;
*/
class Api
{
public const string LIBRARY_VERSION = '1.2.1';
public const string LIBRARY_VERSION = '1.3.0';
public const string API_VERSION = '0.0.6';
private const string API_BASE_URL = 'https://botapi.max.ru';
private const string API_BASE_URL = 'https://platform-api.max.ru';
private const string METHOD_GET = 'GET';
private const string METHOD_POST = 'POST';
+2 -2
View File
@@ -60,7 +60,6 @@ final readonly class Client implements ClientApiInterface
*/
public function request(string $method, string $uri, array $queryParams = [], array $body = []): array
{
$queryParams['access_token'] = $this->accessToken;
if (!empty($this->apiVersion)) {
$queryParams['v'] = $this->apiVersion;
}
@@ -83,7 +82,8 @@ final readonly class Client implements ClientApiInterface
$stream = $this->streamFactory->createStream($payload);
$request = $request
->withBody($stream)
->withHeader('Content-Type', 'application/json; charset=utf-8');
->withHeader('Content-Type', 'application/json; charset=utf-8')
->withHeader('Authorization', $this->accessToken);
}
try {