Fix misspellings and deprecations in HTTP API class
This commit is contained in:
parent
ea38609e8b
commit
1295ab9c21
|
@ -8,6 +8,7 @@ use Aryess\PhpMatrixSdk\Exceptions\MatrixRequestException;
|
|||
use Aryess\PhpMatrixSdk\Exceptions\ValidationException;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use GuzzleHttp\RequestOptions;
|
||||
|
||||
/**
|
||||
* Contains all raw Matrix HTTP Client-Server API calls.
|
||||
|
@ -20,6 +21,8 @@ use GuzzleHttp\Exception\GuzzleException;
|
|||
* $response = $matrix.sync();
|
||||
* $response = $matrix->sendMessage("!roomid:matrix.org", "Hello!");
|
||||
*
|
||||
* @see https://matrix.org/docs/spec/client_server/latest
|
||||
*
|
||||
* @package Aryess\PhpMatrixSdk
|
||||
*/
|
||||
class MatrixHttpApi {
|
||||
|
@ -61,7 +64,7 @@ class MatrixHttpApi {
|
|||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $vallidateCert;
|
||||
private $validateCert;
|
||||
|
||||
/**
|
||||
* @var Client
|
||||
|
@ -92,7 +95,7 @@ class MatrixHttpApi {
|
|||
$this->token = $token;
|
||||
$this->identity = $identity;
|
||||
$this->txnId = 0;
|
||||
$this->vallidateCert = true;
|
||||
$this->validateCert = true;
|
||||
$this->client = new Client();
|
||||
$this->default429WaitMs = $default429WaitMs;
|
||||
$this->useAuthorizationHeader = $useAuthorizationHeader;
|
||||
|
@ -137,7 +140,7 @@ class MatrixHttpApi {
|
|||
}
|
||||
|
||||
public function validateCertificate(bool $validity) {
|
||||
$this->vallidateCert = $validity;
|
||||
$this->validateCert = $validity;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -923,18 +926,20 @@ class MatrixHttpApi {
|
|||
$queryParams['user_id'] = $this->identity;
|
||||
}
|
||||
|
||||
$endpoint = $this->baseUrl . $apiPath . $path;
|
||||
if ($headers['Content-Type'] == "application/json" && $content != null) {
|
||||
$content = json_encode($content);
|
||||
}
|
||||
|
||||
$options = array_merge($options, [
|
||||
'headers' => $headers,
|
||||
'query' => $queryParams,
|
||||
'body' => $content,
|
||||
'verify' => $this->vallidateCert,
|
||||
'verify' => $this->validateCert,
|
||||
]);
|
||||
|
||||
$endpoint = $this->baseUrl . $apiPath . $path;
|
||||
if ($headers['Content-Type'] == "application/json" && $content !== null) {
|
||||
$options[RequestOptions::JSON] = $content;
|
||||
}
|
||||
else {
|
||||
$options[RequestOptions::FORM_PARAMS] = $content;
|
||||
}
|
||||
|
||||
$responseBody = '';
|
||||
while (true) {
|
||||
try {
|
||||
|
@ -1447,4 +1452,4 @@ class MatrixHttpApi {
|
|||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue