diff --git a/src/Api.php b/src/Api.php index 2f76d8e..72f5446 100644 --- a/src/Api.php +++ b/src/Api.php @@ -50,9 +50,11 @@ use RuntimeException; */ class Api { + public const string LIBRARY_VERSION = '0.9.0'; + public const string API_VERSION = '0.0.6'; - private const string API_BASE_URL = 'http://127.0.0.1:5001'; + private const string API_BASE_URL = 'https://botapi.max.ru'; private const string METHOD_GET = 'GET'; private const string METHOD_POST = 'POST'; @@ -107,7 +109,12 @@ class Api ); } - $guzzle = new \GuzzleHttp\Client(); + $guzzle = new \GuzzleHttp\Client([ + 'timeout' => 10, + 'connect_timeout' => 5, + 'read_timeout' => 10, + 'headers' => ['User-Agent' => 'max-bot-api-client-php/' . self::LIBRARY_VERSION . ' PHP/' . PHP_VERSION], + ]); $httpFactory = new \GuzzleHttp\Psr7\HttpFactory(); $client = new Client( $accessToken, diff --git a/src/ClientApiInterface.php b/src/ClientApiInterface.php index 6313ae3..18a5ff7 100644 --- a/src/ClientApiInterface.php +++ b/src/ClientApiInterface.php @@ -26,7 +26,7 @@ interface ClientApiInterface public function request(string $method, string $uri, array $queryParams = [], array $body = []): array; /** - * Performs a file download at the specified URL. + * Performs a file upload at the specified URL. * * @param string $uri URL received from the download API. * @param resource|string $fileContents File content (stream resource or string).