Fix misspellings and deprecations in HTTP API class
This commit is contained in:
parent
9b8591d1f3
commit
8d5f95ed38
|
@ -8,6 +8,7 @@ use Aryess\PhpMatrixSdk\Exceptions\MatrixRequestException;
|
||||||
use Aryess\PhpMatrixSdk\Exceptions\ValidationException;
|
use Aryess\PhpMatrixSdk\Exceptions\ValidationException;
|
||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
use GuzzleHttp\Exception\GuzzleException;
|
use GuzzleHttp\Exception\GuzzleException;
|
||||||
|
use GuzzleHttp\RequestOptions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains all raw Matrix HTTP Client-Server API calls.
|
* Contains all raw Matrix HTTP Client-Server API calls.
|
||||||
|
@ -63,7 +64,7 @@ class MatrixHttpApi {
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
private $vallidateCert;
|
private $validateCert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Client
|
* @var Client
|
||||||
|
@ -94,7 +95,7 @@ class MatrixHttpApi {
|
||||||
$this->token = $token;
|
$this->token = $token;
|
||||||
$this->identity = $identity;
|
$this->identity = $identity;
|
||||||
$this->txnId = 0;
|
$this->txnId = 0;
|
||||||
$this->vallidateCert = true;
|
$this->validateCert = true;
|
||||||
$this->client = new Client();
|
$this->client = new Client();
|
||||||
$this->default429WaitMs = $default429WaitMs;
|
$this->default429WaitMs = $default429WaitMs;
|
||||||
$this->useAuthorizationHeader = $useAuthorizationHeader;
|
$this->useAuthorizationHeader = $useAuthorizationHeader;
|
||||||
|
@ -139,7 +140,7 @@ class MatrixHttpApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function validateCertificate(bool $validity) {
|
public function validateCertificate(bool $validity) {
|
||||||
$this->vallidateCert = $validity;
|
$this->validateCert = $validity;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -925,18 +926,20 @@ class MatrixHttpApi {
|
||||||
$queryParams['user_id'] = $this->identity;
|
$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, [
|
$options = array_merge($options, [
|
||||||
'headers' => $headers,
|
'headers' => $headers,
|
||||||
'query' => $queryParams,
|
'query' => $queryParams,
|
||||||
'body' => $content,
|
'verify' => $this->validateCert,
|
||||||
'verify' => $this->vallidateCert,
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$endpoint = $this->baseUrl . $apiPath . $path;
|
||||||
|
if ($headers['Content-Type'] == "application/json" && $content !== null) {
|
||||||
|
$options[RequestOptions::JSON] = $content;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$options[RequestOptions::FORM_PARAMS] = $content;
|
||||||
|
}
|
||||||
|
|
||||||
$responseBody = '';
|
$responseBody = '';
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
|
@ -1449,4 +1452,4 @@ class MatrixHttpApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue