Merge pull request '[various] Rename ICanHandleHttpResponses->getBody to getBodyString' (#1456) from MrPetovan/friendica-addons:bug/deprecated into develop
Reviewed-on: https://git.friendi.ca/friendica/friendica-addons/pulls/1456pull/1457/head
commit
a179bab747
|
@ -1111,11 +1111,11 @@ function bluesky_process_post(stdClass $post, int $uid, int $post_reason, int $l
|
|||
$uri = bluesky_get_uri($post);
|
||||
|
||||
if ($id = Post::selectFirst(['id'], ['uri' => $uri, 'uid' => $uid])) {
|
||||
return $id['id'];
|
||||
return $id['id'];
|
||||
}
|
||||
|
||||
if ($id = Post::selectFirst(['id'], ['extid' => $uri, 'uid' => $uid])) {
|
||||
return $id['id'];
|
||||
return $id['id'];
|
||||
}
|
||||
|
||||
Logger::debug('Importing post', ['uid' => $uid, 'indexedAt' => $post->indexedAt, 'uri' => $post->uri, 'cid' => $post->cid, 'root' => $post->record->reply->root ?? '']);
|
||||
|
@ -1251,7 +1251,7 @@ function bluesky_get_text(stdClass $record, int $uri_id): string
|
|||
$url = DI::baseUrl() . '/search?tag=' . urlencode($feature->tag);
|
||||
$linktext = '#' . $feature->tag;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
Logger::notice('Unhandled feature type', ['type' => $feature->$type, 'feature' => $feature, 'record' => $record]);
|
||||
break;
|
||||
|
@ -1736,13 +1736,13 @@ function bluesky_post(int $uid, string $url, string $params, array $headers): ?s
|
|||
}
|
||||
|
||||
if (!$curlResult->isSuccess()) {
|
||||
Logger::notice('API Error', ['error' => json_decode($curlResult->getBody()) ?: $curlResult->getBody()]);
|
||||
Logger::notice('API Error', ['error' => json_decode($curlResult->getBodyString()) ?: $curlResult->getBodyString()]);
|
||||
DI::pConfig()->set($uid, 'bluesky', 'status', BLUEKSY_STATUS_API_FAIL);
|
||||
return null;
|
||||
}
|
||||
|
||||
DI::pConfig()->set($uid, 'bluesky', 'status', BLUEKSY_STATUS_SUCCESS);
|
||||
return json_decode($curlResult->getBody());
|
||||
return json_decode($curlResult->getBodyString());
|
||||
}
|
||||
|
||||
function bluesky_xrpc_get(int $uid, string $url, array $parameters = []): ?stdClass
|
||||
|
@ -1767,9 +1767,9 @@ function bluesky_get(string $url, string $accept_content = HttpClientAccept::DEF
|
|||
}
|
||||
|
||||
if (!$curlResult->isSuccess()) {
|
||||
Logger::notice('API Error', ['error' => json_decode($curlResult->getBody()) ?: $curlResult->getBody()]);
|
||||
Logger::notice('API Error', ['error' => json_decode($curlResult->getBodyString()) ?: $curlResult->getBodyString()]);
|
||||
return null;
|
||||
}
|
||||
|
||||
return json_decode($curlResult->getBody());
|
||||
return json_decode($curlResult->getBodyString());
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ function discourse_fetch_post($host, $topic, $pid)
|
|||
return false;
|
||||
}
|
||||
|
||||
$raw = $curlResult->getBody();
|
||||
$raw = $curlResult->getBodyString();
|
||||
$data = json_decode($raw, true);
|
||||
$posts = $data['post_stream']['posts'];
|
||||
foreach($posts as $post) {
|
||||
|
@ -162,7 +162,7 @@ function discourse_fetch_post_from_api(&$message, $post, $host)
|
|||
return false;
|
||||
}
|
||||
|
||||
$raw = $curlResult->getBody();
|
||||
$raw = $curlResult->getBodyString();
|
||||
$data = json_decode($raw, true);
|
||||
if (empty($data)) {
|
||||
return false;
|
||||
|
|
|
@ -192,7 +192,7 @@ EOT;
|
|||
Logger::debug('dwpost: data: ' . $xml);
|
||||
|
||||
if ($dw_blog !== 'test') {
|
||||
$x = DI::httpClient()->post($dw_blog, $xml, ['Content-Type' => 'text/xml'])->getBody();
|
||||
$x = DI::httpClient()->post($dw_blog, $xml, ['Content-Type' => 'text/xml'])->getBodyString();
|
||||
}
|
||||
|
||||
Logger::info('posted to dreamwidth: ' . ($x) ? $x : '');
|
||||
|
|
|
@ -186,7 +186,7 @@ EOT;
|
|||
Logger::debug('ijpost: data: ' . $xml);
|
||||
|
||||
if ($ij_blog !== 'test') {
|
||||
$x = DI::httpClient()->post($ij_blog, $xml, ['Content-Type' => 'text/xml'])->getBody();
|
||||
$x = DI::httpClient()->post($ij_blog, $xml, ['Content-Type' => 'text/xml'])->getBodyString();
|
||||
}
|
||||
Logger::info('posted to insanejournal: ' . $x ? $x : '');
|
||||
}
|
||||
|
|
|
@ -201,7 +201,7 @@ function libertree_send(array &$b)
|
|||
// 'token' => $ltree_api_token
|
||||
];
|
||||
|
||||
$result = DI::httpClient()->post($ltree_blog, $params)->getBody();
|
||||
$result = DI::httpClient()->post($ltree_blog, $params)->getBodyString();
|
||||
Logger::notice('libertree: ' . $result);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -207,7 +207,7 @@ EOT;
|
|||
Logger::debug('ljpost: data: ' . $xml);
|
||||
|
||||
if ($lj_blog !== 'test') {
|
||||
$x = DI::httpClient()->post($lj_blog, $xml, ['Content-Type' => 'text/xml'])->getBody();
|
||||
$x = DI::httpClient()->post($lj_blog, $xml, ['Content-Type' => 'text/xml'])->getBodyString();
|
||||
}
|
||||
|
||||
Logger::info('posted to livejournal: ' . ($x) ? $x : '');
|
||||
|
|
|
@ -221,7 +221,7 @@ function mailstream_do_images(array &$item, array &$attachments)
|
|||
continue;
|
||||
}
|
||||
$attachments[$url] = [
|
||||
'data' => $curlResult->getBody(),
|
||||
'data' => $curlResult->getBodyString(),
|
||||
'guid' => hash('crc32', $url),
|
||||
'filename' => basename($components['path']),
|
||||
'type' => $curlResult->getContentType()
|
||||
|
|
|
@ -82,7 +82,7 @@ function mastodoncustomemojis_fetch_custom_emojis_for_url($api_base_url)
|
|||
$fetchResult = DI::httpClient()->fetchFull($api_url);
|
||||
|
||||
if ($fetchResult->isSuccess()) {
|
||||
$emojis_array = json_decode($fetchResult->getBody(), true);
|
||||
$emojis_array = json_decode($fetchResult->getBodyString(), true);
|
||||
|
||||
if (is_array($emojis_array) && count($emojis_array)) {
|
||||
foreach ($emojis_array as $emoji) {
|
||||
|
|
|
@ -121,7 +121,7 @@ function openstreetmap_get_coordinates(array &$b)
|
|||
if (is_null($j)) {
|
||||
$curlResult = DI::httpClient()->get($nomserver . $args);
|
||||
if ($curlResult->isSuccess()) {
|
||||
$j = json_decode($curlResult->getBody(), true);
|
||||
$j = json_decode($curlResult->getBodyString(), true);
|
||||
DI::cache()->set($cachekey, $j, Duration::MONTH);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1244,7 +1244,7 @@ function tumblr_get_contact_by_url(string $url, int $uid): ?array
|
|||
} catch (\Exception $e) {
|
||||
return null;
|
||||
}
|
||||
$html = $curlResult->getBody();
|
||||
$html = $curlResult->getBodyString();
|
||||
if (empty($html)) {
|
||||
return null;
|
||||
}
|
||||
|
@ -1372,7 +1372,7 @@ function tumblr_delete(int $uid, string $url, array $parameters): stdClass
|
|||
*/
|
||||
function tumblr_format_result(ICanHandleHttpResponses $curlResult): stdClass
|
||||
{
|
||||
$result = json_decode($curlResult->getBody());
|
||||
$result = json_decode($curlResult->getBodyString());
|
||||
if (empty($result) || empty($result->meta)) {
|
||||
$result = new stdClass;
|
||||
$result->meta = new stdClass;
|
||||
|
@ -1426,11 +1426,11 @@ function tumblr_get_token(int $uid, string $code = ''): string
|
|||
|
||||
$curlResult = DI::httpClient()->post('https://api.tumblr.com/v2/oauth2/token', $parameters);
|
||||
if (!$curlResult->isSuccess()) {
|
||||
Logger::info('Error fetching token', ['uid' => $uid, 'code' => $code, 'result' => $curlResult->getBody(), 'parameters' => $parameters]);
|
||||
Logger::info('Error fetching token', ['uid' => $uid, 'code' => $code, 'result' => $curlResult->getBodyString(), 'parameters' => $parameters]);
|
||||
return '';
|
||||
}
|
||||
|
||||
$result = json_decode($curlResult->getBody());
|
||||
$result = json_decode($curlResult->getBodyString());
|
||||
if (empty($result)) {
|
||||
Logger::info('Invalid result when updating token', ['uid' => $uid]);
|
||||
return '';
|
||||
|
@ -1479,7 +1479,7 @@ function tumblr_exchange_token(int $uid): stdClass
|
|||
]);
|
||||
|
||||
$response = $client->post('oauth2/exchange', ['auth' => 'oauth']);
|
||||
return json_decode($response->getBody()->getContents());
|
||||
return json_decode($response->getBodyString()->getContents());
|
||||
} catch (RequestException $exception) {
|
||||
Logger::notice('Exchange failed', ['code' => $exception->getCode(), 'message' => $exception->getMessage()]);
|
||||
return new stdClass;
|
||||
|
|
|
@ -362,7 +362,7 @@ function twitter_post(int $uid, string $url, string $type, array $data): stdClas
|
|||
]);
|
||||
|
||||
$response = $client->post($url, ['auth' => 'oauth', $type => $data]);
|
||||
$body = $response->getBody()->getContents();
|
||||
$body = $response->getBodyString()->getContents();
|
||||
|
||||
$status = [
|
||||
'code' => $response->getStatusCode(),
|
||||
|
@ -399,7 +399,7 @@ function twitter_test_connection(int $uid)
|
|||
$status = [
|
||||
'code' => $response->getStatusCode(),
|
||||
'reason' => $response->getReasonPhrase(),
|
||||
'content' => $response->getBody()->getContents()
|
||||
'content' => $response->getBodyString()->getContents()
|
||||
];
|
||||
DI::pConfig()->set(1, 'twitter', 'last_status', $status);
|
||||
Logger::info('Test successful', ['uid' => $uid]);
|
||||
|
|
|
@ -113,7 +113,7 @@ class WebDav implements ICanWriteToStorage
|
|||
$response = $this->client->request('propfind', $uri, $opts);
|
||||
|
||||
$responseDoc = new \DOMDocument();
|
||||
$responseDoc->loadXML($response->getBody());
|
||||
$responseDoc->loadXML($response->getBodyString());
|
||||
$responseDoc->formatOutput = true;
|
||||
|
||||
$xpath = new \DOMXPath($responseDoc);
|
||||
|
@ -205,7 +205,7 @@ class WebDav implements ICanWriteToStorage
|
|||
throw new ReferenceStorageException(sprintf('Invalid reference %s', $reference));
|
||||
}
|
||||
|
||||
return $response->getBody();
|
||||
return $response->getBodyString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -269,7 +269,7 @@ EOT;
|
|||
Logger::debug('wppost: data: ' . $xml);
|
||||
|
||||
if ($wp_blog !== 'test') {
|
||||
$x = DI::httpClient()->post($wp_blog, $xml)->getBody();
|
||||
$x = DI::httpClient()->post($wp_blog, $xml)->getBodyString();
|
||||
}
|
||||
Logger::info('posted to wordpress: ' . (($x) ? $x : ''));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue