Version 5.1 - All the GraphQL #32
@ -84,7 +84,7 @@
|
||||
<h2>Characters</h2>
|
||||
<div class="flex flex-wrap">
|
||||
<?php foreach($characters as $char): ?>
|
||||
<?php if (array_key_exists('image', $char)): ?>
|
||||
<?php if ( ! empty($char['image']['original'])): ?>
|
||||
<div class="character">
|
||||
<?php $link = $url->generate('character', ['slug' => $char['slug']]) ?>
|
||||
<?= $helper->a($link, $char['name']); ?>
|
||||
|
@ -35,9 +35,9 @@
|
||||
<dt>About:</dt>
|
||||
<dd><?= $escape->html($attributes['bio']) ?></dd>
|
||||
</dl>
|
||||
<pre><?= json_encode($attributes, \JSON_PRETTY_PRINT) ?></pre>
|
||||
<?php /* <pre><?= json_encode($attributes, \JSON_PRETTY_PRINT) ?></pre>
|
||||
<pre><?= json_encode($relationships, \JSON_PRETTY_PRINT) ?></pre>
|
||||
<pre><?= json_encode($included, \JSON_PRETTY_PRINT) ?></pre>
|
||||
<pre><?= json_encode($included, \JSON_PRETTY_PRINT) ?></pre> */ ?>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
@ -17,12 +17,7 @@
|
||||
namespace Aviat\AnimeClient\API;
|
||||
|
||||
use Amp;
|
||||
use Amp\Artax\{
|
||||
Client,
|
||||
FormBody,
|
||||
Request
|
||||
};
|
||||
use Aviat\Ion\Di\ContainerAware;
|
||||
use Amp\Artax\{FormBody, Request};
|
||||
use Aviat\Ion\Json;
|
||||
use InvalidArgumentException;
|
||||
use Psr\Log\LoggerAwareTrait;
|
||||
|
@ -16,8 +16,6 @@
|
||||
|
||||
namespace Aviat\AnimeClient\API;
|
||||
|
||||
use Aviat\Ion\Json;
|
||||
|
||||
/**
|
||||
* Class encapsulating Json API data structure for a request or response
|
||||
*/
|
||||
|
@ -19,10 +19,6 @@ namespace Aviat\AnimeClient\API;
|
||||
use Aviat\AnimeClient\API\Kitsu\Enum\AnimeAiringStatus;
|
||||
use DateTimeImmutable;
|
||||
|
||||
const AUTH_URL = 'https://kitsu.io/api/oauth/token';
|
||||
const AUTH_USER_ID_KEY = 'kitsu-auth-userid';
|
||||
const AUTH_TOKEN_CACHE_KEY = 'kitsu-auth-token';
|
||||
|
||||
/**
|
||||
* Data massaging helpers for the Kitsu API
|
||||
*/
|
||||
|
@ -20,7 +20,6 @@ use Aviat\AnimeClient\API\{
|
||||
APIRequestBuilder,
|
||||
Kitsu as K
|
||||
};
|
||||
use Aviat\Ion\Json;
|
||||
|
||||
class KitsuRequestBuilder extends APIRequestBuilder {
|
||||
|
||||
|
@ -24,14 +24,12 @@ use Amp\Artax\{Client, Request};
|
||||
use Aviat\AnimeClient\AnimeClient;
|
||||
use Aviat\AnimeClient\API\Kitsu as K;
|
||||
use Aviat\Ion\Json;
|
||||
use InvalidArgumentException;
|
||||
use RuntimeException;
|
||||
|
||||
trait KitsuTrait {
|
||||
|
||||
/**
|
||||
* The request builder for the MAL API
|
||||
* @var MALRequestBuilder
|
||||
* @var KitsuRequestBuilder
|
||||
*/
|
||||
protected $requestBuilder;
|
||||
|
||||
@ -57,8 +55,6 @@ trait KitsuTrait {
|
||||
*/
|
||||
public function setUpRequest(string $type, string $url, array $options = []): Request
|
||||
{
|
||||
$config = $this->container->get('config');
|
||||
|
||||
$request = $this->requestBuilder->newRequest($type, $url);
|
||||
|
||||
$sessionSegment = $this->getContainer()
|
||||
@ -100,7 +96,6 @@ trait KitsuTrait {
|
||||
private function getResponse(string $type, string $url, array $options = [])
|
||||
{
|
||||
$request = $this->setUpRequest($type, $url, $options);
|
||||
$logger = $this->container->getLogger('kitsu-request');
|
||||
|
||||
$response = wait((new Client)->request($request));
|
||||
|
||||
@ -133,7 +128,7 @@ trait KitsuTrait {
|
||||
}
|
||||
}
|
||||
|
||||
return JSON::decode($response->getBody(), TRUE);
|
||||
return Json::decode($response->getBody(), TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user